-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature: rename #14
Comments
Does this also include rename modules (and moving files if necessary)? |
rope alread internally supports moving modules using rename, but I hadn't figured out how moving files work in lsp protocol yet. That should be fairly easy, but I just hadn't got the chance to look at it yet, but yes, once this is implemented, rename should support moving files as well. |
@lieryan any progress on this? Happy to help! |
I have created a work-in-progress PR for this some time ago but had not had the chance to finish it. It was basically just porting the pylsp core's implementation of rope_rename into here. I'm not currently actively working on it so feel free to either pick up the PR and improve on it, or to restart the effort from fresh instead. Mainly the PR hasn't really been tested on how it interacts if rope rename feature is also enabled in pylsp core. Ideally I think there shouldn't be two separate implementation of rope between pylsp core and pylsp-rope, so removing rope support out of core and into pylsp-rope might be something we want to explore in the future, but this will be something that will need to be coordinated with core pylsp maintainers. However, in the mean time, if we implement rename in pylsp-core, it's going to be confusing if the user accidentally enabled two separate implementations of rename rope. I think installing pylsp-rope should probably just force disable pylsp core's rename. There's some thinking that needs to be done to plan such transition, if it's even desirable to merge the implementations. |
This might be a silly question... How should I use the rename file/rename module functionality? For example, if I have two files
a = 1
from .a import a Now, I want to rename I'm not sure how to configure my LSP client for this... For renaming variables, the following configuration works fine: {
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pylsp = {
cmd = { "pylsp", "--verbose", "--log-file", "/tmp/pylsp-log.txt" },
plugins = {
pylsp_rope = { rename = true },
rope_rename = { enabled = false },
jedi_rename = { enabled = false },
},
on_attach = function(client, bufnr)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', { noremap = true, silent = true })
end,
},
},
},
}, However, I'm not sure how to perform a rename file operation. Any guidance would be appreciated. |
The text was updated successfully, but these errors were encountered: