Skip to content

Commit ebe10e6

Browse files
authored
Merge pull request #263 from SeeSharpSoft/master
Release 2.15.0
2 parents a413ace + 822befe commit ebe10e6

File tree

20 files changed

+86
-107
lines changed

20 files changed

+86
-107
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jdk:
33
- openjdk11
44

55
env:
6-
- IDEA_VERSION=PC-2019.3.3 GRAMMAR_KIT_VERSION=2019.3
6+
- IDEA_VERSION=PC-2020.3.3 GRAMMAR_KIT_VERSION=2019.3
77
- IDEA_VERSION=IU-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3
88

99
script: xvfb-run gradle check

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.15.0
2+
Mar 23, 2021
3+
4+
NEW: Default value separator #259
5+
FIX: Removal of deprecated function usage
6+
17
2.14.4
28
Feb 14, 2021
39

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Lightweight CSV Plugin for JetBrains IDE family
99

10-
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2017.3.1 and newer__
10+
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2019.3.5 and newer__
1111

1212
This plugin introduces CSV (_Comma-Separated Values_) as a language to Jetbrains IDE with a syntax definition, structured language elements and associated file types (.csv/.tsv/.psv).
1313
This enables default editor features like syntax validation, highlighting and inspections for CSV-alike files.
@@ -37,7 +37,7 @@ This enables default editor features like syntax validation, highlighting and in
3737

3838
**!!Please note!!**
3939

40-
- Starting with **CSV Plugin 2.10.0**, _new features will only be developed for IntelliJ IDE 2019.3 and higher_. I will still release patches for major/critical bugs for previous IDE versions 2017.3.1 - 2019.2.\*, but no additional features or cosmetic fixes.
40+
- Starting with **CSV Plugin 2.10.0**, _new features will only be developed for IntelliJ IDE 2019.3.5 and higher_. ~~I will still release patches for major/critical bugs for previous IDE versions 2017.3.1 - 2019.3.4\*, but no additional features or cosmetic fixes.~~
4141

