Skip to content

Commit

Permalink
fix: rename bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Jun 21, 2023
1 parent 7cc6f3e commit c707e36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/els/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl FileCache {
);
}

pub(crate) fn ranged_update(&self, uri: &NormalizedUrl, old: Range, new_code: &str) {
pub(crate) fn _ranged_update(&self, uri: &NormalizedUrl, old: Range, new_code: &str) {
let mut ent = self.files.borrow_mut();
let Some(entry) = ent.get_mut(uri) else {
return;
Expand Down
6 changes: 2 additions & 4 deletions crates/els/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
let mut changes = HashMap::new();
for dep in self.dependents_of(old_uri) {
let imports = self.search_imports(&dep, old_path);
for import in imports.iter() {
let range = util::loc_to_range(import.loc()).unwrap();
self.file_cache.ranged_update(&dep, range, new_path);
}
let edits = imports.iter().map(|lit| {
TextEdit::new(
util::loc_to_range(lit.loc()).unwrap(),
Expand Down Expand Up @@ -289,6 +285,8 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
}
}

/// Rename .er files and rewrite the imports of the dependent files.
/// This does not update `file_cache`, the editing is done by a `didChange` request.
pub(crate) fn handle_will_rename_files(
&mut self,
params: RenameFilesParams,
Expand Down

0 comments on commit c707e36

Please sign in to comment.