← 返回命令列表

Linux command

metals 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Install Metals using Coursier

cs bootstrap org.scalameta:metals_2.13:[version] -o metals -f

Start Metals as an MCP server for a workspace

metals-mcp --workspace [/path/to/project]

Start Metals MCP server on a specific port

metals-mcp --workspace [/path/to/project] --port [8080]

Generate editor config for a specific client

metals-mcp --workspace [/path/to/project] --client [vscode]

说明

Metals is a Scala language server implementing the Language Server Protocol (LSP). It provides IDE features like code completion, navigation, refactoring, and error checking for Scala projects. Metals works with various editors including VS Code, Vim/Neovim, Emacs, and Sublime Text.

参数

--workspace _path_
Path to the Scala project (required for MCP server).
--port _number_
HTTP port to listen on. Auto-assigned by default.
--transport _type_
Transport type: http (default) or stdio.
--client _name_
Client to generate config for (e.g., vscode, cursor).
-v, --version
Print version information.
-h, --help
Print usage message.

FAQ

What is the metals command used for?

Metals is a Scala language server implementing the Language Server Protocol (LSP). It provides IDE features like code completion, navigation, refactoring, and error checking for Scala projects. Metals works with various editors including VS Code, Vim/Neovim, Emacs, and Sublime Text.

How do I run a basic metals example?

Run `cs bootstrap org.scalameta:metals_2.13:[version] -o metals -f` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --workspace _path_ do in metals?

Path to the Scala project (required for MCP server).