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

Make a tutorial/user guide doing various refactoring #18

Open
lieryan opened this issue Nov 30, 2022 · 3 comments
Open

Make a tutorial/user guide doing various refactoring #18

lieryan opened this issue Nov 30, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed

Comments

@lieryan
Copy link
Member

lieryan commented Nov 30, 2022

Probably some sort of video or asciinema terminal session showing what to select for triggering various actions and some of the LSP-specific quirks.

@lieryan lieryan added documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed labels Nov 30, 2022
@avario-cpu
Copy link

avario-cpu commented Sep 27, 2024

I have been interested in trying to use this for weeks but I literally don't have the slighest clue how to perform ANY refactoring action WHATSOEVER .... 😅

@lieryan
Copy link
Member Author

lieryan commented Sep 27, 2024

@avario-cpu which IDE/text editor are you using? pylsp-rope is a plugin for the pylsp language server, a large part of how to use pylsp-rope in practice will be highly dependant on the client-side component, which is part of the IDE/editor you are using.

Currently, I've got the most documentation and demo for Vim and Neovim since that's what I use, but if you're using other editors that supports LSP, you'll want to look into how to trigger LSP-based actions in those editor. To be more specific, the Code Action and Rename action are the two features that pylsp-rope currently provides implementations for.

@avario-cpu
Copy link

avario-cpu commented Sep 27, 2024

Im using nvim. I'm in the process of switching from native lsp to coc right now to try and test the features, because you seem to recommand it over native. So far the only feature I've been able to use with native is the renaming of a module i.e.: from a.b.c.module import CONSTANT to from a.b.c.new_module_name import CONSTANT using vim.lsp.buf.rename, which did adjust import statements but did not perform any filewise refactoring on the module name itself.

(When I say "only" feature: I'm not really instered in the simpler variable/param/attr renaming. I'm looking into mostly module/package refactoring, extraction and eventual others tools I might not be accustomed to using right now)

EDIT: Cannot get this to work with CoC either, at all, cannot even perform the import statement renaming this time. And I'm at a loss when it comes to knowing wether my configuration is correct or not... I cannot find a single block of code/screenshot showing what the most basic configuration to be able to do this should look like.

This configuration setup does not seem sufficient, if the point is supposed to be using the lsp basic rename function, so here `coc-rename` (Again, don't really know if that's the case... ):
{
  "languageserver": {
    "python": {
      "command": "python3",
      "args": [
        "-mpylsp"
      ],
      "trace.server": "verbose",
      "filetypes": ["python"],
      "settings": {
        "pylsp": {
          "enable": true,
          "trace": { "server": "verbose" },
          "commandPath": "/pylsp-venv/bin/python",
          "configurationSources": ["flake8"],
          "plugins": {
            "jedi_rename": { "enabled": false },
            "rope_rename": { "enabled": false },
            "pylsp_rope": { "enabled": true }
            // tried also with: "pylsp_rope": { "rename": { "enabled": true } }},
            // and with "pylsp_rope": { "rename": true },
          }
        }
      }
    }
  }
}

Will try vim-lsp to be thourough and as that seems to be the one you're using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants