diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/lsp_tests.rs | 63 | ||||
-rw-r--r-- | tests/testdata/subdir/exports.ts | 1 |
2 files changed, 64 insertions, 0 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 9300413b5..8165cc86a 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -2461,6 +2461,69 @@ fn lsp_hover_deps_preserved_when_invalid_parse() { client.shutdown(); } +// Regression test for https://github.com/denoland/vscode_deno/issues/1068. +#[test] +fn lsp_rename_synbol_file_scheme_edits_only() { + let context = TestContextBuilder::new() + .use_http_server() + .use_temp_cwd() + .build(); + let temp_dir = context.temp_dir(); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); + client.did_open(json!({ + "textDocument": { + "uri": temp_dir.uri().join("file.ts").unwrap(), + "languageId": "typescript", + "version": 1, + "text": r#" + import { SEPARATOR } from "http://localhost:4545/subdir/exports.ts"; + console.log(SEPARATOR); + "#, + }, + })); + let res = client.write_request( + "textDocument/rename", + json!({ + "textDocument": { + "uri": temp_dir.uri().join("file.ts").unwrap(), + }, + "position": { "line": 1, "character": 17 }, + "newName": "PATH_SEPARATOR", + }), + ); + assert_eq!( + res, + json!({ + "documentChanges": [ + { + "textDocument": { + "uri": temp_dir.uri().join("file.ts").unwrap(), + "version": 1, + }, + "edits": [ + { + "range": { + "start": { "line": 1, "character": 17 }, + "end": { "line": 1, "character": 26 }, + }, + "newText": "PATH_SEPARATOR", + }, + { + "range": { + "start": { "line": 2, "character": 20 }, + "end": { "line": 2, "character": 29 }, + }, + "newText": "PATH_SEPARATOR", + }, + ], + } + ], + }) + ); + client.shutdown(); +} + #[test] fn lsp_hover_typescript_types() { let context = TestContextBuilder::new() diff --git a/tests/testdata/subdir/exports.ts b/tests/testdata/subdir/exports.ts new file mode 100644 index 000000000..d5f8be342 --- /dev/null +++ b/tests/testdata/subdir/exports.ts @@ -0,0 +1 @@ +export const SEPARATOR = "/"; |