Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose a lua API or ex commands for renaming without nvim-tree? #13

Open
IndianBoy42 opened this issue May 24, 2023 · 7 comments
Open

Comments

@IndianBoy42
Copy link

No description provided.

@chrisgrieser
Copy link

Also came here for this. I don't use a file tree plugin at all and installing one just for the LSP renaming operation feels a bit bad

@antosha417
Copy link
Owner

Yeah, I totally agree. Would be a great addition to the plugin. @IndianBoy42 how would you like the api to look like?

I think for now you can just call this function before moving the files around.
https://github.com/antosha417/nvim-lsp-file-operations/blob/master/lua/lsp-file-operations/will-rename.lua#L23-L38

require('lsp-file-operations.will-rename').callback({old_name: "path/to/file", new_name: "new/path/to/file"})

@chrisgrieser
Copy link

chrisgrieser commented May 24, 2023

for the API, something like these seems fine to me?

require('lsp-file-operations').rename({ old_name = "foo", new_name = "bar"})

edit: old_name should be optional, defaulting to the current file

@antosha417
Copy link
Owner

antosha417 commented May 30, 2023

@chrisgrieser, do you want it to actually move the files? after calling callback

There should also be a way of specifying which callback you want to call. Right now we have only will-rename but lsp spec supports others. Like did-rename. Or should we call all of them?

@antosha417
Copy link
Owner

I don't have a lot of time to work on this for now. You can try it in your local config and open a pr if you want. I'll happily merge it

@bugabinga
Copy link

@chrisgrieser are you planning to integrate this into genghis wink wink ? :)

@chrisgrieser
Copy link

@bugabinga No, but I'll gladly accept a PR if someone would wink wink :)

bugabinga added a commit to bugabinga/nvim-genghis that referenced this issue Sep 30, 2023
This commit calls a callback in the `nvim-lsp-file-operations` plugin,
if available.
<antosha417/nvim-lsp-file-operations#13>
The affacted file operations are "rename" and "move-rename".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants