chore(lsp): rename client-side command invocations (#22140)

This commit is contained in:
Nayeem Rahman 2024-01-28 21:56:45 +00:00 committed by GitHub
parent 7281775381
commit aed5e4997d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 62 deletions

View file

@ -39,7 +39,6 @@ fn code_action_capabilities(
pub fn server_capabilities(
client_capabilities: &ClientCapabilities,
enable_builtin_commands: bool,
) -> ServerCapabilities {
let code_action_provider = code_action_capabilities(client_capabilities);
ServerCapabilities {
@ -120,14 +119,10 @@ pub fn server_capabilities(
document_link_provider: None,
color_provider: None,
execute_command_provider: Some(ExecuteCommandOptions {
commands: if enable_builtin_commands {
vec![
"deno.cache".to_string(),
"deno.reloadImportRegistries".to_string(),
]
} else {
vec![]
},
commands: vec![
"deno.cache".to_string(),
"deno.reloadImportRegistries".to_string(),
],
..Default::default()
}),
call_hierarchy_provider: Some(CallHierarchyServerCapability::Simple(true)),

View file

@ -86,7 +86,7 @@ impl DenoTestCollector {
range,
command: Some(lsp::Command {
title: title.to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!(self.specifier),
json!(name.as_ref()),
@ -282,7 +282,7 @@ async fn resolve_implementation_code_lens(
};
lsp::Command {
title,
command: "deno.showReferences".to_string(),
command: "deno.client.showReferences".to_string(),
arguments: Some(vec![
json!(data.specifier),
json!(code_lens.range.start),
@ -373,7 +373,7 @@ async fn resolve_references_code_lens(
} else {
lsp::Command {
title,
command: "deno.showReferences".to_string(),
command: "deno.client.showReferences".to_string(),
arguments: Some(vec![
json!(data.specifier),
json!(code_lens.range.start),
@ -587,7 +587,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "\u{fe0e} Run Test".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test a"),
@ -611,7 +611,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "Debug".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test a"),
@ -635,7 +635,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "\u{fe0e} Run Test".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("useFnName"),
@ -659,7 +659,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "Debug".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("useFnName"),
@ -683,7 +683,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "\u{fe0e} Run Test".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test b"),
@ -707,7 +707,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "Debug".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test b"),
@ -731,7 +731,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "\u{fe0e} Run Test".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test ignore"),
@ -755,7 +755,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "Debug".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test ignore"),
@ -779,7 +779,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "\u{fe0e} Run Test".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test only"),
@ -803,7 +803,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "Debug".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test only"),
@ -827,7 +827,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "\u{fe0e} Run Test".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test template literal name"),
@ -851,7 +851,7 @@ mod tests {
},
command: Some(lsp::Command {
title: "Debug".to_string(),
command: "deno.test".to_string(),
command: "deno.client.test".to_string(),
arguments: Some(vec![
json!("https://deno.land/x/mod.ts"),
json!("test template literal name"),

View file

@ -1216,24 +1216,7 @@ impl Inner {
parent_process_checker::start(parent_pid)
}
// TODO(nayeemrmn): This flag exists to avoid breaking the extension for the
// 1.37.0 release. Eventually make this always true.
// See https://github.com/denoland/deno/pull/20111#issuecomment-1705776794.
let mut enable_builtin_commands = false;
if let Some(value) = &params.initialization_options {
if let Some(object) = value.as_object() {
if let Some(value) = object.get("enableBuiltinCommands") {
if value.as_bool() == Some(true) {
enable_builtin_commands = true;
}
}
}
}
let capabilities = capabilities::server_capabilities(
&params.capabilities,
enable_builtin_commands,
);
let capabilities = capabilities::server_capabilities(&params.capabilities);
let version = format!(
"{} ({}, {})",

View file

@ -3295,7 +3295,7 @@ fn lsp_code_lens() {
},
"command": {
"title": "1 reference",
"command": "deno.showReferences",
"command": "deno.client.showReferences",
"arguments": [
"file:///a/file.ts",
{ "line": 0, "character": 6 },
@ -3362,7 +3362,7 @@ fn lsp_code_lens() {
},
"command": {
"title": "2 references",
"command": "deno.showReferences",
"command": "deno.client.showReferences",
"arguments": [
"file:///a/file.ts",
{ "line": 15, "character": 6 },
@ -3490,7 +3490,7 @@ fn lsp_code_lens_impl() {
},
"command": {
"title": "1 implementation",
"command": "deno.showReferences",
"command": "deno.client.showReferences",
"arguments": [
"file:///a/file.ts",
{ "line": 0, "character": 10 },
@ -3568,7 +3568,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test a",
@ -3582,7 +3582,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test a",
@ -3596,7 +3596,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test b",
@ -3610,7 +3610,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test b",
@ -3624,7 +3624,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test c",
@ -3638,7 +3638,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test c",
@ -3652,7 +3652,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test d",
@ -3666,7 +3666,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test d",
@ -3680,7 +3680,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test e",
@ -3694,7 +3694,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test e",
@ -3708,7 +3708,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test f",
@ -3722,7 +3722,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test f",
@ -3736,7 +3736,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test g",
@ -3750,7 +3750,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test g",
@ -3764,7 +3764,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "▶︎ Run Test",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test h",
@ -3778,7 +3778,7 @@ fn lsp_code_lens_test() {
},
"command": {
"title": "Debug",
"command": "deno.test",
"command": "deno.client.test",
"arguments": [
"file:///a/file.ts",
"test h",

View file

@ -668,7 +668,6 @@ impl LspClient {
self.initialize_with_config(
do_build,
json!({ "deno": {
"enableBuiltinCommands": true,
"enable": true,
"cache": null,
"certificateStores": null,