diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-03-07 17:27:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 17:27:24 +0000 |
commit | 8df47882c942d3cf5558fee05f02629025e46ae7 (patch) | |
tree | 95d1eb9f755fece90a379ae52386e196c9bf9910 /tests/integration/lsp_tests.rs | |
parent | 0fdb33c3aa9f4c75d9e15e8a33d9c00116d9052f (diff) |
fix(lsp): don't apply renames to remote modules (#22765)
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r-- | tests/integration/lsp_tests.rs | 63 |
1 files changed, 63 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() |