summaryrefslogtreecommitdiff
path: root/cli/bench/lsp.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-10-25 04:13:16 +0100
committerGitHub <noreply@github.com>2023-10-25 03:13:16 +0000
commit6c60859407a39e579a9f7101b254c874af85ca68 (patch)
tree39c3c3a7ae1c94fc463c6340ca12fb773b6a87d0 /cli/bench/lsp.rs
parentbc53b588d0c0f42da15408968421a10f4c04df25 (diff)
build: fix lsp benchmark (#20969)
Diffstat (limited to 'cli/bench/lsp.rs')
-rw-r--r--cli/bench/lsp.rs47
1 files changed, 11 insertions, 36 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();