ecode: Added textDocument/rename support ("Rename Symbol Under Cursor").

This commit is contained in:
Martín Lucas Golini
2023-03-13 02:23:00 -03:00
parent de59ee7423
commit 51381a38db
11 changed files with 137 additions and 7 deletions

View File

@@ -186,6 +186,17 @@ void LSPClientServerManager::applyWorkspaceEdit(
} );
}
void LSPClientServerManager::renameSymbol( const URI& uri, const TextPosition& pos,
const std::string& newName ) {
auto* server = getOneLSPClientServer( uri );
if ( !server )
return;
server->documentRename( uri, pos, newName,
[this]( const PluginIDType&, const LSPWorkspaceEdit& edit ) {
applyWorkspaceEdit( edit, []( const auto& ) {} );
} );
}
void LSPClientServerManager::run( const std::shared_ptr<TextDocument>& doc ) {
mThreadPool->run( [&, doc]() { tryRunServer( doc ); } );
}