Skip to content

docs: Getting started documentation - #33

Merged
angelozerr merged 3 commits into
redhat-developer:mainfrom
angelozerr:getting_started
Dec 15, 2023
Merged

angelozerr merged 3 commits into
redhat-developer:mainfrom
angelozerr:getting_started

Conversation

@angelozerr

@angelozerr angelozerr commented Dec 7, 2023 •

Copy link
Copy Markdown
Contributor

docs: Getting started documentation

Fixes #24

@angelozerr angelozerr added the documentation Improvements or additions to documentation label Dec 7, 2023
@angelozerr angelozerr self-assigned this Dec 7, 2023
@angelozerr angelozerr added this to the 0.0.1 milestone Dec 7, 2023
@angelozerr
angelozerr force-pushed the getting_started branch 6 times, most recently from 0cf9ae8 to 63bafcb Compare December 9, 2023 16:45
@angelozerr angelozerr changed the title doc: Getting started documentation docs: Getting started documentation Dec 9, 2023
@angelozerr
angelozerr force-pushed the getting_started branch 6 times, most recently from 1777a46 to 4b04b53 Compare December 11, 2023 09:40
@angelozerr
angelozerr marked this pull request as ready for review December 11, 2023 09:41
@angelozerr
angelozerr requested a review from fbricon December 11, 2023 09:41
@angelozerr
angelozerr force-pushed the getting_started branch 2 times, most recently from 3ff3148 to 91cb6e4 Compare December 11, 2023 14:06
@angelozerr
angelozerr marked this pull request as draft December 11, 2023 14:16
@angelozerr
angelozerr force-pushed the getting_started branch 5 times, most recently from 1b91f64 to 92bc62b Compare December 11, 2023 16:58
@angelozerr
angelozerr force-pushed the getting_started branch 2 times, most recently from 3b64430 to 3e50b1d Compare December 11, 2023 17:15
@angelozerr
angelozerr marked this pull request as ready for review December 11, 2023 17:15
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/DeveloperGuide.md Resolved
Comment thread docs/LSPSupport.md Resolved
@angelozerr
angelozerr force-pushed the getting_started branch 8 times, most recently from 45fab1b to 98385ef Compare December 14, 2023 13:29

@fbricon fbricon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to check LSPSupport.md

Comment thread docs/DeveloperGuide.md Outdated

### 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It provides its own version of LSP4J and its classes are loaded in the LSP4IJ plugin class loader.

Comment thread docs/DeveloperGuide.md Outdated

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/DeveloperGuide.md Outdated

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to exclude the LSP4J dependency from the Qute Language Server.

Comment thread docs/DeveloperGuide.md Outdated
Comment on lines +119 to +144
## 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);
}
}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move below L37

Comment thread docs/DeveloperGuide.md Outdated

## Add specific IJ features

When it is possible, LSP4IJ declare the IJ feature with `any` language.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LSP4IJ binds IJ features to any language.

Comment thread docs/DeveloperGuide.md Outdated
Comment on lines +258 to +269
<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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be necessary anymore right?

Comment thread docs/UserGuide.md Outdated

![LSP console](./images/LSPConsole.png)

When language server is started, several action like stopping the language server or copy the command which starts the language servers are available:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

several actions

@fbricon
fbricon force-pushed the getting_started branch 2 times, most recently from 2f2b43c to ab5e0f2 Compare December 15, 2023 16:45
@angelozerr
angelozerr merged commit c114384 into redhat-developer:main Dec 15, 2023
@angelozerr

Copy link
Copy Markdown
Contributor Author

Thanks so much @fbricon for your great review!

@angelozerr angelozerr mentioned this pull request May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getting started documentation

2 participants