Describe the Bug
Pyrefly's LSP server implementation only adjusts absolute imports when it gets a renamed-file notification (WillRenameFiles / DidRenameFiles1) from the client, but not relative ones.
To reproduce:
- Create a Python package
pkg/__init__.py with modules pkg/a.py and pkg/b.py.
- Define a function in
a.py:
- Import this function from
b.py:
- In your editor with Pyrefly attached as an LSP server, rename
a.py to a2.py and notice that the import in b.py remains unchanged.
Whereas if you instead have from pkg.a import foo in b.py, the import is updated to say pkg.a2 as it should.
1 Although I think Pyrefly only implements the former
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Note: I tested this in Neovim with neo-tree and nvim-lsp-file-operations, but as it worked fine for absolute imports, it wouldn't make sense for the editor setup to be at fault.
Describe the Bug
Pyrefly's LSP server implementation only adjusts absolute imports when it gets a renamed-file notification (
WillRenameFiles/DidRenameFiles1) from the client, but not relative ones.To reproduce:
pkg/__init__.pywith modulespkg/a.pyandpkg/b.py.a.py:b.py:a.pytoa2.pyand notice that the import inb.pyremains unchanged.Whereas if you instead have
from pkg.a import fooinb.py, the import is updated to saypkg.a2as it should.1 Although I think Pyrefly only implements the former
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Note: I tested this in Neovim with neo-tree and nvim-lsp-file-operations, but as it worked fine for absolute imports, it wouldn't make sense for the editor setup to be at fault.