summaryrefslogtreecommitdiffstats
path: root/integration/intellij
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-28 15:45:56 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-28 15:45:56 +0100
commitbd7b7bcf5b8d3ac710032f66e891caa90a4334a1 (patch)
tree94703b2384be73fb9189b217b9de8187c7f1f68c /integration/intellij
parent0b3976a46f761b0add47e0b112d79be8290060fa (diff)
Support multiple inheritance and standalone rank profiles
Diffstat (limited to 'integration/intellij')
-rw-r--r--integration/intellij/README.md14
-rw-r--r--integration/intellij/build.gradle2
-rw-r--r--integration/intellij/pom.xml2
-rw-r--r--integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf4
-rw-r--r--integration/intellij/src/main/java/ai/vespa/intellij/schema/SdUtil.java3
-rw-r--r--integration/intellij/src/main/resources/META-INF/plugin.xml2
6 files changed, 15 insertions, 12 deletions
diff --git a/integration/intellij/README.md b/integration/intellij/README.md
index fec547f8a06..d293b320028 100644
--- a/integration/intellij/README.md
+++ b/integration/intellij/README.md
@@ -36,17 +36,19 @@ open a project with some sd file and see how the plugin works on it.
## Some useful links:
-1. JetBrains official tutorials: https://plugins.jetbrains.com/docs/intellij/custom-language-support.html and
- https://plugins.jetbrains.com/docs/intellij/custom-language-support-tutorial.html
+1. Plugin development documentation: https://plugins.jetbrains.com/docs/intellij/welcome.html
-2. Grammar-Kit HOWTO: Helps to understand the BNF syntax.
+2. JetBrains official tutorials: https://plugins.jetbrains.com/docs/intellij/custom-language-support.html and
+ https://plugins.jetbrains.com/docs/intellij/custom-language-support-tutorial.html
+
+3. Grammar-Kit HOWTO: Helps to understand the BNF syntax.
https://github.com/JetBrains/Grammar-Kit/blob/master/HOWTO.md
-3. How to deal with left-recursion in the grammar (in SD for example it happens in expressions). Last answer here:
+4. How to deal with left-recursion in the grammar (in SD for example it happens in expressions). Last answer here:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001258300-What-s-the-alternative-to-left-recursion-in-GrammarKit-
-4. Great tutorial for a custom-language-plugin, but only for the basics (mainly the parser and lexer):
+5. Great tutorial for a custom-language-plugin, but only for the basics (mainly the parser and lexer):
https://medium.com/@shan1024/custom-language-plugin-development-for-intellij-idea-part-01-d6a41ab96bc9
-5. Code of Dart (some custom language) plugin for IntelliJ:
+6. Code of Dart (some custom language) plugin for IntelliJ:
https://github.com/JetBrains/intellij-plugins/tree/0f07ca63355d5530b441ca566c98f17c560e77f8/Dart \ No newline at end of file
diff --git a/integration/intellij/build.gradle b/integration/intellij/build.gradle
index 2d5ad1f33d6..5529d3d7c15 100644
--- a/integration/intellij/build.gradle
+++ b/integration/intellij/build.gradle
@@ -36,7 +36,7 @@ compileJava {
}
group 'ai.vespa'
-version '1.0.2' // Also update pom.xml version if this is changed
+version '1.0.3' // Also update pom.xml version if this is changed
sourceCompatibility = 11
diff --git a/integration/intellij/pom.xml b/integration/intellij/pom.xml
index 984968b2834..94d8fd90f99 100644
--- a/integration/intellij/pom.xml
+++ b/integration/intellij/pom.xml
@@ -9,7 +9,7 @@
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>vespa-intellij</artifactId> <!-- Not used - plugin is build by gradle -->
- <version>1.0.2</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle -->
+ <version>1.0.3</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle -->
<description>
Maven wrapper for the gradle build of this IntelliJ plugin.
</description>
diff --git a/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf b/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
index 6be7302a28c..04368bf29af 100644
--- a/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
+++ b/integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
@@ -40,7 +40,7 @@
]
}
-SdFile ::= SchemaDefinition | DocumentDefinition
+SdFile ::= SchemaDefinition | DocumentDefinition | RankProfileDefinition
SchemaDefinition ::= (search | schema) IdentifierVal? (inherits IdentifierVal)? '{' SchemaBody '}'
SchemaBody ::= SchemaBodyOptions* DocumentDefinition SchemaBodyOptions* // Does not support zero-or-one occurrences
private SchemaBodyOptions ::= SchemaFieldDefinition | ImportFieldDefinition | DocumentSummaryDefinition |
@@ -129,7 +129,7 @@ PrimitiveExpr ::= (('-')? INTEGER_REG) | (('-')? FLOAT_REG) | IdentifierVal | Ra
//-------------------------
//-- Rank Profile rules ---
//-------------------------
-RankProfileDefinition ::= (rank-profile | model) IdentifierWithDashVal (inherits IdentifierWithDashVal)? '{' RankProfileBody '}'
+RankProfileDefinition ::= (rank-profile | model) IdentifierWithDashVal (inherits IdentifierWithDashVal (',' IdentifierWithDashVal)*)? '{' RankProfileBody '}'
{ mixin="ai.vespa.intellij.schema.psi.impl.SdNamedElementImpl"
implements=["ai.vespa.intellij.schema.psi.SdDeclaration"]
}
diff --git a/integration/intellij/src/main/java/ai/vespa/intellij/schema/SdUtil.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/SdUtil.java
index d9f769d07cc..cba1bd04ce4 100644
--- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/SdUtil.java
+++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/SdUtil.java
@@ -132,7 +132,8 @@ public class SdUtil {
for (VirtualFile vfile : virtualFiles) {
SdFile sdFile = (SdFile) PsiManager.getInstance(project).findFile(vfile);
- if (sdFile != null && !sdFile.getName().equals(docName + ".sd")) {
+ if (sdFile != null &&
+ ( !sdFile.getName().equals(docName + ".sd") && !sdFile.getName().equals(docName + ".profile"))) {
continue;
}
result.addAll(SdUtil.findDeclarationsByName(sdFile, name));
diff --git a/integration/intellij/src/main/resources/META-INF/plugin.xml b/integration/intellij/src/main/resources/META-INF/plugin.xml
index 673a66f3228..ea6fe3f2f15 100644
--- a/integration/intellij/src/main/resources/META-INF/plugin.xml
+++ b/integration/intellij/src/main/resources/META-INF/plugin.xml
@@ -29,7 +29,7 @@
<!-- Extension points defined by the plugin -->
<extensions defaultExtensionNs="com.intellij">
<fileType name="Sd File" implementationClass="ai.vespa.intellij.schema.SdFileType" fieldName="INSTANCE"
- language="Sd" extensions="sd"/>
+ language="Sd" extensions="sd;profile"/>
<lang.parserDefinition language="Sd" implementationClass="ai.vespa.intellij.schema.parser.SdParserDefinition"/>
<lang.syntaxHighlighterFactory language="Sd" implementationClass="ai.vespa.intellij.schema.SdSyntaxHighlighterFactory"/>
<completion.contributor language="Sd" implementationClass="ai.vespa.intellij.schema.SdCompletionContributor"/>