From acba2cd48c3b8725c93513edc291a107bdc7eeaf Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 20 Aug 2024 19:38:47 +0100 Subject: fix(lsp): include scoped import map keys in completions (#25047) --- tests/integration/lsp_tests.rs | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'tests/integration') diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 3d20efbba..cacd05d9f 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -1346,23 +1346,27 @@ fn lsp_import_map_import_completions() { let context = TestContextBuilder::new().use_temp_cwd().build(); let temp_dir = context.temp_dir(); temp_dir.write( - "import-map.json", - r#"{ - "imports": { - "/~/": "./lib/", - "/#/": "./src/", - "fs": "https://example.com/fs/index.js", - "std/": "https://example.com/std@0.123.0/" - } -}"#, + "deno.json", + json!({ + "imports": { + "/~/": "./lib/", + "/#/": "./src/", + "fs": "https://example.com/fs/index.js", + "std/": "https://example.com/std@0.123.0/", + }, + "scopes": { + "file:///": { + "file": "./file.ts", + }, + }, + }) + .to_string(), ); temp_dir.create_dir_all("lib"); temp_dir.write("lib/b.ts", r#"export const b = "b";"#); let mut client = context.new_lsp_command().build(); - client.initialize(|builder| { - builder.set_import_map("import-map.json"); - }); + client.initialize_default(); let uri = temp_dir.uri().join("a.ts").unwrap(); @@ -1403,6 +1407,13 @@ fn lsp_import_map_import_completions() { "insertText": "..", "commitCharacters": ["\"", "'"], }, { + "label": "file", + "kind": 17, + "detail": "(import map)", + "sortText": "file", + "insertText": "file", + "commitCharacters": ["\"", "'"], + }, { "label": "std", "kind": 19, "detail": "(import map)", -- cgit v1.2.3