diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-05-09 13:18:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 13:18:13 -0400 |
commit | f0e8ec01461519dddcb61f1b91b4455a354e38e6 (patch) | |
tree | 0d67ab33ca2a6b613bd7d378d2da7b4c474f61af /tests | |
parent | 684377c92c88877d97c522bcc4cd6a4175277dfb (diff) |
fix(lsp): completions for using decl identifiers (#23748)
Closes #23688
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/lsp_tests.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 997e89050..d25443623 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -7082,6 +7082,43 @@ fn lsp_npm_completions_auto_import_and_quick_fix_no_import_map() { } #[test] +fn lsp_completions_using_decl() { + let context = TestContextBuilder::new().use_temp_cwd().build(); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); + client.did_open(json!({ + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": r#"function makeResource() { + return { + [Symbol.dispose]() { + }, + }; +} + +using resource = makeResource(); + +res"# + } + })); + + let list = client.get_completion_list( + "file:///a/file.ts", + (9, 3), + json!({ + "triggerKind": 2, + "triggerCharacter": "." + }), + ); + assert!(list.items.iter().any(|i| i.label == "resource")); + assert!(!list.is_incomplete); + + client.shutdown(); +} + +#[test] fn lsp_npm_always_caches() { // npm specifiers should always be cached even when not specified // because they affect the resolution of each other |