summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-02-06 13:39:01 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2021-02-08 10:47:32 +0100
commit09b79463d71f3b144a0cfd878108a012c87464ca (patch)
treebb8ad85b9545c683a705f65c6c78e644e40acca7 /cli/tests
parentccbaedb138038c175f4a62929ccf3ec625683893 (diff)
feat(lsp): add asset cache regression test
When we migrated away from all the locks, there was a regression that was not caught immediately. The tsc::get_asset() would attempt to modify the snapshot, but the problem was that the snapshot was a .clone() of the inner language server's assets, which meant that modifications to that where lost. When we then attempted to do a hover on those assets, the inner language servers assets didn't have the retrieved asset, and therefore would throw an error.
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/lsp/did_open_notification_asset.json12
-rw-r--r--cli/tests/lsp/hover_request_asset_01.json14
-rw-r--r--cli/tests/lsp/hover_request_asset_02.json14
-rw-r--r--cli/tests/lsp/virtual_text_document_request.json10
4 files changed, 50 insertions, 0 deletions
diff --git a/cli/tests/lsp/did_open_notification_asset.json b/cli/tests/lsp/did_open_notification_asset.json
new file mode 100644
index 000000000..413353f29
--- /dev/null
+++ b/cli/tests/lsp/did_open_notification_asset.json
@@ -0,0 +1,12 @@
+{
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ "languageId": "typescript",
+ "version": 1,
+ "text": "console.log(Date.now());\n"
+ }
+ }
+}
diff --git a/cli/tests/lsp/hover_request_asset_01.json b/cli/tests/lsp/hover_request_asset_01.json
new file mode 100644
index 000000000..fb1c899a3
--- /dev/null
+++ b/cli/tests/lsp/hover_request_asset_01.json
@@ -0,0 +1,14 @@
+{
+ "jsonrpc": "2.0",
+ "id": 4,
+ "method": "textDocument/hover",
+ "params": {
+ "textDocument": {
+ "uri": "file:///a/file.ts"
+ },
+ "position": {
+ "line": 0,
+ "character": 12
+ }
+ }
+}
diff --git a/cli/tests/lsp/hover_request_asset_02.json b/cli/tests/lsp/hover_request_asset_02.json
new file mode 100644
index 000000000..30f404709
--- /dev/null
+++ b/cli/tests/lsp/hover_request_asset_02.json
@@ -0,0 +1,14 @@
+{
+ "jsonrpc": "2.0",
+ "id": 4,
+ "method": "textDocument/hover",
+ "params": {
+ "textDocument": {
+ "uri": "deno:/asset//lib.es2015.symbol.wellknown.d.ts"
+ },
+ "position": {
+ "line": 109,
+ "character": 13
+ }
+ }
+}
diff --git a/cli/tests/lsp/virtual_text_document_request.json b/cli/tests/lsp/virtual_text_document_request.json
new file mode 100644
index 000000000..08ad7a3ca
--- /dev/null
+++ b/cli/tests/lsp/virtual_text_document_request.json
@@ -0,0 +1,10 @@
+{
+ "jsonrpc": "2.0",
+ "id": 2,
+ "method": "deno/virtualTextDocument",
+ "params": {
+ "textDocument": {
+ "uri": "deno:/asset//lib.es2015.symbol.wellknown.d.ts"
+ }
+ }
+}