fix(lsp): fix import specifiers in file rename changes (#30458)
Some checks are pending
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

This commit is contained in:
Nayeem Rahman 2025-08-19 21:46:59 +01:00 committed by GitHub
parent dabf9c79b3
commit efdcdf82c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 104 additions and 2 deletions

View file

@ -18893,6 +18893,51 @@ console.log(invalid, validBytes, validText);
client.shutdown();
}
/// Regression test for https://github.com/denoland/deno/issues/30380.
#[test]
#[timeout(300_000)]
fn lsp_will_rename_files_js_to_ts() {
let context = TestContextBuilder::new().use_temp_cwd().build();
let temp_dir = context.temp_dir();
temp_dir.write("deno.json", json!({}).to_string());
let file = temp_dir.source_file("main.ts", "import \"./other.js\";\n");
let other_file = temp_dir.source_file("other.js", "");
let mut client = context.new_lsp_command().build();
client.initialize_default();
client.did_open_file(&file);
let res = client.write_request(
"workspace/willRenameFiles",
json!({
"files": [
{
"oldUri": other_file.uri(),
"newUri": temp_dir.path().join("other.ts").uri_file(),
},
],
}),
);
assert_eq!(
res,
json!({
"documentChanges": [
{
"textDocument": { "uri": file.uri(), "version": 1 },
"edits": [
{
"range": {
"start": { "line": 0, "character": 8 },
"end": { "line": 0, "character": 18 },
},
"newText": "./other.ts",
},
],
},
],
}),
);
client.shutdown();
}
#[test]
#[timeout(300_000)]
fn lsp_push_diagnostics() {