File tree Expand file tree Collapse file tree 4 files changed +44
-4
lines changed
java/net/seesharpsoft/intellij/plugins/csv Expand file tree Collapse file tree 4 files changed +44
-4
lines changed Original file line number Diff line number Diff line change 44
55env :
66 - IDEA_VERSION=IC-2017.3.1 GRAMMAR_KIT_VERSION=2017.1.2
7- - IDEA_VERSION=IC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.7
8- - IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3
7+ - IDEA_VERSION=PC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.7
8+ - IDEA_VERSION=RD-2019.3.3 GRAMMAR_KIT_VERSION=2019.3
9+ - IDEA_VERSION=IU-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3
910
1011script : xvfb-run gradle check
1112
Original file line number Diff line number Diff line change 7171apply plugin : ' org.jetbrains.intellij'
7272intellij {
7373 // IDE version - https://www.jetbrains.com/intellij-repository/releases
74- version = System . getenv(). getOrDefault(' IDEA_VERSION' , ' IC-2019.1.3 ' )
74+ version = System . getenv(). getOrDefault(' IDEA_VERSION' , ' IU-LATEST-EAP-SNAPSHOT ' )
7575 pluginName = ' CSV Plugin'
7676 instrumentCode = true
7777 updateSinceUntilBuild = false
@@ -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' , ' 2019.1.1 ' )
101+ grammarKitRelease = System . getenv(). getOrDefault(' GRAMMAR_KIT_VERSION' , ' 2019.3 ' )
102102}
103103
104104import org.jetbrains.grammarkit.tasks.GenerateLexer
Original file line number Diff line number Diff line change 1+ package net .seesharpsoft .intellij .plugins .csv ;
2+
3+ import com .intellij .openapi .fileTypes .FileType ;
4+ import com .intellij .openapi .fileTypes .impl .FileTypeOverrider ;
5+ import com .intellij .openapi .vfs .VirtualFile ;
6+ import net .seesharpsoft .intellij .plugins .psv .PsvFileType ;
7+ import net .seesharpsoft .intellij .plugins .tsv .TsvFileType ;
8+ import org .jetbrains .annotations .NotNull ;
9+ import org .jetbrains .annotations .Nullable ;
10+
11+ public class CsvFileTypeOverrider implements FileTypeOverrider {
12+ @ Nullable
13+ @ Override
14+ public FileType getOverriddenFileType (@ NotNull VirtualFile file ) {
15+ if (file != null ) {
16+ String extension = file .getExtension ();
17+ if (extension != null ) {
18+ switch (extension .toLowerCase ()) {
19+ case "csv" :
20+ return CsvFileType .INSTANCE ;
21+ case "tsv" :
22+ case "tab" :
23+ return TsvFileType .INSTANCE ;
24+ case "psv" :
25+ return PsvFileType .INSTANCE ;
26+ }
27+ }
28+ }
29+ return null ;
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ FIX: consider escape char inside quotes as escaped text
5757 <!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
5858 <idea-version since-build =" 173.2099.1" />
5959<!-- <idea-version since-build="192" until-build="192.*" />-->
60+ <!-- <idea-version since-build="173.2099.1" until-build="192.*" />-->
61+ <!-- <idea-version since-build="193" />-->
6062
6163 <!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
6264 on how to target different products -->
@@ -72,6 +74,12 @@ FIX: consider escape char inside quotes as escaped text
7274 <fileTypeFactory implementation =" net.seesharpsoft.intellij.plugins.tsv.TsvFileTypeFactory" />
7375 <fileTypeFactory implementation =" net.seesharpsoft.intellij.plugins.psv.PsvFileTypeFactory" />
7476
77+ <!-- <fileType name="CSV" language="csv" implementationClass="net.seesharpsoft.intellij.plugins.csv.CsvFileType" extensions="csv" fieldName="INSTANCE"/>-->
78+ <!-- <fileType name="TSV" language="tsv" implementationClass="net.seesharpsoft.intellij.plugins.tsv.TsvFileType" extensions="tsv;tab" fieldName="INSTANCE"/>-->
79+ <!-- <fileType name="PSV" language="psv" implementationClass="net.seesharpsoft.intellij.plugins.psv.PsvFileType" extensions="psv" fieldName="INSTANCE"/>-->
80+
81+ <fileTypeOverrider implementation =" net.seesharpsoft.intellij.plugins.csv.CsvFileTypeOverrider" />
82+
7583 <lang .parserDefinition language =" csv"
7684 implementationClass =" net.seesharpsoft.intellij.plugins.csv.CsvParserDefinition" />
7785 <lang .parserDefinition language =" tsv"
You can’t perform that action at this time.
0 commit comments