vue: Release 0.0.4 (#13580)

Respect user settings in initialization_options.


Release Notes:

- Fixed Vue extension not picking up user-provided initialization
options.
This commit is contained in:
Piotr Osiewicz 2024-06-27 11:11:22 +02:00 committed by GitHub
parent 6cedfa0ce7
commit e71b642f44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 10 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "zed_vue"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
publish = false
license = "Apache-2.0"

View file

@ -1,7 +1,7 @@
id = "vue"
name = "Vue"
description = "Vue support."
version = "0.0.3"
version = "0.0.4"
schema_version = 1
authors = ["Piotr Osiewicz <piotr@zed.dev>"]
repository = "https://github.com/zed-industries/zed"

View file

@ -1,6 +1,7 @@
use std::{env, fs};
use zed::lsp::{Completion, CompletionKind};
use zed::CodeLabelSpan;
use zed_extension_api::settings::LspSettings;
use zed_extension_api::{self as zed, serde_json, Result};
struct VueExtension {
@ -86,14 +87,22 @@ impl zed::Extension for VueExtension {
fn language_server_initialization_options(
&mut self,
_: &zed::LanguageServerId,
_: &zed::Worktree,
language_server_id: &zed::LanguageServerId,
worktree: &zed::Worktree,
) -> Result<Option<serde_json::Value>> {
Ok(Some(serde_json::json!({
"typescript": {
"tsdk": "node_modules/typescript/lib"
}
})))
let initialization_options =
LspSettings::for_worktree(language_server_id.as_ref(), worktree)
.ok()
.and_then(|lsp_settings| lsp_settings.initialization_options.clone())
.unwrap_or_else(|| {
serde_json::json!({
"typescript": {
"tsdk": "node_modules/typescript/lib"
}
})
});
Ok(Some(serde_json::json!(initialization_options)))
}
fn label_for_completion(