LSP-jdtls
Convenience package for the Eclipse JDT language server
Installations minus removals
Upgrades
- 6,885 installs
- 41 stars
Links
Versions
4.0.0
(ST4070+)
·
LSP-jdtls
This is a helper package that manages and downloads the Eclipse JDT language server for you.
To use this package, you must have:
- The LSP package.
- A Java SDK (>= 25).
- The language server is started with the JDK in the
java.jdt.ls.java.homesetting, under"settings"in the plugin settings. If it isn't set, the JDK in theJAVA_HOMEenvironment variable is used, and otherwisejavafrom thePATH. - It's recommended to install LSP-file-watcher-rust. Without a file watcher, jdtls isn't notified about files changed outside of Sublime Text, for example build files updated by
git pullor jars added tolib/(seejava.project.referencedLibraries).
Configuration
Configure jdtls by running Preferences: LSP-jdtls Settings from the command palette.
Capabilities
jdtls can do a lot of cool things, like
- code completion
- signature help
- hover info
- code actions
- formatting
- find references
- goto def
Commands
| Sublime Command | Description | Command Palette | Note |
|---|---|---|---|
| lsp_jdtls_build_workspace | Builds the project | LSP-jdtls: Build Workspace | |
| lsp_jdtls_refresh_workspace | Refreshes all files | LSP-jdtls: Refresh Workspace | |
| lsp_jdtls_generate_tests | Generate a test method in the associated test class | LSP-jdtls: Generate tests... | |
| lsp_jdtls_goto_test | Jump to test and implementation | LSP-jdtls: Goto Test / LSP-jdtls: Goto Implementation | |
| lsp_jdtls_run_test_class | Runs the test class in the active view | LSP-jdtls: Run Test Class | (experimental) Requires Debugger |
| lsp_jdtls_run_test_at_cursor | Runs the test at the first cursor | LSP-jdtls: Run Test At Cursor | (experimental) Requires Debugger |
| lsp_jdtls_run_test | Opens a panel to run a test in the active view | LSP-jdtls: Run Test... | (experimental) Requires Debugger |
| jdtls_clear_data | Clears the server data of the current workspace | LSP-jdtls: Clear data |
Troubleshoot
Server exits with code 13
The server caches workspace specific information in a data directory that is separate for each workspace (Sublime project or set of open folders). When this data is corrupted the server crashes with exit code 13 and the server is disabled for the current project.
Run the command LSP-jdtls: Clear data from the command palette and re-enable the server using the command LSP: Enable Language Server in Project.
Running tests fails with "LSP-jdtls must be installed via package control"
The Java adapter of Debugger only starts when both LSP and LSP-jdtls are installed via Package Control. If you installed either of them manually (e.g. cloned or symlinked into the Packages folder), list it in installed_packages in the Debugger settings (Preferences: Debugger Settings from the command palette):
{
"installed_packages": ["LSP", "LSP-jdtls"],
}
Licenses
- The Java Debug Plugin is licensed under Eclipse Public License 1.0.
- The Test Runner for Java is licensed under MIT License
- The Decompiler for Java™ in Visual Studio Code is licensed under Eclipse Public License 2.0