Skip to content

Commit 9752a22

Browse files
authored
Merge pull request #157 from SeeSharpSoft/master
Release 2.7.0
2 parents f1a12b0 + 5ec4e56 commit 9752a22

34 files changed

+554
-376
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ jdk:
55
env:
66
- IDEA_VERSION=IC-2016.3.2 GRAMMAR_KIT_VERSION=1.4.3
77
- IDEA_VERSION=IC-2017.3.2 GRAMMAR_KIT_VERSION=2017.1.2
8-
- IDEA_VERSION=IC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.6
9-
- IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2017.1.6
8+
- IDEA_VERSION=IC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.7
9+
- IDEA_VERSION=IC-2019.2.2 GRAMMAR_KIT_VERSION=2017.1.7
10+
# - IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=07f30a1e7666f36ae780f614b6bbc89690ba36c3
1011

1112
script: xvfb-run gradle check
1213

@@ -16,9 +17,9 @@ after_success:
1617
jobs:
1718
include:
1819
- if: (branch = master AND type = push) OR (type = pull_request)
19-
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.6
20+
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.7
2021
script: xvfb-run gradle check verifyPlugin
2122
- stage: deploy
2223
if: branch IN (Testing, Staging, Stable) AND type = push
23-
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.6 JI_CHANNELS=$TRAVIS_BRANCH
24+
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.7 JI_CHANNELS=$TRAVIS_BRANCH
2425
script: xvfb-run gradle publishPlugin

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2.7.0
2+
Sep 16, 2019
3+
4+
NEW: add separator selection to table editor #140
5+
FIX: coloring of table cells (e.g. selection mode)
6+
FIX: enter edit mode via keyboard (e.g. ENTER key in cell)
7+
18
2.6.4
29
Aug 30, 2019
310

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2016.3.2 and newer__
1212

13-
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).
14-
This enables default editor features like syntax validation, highlighting and inspections for CSV files.
13+
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).
14+
This enables default editor features like syntax validation, highlighting and inspections for CSV-alike files.
1515

1616
## Features
1717

@@ -300,7 +300,7 @@ Annasusanna,Amsterdam, 1
300300

301301
![Context menu](./docs/contextmenu.png)
302302

303-
The action to switch the value separator used for CSV syntax validation of a specific file is part of its text editors context menu.
303+
The action to switch the value separator used for CSV syntax validation of a specific file is part of its editors context menu.
304304

305305

306306
This action defines how the parser/validator/highlighter/etc. behaves. It does intentionally not change the file content.
@@ -312,7 +312,7 @@ Calculates and sets the maximum width for all table columns based on their conte
312312

313313
#### Reset column widths to default (table editor only)
314314

