mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 12:16:11 -05:00
This commit is contained in:
parent
8971064546
commit
9da6a20e57
1 changed files with 13 additions and 28 deletions
|
@ -1880,7 +1880,7 @@ impl Inner {
|
||||||
})?;
|
})?;
|
||||||
let asset_or_doc = self.get_asset_or_document(&action_data.specifier)?;
|
let asset_or_doc = self.get_asset_or_document(&action_data.specifier)?;
|
||||||
let line_index = asset_or_doc.line_index();
|
let line_index = asset_or_doc.line_index();
|
||||||
let refactor_edit_info = self
|
let mut refactor_edit_info = self
|
||||||
.ts_server
|
.ts_server
|
||||||
.get_edits_for_refactor(
|
.get_edits_for_refactor(
|
||||||
self.snapshot(),
|
self.snapshot(),
|
||||||
|
@ -1901,34 +1901,19 @@ impl Inner {
|
||||||
)),
|
)),
|
||||||
asset_or_doc.scope().cloned(),
|
asset_or_doc.scope().cloned(),
|
||||||
)
|
)
|
||||||
.await;
|
.await?;
|
||||||
|
if kind_suffix == ".rewrite.function.returnType"
|
||||||
match refactor_edit_info {
|
|| kind_suffix == ".move.newFile"
|
||||||
Ok(mut refactor_edit_info) => {
|
{
|
||||||
if kind_suffix == ".rewrite.function.returnType"
|
refactor_edit_info.edits =
|
||||||
|| kind_suffix == ".move.newFile"
|
fix_ts_import_changes(&refactor_edit_info.edits, self).map_err(
|
||||||
{
|
|err| {
|
||||||
refactor_edit_info.edits =
|
error!("Unable to remap changes: {:#}", err);
|
||||||
fix_ts_import_changes(&refactor_edit_info.edits, self).map_err(
|
LspError::internal_error()
|
||||||
|err| {
|
},
|
||||||
error!("Unable to remap changes: {:#}", err);
|
)?
|
||||||
LspError::internal_error()
|
|
||||||
},
|
|
||||||
)?
|
|
||||||
}
|
|
||||||
code_action.edit = refactor_edit_info.to_workspace_edit(self)?;
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
// TODO(nayeemrmn): Investigate cause for
|
|
||||||
// https://github.com/denoland/deno/issues/27778. Prevent popups for
|
|
||||||
// this error for now.
|
|
||||||
if kind_suffix == ".move.newFile" {
|
|
||||||
lsp_warn!("{:#}", err);
|
|
||||||
} else {
|
|
||||||
return Err(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
code_action.edit = refactor_edit_info.to_workspace_edit(self)?;
|
||||||
code_action
|
code_action
|
||||||
} else {
|
} else {
|
||||||
// The code action doesn't need to be resolved
|
// The code action doesn't need to be resolved
|
||||||
|
|
Loading…
Add table
Reference in a new issue