diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-10-25 04:13:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 03:13:16 +0000 |
commit | 6c60859407a39e579a9f7101b254c874af85ca68 (patch) | |
tree | 39c3c3a7ae1c94fc463c6340ca12fb773b6a87d0 /cli/bench | |
parent | bc53b588d0c0f42da15408968421a10f4c04df25 (diff) |
build: fix lsp benchmark (#20969)
Diffstat (limited to 'cli/bench')
-rw-r--r-- | cli/bench/lsp.rs | 47 | ||||
-rw-r--r-- | cli/bench/lsp_bench_standalone.rs | 10 |
2 files changed, 12 insertions, 45 deletions
diff --git a/cli/bench/lsp.rs b/cli/bench/lsp.rs index a449c9350..5f3bc50fc 100644 --- a/cli/bench/lsp.rs +++ b/cli/bench/lsp.rs @@ -45,6 +45,7 @@ fn bench_big_file_edits(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + client.change_configuration(json!({ "deno": { "enable": true } })); client.write_notification( "textDocument/didOpen", @@ -58,16 +59,6 @@ fn bench_big_file_edits(deno_exe: &Path) -> Duration { }), ); - let (id, method, _): (u64, String, Option<Value>) = client.read_request(); - assert_eq!(method, "workspace/configuration"); - - client.write_response( - id, - json!({ - "enable": true - }), - ); - let (method, _): (String, Option<Value>) = client.read_notification(); assert_eq!(method, "textDocument/publishDiagnostics"); let (method, _): (String, Option<Value>) = client.read_notification(); @@ -110,6 +101,14 @@ fn bench_code_lens(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + client.change_configuration(json!({ "deno": { + "enable": true, + "codeLens": { + "implementations": true, + "references": true, + "test": true, + }, + } })); client.write_notification( "textDocument/didOpen", @@ -123,16 +122,6 @@ fn bench_code_lens(deno_exe: &Path) -> Duration { }), ); - let (id, method, _): (u64, String, Option<Value>) = client.read_request(); - assert_eq!(method, "workspace/configuration"); - - client.write_response( - id, - json!({ - "enable": true - }), - ); - let (method, _): (String, Option<Value>) = client.read_notification(); assert_eq!(method, "textDocument/publishDiagnostics"); let (method, _): (String, Option<Value>) = client.read_notification(); @@ -163,6 +152,7 @@ fn bench_find_replace(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + client.change_configuration(json!({ "deno": { "enable": true } })); for i in 0..10 { client.write_notification( @@ -178,12 +168,6 @@ fn bench_find_replace(deno_exe: &Path) -> Duration { ); } - for _ in 0..10 { - let (id, method, _) = client.read_request::<Value>(); - assert_eq!(method, "workspace/configuration"); - client.write_response(id, json!({ "enable": true })); - } - for _ in 0..3 { let (method, _): (String, Option<Value>) = client.read_notification(); assert_eq!(method, "textDocument/publishDiagnostics"); @@ -252,6 +236,7 @@ fn bench_startup_shutdown(deno_exe: &Path) -> Duration { .deno_exe(deno_exe) .build(); client.initialize_default(); + client.change_configuration(json!({ "deno": { "enable": true } })); client.write_notification( "textDocument/didOpen", @@ -265,16 +250,6 @@ fn bench_startup_shutdown(deno_exe: &Path) -> Duration { }), ); - let (id, method, _) = client.read_request::<Value>(); - assert_eq!(method, "workspace/configuration"); - - client.write_response( - id, - json!({ - "enable": true - }), - ); - let (method, _): (String, Option<Value>) = client.read_notification(); assert_eq!(method, "textDocument/publishDiagnostics"); let (method, _): (String, Option<Value>) = client.read_notification(); diff --git a/cli/bench/lsp_bench_standalone.rs b/cli/bench/lsp_bench_standalone.rs index b3b1f2d92..bd89a5e31 100644 --- a/cli/bench/lsp_bench_standalone.rs +++ b/cli/bench/lsp_bench_standalone.rs @@ -13,6 +13,7 @@ use test_util::lsp::LspClientBuilder; fn incremental_change_wait(bench: &mut Bencher) { let mut client = LspClientBuilder::new().use_diagnostic_sync(false).build(); client.initialize_default(); + client.change_configuration(json!({ "deno": { "enable": true } })); client.write_notification( "textDocument/didOpen", @@ -26,15 +27,6 @@ fn incremental_change_wait(bench: &mut Bencher) { }), ); - let (id, method, _): (u64, String, Option<Value>) = client.read_request(); - assert_eq!(method, "workspace/configuration"); - client.write_response( - id, - json!({ - "enable": true - }), - ); - let (method, _maybe_diag): (String, Option<Value>) = client.read_notification(); assert_eq!(method, "textDocument/publishDiagnostics"); |