summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-02-06 07:10:53 +1100
committerGitHub <noreply@github.com>2021-02-06 07:10:53 +1100
commitb6353672f8d01b8c7a67131aac52c6492b432677 (patch)
tree0b1736f4c627a005055a73fc56a4a78492024d89 /cli/tests
parent647f11b3acc2f629a6d77836f5f6ef74ee10c4ce (diff)
fix(lsp): support codeAction/resolve (#9405)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/lsp/code_action_resolve_request.json32
-rw-r--r--cli/tests/lsp/code_action_resolve_request_response.json91
-rw-r--r--cli/tests/lsp/code_action_response.json66
3 files changed, 126 insertions, 63 deletions
diff --git a/cli/tests/lsp/code_action_resolve_request.json b/cli/tests/lsp/code_action_resolve_request.json
new file mode 100644
index 000000000..48a2eea3b
--- /dev/null
+++ b/cli/tests/lsp/code_action_resolve_request.json
@@ -0,0 +1,32 @@
+{
+ "jsonrpc": "2.0",
+ "id": 4,
+ "method": "codeAction/resolve",
+ "params": {
+ "title": "Add all missing 'async' modifiers",
+ "kind": "quickfix",
+ "diagnostics": [
+ {
+ "range": {
+ "start": {
+ "line": 1,
+ "character": 2
+ },
+ "end": {
+ "line": 1,
+ "character": 7
+ }
+ },
+ "severity": 1,
+ "code": 1308,
+ "source": "deno-ts",
+ "message": "'await' expressions are only allowed within async functions and at the top levels of modules.",
+ "relatedInformation": []
+ }
+ ],
+ "data": {
+ "specifier": "file:///a/file.ts",
+ "fixId": "fixAwaitInSyncFunction"
+ }
+ }
+}
diff --git a/cli/tests/lsp/code_action_resolve_request_response.json b/cli/tests/lsp/code_action_resolve_request_response.json
new file mode 100644
index 000000000..e3f5b3f0e
--- /dev/null
+++ b/cli/tests/lsp/code_action_resolve_request_response.json
@@ -0,0 +1,91 @@
+{
+ "title": "Add all missing 'async' modifiers",
+ "kind": "quickfix",
+ "diagnostics": [
+ {
+ "range": {
+ "start": {
+ "line": 1,
+ "character": 2
+ },
+ "end": {
+ "line": 1,
+ "character": 7
+ }
+ },
+ "severity": 1,
+ "code": 1308,
+ "source": "deno-ts",
+ "message": "'await' expressions are only allowed within async functions and at the top levels of modules.",
+ "relatedInformation": []
+ }
+ ],
+ "edit": {
+ "documentChanges": [
+ {
+ "textDocument": {
+ "uri": "file:///a/file.ts",
+ "version": 1
+ },
+ "edits": [
+ {
+ "range": {
+ "start": {
+ "line": 0,
+ "character": 7
+ },
+ "end": {
+ "line": 0,
+ "character": 7
+ }
+ },
+ "newText": "async "
+ },
+ {
+ "range": {
+ "start": {
+ "line": 0,
+ "character": 21
+ },
+ "end": {
+ "line": 0,
+ "character": 25
+ }
+ },
+ "newText": "Promise<void>"
+ },
+ {
+ "range": {
+ "start": {
+ "line": 4,
+ "character": 7
+ },
+ "end": {
+ "line": 4,
+ "character": 7
+ }
+ },
+ "newText": "async "
+ },
+ {
+ "range": {
+ "start": {
+ "line": 4,
+ "character": 21
+ },
+ "end": {
+ "line": 4,
+ "character": 25
+ }
+ },
+ "newText": "Promise<void>"
+ }
+ ]
+ }
+ ]
+ },
+ "data": {
+ "specifier": "file:///a/file.ts",
+ "fixId": "fixAwaitInSyncFunction"
+ }
+}
diff --git a/cli/tests/lsp/code_action_response.json b/cli/tests/lsp/code_action_response.json
index 5af45ba7f..ab30898f8 100644
--- a/cli/tests/lsp/code_action_response.json
+++ b/cli/tests/lsp/code_action_response.json
@@ -82,69 +82,9 @@
"relatedInformation": []
}
],
- "edit": {
- "documentChanges": [
- {
- "textDocument": {
- "uri": "file:///a/file.ts",
- "version": 1
- },
- "edits": [
- {
- "range": {
- "start": {
- "line": 0,
- "character": 7
- },
- "end": {
- "line": 0,
- "character": 7
- }
- },
- "newText": "async "
- },
- {
- "range": {
- "start": {
- "line": 0,
- "character": 21
- },
- "end": {
- "line": 0,
- "character": 25
- }
- },
- "newText": "Promise<void>"
- },
- {
- "range": {
- "start": {
- "line": 4,
- "character": 7
- },
- "end": {
- "line": 4,
- "character": 7
- }
- },
- "newText": "async "
- },
- {
- "range": {
- "start": {
- "line": 4,
- "character": 21
- },
- "end": {
- "line": 4,
- "character": 25
- }
- },
- "newText": "Promise<void>"
- }
- ]
- }
- ]
+ "data": {
+ "specifier": "file:///a/file.ts",
+ "fixId": "fixAwaitInSyncFunction"
}
}
]