Allow extensions to define more of the methods in the LspAdapter trait (#9554)
Our goal is to extract Svelte support into an extension, since we've seen problems with the Tree-sitter Svelte parser crashing due to bugs in the external scanner. In order to do this, we need a couple more capabilities in LSP extensions: * [x] `initialization_options` - programmatically controlling the JSON initialization params sent to the language server * [x] `prettier_plugins` - statically specifying a list of prettier plugins that apply for a given language. * [x] `npm_install_package` Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
0ce5cdc48f
commit
d699b8e104
26 changed files with 318 additions and 208 deletions
|
@ -92,8 +92,11 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
get_cached_server_binary(container_dir, &*self.node).await
|
||||
}
|
||||
|
||||
fn initialization_options(&self) -> Option<serde_json::Value> {
|
||||
Some(json!({
|
||||
async fn initialization_options(
|
||||
self: Arc<Self>,
|
||||
_: &Arc<dyn LspAdapterDelegate>,
|
||||
) -> Result<Option<serde_json::Value>> {
|
||||
Ok(Some(json!({
|
||||
"provideFormatter": true,
|
||||
"userLanguages": {
|
||||
"html": "html",
|
||||
|
@ -101,7 +104,7 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
"javascript": "javascript",
|
||||
"typescriptreact": "typescriptreact",
|
||||
},
|
||||
}))
|
||||
})))
|
||||
}
|
||||
|
||||
fn workspace_configuration(&self, _workspace_root: &Path, _: &mut AppContext) -> Value {
|
||||
|
@ -126,10 +129,6 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
("PHP".to_string(), "php".to_string()),
|
||||
])
|
||||
}
|
||||
|
||||
fn prettier_plugins(&self) -> &[&'static str] {
|
||||
&["prettier-plugin-tailwindcss"]
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_cached_server_binary(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue