diff options
author | Hajime-san <41257923+Hajime-san@users.noreply.github.com> | 2024-03-28 00:58:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 15:58:18 +0000 |
commit | feb744cebd37263026893c7e7c4852daa5df24d0 (patch) | |
tree | 99f8da702a85406acec872494a760c538025354e /tests/integration/lsp_tests.rs | |
parent | 3462248571fd3193106a0427b3d8f585f9716c48 (diff) |
fix(lsp): decoding percent-encoding(non-ASCII) file path correctly (#22582)
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r-- | tests/integration/lsp_tests.rs | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 852f56e9b..5a81244fd 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -2266,7 +2266,7 @@ fn lsp_hover_dependency() { "uri": "file:///a/file.ts", "languageId": "typescript", "version": 1, - "text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n// @deno-types=\"http://127.0.0.1:4545/type_definitions/foo.d.ts\"\nimport * as b from \"http://127.0.0.1:4545/type_definitions/foo.js\";\nimport * as c from \"http://127.0.0.1:4545/subdir/type_reference.js\";\nimport * as d from \"http://127.0.0.1:4545/subdir/mod1.ts\";\nimport * as e from \"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=\";\nimport * as f from \"./file_01.ts\";\nimport * as g from \"http://localhost:4545/x/a/mod.ts\";\n\nconsole.log(a, b, c, d, e, f, g);\n" + "text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n// @deno-types=\"http://127.0.0.1:4545/type_definitions/foo.d.ts\"\nimport * as b from \"http://127.0.0.1:4545/type_definitions/foo.js\";\nimport * as c from \"http://127.0.0.1:4545/subdir/type_reference.js\";\nimport * as d from \"http://127.0.0.1:4545/subdir/mod1.ts\";\nimport * as e from \"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=\";\nimport * as f from \"./file_01.ts\";\nimport * as g from \"http://localhost:4545/x/a/mod.ts\";\nimport * as h from \"./mod🦕.ts\";\n\nconsole.log(a, b, c, d, e, f, g, h);\n" } }), ); @@ -2387,6 +2387,28 @@ fn lsp_hover_dependency() { } }) ); + let res = client.write_request( + "textDocument/hover", + json!({ + "textDocument": { + "uri": "file:///a/file.ts", + }, + "position": { "line": 8, "character": 28 } + }), + ); + assert_eq!( + res, + json!({ + "contents": { + "kind": "markdown", + "value": "**Resolved Dependency**\n\n**Code**: file​:///a/mod🦕.ts\n" + }, + "range": { + "start": { "line": 8, "character": 19 }, + "end":{ "line": 8, "character": 30 } + } + }) + ); } // This tests for a regression covered by denoland/deno#12753 where the lsp was @@ -6637,7 +6659,7 @@ fn lsp_completions_auto_import() { client.initialize_default(); client.did_open(json!({ "textDocument": { - "uri": "file:///a/b.ts", + "uri": "file:///a/🦕.ts", "languageId": "typescript", "version": 1, "text": "export const foo = \"foo\";\n", @@ -6668,7 +6690,7 @@ fn lsp_completions_auto_import() { let req = json!({ "label": "foo", "labelDetails": { - "description": "./b.ts", + "description": "./🦕.ts", }, "kind": 6, "sortText": "ï¿¿16_0", @@ -6683,12 +6705,16 @@ fn lsp_completions_auto_import() { "specifier": "file:///a/file.ts", "position": 12, "name": "foo", - "source": "./b.ts", + "source": "./%F0%9F%A6%95.ts", + "specifierRewrite": [ + "./%F0%9F%A6%95.ts", + "./🦕.ts", + ], "data": { "exportName": "foo", "exportMapKey": "", - "moduleSpecifier": "./b.ts", - "fileName": "file:///a/b.ts" + "moduleSpecifier": "./%F0%9F%A6%95.ts", + "fileName": "file:///a/%F0%9F%A6%95.ts" }, "useCodeSnippet": false } @@ -6702,7 +6728,7 @@ fn lsp_completions_auto_import() { json!({ "label": "foo", "labelDetails": { - "description": "./b.ts", + "description": "./🦕.ts", }, "kind": 6, "detail": "const foo: \"foo\"", @@ -6717,7 +6743,7 @@ fn lsp_completions_auto_import() { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, - "newText": "import { foo } from \"./b.ts\";\n\n" + "newText": "import { foo } from \"./🦕.ts\";\n\n" } ] }) |