@@ -57,47 +57,60 @@ impl CodingService for LspCodingService {
5757 workspace_manager : & mut WorkspaceManager ,
5858 request : RenameSymbolRequest ,
5959 ) -> Result < Option < WorkspaceEdit > > {
60+ tracing:: trace!( "Starting rename_symbol: file={:?}, row={}, col={}, new_name={}" ,
61+ request. file_path, request. row, request. column, request. new_name) ;
62+
6063 // Ensure initialized
6164 if !workspace_manager. is_initialized ( ) {
65+ tracing:: trace!( "Workspace not initialized, initializing..." ) ;
6266 workspace_manager. initialize ( ) . await ?;
6367 }
6468
6569 let canonical_path = canonicalize_path ( & request. file_path ) ?;
70+ tracing:: trace!( "Canonical path: {:?}" , canonical_path) ;
71+
6672 let content = std:: fs:: read_to_string ( & canonical_path) ?;
73+ tracing:: trace!( "File content length: {} bytes" , content. len( ) ) ;
74+
6775 self . workspace_service
6876 . open_file ( workspace_manager, & canonical_path, content)
6977 . await ?;
78+ tracing:: trace!( "File opened in workspace" ) ;
7079
7180 let client = workspace_manager
7281 . get_client_for_file ( & canonical_path)
7382 . await ?
7483 . ok_or_else ( || anyhow:: anyhow!( "No language server for file" ) ) ?;
84+ tracing:: trace!( "Got LSP client for file" ) ;
7585
7686 let uri = Url :: from_file_path ( & canonical_path)
7787 . map_err ( |_| anyhow:: anyhow!( "Invalid file path" ) ) ?;
88+ tracing:: trace!( "File URI: {}" , uri) ;
7889
7990 let params = RenameParams {
8091 text_document_position : TextDocumentPositionParams {
81- text_document : TextDocumentIdentifier { uri } ,
82- position : Position {
83- line : request. row ,
84- character : request. column ,
85- } ,
92+ text_document : TextDocumentIdentifier { uri : uri. clone ( ) } ,
93+ position : crate :: utils:: position:: to_lsp_position ( request. row , request. column ) ,
8694 } ,
8795 new_name : request. new_name . clone ( ) ,
8896 work_done_progress_params : Default :: default ( ) ,
8997 } ;
98+ tracing:: trace!( "Sending rename request to LSP: {:?}" , params) ;
9099
91100 let result = client. rename ( params) . await ;
101+ tracing:: trace!( "LSP rename result: {:?}" , result) ;
92102
93103 // Apply edits if not dry_run
94104 if !request. dry_run {
95105 if let Ok ( Some ( ref workspace_edit) ) = result {
106+ tracing:: trace!( "Applying workspace edit (not dry-run)" ) ;
96107 use crate :: utils:: apply_workspace_edit;
97108 if let Err ( e) = apply_workspace_edit ( workspace_edit) {
98109 tracing:: trace!( "Failed to apply workspace edit: {}" , e) ;
99110 }
100111 }
112+ } else {
113+ tracing:: trace!( "Dry-run mode, not applying edits" ) ;
101114 }
102115
103116 result
0 commit comments