315-
Set the width of all table columns back to default. The default table column width can be changed via [Editor Settings](#default-column-width)).
315+
Set the width of all table columns back to default. The default table column width can be changed via [Editor Settings](#default-column-width).
316316

317317
### Inspections
318318

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ grammarKit {
9898
jflexRelease = '1.7.0-1'
9999

100100
// tag or short commit hash of Grammar-Kit to use - https://github.com/JetBrains/Grammar-Kit
101-
grammarKitRelease = System.getenv().getOrDefault('GRAMMAR_KIT_VERSION', '2017.1.6')
101+
grammarKitRelease = System.getenv().getOrDefault('GRAMMAR_KIT_VERSION', '2017.1.7')
102102
}
103103

104104
import org.jetbrains.grammarkit.tasks.GenerateLexer

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://www.jetbrains.com/intellij-repository/snapshots
44

55
name='CSV Plugin'
6-
pluginVersion=2.6.4
6+
pluginVersion=2.7.0
77
javaVersion=1.8
88
javaTargetVersion=1.8
99
downloadIntellijSources=false

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
public class CsvFileTypeFactory extends FileTypeFactory {
88
@Override
99
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
10-
fileTypeConsumer.consume(CsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[]{"csv"}));
10+
fileTypeConsumer.consume(CsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"csv"}));
1111
}
1212
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static PsiElement createEmptyCsvField(PsiFile psiFile) {
3838
final PsiManager psiManager = PsiManager.getInstance(project);
3939
final DummyHolder dummyHolder = DummyHolderFactory.createHolder(psiManager, null);
4040
final FileElement fileElement = dummyHolder.getTreeElement();
41-
final FileParserDefinition parserDefinition = (FileParserDefinition)LanguageParserDefinitions.INSTANCE.forLanguage(CsvLanguage.INSTANCE);
41+
final FileParserDefinition parserDefinition = (FileParserDefinition) LanguageParserDefinitions.INSTANCE.forLanguage(CsvLanguage.INSTANCE);
4242
final Lexer lexer = parserDefinition.createLexer(psiFile);
4343
final PsiBuilder psiBuilder = PsiBuilderFactory.getInstance().createBuilder(project, fileElement, lexer, CsvLanguage.INSTANCE, text);
4444
final ASTNode node = parserDefinition.createParser(project).parse(type, psiBuilder);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import com.intellij.lang.PsiBuilder;
44
import com.intellij.psi.PsiFile;
55
import com.intellij.psi.impl.source.resolve.FileContextUtil;
6-
import net.seesharpsoft.intellij.plugins.csv.settings.CsvCodeStyleSettings;
76
import net.seesharpsoft.intellij.plugins.csv.psi.CsvTypes;
7+
import net.seesharpsoft.intellij.plugins.csv.settings.CsvCodeStyleSettings;
88

99
public final class CsvParserUtil {
1010

src/main/java/net/seesharpsoft/intellij/plugins/csv/actions/CsvChangeSeparatorAction.java

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import com.intellij.lang.Language;
44
import com.intellij.openapi.actionSystem.AnActionEvent;
55
import com.intellij.openapi.actionSystem.CommonDataKeys;
6+
import com.intellij.openapi.actionSystem.PlatformDataKeys;
67
import com.intellij.openapi.actionSystem.ToggleAction;
78
import com.intellij.openapi.components.ServiceManager;
9+
import com.intellij.openapi.fileEditor.FileEditor;
810
import com.intellij.psi.PsiFile;
911
import com.intellij.util.FileContentUtil;
1012
import net.seesharpsoft.intellij.plugins.csv.CsvLanguage;
@@ -14,35 +16,40 @@
1416
import org.jetbrains.annotations.NotNull;
1517

1618
public class CsvChangeSeparatorAction extends ToggleAction {
17-
private String mySeparator;
19+
private String mySeparator;
1820

19-
CsvChangeSeparatorAction(String separator, String mySeparatorTextArg) {
20-
super(mySeparatorTextArg);
21-
mySeparator = separator;
21+
CsvChangeSeparatorAction(String separator, String mySeparatorTextArg) {
22+
super(mySeparatorTextArg);
23+
mySeparator = separator;
24+
}
25+
26+
@Override
27+
public boolean isSelected(@NotNull AnActionEvent anActionEvent) {
28+
PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
29+
if (psiFile == null) {
30+
return false;
2231
}
32+
CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class);
33+
return csvFileAttributes.getFileSeparator(psiFile) != null && CsvCodeStyleSettings.getCurrentSeparator(anActionEvent.getProject(), psiFile).equals(mySeparator);
34+
}
2335

24-
@Override
25-
public boolean isSelected(@NotNull AnActionEvent anActionEvent) {
26-
PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
27-
if (psiFile == null) {
28-
return false;
29-
}
30-
CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class);
31-
return csvFileAttributes.getFileSeparator(psiFile) != null && CsvCodeStyleSettings.getCurrentSeparator(anActionEvent.getProject(), psiFile).equals(mySeparator);
36+
@Override
37+
public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) {
38+
PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
39+
if (psiFile == null) {
40+
return;
41+
}
42+
Language language = psiFile.getLanguage();
43+
if (!language.isKindOf(CsvLanguage.INSTANCE) || language instanceof CsvSeparatorHolder) {
44+
return;
3245
}
46+
CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class);
47+
csvFileAttributes.setFileSeparator(psiFile, this.mySeparator);
48+
FileContentUtil.reparseFiles(psiFile.getVirtualFile());
3349

34-
@Override
35-
public void setSelected(@NotNull AnActionEvent anActionEvent, boolean b) {
36-
PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
37-
if (psiFile == null) {
38-
return;
39-
}
40-
Language language = psiFile.getLanguage();
41-
if (!language.isKindOf(CsvLanguage.INSTANCE) || language instanceof CsvSeparatorHolder) {
42-
return;
43-
}
44-
CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class);
45-
csvFileAttributes.setFileSeparator(psiFile, this.mySeparator);
46-
FileContentUtil.reparseFiles(psiFile.getVirtualFile());
50+
FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR);
51+
if (fileEditor != null) {
52+
fileEditor.selectNotify();
4753
}
48-
}
54+
}
55+
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/actions/CsvDefaultSeparatorAction.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import com.intellij.lang.Language;
44
import com.intellij.openapi.actionSystem.AnActionEvent;
55
import com.intellij.openapi.actionSystem.CommonDataKeys;
6+
import com.intellij.openapi.actionSystem.PlatformDataKeys;
67
import com.intellij.openapi.actionSystem.ToggleAction;
78
import com.intellij.openapi.components.ServiceManager;
9+
import com.intellij.openapi.fileEditor.FileEditor;
810
import com.intellij.psi.PsiFile;
911
import com.intellij.util.FileContentUtil;
1012
import net.seesharpsoft.intellij.plugins.csv.CsvLanguage;
@@ -28,7 +30,7 @@ public boolean isSelected(@NotNull AnActionEvent anActionEvent) {
2830
}
2931

3032
@Override
31-
public void setSelected(@NotNull AnActionEvent anActionEvent, boolean b) {
33+
public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) {
3234
PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);
3335
if (psiFile == null) {
3436
return;
@@ -40,5 +42,10 @@ public void setSelected(@NotNull AnActionEvent anActionEvent, boolean b) {
4042
CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class);
4143
csvFileAttributes.removeFileSeparator(psiFile);
4244
FileContentUtil.reparseFiles(psiFile.getVirtualFile());
45+
46+
FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR);
47+
if (fileEditor != null) {
48+
fileEditor.selectNotify();
49+
}
4350
}
4451
}

0 commit comments

Comments
 (0)