Skip to content

Commit 36e6a17

Browse files
authored
Merge pull request #246 from SeeSharpSoft/master
Release 2.14.2
2 parents 2ddfee4 + 280a7b7 commit 36e6a17

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.14.2
2+
Sep 17, 2020
3+
4+
FIX: Settings reset every update #245
5+
FIX: Removing comment indicator causes parsing errors
6+
17
2.14.1
28
Aug 14, 2020
39

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jacocoTestReport {
2424
}
2525

2626
group 'net.seesharpsoft.intellij.plugins'
27-
version '2.14.1'
27+
version '2.14.2'
2828

2929
apply plugin: 'java'
3030
sourceCompatibility = javaVersion

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvSharpLexer.java

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
public class CsvSharpLexer extends LexerBase {
2020

21+
private final static String NON_MATCHING_REGEX = "[^\\w\\W]";
22+
2123
private final Tokenizer<TokenType> tokenizer;
2224
private final List<Tokenizer.Token<TokenType>> initialNextStateTokens;
2325
private final List<Tokenizer.Token<TokenType>> unquotedNextStateTokens;
@@ -122,6 +124,9 @@ public CsvSharpLexer(Configuration configuration) {
122124
if (!configuration.commentCharacter.isEmpty()) {
123125
tokenizer.add(TokenType.COMMENT_CHARACTER, configuration.commentCharacter);
124126
tokenizer.add(TokenType.COMMENT, configuration.commentCharacter + ".*(?=(\n|$))");
127+
} else {
128+
tokenizer.add(TokenType.COMMENT_CHARACTER, NON_MATCHING_REGEX);
129+
tokenizer.add(TokenType.COMMENT, NON_MATCHING_REGEX);
125130
}
126131

127132
if (configuration.escapeCharacter.equals(configuration.quoteCharacter)) {

src/main/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettings.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.seesharpsoft.intellij.plugins.csv.settings;
22

3+
import com.intellij.openapi.application.Application;
4+
import com.intellij.openapi.application.ApplicationManager;
35
import com.intellij.openapi.components.PersistentStateComponent;
46
import com.intellij.openapi.components.ServiceManager;
57
import com.intellij.openapi.components.State;
@@ -32,7 +34,8 @@ public class CsvEditorSettings implements PersistentStateComponent<CsvEditorSett
3234

3335
public static final String COMMENT_INDICATOR_DEFAULT = "#";
3436

35-
private static final CsvEditorSettings STATIC_INSTANCE = new CsvEditorSettings();
37+
// only required for testing
38+
private static final CsvEditorSettings STATIC_TEST_INSTANCE = new CsvEditorSettings();
3639

3740
public enum EditorPrio {
3841
TEXT_FIRST,
@@ -95,8 +98,11 @@ public CsvEditorSettings() {
9598
}
9699

97100
public static CsvEditorSettings getInstance() {
98-
CsvEditorSettings instance = ServiceManager.getService(CsvEditorSettings.class);
99-
return instance == null ? STATIC_INSTANCE : instance;
101+
Application application = ApplicationManager.getApplication();
102+
if (application.isUnitTestMode()) {
103+
return CsvEditorSettings.STATIC_TEST_INSTANCE;
104+
}
105+
return application.isDisposed() ? new CsvEditorSettings() : ServiceManager.getService(CsvEditorSettings.class);
100106
}
101107

102108
public void addPropertyChangeListener(PropertyChangeListener listener) {

src/main/resources/META-INF/plugin.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949

5050
<change-notes><![CDATA[
5151
<pre style="font-family: sans-serif">
52-
FIX: Performance for indexing large CSV files #239
52+
FIX: Settings reset every update #245
53+
FIX: Removing comment indicator causes parsing errors
5354
</pre>
5455
]]>
5556
</change-notes>

0 commit comments

Comments
 (0)