marksman icon indicating copy to clipboard operation
marksman copied to clipboard

Feature request: rename files when using the rename action

Open pacien opened this issue 2 years ago • 3 comments
trafficstars

Currently, the rename action modifies the title of a heading and links referencing it, but the name of the file containing it is left as is.

Would it be possible to have an option (or another distinct code action) to also rename the file as well?

pacien avatar Jan 30 '23 18:01 pacien

I'd imagine it working slightly differently -- you rename a file using your editor's regular 'rename' functionality and Marksman in response adjusts all the references to the renamed file. LSP has hooks for this such as textDocument/willRename and textDocument/didRename and at least in Emacs with lsp-mode these hooks work; I think neovim also handles this properly.

Most of the required functionality is already present in Marksman as part of title rename refactor. Implementing the hooks for file renaming should be straightforward.

artempyanykh avatar Jan 31 '23 20:01 artempyanykh

Support for file rename with hooks in Helix: https://github.com/helix-editor/helix/pull/5531

edrex avatar Feb 15 '23 17:02 edrex

I just found nvim-lsp-file-operations for neovim. Unfortunately, with my lazyvim config it is not working.

codingluke avatar Jan 25 '24 20:01 codingluke

I just found nvim-lsp-file-operations for neovim. Unfortunately, with my lazyvim config it is not working.

FYI, some file explorers such as oil.nvim correctly emit file operations with LSP methods (e.g., "workspace/willRenameFiles").

It would be great to have marksman support LSP file operations.

franco-ruggeri avatar Jul 29 '25 16:07 franco-ruggeri