summaryrefslogtreecommitdiffstats
path: root/integration
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-02-21 10:45:27 +0100
committerJon Bratseth <bratseth@gmail.com>2022-02-21 10:45:27 +0100
commit004ac86f2a0e557599bf14440035e0e107cf5184 (patch)
tree0a04880729fbaa9435fa0810d7bce76f9e242f3d /integration
parent1dfb1a1d626d5a9474b9db95cec061ada4b626a4 (diff)
Make compatible with older IntelliJ's
Diffstat (limited to 'integration')
-rw-r--r--integration/intellij/build.gradle4
-rw-r--r--integration/intellij/pom.xml2
-rw-r--r--integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Files.java5
-rw-r--r--integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Path.java7
4 files changed, 12 insertions, 6 deletions
diff --git a/integration/intellij/build.gradle b/integration/intellij/build.gradle
index 53959d45a87..9815a7029d4 100644
--- a/integration/intellij/build.gradle
+++ b/integration/intellij/build.gradle
@@ -36,7 +36,7 @@ compileJava {
}
group 'ai.vespa'
-version '1.1.0' // Also update pom.xml version if this is changed
+version '1.1.1' // Also update pom.xml version if this is changed
sourceCompatibility = 11
@@ -64,7 +64,7 @@ patchPluginXml {
untilBuild = '213.*'
// in changeNotes you can add a description of the changes in this version (would appear in the plugin page in preferences\plugins)
changeNotes = """
- <em>Support IntelliJ 213</em>"""
+ <em>Full support for .profile files. Support finding usages and go to definition across files.</em>"""
}
test {
diff --git a/integration/intellij/pom.xml b/integration/intellij/pom.xml
index 6f84c430db3..f460033c4a9 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.1.0</version> <!-- See copy-zip below, which depends on this being the same as the v. in build.gradle -->
+ <version>1.1.1</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/java/ai/vespa/intellij/schema/utils/Files.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Files.java
index 0f1fece1439..3f6d6b2d8d8 100644
--- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Files.java
+++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Files.java
@@ -24,10 +24,9 @@ public class Files {
* @return the file or empty if not found
*/
public static Optional<PsiFile> open(Path file, Project project) {
- // Apparently there s no API for getting a file by path.
+ // Apparently there's no API for getting a file by path.
// This method returns all files having a particular name.
- for (VirtualFile candidate : FilenameIndex.getVirtualFilesByName(file.last(),
- GlobalSearchScope.allScope(project))) {
+ for (VirtualFile candidate : FilenameIndex.getAllFilesByExt(project, file.extension())) {
// Not safe, but (at least in tests) there doesn't appear to be a way to get the workspace root (/src)
if (candidate.getPath().endsWith(file.getRelative()))
return Optional.of(PsiManager.getInstance(project).findFile(candidate));
diff --git a/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Path.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Path.java
index 07b2e7f3adf..ce889c24fea 100644
--- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Path.java
+++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Path.java
@@ -154,6 +154,13 @@ public final class Path {
/** Returns an immutable list of the elements of this path in order */
public List<String> elements() { return elements; }
+ /** Returns the extension of this file name, or an empty string if none. */
+ public String extension() {
+ int dotIndex = last().lastIndexOf('.');
+ if (dotIndex < 0) return "";
+ return last().substring(dotIndex + 1);
+ }
+
/** Returns this as a string */
@Override
public String toString() {