MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / rename

Method rename

crates/opencode-lsp/src/lib.rs:652–680  ·  view source on GitHub ↗
(
        &self,
        path: &Path,
        line: u32,
        character: u32,
        new_name: &str,
    )

Source from the content-addressed store, hash-verified

650 }
651
652 pub async fn rename(
653 &self,
654 path: &Path,
655 line: u32,
656 character: u32,
657 new_name: &str,
658 ) -> Result<Option<lsp_types::WorkspaceEdit>, LspError> {
659 let uri = path_to_uri(path)?;
660
661 let params = lsp_types::RenameParams {
662 text_document_position: lsp_types::TextDocumentPositionParams {
663 text_document: TextDocumentIdentifier { uri },
664 position: lsp_types::Position { line, character },
665 },
666 new_name: new_name.to_string(),
667 work_done_progress_params: Default::default(),
668 };
669
670 let result = self
671 .request("textDocument/rename", serde_json::to_value(params)?)
672 .await?;
673
674 if result.is_null() {
675 return Ok(None);
676 }
677
678 let edit: lsp_types::WorkspaceEdit = serde_json::from_value(result)?;
679 Ok(Some(edit))
680 }
681
682 pub async fn prepare_call_hierarchy(
683 &self,

Callers 1

execute_with_lspFunction · 0.80

Calls 2

path_to_uriFunction · 0.85
requestMethod · 0.80

Tested by

no test coverage detected