Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lsp4e-dev] LSP diagnostics don't seem to be supported when integrating with Eclipse

Dear everyone,

I'm working on an Eclipse plugin for our language server (at https://github.com/codiga/vscode-plugin/tree/main/server/src), and I so far managed to put together an implementation based on these articles:

Our language server is implemented in TypeScript with the vscode-language-server-node package, so I'm executing a Node process from the Eclipse plugin. I see that the Node process starts properly, but when I inspect the client capabilities in the connection's InitializeParams, I see that both the textDocument/publishDiagnostics and the pull diagnostic related capabilities are false, meaning they are not supported by the client application (Eclipse).

I find this odd considering that there are other language server integrations for Eclipse that work with diagnostics. I'm completely new to Eclipse plugin development, so, I don't know if I'm missing something, or misconfigured something.

The client application name and version I get from InitializeParams is Eclipse IDE/0.15.0.202211292024.

I included my implementation below, and I appreaciate any help.

ProcessStreamConnectionProvider implementation:
package io.codiga.rosiels;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider;

public class RosieStreamConnectionProvider extends ProcessStreamConnectionProvider {
  public RosieStreamConnectionProvider() {
    try {
      String nodeJsLocation = System.getenv("NODE_PATH");

      URL serverJsUrl = getClass().getResource("/language-server/out/server.js");
      String serverJsPath = FileLocator.toFileURL(serverJsUrl).getPath();
      String serverjsAbsolutePath = new File(serverJsPath).getAbsolutePath();
      var commands = List.of(nodeJsLocation + "node", serverjsAbsolutePath, "--stdio");
      setCommands(commands);
      setWorkingDirectory(System.getProperty("user.dir"));
    } catch (IOException e) {
    }
  }
}

plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.core.contenttype.contentTypes">
         <content-type
          base-type="org.eclipse.core.runtime.text"
          file-extensions="js,jsx,ts,tsx,py,ipynb"
          id="rosie.language.server"
          name="Rosie Language Server"
          priority="normal">
      </content-type>
   </extension>
   <extension
         point="org.eclipse.ui.editors">
         <editorContentTypeBinding
          contentTypeId="rosie.language.server"
          editorId="org.eclipse.ui.genericeditor.GenericEditor">
         </editorContentTypeBinding>
   </extension>
   <extension
         point="org.eclipse.lsp4e.languageServer">
      <server
            class="io.codiga.rosiels.RosieStreamConnectionProvider"
            id="rosie.language.server"
            label="rosie.language.server">
      </server>
      <contentTypeMapping
            contentType="rosie.language.server"
            id="rosie.language.server">
      </contentTypeMapping>
   </extension>
</plugin>

Cheers,
Tamás Balog

Back to the top