diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-11 17:17:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 17:17:14 -0400 |
commit | 28a72d548801f81a96ff4bba750d8dc51a2b1567 (patch) | |
tree | 0a689e1256d6e20f071156f5c8d0f52758a58d2d /cli/tests/integration/lsp_tests.rs | |
parent | c926bc0debd0df3bf62d5125a490f8675e70c6ef (diff) |
feat(lsp): ability to configure document pre-load limit (#19097)
Adds a `deno.preloadLimit` option (ex. `"deno.preloadLimit": 2000`)
which specifies how many file entries to traverse on the file system
when the lsp loads or its configuration changes.
Closes #18955
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r-- | cli/tests/integration/lsp_tests.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index aa69b0daf..500a27ed2 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -7419,6 +7419,49 @@ fn lsp_closed_file_find_references() { } #[test] +fn lsp_closed_file_find_references_low_document_pre_load() { + let context = TestContextBuilder::new().use_temp_cwd().build(); + let temp_dir = context.temp_dir(); + temp_dir.create_dir_all("sub_dir"); + temp_dir.write("./other_file.ts", "export const b = 5;"); + temp_dir.write("./sub_dir/mod.ts", "export const a = 5;"); + temp_dir.write( + "./sub_dir/mod.test.ts", + "import { a } from './mod.ts'; console.log(a);", + ); + let temp_dir_url = temp_dir.uri(); + let mut client = context.new_lsp_command().build(); + client.initialize(|builder| { + builder.set_preload_limit(1); + }); + client.did_open(json!({ + "textDocument": { + "uri": temp_dir_url.join("sub_dir/mod.ts").unwrap(), + "languageId": "typescript", + "version": 1, + "text": r#"export const a = 5;"# + } + })); + let res = client.write_request( + "textDocument/references", + json!({ + "textDocument": { + "uri": temp_dir_url.join("sub_dir/mod.ts").unwrap(), + }, + "position": { "line": 0, "character": 13 }, + "context": { + "includeDeclaration": false + } + }), + ); + + // won't have results because the document won't be pre-loaded + assert_eq!(res, json!([])); + + client.shutdown(); +} + +#[test] fn lsp_data_urls_with_jsx_compiler_option() { let context = TestContextBuilder::new().use_temp_cwd().build(); let temp_dir = context.temp_dir(); |