MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / rename

Method rename

src/server.rs:925–956  ·  view source on GitHub ↗
(&self, params: RenameParams)

Source from the content-addressed store, hash-verified

923 }
924
925 async fn rename(&self, params: RenameParams) -> Result<Option<WorkspaceEdit>> {
926 let uri = params.text_document_position.text_document.uri.to_string();
927 let position = params.text_document_position.position;
928 let new_name = params.new_name.clone();
929
930 let backend = self.clone_for_blocking();
931 let uri_clone = uri.clone();
932 tokio::task::spawn_blocking(move || {
933 backend.handle_with_position("rename", &uri_clone, position, |content, pos| {
934 backend
935 .handle_rename(&uri_clone, content, pos, &new_name)
936 .map(|mut edit| {
937 if let Some(changes) = &mut edit.changes {
938 for (uri, edits) in changes {
939 let uri_str = uri.to_string();
940 if backend.is_blade_file(&uri_str) {
941 for e in edits {
942 e.range.start =
943 backend.translate_php_to_blade(&uri_str, e.range.start);
944 e.range.end =
945 backend.translate_php_to_blade(&uri_str, e.range.end);
946 }
947 }
948 }
949 }
950 edit
951 })
952 })
953 })
954 .await
955 .unwrap_or(Ok(None))
956 }
957
958 async fn document_symbol(
959 &self,

Callers 1

renameFunction · 0.45

Calls 7

cloneMethod · 0.80
clone_for_blockingMethod · 0.80
handle_with_positionMethod · 0.80
handle_renameMethod · 0.80
is_blade_fileMethod · 0.80
mapMethod · 0.45

Tested by 1

renameFunction · 0.36