diff options
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r-- | cli/tests/integration/lsp_tests.rs | 191 |
1 files changed, 104 insertions, 87 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 2296181ff..0ec3c753d 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -723,7 +723,7 @@ fn lsp_hover_asset() { "textDocument": { "uri": "deno:/asset/lib.es2015.symbol.wellknown.d.ts" }, - "position": { "line": 109, "character": 13 } + "position": { "line": 111, "character": 13 } }), ); assert_eq!( @@ -737,8 +737,8 @@ fn lsp_hover_asset() { "Enables basic storage and retrieval of dates and times." ], "range": { - "start": { "line": 109, "character": 10, }, - "end": { "line": 109, "character": 14, } + "start": { "line": 111, "character": 10, }, + "end": { "line": 111, "character": 14, } } }) ); @@ -3674,23 +3674,6 @@ export class DuckConfig { }] } }, { - "title": "Add all missing imports", - "kind": "quickfix", - "diagnostics": [{ - "range": { - "start": { "line": 0, "character": 50 }, - "end": { "line": 0, "character": 67 } - }, - "severity": 1, - "code": 2304, - "source": "deno-ts", - "message": "Cannot find name 'DuckConfigOptions'." - }], - "data": { - "specifier": "file:///a/file00.ts", - "fixId": "fixMissingImport" - } - }, { "title": "Add import from \"./file01.ts\"", "kind": "quickfix", "diagnostics": [{ @@ -3718,6 +3701,23 @@ export class DuckConfig { }] }] } + }, { + "title": "Add all missing imports", + "kind": "quickfix", + "diagnostics": [{ + "range": { + "start": { "line": 0, "character": 50 }, + "end": { "line": 0, "character": 67 } + }, + "severity": 1, + "code": 2304, + "source": "deno-ts", + "message": "Cannot find name 'DuckConfigOptions'." + }], + "data": { + "specifier": "file:///a/file00.ts", + "fixId": "fixMissingImport" + } }]) ); let res = client.write_request( @@ -3830,8 +3830,8 @@ fn lsp_code_actions_refactor() { assert_eq!( res, json!([{ - "title": "Extract to function in module scope", - "kind": "refactor.extract.function", + "title": "Move to a new file", + "kind": "refactor.move.newFile", "isPreferred": false, "data": { "specifier": "file:///a/file.ts", @@ -3839,12 +3839,12 @@ fn lsp_code_actions_refactor() { "start": { "line": 0, "character": 0 }, "end": { "line": 1, "character": 0 } }, - "refactorName": "Extract Symbol", - "actionName": "function_scope_0" + "refactorName": "Move to a new file", + "actionName": "Move to a new file" } }, { - "title": "Extract to constant in enclosing scope", - "kind": "refactor.extract.constant", + "title": "Extract to function in module scope", + "kind": "refactor.extract.function", "isPreferred": false, "data": { "specifier": "file:///a/file.ts", @@ -3853,11 +3853,11 @@ fn lsp_code_actions_refactor() { "end": { "line": 1, "character": 0 } }, "refactorName": "Extract Symbol", - "actionName": "constant_scope_0" + "actionName": "function_scope_0" } }, { - "title": "Move to a new file", - "kind": "refactor.move.newFile", + "title": "Extract to constant in enclosing scope", + "kind": "refactor.extract.constant", "isPreferred": false, "data": { "specifier": "file:///a/file.ts", @@ -3865,8 +3865,8 @@ fn lsp_code_actions_refactor() { "start": { "line": 0, "character": 0 }, "end": { "line": 1, "character": 0 } }, - "refactorName": "Move to a new file", - "actionName": "Move to a new file" + "refactorName": "Extract Symbol", + "actionName": "constant_scope_0" } }, { "title": "Convert default export to named export", @@ -4047,8 +4047,8 @@ fn lsp_code_actions_refactor_no_disabled_support() { assert_eq!( res, json!([{ - "title": "Extract to function in module scope", - "kind": "refactor.extract.function", + "title": "Move to a new file", + "kind": "refactor.move.newFile", "isPreferred": false, "data": { "specifier": "file:///a/file.ts", @@ -4056,12 +4056,12 @@ fn lsp_code_actions_refactor_no_disabled_support() { "start": { "line": 0, "character": 0 }, "end": { "line": 14, "character": 0 } }, - "refactorName": "Extract Symbol", - "actionName": "function_scope_0" + "refactorName": "Move to a new file", + "actionName": "Move to a new file" } }, { - "title": "Move to a new file", - "kind": "refactor.move.newFile", + "title": "Extract to function in module scope", + "kind": "refactor.extract.function", "isPreferred": false, "data": { "specifier": "file:///a/file.ts", @@ -4069,8 +4069,8 @@ fn lsp_code_actions_refactor_no_disabled_support() { "start": { "line": 0, "character": 0 }, "end": { "line": 14, "character": 0 } }, - "refactorName": "Move to a new file", - "actionName": "Move to a new file" + "refactorName": "Extract Symbol", + "actionName": "function_scope_0" } }]) ); @@ -4394,6 +4394,7 @@ fn lsp_completions_auto_import() { panic!("completions items missing 'foo' symbol"); } + // the request here is one of the items in `list` let res = client.write_request( "completionItem/resolve", json!({ @@ -4411,10 +4412,11 @@ fn lsp_completions_auto_import() { "specifier": "file:///a/file.ts", "position": 12, "name": "foo", - "source": "./b", + "source": "./b.ts", "data": { "exportName": "foo", - "moduleSpecifier": "./b", + "exportMapKey": "foo|6843|file:///a/b", + "moduleSpecifier": "./b.ts", "fileName": "file:///a/b.ts" }, "useCodeSnippet": false @@ -6357,53 +6359,68 @@ fn lsp_workspace_symbol() { ); assert_eq!( res, - json!([ - { - "name": "fieldA", - "kind": 8, - "location": { - "uri": "file:///a/file.ts", - "range": { - "start": { "line": 1, "character": 2 }, - "end": { "line": 1, "character": 17 } - } - }, - "containerName": "A" - }, { - "name": "fieldB", - "kind": 8, - "location": { - "uri": "file:///a/file.ts", - "range": { - "start": { "line": 2, "character": 2 }, - "end": { "line": 2, "character": 17 } - } - }, - "containerName": "A" - }, { - "name": "fieldC", - "kind": 8, - "location": { - "uri": "file:///a/file_01.ts", - "range": { - "start": { "line": 1, "character": 2 }, - "end": { "line": 1, "character": 17 } - } - }, - "containerName": "B" - }, { - "name": "fieldD", - "kind": 8, - "location": { - "uri": "file:///a/file_01.ts", - "range": { - "start": { "line": 2, "character": 2 }, - "end": { "line": 2, "character": 17 } - } + json!([{ + "name": "fieldA", + "kind": 8, + "location": { + "uri": "file:///a/file.ts", + "range": { + "start": { "line": 1, "character": 2 }, + "end": { "line": 1, "character": 17 } + } + }, + "containerName": "A" + }, { + "name": "fieldB", + "kind": 8, + "location": { + "uri": "file:///a/file.ts", + "range": { + "start": { "line": 2, "character": 2 }, + "end": { "line": 2, "character": 17 } + } + }, + "containerName": "A" + }, { + "name": "fieldC", + "kind": 8, + "location": { + "uri": "file:///a/file_01.ts", + "range": { + "start": { "line": 1, "character": 2 }, + "end": { "line": 1, "character": 17 } + } + }, + "containerName": "B" + }, { + "name": "fieldD", + "kind": 8, + "location": { + "uri": "file:///a/file_01.ts", + "range": { + "start": { "line": 2, "character": 2 }, + "end": { "line": 2, "character": 17 } + } + }, + "containerName": "B" + }, { + "name": "ClassFieldDecoratorContext", + "kind": 11, + "location": { + "uri": "deno:/asset/lib.decorators.d.ts", + "range": { + "start": { + "line": 331, + "character": 0, + }, + "end": { + "line": 371, + "character": 1, + }, }, - "containerName": "B" - } - ]) + }, + "containerName": "", + }]) ); client.shutdown(); } |