Skip to content

Commit

Permalink
Merge pull request #32329 from vespa-engine/theodorkl/fixIntelliJNPE
Browse files Browse the repository at this point in the history
Fix IntelliJ NPE
  • Loading branch information
bratseth authored Sep 3, 2024
2 parents 16fcbea + 6302d7d commit 72a4e49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.0.7
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ai.vespa.schemals.intellij

import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.ide.plugins.PluginManager
import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.openapi.extensions.PluginId
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.lsp.api.LspServerSupportProvider
import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor
import com.intellij.openapi.application.PathManager
import java.nio.file.Path

/**
* Entry point for giving LSP support by starting the server.
Expand All @@ -28,8 +30,15 @@ class SchemaLspServerDescriptor(project: Project) : ProjectWideLspServerDescript
override fun isSupportedFile(file: VirtualFile) = file.extension.equals("sd") || file.extension.equals("profile")

override fun createCommandLine(): GeneralCommandLine {
val schemaPlugin = PluginManager.getInstance().findEnabledPlugin(PluginId.getId("ai.vespa"))!!
val serverPath = schemaPlugin.pluginPath.resolve("schema-language-server-jar-with-dependencies.jar").toAbsolutePath().toString()
val id = PluginId.getId("ai.vespa")
val plugin = PluginManagerCore.getPlugin(id)!!
val pluginPath = plugin.getPluginPath()

val serverPath = pluginPath
.resolve("schema-language-server-jar-with-dependencies.jar")
.toAbsolutePath()
.toString()

return GeneralCommandLine("java", "-jar", serverPath)
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Support for Vespa schema files.",
"author": "Vespa",
"publisher": "vespaai",
"version": "2.0.6",
"version": "2.0.7",
"engines": {
"vscode": "^1.72.0"
},
Expand Down Expand Up @@ -86,4 +86,4 @@
"hasbin": "^1.2.3",
"vscode-languageclient": "^9.0.1"
}
}
}

0 comments on commit 72a4e49

Please sign in to comment.