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

Renaming plugin is invalid #86

Closed
mel0n0 opened this issue Aug 24, 2022 · 5 comments
Closed

Renaming plugin is invalid #86

mel0n0 opened this issue Aug 24, 2022 · 5 comments

Comments

@mel0n0
Copy link

mel0n0 commented Aug 24, 2022

When I try to modify the function name, after typing the Command Palette LSP:Rename, the status bar prompts that:

Nothing to rename

Before I added the User configuration file, I found the plugin jedi_rename could not be found.

Screen Shot 2022-08-24 at 5 07 07 PM

@rchl
Copy link
Member

rchl commented Aug 26, 2022

I've tried it on a simplest of projects and it seemed to work for me without setting any options.

You should enable log_server and report what you are seeing in the logs. More details at https://lsp.sublimetext.io/troubleshooting/#self-help-instructions.

I've also made an issue with some questions in the pylsp repo: python-lsp/python-lsp-server#255

@mel0n0
Copy link
Author

mel0n0 commented Aug 27, 2022

Yeah, when I comment out that:

// "pylsp.plugins.jedi_rename.enabled": true,

The plugins jedi_rename still works as you mentioned. But it fails, I looked at the log panel and it has a warning that is:

LSP-pylsp: WARNING - pylsp.config.config - Failed to load hook pylsp_rename: '/Users/xxx/test.py' is not in the subpath of '/Applications/Sublime Text.app/Contents/MacOS' OR one path is relative and the other is absolute.

Then I checked my PATH in Sublime Text, it contained the path/usr/local/bin, so I don't know what this warning means.

@rchl
Copy link
Member

rchl commented Aug 27, 2022

This could mean that you are trying to rename file that is not within a project. You should make sure that the project folder is added to the side bar.

You can also run LSP: Troubleshoot server when that file is open and it will tell more info.

@mel0n0
Copy link
Author

mel0n0 commented Aug 27, 2022

Thanks for your reply:-)

Indeed, it is not a project file, and it is a single simple script. After your comment, I enabled Troubleshoot Server, but I can't find any exceptions. The information captured is: Gathered Troubleshoot info

And warnings in the log panel:

:: --> LSP-pylsp textDocument/rename(10): {'newName': 'reqs_by', 'workDoneToken': 'wd10', 'textDocument': {'uri': 'file:///Users/xxx/Desktop/remove_moudle.py'}, 'position': {'line': 41, 'character': 12}}
LSP-pylsp: 2022-08-27 - WARNING - pylsp.config.config - Failed to load hook pylsp_rename: '/Users/xxx/Desktop/remove_moudle.py' is not in the subpath of '/Applications/Sublime Text.app/Contents/MacOS' OR one path is relative and the other is absolute.
:: <<< LSP-pylsp 10: []

I tried to change the name of a variable within a file in my project and it had no problem. So I wonder if it is because of a single file that it can't be renamed?

@rchl
Copy link
Member

rchl commented Aug 27, 2022

I tried to change the name of a variable within a file in my project and it had no problem. So I wonder if it is because of a single file that it can't be renamed?

Yes, pylsp requires the file to be in a workspace folder so you need your file to be in a folder added to the ST sidebar (don't need to save it as a project).

I guess the messaging in pylsp could be clearer and exposed to the user (not only in the logs but in the UI). But that would have to be done in the pylsp repo.

@rchl rchl closed this as completed Aug 27, 2022
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

2 participants