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

rope_autoimport doesn't work for neovim #701

Open
fecet opened this issue Jun 28, 2023 · 2 comments
Open

rope_autoimport doesn't work for neovim #701

fecet opened this issue Jun 28, 2023 · 2 comments
Labels
bug Unexpected or incorrect user-visible behavior

Comments

@fecet
Copy link

fecet commented Jun 28, 2023

Some times I can find sqlite3.operationalerror in lsp.log so I guess it's relevant to concurrent behavior. Most cases, it's just doesn't work.

@fecet fecet added the bug Unexpected or incorrect user-visible behavior label Jun 28, 2023
@magnuslarsen
Copy link

magnuslarsen commented Oct 2, 2023

I also cannot get it to work. Relevant issue from the pylsp tracker: python-lsp/python-lsp-server#431

Though I get an error from Rope itself:

> rg rope.plugin ~/.local/state/nvim/
/home/mlar/.local/state/nvim/lsp.log
5515:[ERROR][2023-09-05 08:11:16] .../vim/lsp/rpc.lua:675       "rpc"   "/home/mlar/.local/share/nvim/mason/bin/pylsp"  "stderr"        '2023-09-05 08:11:16,428 CEST - ERROR - pylsp_rope.plugin - Exception when doing workspace/executeCommand: Syntax error in file <string> line <1>: expected an indented block after function definition on line 1\nTraceback (most recent call last):\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/base/pyobjectsdef.py", line 200, in _init_source\n    ast_node = ast.parse(source_bytes, filename=filename)\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/base/ast.py", line 33, in parse\n    return ast.parse(source, filename=filename, *args, **kwargs)\n  File "/usr/lib/python3.10/ast.py", line 50, in parse\n    return compile(source, filename, mode, flags,\n  File "string", line 1\n    def f():\n            ^\nIndentationError: expected an indented block after function definition on line 1\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_rope/plugin.py", line 143, in pylsp_execute_command\n    return commands[command](workspace, **arguments[0])()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_rope/refactoring.py", line 36, in __call__\n    rope_changeset = self.get_changes()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_rope/refactoring.py", line 100, in get_changes\n    rope_changeset = refactoring.get_changes(\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/extract.py", line 82, in get_changes\n    new_contents = _ExtractPerformer(info).extract()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/extract.py", line 287, in extract\n    extract_info = self._collect_info()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/extract.py", line 313, in _collect_info\n    self._find_definition(extract_collector)\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/extract.py", line 387, in _find_definition\n    collector.body_pattern = parts.get_body_pattern()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/extract.py", line 562, in get_body_pattern\n    variables.extend(self._find_temps())\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/extract.py", line 572, in _find_temps\n    return usefunction.find_temps(self.info.project, self._get_body())\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/usefunction.py", line 143, in find_temps\n    pymodule = libutils.get_string_module(project, code)\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/base/libutils.py", line 91, in get_string_module\n    return pyobjectsdef.PyModule(\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/base/pyobjectsdef.py", line 173, in __init__\n    source, node = self._init_source(pycore, source, resource)\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/base/pyobjectsdef.py", line 202, in _init_source\n    raise exceptions.ModuleSyntaxError(filename, e.lineno, e.msg)\nrope.base.exceptions.ModuleSyntaxError: Syntax error in file <string> line <1>: expected an indented block after function definition on line 1\n'
5519:[ERROR][2023-09-05 08:11:26] .../vim/lsp/rpc.lua:675       "rpc"   "/home/mlar/.local/share/nvim/mason/bin/pylsp"  "stderr"        '2023-09-05 08:11:26,424 CEST - ERROR - pylsp_rope.plugin - Exception when doing workspace/executeCommand: Convert local variable to field should be performed on a local variable of a method.\nTraceback (most recent call last):\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_rope/plugin.py", line 143, in pylsp_execute_command\n    return commands[command](workspace, **arguments[0])()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_rope/refactoring.py", line 36, in __call__\n    rope_changeset = self.get_changes()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_rope/refactoring.py", line 306, in get_changes\n    rope_changeset = refactoring.get_changes()\n  File "/home/mlar/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/rope/refactor/localtofield.py", line 16, in get_changes\n    raise exceptions.RefactoringError(\nrope.base.exceptions.RefactoringError: Convert local variable to field should be performed on a local variable of a method.\n'

@lieryan
Copy link
Member

lieryan commented Oct 2, 2023

@magnuslarsen I think you should create a new ticket. @fecet's ticket is about the sqlite3 error, which is not related to the other neovim/pylsp/autoimport-related issue. I'll provide some context on the pylsp ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect user-visible behavior
Projects
None yet
Development

No branches or pull requests

3 participants