Repository navigation
docs: Getting started documentation - #33
Conversation
cb11dff to
4b53999
Compare
0cf9ae8 to
63bafcb
Compare
1777a46 to
4b04b53
Compare
3ff3148 to
91cb6e4
Compare
1b91f64 to
92bc62b
Compare
3b64430 to
3e50b1d
Compare
3e50b1d to
5c5968b
Compare
45fab1b to
98385ef
Compare
Fixes redhat-developer#24 Signed-off-by: azerr <[email protected]>
98385ef to
3d10917
Compare
fbricon
left a comment
There was a problem hiding this comment.
Still need to check LSPSupport.md
|
|
||
| ### Exclude all LSP4J dependencies | ||
|
|
||
| LSP4IJ depends on [Eclipse LSP4J](https://github.com/eclipse-lsp4j/lsp4j) (Java binding for the [Language Server Protocol](https://microsoft.github.io/language-server-protocol) and the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol).). It uses a given version of LSPJ and their classes are loaded in the LSP4IJ plugin class loader. |
There was a problem hiding this comment.
It provides its own version of LSP4J and its classes are loaded in the LSP4IJ plugin class loader.
|
|
||
| LSP4IJ depends on [Eclipse LSP4J](https://github.com/eclipse-lsp4j/lsp4j) (Java binding for the [Language Server Protocol](https://microsoft.github.io/language-server-protocol) and the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol).). It uses a given version of LSPJ and their classes are loaded in the LSP4IJ plugin class loader. | ||
|
|
||
| Your IntelliJ Plugin should use `the same LSP4J classes than LSP4IJ` to avoid some `ClassCastException` errors. To do that you need to `exclude all LSP4J dependencies` from your plugin. |
There was a problem hiding this comment.
Your IntelliJ Plugin must not embed its own version of LSP4J, in order to avoid conflicts with the version provided by LSP4IJ. Failing to do see will result in ClassCastException errors to be thrown. Make sure that the LSP4J dependency in your plugin is either declared with a "runtimeOnly" scope or excluded entirely if it's included as a transitive dependency.
|
|
||
| Your IntelliJ Plugin should use `the same LSP4J classes than LSP4IJ` to avoid some `ClassCastException` errors. To do that you need to `exclude all LSP4J dependencies` from your plugin. | ||
|
|
||
| Here a sample used in [Quarkus Tools](https://github.com/redhat-developer/intellij-quarkus) in [build.gradle.kts](https://github.com/redhat-developer/intellij-quarkus/blob/main/build.gradle.kts) to exclude LSP4J dependency from the [Qute Language Server](https://github.com/redhat-developer/quarkus-ls/tree/master/qute.ls) which have a dependency to LSP4J: |
There was a problem hiding this comment.
to exclude the LSP4J dependency from the Qute Language Server.
| ## LanguageServerFactory | ||
|
|
||
| Create an implementation of [LanguageServerFactory](https://github.com/redhat-developer/lsp4ij/blob/main/src/main/java/com/redhat/devtools/lsp4ij/LanguageServerFactory.java) to use your `my.language.server.MyLanguageServer`, `my.language.server.MyLanguageClient` and defines a custom LanguageServer API if you need: | ||
|
|
||
| ```java | ||
| package my.language.server; | ||
|
|
||
| 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 MyLanguageServerFactory implements LanguageServerFactory { | ||
|
|
||
| @Override | ||
| public @NotNull StreamConnectionProvider createConnectionProvider(@NotNull Project project) { | ||
| return new MyLanguageServer(project); | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull LanguageClientImpl createLanguageClient(@NotNull Project project) { | ||
| return new MyLanguageClient(project); | ||
| } | ||
| } | ||
| ``` |
|
|
||
| ## Add specific IJ features | ||
|
|
||
| When it is possible, LSP4IJ declare the IJ feature with `any` language. |
There was a problem hiding this comment.
LSP4IJ binds IJ features to any language.
| <codeInsight.inlayProvider | ||
| language="MyLanguage" | ||
| implementationClass="com.redhat.devtools.lsp4ij.operations.codelens.LSPCodelensInlayProvider"/> | ||
| ``` | ||
|
|
||
| * `textDocument/inlayHint`: | ||
|
|
||
| ```xml | ||
| <codeInsight.inlayProvider | ||
| language="MyLanguage" | ||
| implementationClass="com.redhat.devtools.lsp4ij.operations.codelens.LSPInlayHintInlayProvider"/> | ||
| ``` No newline at end of file |
There was a problem hiding this comment.
this should not be necessary anymore right?
|
|
||
|  | ||
|
|
||
| When language server is started, several action like stopping the language server or copy the command which starts the language servers are available: |
224d685 to
8a37c68
Compare
Signed-off-by: Fred Bricon <[email protected]>
2f2b43c to
ab5e0f2
Compare
Signed-off-by: Fred Bricon <[email protected]>
ab5e0f2 to
5018db4
Compare
|
Thanks so much @fbricon for your great review! |
docs: Getting started documentation
Fixes #24