diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests_lsp.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/cli/tests/integration_tests_lsp.rs b/cli/tests/integration_tests_lsp.rs index 999d2de71..e4b963f2b 100644 --- a/cli/tests/integration_tests_lsp.rs +++ b/cli/tests/integration_tests_lsp.rs @@ -1840,6 +1840,53 @@ fn lsp_completions_registry_empty() { } #[test] +fn lsp_auto_discover_registry() { + let _g = http_server(); + let mut client = init("initialize_params.json"); + did_open( + &mut client, + json!({ + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "import * as a from \"http://localhost:4545/x/a@\"" + } + }), + ); + let (maybe_res, maybe_err) = client + .write_request::<_, _, Value>( + "textDocument/completion", + json!({ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "line": 0, + "character": 46 + }, + "context": { + "triggerKind": 2, + "triggerCharacter": "@" + } + }), + ) + .unwrap(); + assert!(maybe_err.is_none()); + assert!(maybe_res.is_some()); + let (method, maybe_res) = client.read_notification().unwrap(); + assert_eq!(method, "deno/registryState"); + assert_eq!( + maybe_res, + Some(json!({ + "origin": "http://localhost:4545", + "suggestions": true, + })) + ); + shutdown(&mut client); +} + +#[test] fn lsp_diagnostics_warn() { let _g = http_server(); let mut client = init("initialize_params.json"); |