lsp: Rename components

Only handle rename requests when on the component name in the component
definition.

Handle exports/imports in the entire project as needed.
This commit is contained in:
Tobias Hunger 2024-05-23 10:16:29 +02:00 committed by Tobias Hunger
parent 97cd00ffd8
commit 704cfff41f
8 changed files with 994 additions and 30 deletions

View file

@ -10,6 +10,12 @@ use lsp_types::{TextEdit, Url, WorkspaceEdit};
use std::{collections::HashMap, path::PathBuf};
pub mod rename_component;
#[cfg(test)]
pub mod test;
#[cfg(any(test, feature = "preview-engine"))]
pub mod text_edit;
pub type Error = Box<dyn std::error::Error>;
pub type Result<T> = std::result::Result<T, Error>;
pub type UrlVersion = Option<i32>;
@ -258,7 +264,6 @@ pub fn create_workspace_edit_from_source_file(
))
}
#[cfg(any(feature = "preview-external", feature = "preview-engine"))]
pub fn create_workspace_edit_from_source_files(
mut inputs: Vec<(SourceFile, TextEdit)>,
) -> Option<WorkspaceEdit> {
@ -274,6 +279,7 @@ pub fn create_workspace_edit_from_source_files(
.entry((url, sf.version()))
.and_modify(|v| v.push(edit.clone()))
.or_insert_with(|| vec![edit]);
} else {
}
});