Skip to content

Commit

Permalink
Merge pull request #32668 from vespa-engine/theodorkl/LSP4IJ
Browse files Browse the repository at this point in the history
Theodorkl/lsp4 ij
  • Loading branch information
theodorklauritzen authored Oct 25, 2024
2 parents ac2dc2f + abf6e4e commit 8a993f6
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 558 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ dependencies {
implementation("com.vladsch.flexmark:flexmark-html2md-converter:0.64.8")

intellijPlatform {
intellijIdeaUltimate("2024.2")
intellijIdeaCommunity("2024.2")
instrumentationTools()
plugin("com.redhat.devtools.lsp4ij:0.7.0")
}
}

Expand Down Expand Up @@ -94,4 +95,4 @@ tasks {
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ai.vespa.schemals.intellij;

import com.intellij.openapi.project.Project;
import com.redhat.devtools.lsp4ij.server.JavaProcessCommandBuilder;
import com.redhat.devtools.lsp4ij.server.ProcessStreamConnectionProvider;

import java.util.Arrays;
import java.util.List;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.ide.plugins.PluginManagerCore;

public class SchemaLanguageServer4IJ extends ProcessStreamConnectionProvider {

public SchemaLanguageServer4IJ(Project project) {
PluginId id = PluginId.getId("ai.vespa");
var plugin = PluginManagerCore.getPlugin(id);
if (plugin == null) {
throw new IllegalStateException("Plugin " + id + " not found. Cannot start the Vespa Schema Language Support plugin.");
}
var pluginPath = plugin.getPluginPath();

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

List<String> commands = new JavaProcessCommandBuilder(project, "vespaSchemaLanguageServer")
.setJar(serverPath)
.create();
super.setCommands(commands);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ai.vespa.schemals.intellij;

import com.intellij.openapi.project.Project;
import com.redhat.devtools.lsp4ij.LanguageServerFactory;
import com.redhat.devtools.lsp4ij.client.LanguageClientImpl;
import com.redhat.devtools.lsp4ij.server.StreamConnectionProvider;
import org.jetbrains.annotations.NotNull;

public class SchemaLanguageServerFactory implements LanguageServerFactory {
@Override
public @NotNull StreamConnectionProvider createConnectionProvider(@NotNull Project project) {
return new SchemaLanguageServer4IJ(project);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8a993f6

Please sign in to comment.