Skip to content

Commit

Permalink
chore(lsp): bump tower-lsp to 0.20.0 (denoland#20693)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored Sep 26, 2023
1 parent dcb00bb commit cb154d6
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 156 deletions.
32 changes: 10 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ indexmap1 = { package = "indexmap", version = "1", features = ["serde"] }
indexmap = { version = "2", features = ["serde"] }
libc = "0.2.126"
log = "=0.4.20"
lsp-types = "=0.93.2" # used by tower-lsp and "proposed" feature is unstable in patch releases
lsp-types = "=0.94.1" # used by tower-lsp and "proposed" feature is unstable in patch releases
memmem = "0.1.1"
monch = "=0.4.3"
notify = "=5.0.0"
Expand Down Expand Up @@ -147,7 +147,7 @@ tokio = { version = "1.28.1", features = ["full"] }
tokio-metrics = { version = "0.3.0", features = ["rt"] }
tokio-rustls = "0.24.0"
tokio-util = "0.7.4"
tower-lsp = { version = "=0.17.0", features = ["proposed"] }
tower-lsp = { version = "=0.20.0", features = ["proposed"] }
url = { version = "2.3.1", features = ["serde", "expose_internals"] }
uuid = { version = "1.3.0", features = ["v4"] }
zstd = "=0.12.4"
Expand Down
3 changes: 3 additions & 0 deletions cli/lsp/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,8 @@ pub fn server_capabilities(
})),
inlay_hint_provider: Some(OneOf::Left(true)),
position_encoding: None,
// TODO(nayeemrmn): Support pull-based diagnostics.
diagnostic_provider: None,
inline_value_provider: None,
}
}
18 changes: 10 additions & 8 deletions cli/lsp/language_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,6 @@ impl LanguageServer {
}
}

pub async fn inlay_hint(
&self,
params: InlayHintParams,
) -> LspResult<Option<Vec<InlayHint>>> {
self.0.read().await.inlay_hint(params).await
}

pub async fn virtual_text_document(
&self,
params: Option<Value>,
Expand Down Expand Up @@ -3156,7 +3149,9 @@ impl tower_lsp::LanguageServer for LanguageServer {
// are interested in.
let options = DidChangeWatchedFilesRegistrationOptions {
watchers: vec![FileSystemWatcher {
glob_pattern: "**/*.{json,jsonc,lock}".to_string(),
glob_pattern: GlobPattern::String(
"**/*.{json,jsonc,lock}".to_string(),
),
kind: None,
}],
};
Expand Down Expand Up @@ -3417,6 +3412,13 @@ impl tower_lsp::LanguageServer for LanguageServer {
self.0.read().await.hover(params).await
}

async fn inlay_hint(
&self,
params: InlayHintParams,
) -> LspResult<Option<Vec<InlayHint>>> {
self.0.read().await.inlay_hint(params).await
}

async fn code_action(
&self,
params: CodeActionParams,
Expand Down
3 changes: 0 additions & 3 deletions cli/lsp/lsp_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ pub const VIRTUAL_TEXT_DOCUMENT: &str = "deno/virtualTextDocument";
pub const LATEST_DIAGNOSTIC_BATCH_INDEX: &str =
"deno/internalLatestDiagnosticBatchIndex";

// While lsp_types supports inlay hints currently, tower_lsp does not.
pub const INLAY_HINT: &str = "textDocument/inlayHint";

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CacheParams {
Expand Down
5 changes: 3 additions & 2 deletions cli/lsp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub async fn start() -> Result<(), AnyError> {
let builder = LspService::build(|client| {
language_server::LanguageServer::new(client::Client::from_tower(client))
})
// TODO(nayeemrmn): The extension has replaced this with the `deno.cache`
// command as of vscode_deno 3.21.0 / 2023.09.05. Remove this eventually.
.custom_method(lsp_custom::CACHE_REQUEST, LanguageServer::cache_request)
.custom_method(
lsp_custom::PERFORMANCE_REQUEST,
Expand All @@ -60,8 +62,7 @@ pub async fn start() -> Result<(), AnyError> {
.custom_method(
lsp_custom::VIRTUAL_TEXT_DOCUMENT,
LanguageServer::virtual_text_document,
)
.custom_method(lsp_custom::INLAY_HINT, LanguageServer::inlay_hint);
);

let builder = if should_send_diagnostic_batch_index_notifications() {
builder.custom_method(
Expand Down
1 change: 1 addition & 0 deletions cli/lsp/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2993,6 +2993,7 @@ impl OutliningSpan {
Some(range.end.character)
},
kind: self.get_folding_range_kind(&self.kind),
collapsed_text: None,
}
}

Expand Down
Loading

0 comments on commit cb154d6

Please sign in to comment.