Register ESLint as an available language server (#11178)

This PR adds the ability for the ESLint language server (`eslint`) to be
controlled by the `language_servers` setting.

Now in your settings you can indicate that the ESLint language server
should be used for a given language, even if that language does not have
the ESLint language server registered for it already:

```json
{
  "languages": {
    "My Language": {
      "language_servers": ["eslint", "..."]
    }
  }
}
```

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-04-29 13:18:30 -04:00 committed by GitHub
parent ec95605fec
commit 9ff847753e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -165,10 +165,10 @@ pub fn init(
); );
language!("proto"); language!("proto");
// Register Tailwind globally as an available language server. // Register globally available language servers.
// //
// This will allow users to add Tailwind support for a given language via // This will allow users to add support for a built-in language server (e.g., Tailwind)
// the `language_servers` setting: // for a given language via the `language_servers` setting:
// //
// ```json // ```json
// { // {
@ -186,6 +186,10 @@ pub fn init(
move || Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())) move || Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone()))
}, },
); );
languages.register_available_lsp_adapter(LanguageServerName("eslint".into()), {
let node_runtime = node_runtime.clone();
move || Arc::new(typescript::EsLintLspAdapter::new(node_runtime.clone()))
});
// Register Tailwind for the existing languages that should have it by default. // Register Tailwind for the existing languages that should have it by default.
// //