diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-04-09 11:27:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 11:27:27 +1000 |
commit | d9d4a5d73c28741deaa2c93d87672ce117315fbf (patch) | |
tree | 57d08deb2e80796f9e426a4592b47254b112021d /cli/tests | |
parent | 3168fa4ee7782e72b57745483a7b0df5df5ce083 (diff) |
feat(lsp): add registry import auto-complete (#9934)
Diffstat (limited to 'cli/tests')
21 files changed, 243 insertions, 3 deletions
diff --git a/cli/tests/041_info_flag.out b/cli/tests/041_info_flag.out index c384fa892..4376c8156 100644 --- a/cli/tests/041_info_flag.out +++ b/cli/tests/041_info_flag.out @@ -1,3 +1,4 @@ DENO_DIR location: "[WILDCARD]" Remote modules cache: "[WILDCARD]deps" -TypeScript compiler cache: "[WILDCARD]gen" +Emitted modules cache: "[WILDCARD]gen" +Language server registries cache: "[WILDCARD]registries" diff --git a/cli/tests/info_json.out b/cli/tests/info_json.out index 361728a7b..d7be26375 100644 --- a/cli/tests/info_json.out +++ b/cli/tests/info_json.out @@ -1,5 +1,6 @@ { "denoDir": "[WILDCARD]", "modulesCache": "[WILDCARD]deps", - "typescriptCache": "[WILDCARD]gen" + "typescriptCache": "[WILDCARD]gen", + "registryCache": "[WILDCARD]registries" }
\ No newline at end of file diff --git a/cli/tests/lsp/completion_request_registry.json b/cli/tests/lsp/completion_request_registry.json new file mode 100644 index 000000000..2165fbdab --- /dev/null +++ b/cli/tests/lsp/completion_request_registry.json @@ -0,0 +1,18 @@ +{ + "jsonrpc": "2.0", + "id": 2, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "line": 0, + "character": 46 + }, + "context": { + "triggerKind": 2, + "triggerCharacter": "@" + } + } +} diff --git a/cli/tests/lsp/completion_request_registry_02.json b/cli/tests/lsp/completion_request_registry_02.json new file mode 100644 index 000000000..21c3bc475 --- /dev/null +++ b/cli/tests/lsp/completion_request_registry_02.json @@ -0,0 +1,18 @@ +{ + "jsonrpc": "2.0", + "id": 2, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "file:///a/file.ts" + }, + "position": { + "line": 0, + "character": 20 + }, + "context": { + "triggerKind": 2, + "triggerCharacter": "\"" + } + } +} diff --git a/cli/tests/lsp/completion_resolve_request_registry.json b/cli/tests/lsp/completion_resolve_request_registry.json new file mode 100644 index 000000000..bae19d060 --- /dev/null +++ b/cli/tests/lsp/completion_resolve_request_registry.json @@ -0,0 +1,25 @@ +{ + "jsonrpc": "2.0", + "id": 4, + "method": "completionItem/resolve", + "params": { + "label": "v2.0.0", + "kind": 19, + "detail": "(version)", + "sortText": "0000000003", + "filterText": "http://localhost:4545/x/a@v2.0.0", + "textEdit": { + "range": { + "start": { + "line": 0, + "character": 20 + }, + "end": { + "line": 0, + "character": 46 + } + }, + "newText": "http://localhost:4545/x/a@v2.0.0" + } + } +} diff --git a/cli/tests/lsp/did_open_notification_completion_registry.json b/cli/tests/lsp/did_open_notification_completion_registry.json new file mode 100644 index 000000000..cb8ad2592 --- /dev/null +++ b/cli/tests/lsp/did_open_notification_completion_registry.json @@ -0,0 +1,12 @@ +{ + "jsonrpc": "2.0", + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "import * as a from \"http://localhost:4545/x/a@\"" + } + } +} diff --git a/cli/tests/lsp/did_open_notification_completion_registry_02.json b/cli/tests/lsp/did_open_notification_completion_registry_02.json new file mode 100644 index 000000000..a53882b56 --- /dev/null +++ b/cli/tests/lsp/did_open_notification_completion_registry_02.json @@ -0,0 +1,12 @@ +{ + "jsonrpc": "2.0", + "method": "textDocument/didOpen", + "params": { + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "import * as a from \"\"" + } + } +} diff --git a/cli/tests/lsp/initialize_request.json b/cli/tests/lsp/initialize_request.json index 78679eb55..a6610ffe9 100644 --- a/cli/tests/lsp/initialize_request.json +++ b/cli/tests/lsp/initialize_request.json @@ -15,8 +15,17 @@ "implementations": true, "references": true }, - "lint": true, "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, "unstable": false }, "capabilities": { diff --git a/cli/tests/lsp/initialize_request_registry.json b/cli/tests/lsp/initialize_request_registry.json new file mode 100644 index 000000000..94480934f --- /dev/null +++ b/cli/tests/lsp/initialize_request_registry.json @@ -0,0 +1,63 @@ +{ + "jsonrpc": "2.0", + "id": 1, + "method": "initialize", + "params": { + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "codeLens": { + "implementations": true, + "references": true + }, + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": { + "http://localhost:4545/": true + } + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + } + } + } +} diff --git a/cli/tests/lsp/registries/a_latest.json b/cli/tests/lsp/registries/a_latest.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/a_latest.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/a_v1.0.0.json b/cli/tests/lsp/registries/a_v1.0.0.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/a_v1.0.0.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/a_v1.0.1.json b/cli/tests/lsp/registries/a_v1.0.1.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/a_v1.0.1.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/a_v2.0.0.json b/cli/tests/lsp/registries/a_v2.0.0.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/a_v2.0.0.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/a_versions.json b/cli/tests/lsp/registries/a_versions.json new file mode 100644 index 000000000..930e38323 --- /dev/null +++ b/cli/tests/lsp/registries/a_versions.json @@ -0,0 +1,5 @@ +[ + "v1.0.0", + "v1.0.1", + "v2.0.0" +] diff --git a/cli/tests/lsp/registries/b_latest.json b/cli/tests/lsp/registries/b_latest.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/b_latest.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/b_v0.0.1.json b/cli/tests/lsp/registries/b_v0.0.1.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/b_v0.0.1.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/b_v0.0.2.json b/cli/tests/lsp/registries/b_v0.0.2.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/b_v0.0.2.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/b_v0.0.3.json b/cli/tests/lsp/registries/b_v0.0.3.json new file mode 100644 index 000000000..f9f9d111e --- /dev/null +++ b/cli/tests/lsp/registries/b_v0.0.3.json @@ -0,0 +1,4 @@ +[ + "b/c.ts", + "d/e.js" +] diff --git a/cli/tests/lsp/registries/b_versions.json b/cli/tests/lsp/registries/b_versions.json new file mode 100644 index 000000000..9532fbb85 --- /dev/null +++ b/cli/tests/lsp/registries/b_versions.json @@ -0,0 +1,5 @@ +[ + "v0.0.1", + "v0.0.2", + "v0.0.3" +] diff --git a/cli/tests/lsp/registries/deno-import-intellisense.json b/cli/tests/lsp/registries/deno-import-intellisense.json new file mode 100644 index 000000000..ff28fac07 --- /dev/null +++ b/cli/tests/lsp/registries/deno-import-intellisense.json @@ -0,0 +1,35 @@ +{ + "version": 1, + "registries": [ + { + "schema": "/x/:module([a-z0-9_]*)@:version?/:path*", + "variables": [ + { + "key": "module", + "url": "http://localhost:4545/cli/tests/lsp/registries/modules.json" + }, + { + "key": "version", + "url": "http://localhost:4545/cli/tests/lsp/registries/${module}_versions.json" + }, + { + "key": "path", + "url": "http://localhost:4545/cli/tests/lsp/registries/${module}_${{version}}.json" + } + ] + }, + { + "schema": "/x/:module([a-z0-9_]*)/:path*", + "variables": [ + { + "key": "module", + "url": "http://localhost:4545/cli/tests/lsp/registries/modules.json" + }, + { + "key": "path", + "url": "http://localhost:4545/cli/tests/lsp/registries/${module}_latest.json" + } + ] + } + ] +} diff --git a/cli/tests/lsp/registries/modules.json b/cli/tests/lsp/registries/modules.json new file mode 100644 index 000000000..517c9d68e --- /dev/null +++ b/cli/tests/lsp/registries/modules.json @@ -0,0 +1,4 @@ +[ + "a", + "b" +] |