Table of Contents
An Intellij IDEA plugin that is intended to turn IntelliJ IDEA into an LSP server and deliver the power of IDEA's language support to LSP clients.
LSP is a protocol that allows decoupling the editor and the language support logic, so you can (theoretically) use any editor supporting LSP client functionality (like Visual Studio Code, Sublime Text, Vim, Emacs, Eclipse, etc.) with any LSP server.
There are a lot of LSP servers with different feature sets for different languages. This one differs from the others in that it doesn't define its own language logic but rather translates LSP requests into IDEA API calls. So it does what your IDEA does, with the languages your IDEA supports, but with your favorite editor. If you are working on a multi-language project you don't need many language-specific LSP servers anymore. Just install IntelliJ IDEA with appropriate set of plugins and turn it into one LSP server for all the languages you need.
IdeaLS is designed to be as much language agnostic as possible. However, for a better user experience some parts are still dependent on language-specific API.
The project was heavily inspired by intellij-lsp-server
- IntelliJ IDEA (Community or Ultimate) or IDEA Platform based IDE 2022.3 or higher
- The project is in a very early stage and really unstable.
- The server is tested with Visual Studio Code only.
- There are conflicts with the Android plugin on startup, so you have to disable it in the IDEA.
- There is A LOT of work yet to be done, please be indulgent.
Name | Method | VSCode Action | |
---|---|---|---|
Workspace Symbols | workspace/symbol |
✔️ | Ctrl + T |
Execute Command | workspace/executeCommand |
❌ | |
Diagnostics | textDocument/publishDiagnostics |
✔️ | N/A |
Completion | textDocument/completion |
✔️ | Ctrl + Space |
Hover | textDocument/hover |
❌ | |
Signature Help | textDocument/signatureHelp |
✔️ | |
Goto Declaration | textDocument/declaration |
❌ | |
Goto Definition | textDocument/definition |
✔️ | Ctrl + Left mouse click |
Goto Type Definition | textDocument/typeDefinition |
✔️ | Right mouse click -> Go to -> Type defintion |
Goto Implementation | textDocument/implementation |
❌ | |
Find References | textDocument/references |
✔️ | Right mouse click -> Go To -> References |
Document Highlights | textDocument/documentHighlight |
✔️ | Left mouse click on symbol |
Document Symbols | textDocument/documentSymbol |
✔️ | Ctrl + O |
Code Action | textDocument/codeAction |
✔️ | Ctrl + . |
Code Lens | textDocument/codeLens |
❌ | |
Document Formatting | textDocument/formatting |
✔️ | Ctrl + Shift + P -> Format Document |
Document Range Formatting | textDocument/rangeFormatting |
✔️ | Select text -> Ctrl + Shift + P -> Format Selection |
Document on Type Formatting | textDocument/onTypeFormatting |
✔️ | N/A |
Rename | textDocument/rename |
✔️ | N/A |
Prepare Call Hierarchy | textDocument/prepareCallHierarchy |
❌ | |
Call Hierarchy Incoming Calls | callHierarchy/incomingCalls |
❌ | |
Call Hierarchy Outgoing Calls | callHierarchy/outgoingCalls |
❌ | |
Prepare Type Hierarchy | textDocument/prepareTypeHierarchy’ |
❌ | |
Type Hierarchy Supertypes | typeHierarchy/supertypes |
❌ | |
Type Hierarchy Subtypes | typeHierarchy/subtypes |
❌ | |
Document Link | textDocument/documentLink |
❌ | |
Folding Range | textDocument/foldingRange |
❌ | |
Selection Range | textDocument/selectionRange |
❌ | |
Semantic Tokens | textDocument/semanticTokens |
❌ | |
Inline Value | textDocument/inlineValue |
❌ | |
Inlay Hint | textDocument/inlayHint |
❌ | |
Monikers | textDocument/moniker |
❌ | |
Document Color | textDocument/documentColor |
❌ | |
Linked Editing Range | textDocument/linkedEditingRange |
❌ |
If you want to use the server plugin in your locally installed Idea:
- Run
:clean :buildPlugin
gradle tasks to create the plugin distribution. - In IDEA, go to
File -> Plugins -> Install plugin from disk...
and select the.zip
file that was output insidebuild/distributions
.
Autoconfiguration of an IDEA project is not implemented yet.
So, before launching IDEA as a language server, you have to start IDEA in normal mode
and configure your project manually (setup SDK, modules, dependencies, install required plugins etc.).
As a result the .idea
directory should be present in the project root.
To run a testing instance of IDEA with the development version of the plugin (as TCP server, port 8989)
execute runIde
gradle task from the project root.
Server can be executed in two modes: STDIO
and TCP
.
In STDIO
mode the client starts the server as a child process,
and they communicate with each other through the standard input/output channels.
In TCP
mode the server must be started before the client, which can communicate with the server through a TCP connection.
Note, that even in TCP mode both the client and the server must run on the same machine as they share the same file system.
If you're going to use IdeaLS in STDIO mode from VS Code, you can skip the rest of this section.
STDIO is the default mode for VS Code IdeaLS client. If you want to use IdeaLS with another LSP client,
configure (or extend) it to start the IDEA using the command line like this:
[<idea executable path>] lsp-server
.
For TCP mode you should run IDEA before the client using command:
[<idea executable path>] lsp-server tcp [<port number>]
where <port number>
is the port to listen, 8989 by default.
When using IDEA as an LSP server it must be configured to be executed in headless mode (no GUI).
You need to add -Djava.awt.headless=true
to a *.vmoptions
file that your IDEA uses.
More information about these files you can read here.
However, if you're going to use our VS Code extension as the client in STDIO (see sections below) mode, you don't have to manually configure IDEA for headless mode. It's done automatically.
IdeaLS VS Code extension project is in client/vscode
folder.
To run a development instance of the extension open that folder in VS Code
and run one of the Run Extension *
launch configurations according to preferred development configuration.
To build and run a standalone extension first refer to the guides:
Once you have a vsix
file, add it to your VS Code instance by Extensions -> Install from VSIX...
.
To configure the VS Code extension:
- Open user settings (ctrl + shift + p => Open User Settings)
- Find extension configurations (Extensions => IdeaLS)
- Select run mode (STDIO or TCP)
-
- Provide a path to the Idea executable (not script) if you selected STDIO on a previous step (etc. C:\Program Files\JetBrains\IDEA\bin\idea64.exe)
- Type TCP port if you selected TCP on a previous step. 8989 is by default
- Restart VS Code to apply the configuration.
Instead of extension configuration environment variables can also be used:
Variable name | Description | Expected values |
---|---|---|
IDEALS_TRANSPORT | Run mode (or transport) | TCP, STDIO |
IDEALS_TCP_PORT | Port for TCP connection | Any available port number. 8989 if not set |
IDEALS_IJ_PATH | Idea executable path | Path to the IDEA binary executable |
IdeaLS is an open-source product. We welcome everyone who wants to make it better. If you want to contribute with us, write @serganch in Telegram.
Sergey Anchipolevsky - @serganch
Project Link: https://github.com/SuduIDE/ideals