summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-06-01 21:53:08 +1000
committerGitHub <noreply@github.com>2021-06-01 21:53:08 +1000
commitbb5bf91067e28cef869f5180dc73a9b86e368bdc (patch)
treeb32cf8ec12073f58bb0f5aa2672047485a582843 /cli/tests
parent9abb899f5fd36da65aae78351df3f478f8363700 (diff)
feat(lsp): registry auto discovery (#10813)
Closes: #10194 Fixes: #10468
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests_lsp.rs47
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");