docs: Document language_ids in extension.toml (#33035)

Document `language-servers.*.language_ids` property in extension.toml.

Release Notes:

- N/A

---------

Co-authored-by: Peter Tripp <peter@zed.dev>
This commit is contained in:
Emanuele Stoppa 2025-06-22 08:12:09 +01:00 committed by GitHub
parent 534475d7aa
commit 0579bf73b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -369,7 +369,7 @@ Zed uses the [Language Server Protocol](https://microsoft.github.io/language-ser
An extension may provide any number of language servers. To provide a language server from your extension, add an entry to your `extension.toml` with the name of your language server and the language(s) it applies to:
```toml
[language_servers.my-language]
[language_servers.my-language-server]
name = "My Language LSP"
languages = ["My Language"]
```
@ -393,3 +393,21 @@ impl zed::Extension for MyExtension {
```
You can customize the handling of the language server using several optional methods in the `Extension` trait. For example, you can control how completions are styled using the `label_for_completion` method. For a complete list of methods, see the [API docs for the Zed extension API](https://docs.rs/zed_extension_api).
### Multi-Language Support
If your language server supports additional languages, you can use `language_ids` to map Zed `languages` to the desired [LSP-specific `languageId`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem) identifiers:
```toml
[language-servers.my-language-server]
name = "Whatever LSP"
languages = ["JavaScript", "JSX", "HTML", "CSS"]
[language-servers.my-language-server.language_ids]
"JavaScript" = "javascript"
"JSX" = "javascriptreact"
"TSX" = "typescriptreact"
"HTML" = "html"
"CSS" = "css"
```