Sublime Text package for Metals, a language server for Scala
- Total 784
- Win 185
- Mac 402
- Linux 197
|Jan 22||Jan 21||Jan 20||Jan 19||Jan 18||Jan 17||Jan 16||Jan 15||Jan 14||Jan 13||Jan 12||Jan 11||Jan 10||Jan 9||Jan 8||Jan 7||Jan 6||Jan 5||Jan 4||Jan 3||Jan 2||Jan 1||Dec 31||Dec 30||Dec 29||Dec 28||Dec 27||Dec 26||Dec 25||Dec 24||Dec 23||Dec 22||Dec 21||Dec 20||Dec 19||Dec 18||Dec 17||Dec 16||Dec 15||Dec 14||Dec 13||Dec 12||Dec 11||Dec 10||Dec 9||Dec 8|
LSP-metals is the recommended Sublime LSP extension for Metals, the Scala language server.
LSP-metals offers automated Metals installation, easy configuration, Metals-specific commands and many other small features.
Table of Contents
- Installing LSP-metals
- Importing a build
- Workplace Diagnostic
- Run doctor
- All Available Commands
- Show document symbols
- Formatting on save
- Status Bar
- Sublime text 3 or above
- LSP package:
Command Palette (Cmd + Shift + P) > Install package > LSP
- Java 8 or 11 provided by OpenJDK or Oracle. Eclipse OpenJ9 is not supported, please make sure the JAVA_HOME environment variable points to a valid Java 8 or 11 installation.
Once you have
LSP installed, you can then install Metals via
Automatically via package control:
Command Palette (Cmd + Shift + P) > Install package > LSP-metals
git clone https://github.com/scalameta/metals-sublime.git LSP-metalsin your sublime packages directory
Importing a build
The first time you open Metals in a new workspace it prompts you to import the build. Click “Import build” to start the installation step.
- “Not now” disables this prompt for 2 minutes.
- “Don't show again” disables this prompt forever, use rm -rf .metals/ to re-enable the prompt.
lsp toggle server panelin the command palette to watch the build import progress. You can optionally add a key binding for this command.
- Behind the scenes, Metals uses Bloop to import sbt builds, but you don't need Bloop installed on your machine to run this step.
Once the import step completes, compilation starts for your open *.scala files.
Once the sources have compiled successfully, you can navigate the codebase with goto definition.
Speeding up import
The “Import build” step can take a long time, especially the first time you run it in a new build. The exact time depends on the complexity of the build and if library dependencies need to be downloaded. For example, this step can take everything from 10 seconds in small cached builds up to 10-15 minutes in large uncached builds.
Consult the Bloop documentation to learn how to speed up build import.
When you change build.sbt or sources under project/, you will be prompted to re-import the build.
You can edit the package settings by running
LSP-metals Settings in the sublime palette or accessing
Preferences > Package Settings > LSP > Servers > LSP-metals.
JAVA_HOME is detected you can then open Settings by following the
instructions in the displayed error message.
To use the latest Metals SNAPSHOT update the
server_version setting to try out the latest pending Metals features.
After updating the version, you need to restart sublime.
To see all compilation errors and warnings in the workspace, run the following command
Toggle Diagnostics Panel Or use the default mapping
To cycle through the diagnostic use the default mapping Next
F4 / Previous
To troubleshoot problems with your build workspace, run
Doctor run in the command pallet. This command opens a browser window.
All Available Commands
The following commands can be invoked simply via the sublime command palette.
- Build Import
- Build Connect
- compile Cascade
- Compile Cancel
- Doctor Run
- New Scala File: Also available in the side bar context menu.
Show document symbols
Document Symbols command to show a symbol outline for the current file. You can also set a key binding for the
Formatting on save
If you'd like to have
LSP-metals format your file on document save then make sure to add this setting to your Sublime settings, Syntax-specific settings and/or in Project files.
"lsp_format_on_save": true, ...
Information about your workspace build like compilation errors count, build status, etc. are displayed by Metals in the sublime status bar.
If you have any questions or issues with LSP-metals, please submit an issue in this repository if it is related to the extension.
If the issue is general to Metals, please submit it in the Metals issue repo.
If you have any feature requests, we also have a feature request issue repo.