4242
- Starting with **CSV Plugin 2.11.0**, _Java 9 (53) or higher is required_. Previous versions can be downloaded and installed manually from the following locations: [GitHub Releases](https://github.com/SeeSharpSoft/intellij-csv-validator/releases), [Plugin Repository](https://plugins.jetbrains.com/plugin/10037-csv-plugin/versions) (see also section [Installation](https://github.com/SeeSharpSoft/intellij-csv-validator#installation)).
4343

@@ -132,6 +132,8 @@ The preferred editor usage can be switched between "Text Editor first", "Table E
132132

133133
The following separators are currently supported: **,** (Comma), **;** (Semicolon), **:** (Colon), **|** (Pipe) and **↹** (Tab)
134134

135+
**since 2.15.0:** The default value separator can also be a user defined character sequence.
136+
135137
_Default Value Separator_ defines which separator is used as standard for each newly created or opened CSV file.
136138
The separator character can be changed for each file individually in its editors context menu.
137139

build.gradle

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,32 @@ buildscript {
1111

1212
plugins {
1313
// https://github.com/JetBrains/gradle-intellij-plugin
14-
id 'org.jetbrains.intellij' version '0.4.10'
14+
id 'org.jetbrains.intellij' version '0.7.2'
1515
id 'jacoco'
16-
id 'com.github.kt3k.coveralls' version '2.8.2'
16+
id 'com.github.kt3k.coveralls' version '2.8.4'
1717
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
1818
}
1919

20+
jacoco {
21+
toolVersion = "0.8.6"
22+
}
23+
2024
jacocoTestReport {
2125
reports {
2226
xml.enabled true
2327
}
2428
}
2529

2630
group 'net.seesharpsoft.intellij.plugins'
27-
version '2.14.4'
31+
version '2.15.0'
2832

2933
apply plugin: 'java'
3034
project.sourceCompatibility = JavaVersion.VERSION_11
3135
project.targetCompatibility = JavaVersion.VERSION_11
32-
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
36+
tasks.withType(JavaCompile) {
37+
options.encoding = 'UTF-8'
38+
options.compilerArgs << "-Xlint:deprecation"
39+
}
3340
repositories {
3441
mavenCentral()
3542
}

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

Lines changed: 0 additions & 12 deletions
This file was deleted.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
public class CsvIconProvider extends IconProvider {
1414

15-
public static final Icon FILE = IconLoader.getIcon("/media/icons/csv-icon.png");
15+
public static final Icon FILE = IconLoader.getIcon("/media/icons/csv-icon.png", CsvIconProvider.class);
1616

17-
public static final Icon HEADER = IconLoader.getIcon("/media/icons/csv-header-icon.png");
17+
public static final Icon HEADER = IconLoader.getIcon("/media/icons/csv-header-icon.png", CsvIconProvider.class);
1818

19-
public static final Icon FIELD = IconLoader.getIcon("/media/icons/csv-field-icon.png");
19+
public static final Icon FIELD = IconLoader.getIcon("/media/icons/csv-field-icon.png", CsvIconProvider.class);
2020

2121
@Nullable
2222
@Override

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ public PsiFile createFile(FileViewProvider viewProvider) {
6262
return new CsvFile(viewProvider, CsvFileType.INSTANCE);
6363
}
6464

65-
@Override
66-
public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
67-
return SpaceRequirements.MAY;
68-
}
69-
7065
@Override
7166
@NotNull
7267
public PsiElement createElement(ASTNode node) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.intellij.ide.actions.ShowSettingsUtilImpl;
44
import com.intellij.ide.plugins.IdeaPluginDescriptorImpl;
55
import com.intellij.ide.plugins.PluginManager;
6+
import com.intellij.ide.plugins.PluginManagerCore;
67
import com.intellij.notification.*;
78
import com.intellij.openapi.extensions.PluginId;
89
import com.intellij.openapi.options.ShowSettingsUtil;
@@ -20,7 +21,7 @@
2021
public class CsvPlugin implements StartupActivity {
2122

2223
protected static IdeaPluginDescriptorImpl getPluginDescriptor() {
23-
return (IdeaPluginDescriptorImpl)PluginManager.getPlugin(PluginId.getId("net.seesharpsoft.intellij.plugins.csv"));
24+
return (IdeaPluginDescriptorImpl)PluginManagerCore.getPlugin(PluginId.getId("net.seesharpsoft.intellij.plugins.csv"));
2425
}
2526

2627
protected static String getVersion() {

src/main/java/net/seesharpsoft/intellij/plugins/csv/components/CsvFileAttributes.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import org.jetbrains.annotations.NotNull;
2121
import org.jetbrains.annotations.Nullable;
2222

23-
import java.util.Arrays;
24-
import java.util.HashMap;
25-
import java.util.Map;
23+
import java.util.*;
2624

2725
@State(
2826
name = "CsvFileAttributes",
@@ -125,10 +123,15 @@ CsvValueSeparator autoDetectOrGetDefaultValueSeparator(Project project, VirtualF
125123

126124
private @NotNull
127125
CsvValueSeparator autoDetectSeparator(Project project, VirtualFile virtualFile) {
128-
Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
126+
final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
129127
final String text = document == null ? "" : document.getText();
128+
final List<CsvValueSeparator> applicableValueSeparators = new ArrayList(Arrays.asList(CsvValueSeparator.values()));
129+
final CsvValueSeparator defaultValueSeparator = CsvEditorSettings.getInstance().getDefaultValueSeparator();
130+
if (defaultValueSeparator.isCustom()) {
131+
applicableValueSeparators.add(defaultValueSeparator);
132+
}
130133
Pair<CsvValueSeparator, Integer> separatorWithCount =
131-
Arrays.stream(CsvValueSeparator.values())
134+
applicableValueSeparators.parallelStream()
132135
// count
133136
.map(separator -> {
134137
String character = separator.getCharacter();
@@ -143,7 +146,7 @@ CsvValueSeparator autoDetectSeparator(Project project, VirtualFile virtualFile)
143146

144147
CsvValueSeparator valueSeparator = separatorWithCount != null ?
145148
separatorWithCount.getFirst() :
146-
CsvEditorSettings.getInstance().getDefaultValueSeparator();
149+
defaultValueSeparator;
147150

148151
setFileSeparator(project, virtualFile, valueSeparator);
149152
return valueSeparator;

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvAnnotator.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ public void annotate(@NotNull final PsiElement element, @NotNull final Annotatio
6565
textRange = TextRange.from(textRange.getStartOffset() - 1, 1);
6666
}
6767

68-
Annotation annotation = holder.createAnnotation(CSV_COLUMN_INFO_SEVERITY, textRange, message, tooltip);
68+
final Annotation annotation =
69+
new Annotation(
70+
textRange.getStartOffset(),
71+
textRange.getEndOffset(),
72+
CSV_COLUMN_INFO_SEVERITY,
73+
message,
74+
tooltip
75+
);
6976
annotation.setEnforcedTextAttributes(
7077
CsvEditorSettings.getInstance().getValueColoring() == CsvEditorSettings.ValueColoring.RAINBOW ?
7178
CsvColorSettings.getTextAttributesOfColumn(columnInfo.getColumnIndex(), holder.getCurrentAnnotationSession()) :
@@ -98,11 +105,15 @@ protected boolean handleSeparatorElement(@NotNull PsiElement element, @NotNull A
98105
}
99106
}
100107
if (textAttributes != null) {
101-
Annotation annotation = holder.createAnnotation(
102-
CSV_COLUMN_INFO_SEVERITY,
103-
element.getTextRange(),
104-
showInfoBalloon(holder.getCurrentAnnotationSession()) ? "↹" : null
105-
);
108+
final TextRange textRange = element.getTextRange();
109+
final Annotation annotation =
110+
new Annotation(
111+
textRange.getStartOffset(),
112+
textRange.getEndOffset(),
113+
CSV_COLUMN_INFO_SEVERITY,
114+
showInfoBalloon(holder.getCurrentAnnotationSession()) ? "↹" : null,
115+
null
116+
);
106117
annotation.setEnforcedTextAttributes(textAttributes);
107118
annotation.setNeedsUpdateOnTyping(false);
108119
}

0 commit comments

Comments
 (0)