Skip to content

Commit

Permalink
0.2.4 tested fix for CLion 2018.2 EAP compatibility issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtsiomCh committed May 18, 2018
1 parent 37c0bdf commit 6ba6a84
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 150 deletions.
12 changes: 11 additions & 1 deletion CMake.iml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="newCmakeStub" scope="PROVIDED" />
<orderEntry type="module-library" scope="PROVIDED">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/jars" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/jars" recursive="false" />
</library>
</orderEntry>
</component>
</module>
Binary file modified CMake.jar
Binary file not shown.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CMake Syntax from [cmake.org](https://cmake.org/cmake/help/latest/manual/cmake-l
Till version 0.1.0 <b>IntelliJ IDEA CE</b> and <b>Android Studio</b>: Commands, Variables, Property and Operator was taken from [vim CMake support pluging](https://raw.githubusercontent.com/nickhutchinson/vim-cmake-syntax/master/syntax/cmake.vim)<br>
For <b>CLion</b> and from version 0.2.0 for <b>IntelliJ IDEA CE</b> and <b>Android Studio</b>: Commands, Variables, Property and Operator was taken from official [cmake.org](https://cmake.org/cmake/help/latest/index.html) manuals.

Variable declaration and usage panels (IDEA/Android studio only: Ctrl+B, Alt+F7, Ctrl+Click, etc.) show all visible mentions of the variable name in ALL Project's cmake files. Scope principles (function, directory, etc.) not yet implemented. Use it for guidance only not for determining variable visibility. Variable reference's specific case inside IF and WHILE conditions implemented.
Variable declaration and usage panels (only IDEA and Android studio(till 3.2): Ctrl+B, Alt+F7, Ctrl+Click, etc.) show all visible mentions of the variable name in ALL Project's cmake files. Scope principles (function, directory, etc.) not yet implemented. Use it for guidance only not for determining variable visibility. Variable reference's specific case inside IF and WHILE conditions implemented.

Navigation between variable's declarations/references in CLion is not implemented. Might be implemented in future releases.

Expand All @@ -41,6 +41,15 @@ If you wish to use compiled version of pluging, please take `CMake.jar` from the
Plugin is open-source software and is licenced under GPL v3 licence.

## **Versions**
**v.0.2.4**
* Finally :) tested fix of CLion 2018.2 EAP compatibility issue. <br>

**v.0.2.3**
* Fixed (but not tested) upcoming CLion 2018.2 EAP compatibility issue: <a href="https://youtrack.jetbrains.com/issue/CPP-12728">CPP-12728</a>. <br>

**v.0.2.2**
* Fixed compatibility for upcoming Android Studio 3.2 (with restricted functionality as for CLion). As a side effect the Plugin become open for all IntelliJ Platform's IDEs.<br>

**v.0.2.1**
* Fixed Android Studio compatibility issue.

Expand Down Expand Up @@ -69,4 +78,5 @@ Plugin is open-source software and is licenced under GPL v3 licence.
* Hover the `cmake_v3.bnf` and generate parser code
* In project properties mark gen as source folder
* Generate lexer class from `CMake_org_v3.flex` file.
* Link `clion.jar` (two of them actually: from CLion 181 and below, from Clion 182 and above) to project as provided module or just create a stub at `CMakeProxyToJB.java`
* Build project and you are set to go
3 changes: 2 additions & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>artsiomch.cmake</id>
<name>CMake simple highlighter</name>
<version>0.2.3</version>
<version>0.2.4</version>
<vendor email="achapialiou@gmail.com" url="http://github.com/ArtsiomCh/CMake">Artsiom Chapialiou</vendor>

<description><![CDATA[
Expand All @@ -17,6 +17,7 @@
]]></description>

<change-notes><![CDATA[
0.2.4 - Finally :) tested fix for CLion 2018.2 EAP compatibility issue. <br>
0.2.3 - Fixed (but not tested) upcoming CLion 2018.2 EAP compatibility issue: <a href="https://youtrack.jetbrains.com/issue/CPP-12728">CPP-12728</a>. <br>
0.2.2 - Fixed compatibility for upcoming Android Studio 3.2 (with restricted functionality as for CLion). As a side effect the Plugin become open for all IntelliJ Platform's IDEs.<br>
0.2.1 - Fixed Android Studio compatibility issue. <br>
Expand Down
246 changes: 99 additions & 147 deletions testData/ParsingTestData.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,152 +3,104 @@ CMake File(0,1144)
PsiWhiteSpace('\n')(14,15)
PsiComment(CMakeTokenType.bracket_comment)('#[[This is a bracket comment.\nIt runs until the close bracket.]]')(15,79)
PsiWhiteSpace('\n')(79,80)
CMakeFileElementImpl(FILE_ELEMENT)(80,208)
CMakeCmdImpl(CMD)(80,208)
CMakeCommandExprImpl(COMMAND_EXPR)(80,208)
CMakeCommandNameImpl(COMMAND_NAME)(80,95)
PsiElement(CMakeTokenType.identifier)('unknown_command')(80,95)
CMakeArgumentsImpl(ARGUMENTS)(95,208)
CMakeLparImpl(LPAR)(95,96)
PsiElement(LPAR)('(')(95,96)
PsiWhiteSpace('\n\t')(96,98)
CMakeArgumentImpl(ARGUMENT)(98,116)
PsiElement(CMakeTokenType.unquoted_argument)('unquoted_argument=')(98,116)
CMakeArgumentImpl(ARGUMENT)(116,151)
CMakeVariablesImpl(VARIABLES)(116,151)
PsiElement(CMakeTokenType.var_ref_begin)('${')(116,118)
PsiElement(CMakeTokenType.variable)('outer_')(118,124)
CMakeVariablesImpl(VARIABLES)(124,141)
PsiElement(CMakeTokenType.var_ref_begin)('${')(124,126)
PsiElement(CMakeTokenType.variable)('inner_variable')(126,140)
PsiElement(CMakeTokenType.var_ref_end)('}')(140,141)
PsiElement(CMakeTokenType.variable)('_variable')(141,150)
PsiElement(CMakeTokenType.var_ref_end)('}')(150,151)
CMakeArgumentImpl(ARGUMENT)(151,168)
PsiElement(CMakeTokenType.path_url)('/followed/by/path')(151,168)
PsiWhiteSpace('\n\t')(168,170)
CMakeArgumentImpl(ARGUMENT)(170,207)
CMakeVariablesImpl(VARIABLES)(170,207)
PsiElement(CMakeTokenType.var_ref_begin)('ENV{')(170,174)
PsiElement(CMakeTokenType.variable)('environmental_variable_reference')(174,206)
PsiElement(CMakeTokenType.var_ref_end)('}')(206,207)
CMakeRparImpl(RPAR)(207,208)
PsiElement(RPAR)(')')(207,208)
CMakeCmdImpl(CMD)(80,208)
CMakeCommandNameImpl(COMMAND_NAME)(80,95)
PsiElement(CMakeTokenType.identifier)('unknown_command')(80,95)
CMakeArgumentsImpl(ARGUMENTS)(95,208)
PsiElement(CMakeTokenType.()('(')(95,96)
PsiWhiteSpace('\n\t')(96,98)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(98,168)
PsiElement(CMakeTokenType.unquoted_argument)('unquoted_argument=${outer_${inner_variable}_variable}/followed/by/path')(98,168)
PsiWhiteSpace('\n\t')(168,170)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(170,207)
PsiElement(CMakeTokenType.unquoted_argument)('ENV{environmental_variable_reference}')(170,207)
PsiElement(CMakeTokenType.))(')')(207,208)
PsiWhiteSpace('\n')(208,209)
CMakeFileElementImpl(FILE_ELEMENT)(209,458)
CMakeCmdImpl(CMD)(209,458)
CMakeCommandExprImpl(COMMAND_EXPR)(209,458)
CMakeCommandNameImpl(COMMAND_NAME)(209,212)
PsiElement(CMakeTokenType.cmake_command)('set')(209,212)
CMakeArgumentsImpl(ARGUMENTS)(212,458)
CMakeLparImpl(LPAR)(212,213)
PsiElement(LPAR)('(')(212,213)
PsiWhiteSpace(' ')(213,214)
CMakeArgumentImpl(ARGUMENT)(214,243)
PsiElement(CMakeTokenType.unquoted_argument)('<-this_is_known_CMake_Command')(214,243)
PsiWhiteSpace(' ')(243,244)
CMakeArgumentImpl(ARGUMENT)(244,248)
PsiElement(CMakeTokenType.unquoted_argument)('arg1')(244,248)
PsiWhiteSpace(';')(248,249)
CMakeArgumentImpl(ARGUMENT)(249,253)
PsiElement(CMakeTokenType.unquoted_argument)('arg2')(249,253)
PsiWhiteSpace(';')(253,254)
CMakeArgumentImpl(ARGUMENT)(254,258)
PsiElement(CMakeTokenType.unquoted_argument)('arg3')(254,258)
PsiWhiteSpace('\n\t')(258,260)
CMakeArgumentImpl(ARGUMENT)(260,266)
PsiElement(CMakeTokenType.cmake_property)('PUBLIC')(260,266)
PsiWhiteSpace(' ')(266,267)
CMakeArgumentImpl(ARGUMENT)(267,292)
PsiElement(CMakeTokenType.unquoted_argument)('with_known_CMake_Property')(267,292)
PsiWhiteSpace('\n\t')(292,294)
PsiComment(CMakeTokenType.bracket_comment)('#[=[with Bracket Comment]=]')(294,321)
PsiWhiteSpace(' ')(321,322)
CMakeArgumentImpl(ARGUMENT)(322,325)
PsiElement(CMakeTokenType.cmake_operator)('AND')(322,325)
PsiWhiteSpace(' ')(325,326)
CMakeArgumentImpl(ARGUMENT)(326,351)
PsiElement(CMakeTokenType.unquoted_argument)('with_known_CMake_Operator')(326,351)
PsiWhiteSpace('\n\t')(351,353)
CMakeArgumentImpl(ARGUMENT)(353,371)
CMakeVariablesImpl(VARIABLES)(353,371)
PsiElement(CMakeTokenType.var_ref_begin)('${')(353,355)
PsiElement(CMakeTokenType.cmake_variable)('CMAKE_CXX_FLAGS')(355,370)
PsiElement(CMakeTokenType.var_ref_end)('}')(370,371)
PsiWhiteSpace(' ')(371,372)
CMakeArgumentImpl(ARGUMENT)(372,397)
PsiElement(CMakeTokenType.unquoted_argument)('with_known_CMake_Variable')(372,397)
PsiWhiteSpace('\n\t')(397,399)
CMakeArgumentImpl(ARGUMENT)(399,421)
PsiElement(CMakeTokenType.unquoted_legacy)('UnquotedLegacy"fff"ghg')(399,421)
PsiWhiteSpace(' ')(421,422)
CMakeArgumentImpl(ARGUMENT)(422,434)
PsiElement(CMakeTokenType.unquoted_legacy)('-Da="b c"" "')(422,434)
PsiWhiteSpace(' ')(434,435)
CMakeArgumentImpl(ARGUMENT)(435,443)
PsiElement(CMakeTokenType.unquoted_legacy)('-Da=$(v)')(435,443)
PsiWhiteSpace(' ')(443,444)
CMakeArgumentImpl(ARGUMENT)(444,456)
PsiElement(CMakeTokenType.unquoted_legacy)('a" "b"c"f$$$')(444,456)
PsiWhiteSpace(' ')(456,457)
CMakeRparImpl(RPAR)(457,458)
PsiElement(RPAR)(')')(457,458)
CMakeCmdImpl(CMD)(209,458)
CMakeCommandNameImpl(COMMAND_NAME)(209,212)
PsiElement(CMakeTokenType.identifier)('set')(209,212)
CMakeArgumentsImpl(ARGUMENTS)(212,458)
PsiElement(CMakeTokenType.()('(')(212,213)
PsiWhiteSpace(' ')(213,214)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(214,243)
PsiElement(CMakeTokenType.unquoted_argument)('<-this_is_known_CMake_Command')(214,243)
PsiWhiteSpace(' ')(243,244)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(244,248)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('arg1')(244,248)
PsiWhiteSpace(';')(248,249)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(249,253)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('arg2')(249,253)
PsiWhiteSpace(';')(253,254)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(254,258)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('arg3')(254,258)
PsiWhiteSpace('\n\t')(258,260)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(260,266)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('PUBLIC')(260,266)
PsiWhiteSpace(' ')(266,267)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(267,292)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('with_known_CMake_Property')(267,292)
PsiWhiteSpace('\n\t')(292,294)
PsiComment(CMakeTokenType.bracket_comment)('#[=[with Bracket Comment]=]')(294,321)
PsiWhiteSpace(' ')(321,322)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(322,325)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('AND')(322,325)
PsiWhiteSpace(' ')(325,326)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(326,351)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('with_known_CMake_Operator')(326,351)
PsiWhiteSpace('\n\t')(351,353)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(353,371)
PsiElement(CMakeTokenType.unquoted_argument)('${CMAKE_CXX_FLAGS}')(353,371)
PsiWhiteSpace(' ')(371,372)
CMakeUnquotedArgumentMaybeVariableContainerImpl(UNQUOTED_ARGUMENT_MAYBE_VARIABLE_CONTAINER)(372,397)
PsiElement(CMakeTokenType.unquoted_argument_maybe_var_def)('with_known_CMake_Variable')(372,397)
PsiWhiteSpace('\n\t')(397,399)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(399,421)
PsiElement(CMakeTokenType.unquoted_argument)('UnquotedLegacy"fff"ghg')(399,421)
PsiWhiteSpace(' ')(421,422)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(422,434)
PsiElement(CMakeTokenType.unquoted_argument)('-Da="b c"" "')(422,434)
PsiWhiteSpace(' ')(434,435)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(435,443)
PsiElement(CMakeTokenType.unquoted_argument)('-Da=$(v)')(435,443)
PsiWhiteSpace(' ')(443,444)
CMakeUnquotedArgumentContainerImpl(UNQUOTED_ARGUMENT_CONTAINER)(444,456)
PsiElement(CMakeTokenType.unquoted_argument)('a" "b"c"f$$$')(444,456)
PsiWhiteSpace(' ')(456,457)
PsiElement(CMakeTokenType.))(')')(457,458)
PsiWhiteSpace('\n')(458,459)
CMakeFileElementImpl(FILE_ELEMENT)(459,1144)
CMakeCondImpl(COND)(459,1144)
CMakePredicateExprImpl(PREDICATE_EXPR)(459,1136)
CMakeIfExprImpl(IF_EXPR)(459,463)
CMakeCommandExprImpl(COMMAND_EXPR)(459,463)
PsiElement(CMakeTokenType.if)('if')(459,461)
CMakeArgumentsImpl(ARGUMENTS)(461,463)
CMakeLparImpl(LPAR)(461,462)
PsiElement(LPAR)('(')(461,462)
CMakeRparImpl(RPAR)(462,463)
PsiElement(RPAR)(')')(462,463)
PsiWhiteSpace('\n ')(463,468)
CMakeBodyImpl(BODY)(468,1136)
CMakeFileElementImpl(FILE_ELEMENT)(468,782)
CMakeCmdImpl(CMD)(468,782)
CMakeCommandExprImpl(COMMAND_EXPR)(468,782)
CMakeCommandNameImpl(COMMAND_NAME)(468,475)
PsiElement(CMakeTokenType.cmake_command)('message')(468,475)
CMakeArgumentsImpl(ARGUMENTS)(475,782)
CMakeLparImpl(LPAR)(475,476)
PsiElement(LPAR)('(')(475,476)
PsiWhiteSpace(' ')(476,477)
CMakeArgumentImpl(ARGUMENT)(477,781)
CMakeBraceImpl(BRACE)(477,478)
PsiElement(BRACE)('"')(477,478)
PsiElement(CMakeTokenType.quoted_argument)('This is a quoted argument containing multiple lines.\n This is always one argument even though it contains a ; character.\n Both \\-escape sequences and ')(478,635)
CMakeVariablesImpl(VARIABLES)(635,646)
PsiElement(CMakeTokenType.var_ref_begin)('${')(635,637)
PsiElement(CMakeTokenType.variable)('variable')(637,645)
PsiElement(CMakeTokenType.var_ref_end)('}')(645,646)
PsiElement(CMakeTokenType.quoted_argument)(' references are evaluated.\n The text does not end on an escaped double-quote like \".\n It does end in an unescaped double quote.')(646,780)
CMakeBraceImpl(BRACE)(780,781)
PsiElement(BRACE)('"')(780,781)
CMakeRparImpl(RPAR)(781,782)
PsiElement(RPAR)(')')(781,782)
PsiWhiteSpace('\n ')(782,787)
CMakeFileElementImpl(FILE_ELEMENT)(787,1136)
CMakeCmdImpl(CMD)(787,1136)
CMakeCommandExprImpl(COMMAND_EXPR)(787,1136)
CMakeCommandNameImpl(COMMAND_NAME)(787,794)
PsiElement(CMakeTokenType.cmake_command)('message')(787,794)
CMakeArgumentsImpl(ARGUMENTS)(794,1136)
CMakeLparImpl(LPAR)(794,795)
PsiElement(LPAR)('(')(794,795)
PsiWhiteSpace(' ')(795,796)
CMakeArgumentImpl(ARGUMENT)(796,1135)
PsiElement(CMakeTokenType.bracket_argument)('[=[\n This is the first line in a bracket argument with bracket length 1.\n No \-escape sequences or ${variable} references are evaluated.\n This is always one argument even though it contains a ; character.\n The text does not end on a closing bracket of length 0 like ]].\n It does end in a closing bracket of length 1.\n ]=]')(796,1135)
CMakeRparImpl(RPAR)(1135,1136)
PsiElement(RPAR)(')')(1135,1136)
PsiWhiteSpace('\n')(1136,1137)
CMakeEndifExprImpl(ENDIF_EXPR)(1137,1144)
CMakeCommandExprImpl(COMMAND_EXPR)(1137,1144)
PsiElement(CMakeTokenType.endif)('endif')(1137,1142)
CMakeArgumentsImpl(ARGUMENTS)(1142,1144)
CMakeLparImpl(LPAR)(1142,1143)
PsiElement(LPAR)('(')(1142,1143)
CMakeRparImpl(RPAR)(1143,1144)
PsiElement(RPAR)(')')(1143,1144)
CMakeCondImpl(COND)(459,1144)
CMakeIfExprImpl(IF_EXPR)(459,463)
PsiElement(CMakeTokenType.if)('if')(459,461)
CMakeArgumentsImpl(ARGUMENTS)(461,463)
PsiElement(CMakeTokenType.()('(')(461,462)
PsiElement(CMakeTokenType.))(')')(462,463)
PsiWhiteSpace('\n ')(463,468)
CMakeIfbodyImpl(IFBODY)(468,1136)
CMakeCmdImpl(CMD)(468,782)
CMakeCommandNameImpl(COMMAND_NAME)(468,475)
PsiElement(CMakeTokenType.identifier)('message')(468,475)
CMakeArgumentsImpl(ARGUMENTS)(475,782)
PsiElement(CMakeTokenType.()('(')(475,476)
PsiWhiteSpace(' ')(476,477)
CMakeBraceImpl(BRACE)(477,478)
PsiElement(BRACE)('"')(477,478)
CMakeQuotedArgumentContainerImpl(QUOTED_ARGUMENT_CONTAINER)(478,780)
PsiElement(CMakeTokenType.quoted_argument)('This is a quoted argument containing multiple lines.\n This is always one argument even though it contains a ; character.\n Both \\-escape sequences and ${variable} references are evaluated.\n The text does not end on an escaped double-quote like \".\n It does end in an unescaped double quote.')(478,780)
CMakeBraceImpl(BRACE)(780,781)
PsiElement(BRACE)('"')(780,781)
PsiElement(CMakeTokenType.))(')')(781,782)
PsiWhiteSpace('\n ')(782,787)
CMakeCmdImpl(CMD)(787,1136)
CMakeCommandNameImpl(COMMAND_NAME)(787,794)
PsiElement(CMakeTokenType.identifier)('message')(787,794)
CMakeArgumentsImpl(ARGUMENTS)(794,1136)
PsiElement(CMakeTokenType.()('(')(794,795)
PsiWhiteSpace(' ')(795,796)
PsiElement(CMakeTokenType.bracket_argument)('[=[\n This is the first line in a bracket argument with bracket length 1.\n No \-escape sequences or ${variable} references are evaluated.\n This is always one argument even though it contains a ; character.\n The text does not end on a closing bracket of length 0 like ]].\n It does end in a closing bracket of length 1.\n ]=]')(796,1135)
PsiElement(CMakeTokenType.))(')')(1135,1136)
PsiWhiteSpace('\n')(1136,1137)
CMakeEndifExprImpl(ENDIF_EXPR)(1137,1144)
PsiElement(CMakeTokenType.endif)('endif')(1137,1142)
CMakeArgumentsImpl(ARGUMENTS)(1142,1144)
PsiElement(CMakeTokenType.()('(')(1142,1143)
PsiElement(CMakeTokenType.))(')')(1143,1144)

0 comments on commit 6ba6a84

Please sign in to comment.