pylance-release
pylance-release copied to clipboard
Move to symbol fails to move import reference if there's a "from foo import bar" in the destination file
Environment data
- Language Server version: 2024.5.1
- OS and version: win32 x64
- Python version (and distribution if applicable, e.g. Anaconda): 3.12.0, poetry
- python.analysis.indexing: true
- python.analysis.typeCheckingMode: basic
Code Snippet
file1.py:
import os
def myfunc():
return os.path.abspath(__file__)
file2.py:
from sys import version
print(version)
Repro Steps
- Select on myfunc and run the "Move file to..." code action
- Select file2 as the destination file
- Notice how
import osis removed from file1.py, but is not added to file2.py:
If you remove the from sys import version statement, it works as expected.
Logs
2024-06-04 16:31:25.662 [info] (Client) Pylance async client (2024.5.103) started with python extension (2024.7.11511013)
2024-06-04 16:31:31.536 [info] [Info - 4:31:31 PM] (27880) Pylance language server 2024.5.103 (pyright version 1.1.364, commit 0618acc5) starting
2024-06-04 16:31:31.540 [info] [Info - 4:31:31 PM] (27880) Server root directory: file:///c%3A/REDACTED/.vscode/extensions/ms-python.vscode-pylance-2024.5.103/dist
2024-06-04 16:31:31.655 [info] [Info - 4:31:31 PM] (27880) Starting service instance "hibla"
2024-06-04 16:31:32.220 [info] Auto-Indent enabled
2024-06-04 16:31:32.352 [info] Auto-Indent enabled
2024-06-04 16:31:32.365 [info] [Info - 4:31:32 PM] (27880) Setting pythonPath for service "hibla": "C:\REDACTED\Apps\pylance-release\testing\single\.venv\Scripts\python.exe"
2024-06-04 16:31:32.366 [info] [Info - 4:31:32 PM] (27880) Setting environmentName for service "hibla": "3.12.0 (.venv venv)"
2024-06-04 16:31:35.315 [info] [Info - 4:31:35 PM] (27880) Assuming Python version 3.12.0.final.0
2024-06-04 16:31:52.757 [info] [Info - 4:31:52 PM] (27880) Found 3 source files
2024-06-04 16:31:52.776 [info] Auto-Indent enabled
2024-06-04 16:31:54.330 [info] [Info - 4:31:54 PM] (27880) Background analysis(1) root directory: file:///c%3A/REDACTED/.vscode/extensions/ms-python.vscode-pylance-2024.5.103/dist
2024-06-04 16:31:54.330 [info] [Info - 4:31:54 PM] (27880) Background analysis(1) started
2024-06-04 16:31:57.494 [info] [Info - 4:31:57 PM] (27880) [BG(1)] Long operation: analyzing: file:///c%3A/REDACTED/Apps/hibla/home.py (2262ms)
2024-06-04 16:31:57.497 [info] [Info - 4:31:57 PM] (27880) Indexer background runner(2) root directory: file:///c%3A/REDACTED/.vscode/extensions/ms-python.vscode-pylance-2024.5.103/dist (index)
2024-06-04 16:31:57.497 [info] [Info - 4:31:57 PM] (27880) Indexing(2) started
2024-06-04 16:32:04.456 [info] [Info - 4:32:04 PM] (27880) [IDX(2)] Long operation: scan packages file:///c%3A/REDACTED/Apps/hibla (5540ms)
2024-06-04 16:32:04.456 [info] [Info - 4:32:04 PM] (27880) scanned(2) 217 files over 1 exec env
2024-06-04 16:32:07.209 [info] [Info - 4:32:07 PM] (27880) indexed(2) 159 files over 1 exec env
2024-06-04 16:32:07.534 [info] [Info - 4:32:07 PM] (27880) Indexing finished(2).
2024-06-04 16:32:54.443 [info] (Client) Pylance async client (2024.5.1) started with python extension (2024.7.11511013)
2024-06-04 16:32:57.585 [info] [Info - 4:32:57 PM] (3096) Pylance language server 2024.5.1 (pyright version 1.1.360, commit 4bc8428d) starting
2024-06-04 16:32:57.870 [info] [Info - 4:32:57 PM] (3096) Server root directory: file:///c%3A/REDACTED/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist
2024-06-04 16:32:58.025 [info] [Info - 4:32:58 PM] (3096) Starting service instance "hibla"
2024-06-04 16:32:58.034 [info] [Info - 4:32:58 PM] (3096) Auto-Indent enabled
2024-06-04 16:32:58.283 [info] [Info - 4:32:58 PM] (3096) Setting pythonPath for service "hibla": "C:\REDACTED\Apps\pylance-release\testing\single\.venv\Scripts\python.exe"
2024-06-04 16:32:58.286 [info] [Info - 4:32:58 PM] (3096) Setting environmentName for service "hibla": "3.12.0 (.venv venv)"
2024-06-04 16:32:59.348 [info] [Info - 4:32:59 PM] (3096) Assuming Python version 3.12.0.final.0
2024-06-04 16:33:06.546 [info] [Info - 4:33:06 PM] (3096) Found 3 source files
2024-06-04 16:33:07.367 [info] [Info - 4:33:07 PM] (3096) Background analysis(1) root directory: file:///c%3A/REDACTED/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist
2024-06-04 16:33:07.368 [info] [Info - 4:33:07 PM] (3096) Background analysis(1) started
2024-06-04 16:33:08.939 [info] [Info - 4:33:08 PM] (3096) Indexer background runner(2) root directory: file:///c%3A/REDACTED/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist (index)
2024-06-04 16:33:08.940 [info] [Info - 4:33:08 PM] (3096) Indexing(2) started
2024-06-04 16:33:12.844 [info] [Info - 4:33:12 PM] (3096) [IDX(2)] Long operation: scan packages file:///c%3A/REDACTED/Apps/hibla (3148ms)
2024-06-04 16:33:12.844 [info] [Info - 4:33:12 PM] (3096) scanned(2) 217 files over 1 exec env
2024-06-04 16:33:14.672 [info] [Info - 4:33:14 PM] (3096) indexed(2) 159 files over 1 exec env
2024-06-04 16:33:14.803 [info] [Info - 4:33:14 PM] (3096) Indexing finished(2).
2024-06-05 11:17:29.858 [info] [Info - 11:17:29 AM] (3096) Found 4 source files
2024-06-05 11:17:32.967 [info] [Info - 11:17:32 AM] (3096) [FG] Long operation: parsing: file:///c%3A/REDACTED/Apps/hibla/models.py (2114ms)
2024-06-05 11:20:34.630 [info] [Info - 11:20:34 AM] (3096) [BG(1)] Long operation: InlayHints range 0:0 - 2:12 at file:///c%3A/REDACTED/Apps/hibla/models.py (9961ms)
2024-06-05 11:20:48.676 [info] [Info - 11:20:48 AM] (3096) [FG] Long operation: parsing: file:///c%3A/REDACTED/AppData/Local/Temp/pyright-3096-YhxmXUeVYUGT/builtins-3096-vsqSW67E3EUH-.py (2559ms)
2024-06-05 11:20:49.065 [info] [Info - 11:20:49 AM] (3096) [BG(1)] Long operation: InlayHints range 0:0 - 2:12 at file:///c%3A/REDACTED/Apps/hibla/models.py (5465ms)
2024-06-05 11:21:28.746 [info] [Info - 11:21:28 AM] (3096) [BG(1)] Long operation: InlayHints range 0:0 - 7:31 at file:///c%3A/REDACTED/Apps/hibla/hi.py (2240ms)