From bcfe279fba865763c87f9cd8d5a2d0b2cbf451be Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 21 Oct 2022 11:20:18 -0400 Subject: feat(unstable/npm): initial type checking of npm specifiers (#16332) --- .../lsp/code_actions/cache_npm/cache_action.json | 41 ++++++++++++++++++++++ .../lsp/code_actions/cache_npm/cache_response.json | 36 +++++++++++++++++++ .../lsp/code_actions/cache_npm/diagnostics.json | 25 +++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 cli/tests/testdata/lsp/code_actions/cache_npm/cache_action.json create mode 100644 cli/tests/testdata/lsp/code_actions/cache_npm/cache_response.json create mode 100644 cli/tests/testdata/lsp/code_actions/cache_npm/diagnostics.json (limited to 'cli/tests/testdata/lsp/code_actions/cache_npm') diff --git a/cli/tests/testdata/lsp/code_actions/cache_npm/cache_action.json b/cli/tests/testdata/lsp/code_actions/cache_npm/cache_action.json new file mode 100644 index 000000000..b698df3bd --- /dev/null +++ b/cli/tests/testdata/lsp/code_actions/cache_npm/cache_action.json @@ -0,0 +1,41 @@ +{ + "textDocument": { + "uri": "file:///a/file.ts" + }, + "range": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 29 + } + }, + "context": { + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 29 + } + }, + "severity": 1, + "code": "no-cache-npm", + "source": "deno", + "message": "Uncached or missing npm package: \"chalk\".", + "data": { + "specifier": "npm:chalk" + } + } + ], + "only": [ + "quickfix" + ] + } +} diff --git a/cli/tests/testdata/lsp/code_actions/cache_npm/cache_response.json b/cli/tests/testdata/lsp/code_actions/cache_npm/cache_response.json new file mode 100644 index 000000000..1b41babcb --- /dev/null +++ b/cli/tests/testdata/lsp/code_actions/cache_npm/cache_response.json @@ -0,0 +1,36 @@ +[ + { + "title": "Cache \"npm:chalk\" and its dependencies.", + "kind": "quickfix", + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 29 + } + }, + "severity": 1, + "code": "no-cache-npm", + "source": "deno", + "message": "Uncached or missing npm package: \"chalk\".", + "data": { + "specifier": "npm:chalk" + } + } + ], + "command": { + "title": "", + "command": "deno.cache", + "arguments": [ + [ + "npm:chalk" + ] + ] + } + } +] diff --git a/cli/tests/testdata/lsp/code_actions/cache_npm/diagnostics.json b/cli/tests/testdata/lsp/code_actions/cache_npm/diagnostics.json new file mode 100644 index 000000000..63c9d0029 --- /dev/null +++ b/cli/tests/testdata/lsp/code_actions/cache_npm/diagnostics.json @@ -0,0 +1,25 @@ +{ + "uri": "file:///a/file.ts", + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 18 + }, + "end": { + "line": 0, + "character": 29 + } + }, + "severity": 1, + "code": "no-cache-npm", + "source": "deno", + "message": "Uncached or missing npm package: \"chalk\".", + "data": { + "specifier": "npm:chalk" + } + } + ], + "version": 1 +} -- cgit v1.2.3