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

Auto-import attempts to import subpackages from self #646

Closed
dmartin opened this issue Nov 24, 2020 · 2 comments
Closed

Auto-import attempts to import subpackages from self #646

dmartin opened this issue Nov 24, 2020 · 2 comments
Assignees
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@dmartin
Copy link

dmartin commented Nov 24, 2020

Environment data

  • Language Server version: 2020.11.2 (pyright 750a296b)
  • OS and version: macOS 11.0.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5

Expected behaviour

Subpackage auto-imports are added as separate from parent import subpackage statements, as shown in the tooltip. Though I'm actually not sure that it makes sense to suggest them as auto-imports in this case at all 🤔

Actual behaviour

Subpackage auto-imports are added to their own import statement (from subpackage import subpackage)

Logs

Click to expand
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:1 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:1 [found 15 items] (1ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:2 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (1ms)
[FG] completion at /path/to/sample.py:0:2 [found 2 items] (2ms)
[FG] completion at /path/to/sample.py:0:3 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:3 [found 14 items] (5ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (0ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (1ms)
[BG(1)] binding: /path/to/sample.py (0ms)
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   checking: /path/to/sample.py (0ms)
[BG(1)] analyzing: /path/to/sample.py (0ms)
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:6 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:6 [found 6 items] (6ms)
[FG] completion at /path/to/sample.py:0:7 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (1ms)
[FG] completion at /path/to/sample.py:0:7 [found 62 items] (5ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:8 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:8 [found 1 items] (1ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:9 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:9 [found 2 items] (1ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:10 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:10 [found 2 items] (1ms)
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (1ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (1ms)
[BG(1)] binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:14 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:14 [found 24 items] (1ms)
[FG] completion at /path/to/sample.py:0:15 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:15 [found 3 items] (2ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:16 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:16 [found 7 items] (2ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (0ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   parsing: /path/to/sample.py (0ms)
[BG(1)]   binding: /path/to/sample.py (1ms)
[BG(1)]   checking: /path/to/sample.py (0ms)
[BG(1)] analyzing: /path/to/sample.py (1ms)
Background analysis message: resumeAnalysis
Background analysis message: getSemanticTokens
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
[FG] parsing: /path/to/sample.py (0ms)
[FG] binding: /path/to/sample.py (0ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   parsing: /path/to/sample.py (0ms)
[BG(1)]   binding: /path/to/sample.py (0ms)
[BG(1)]   checking: /path/to/sample.py (1ms)
[BG(1)] analyzing: /path/to/sample.py (1ms)
Background analysis message: resumeAnalysis
Background analysis message: getSemanticTokens
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:0:21 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (1ms)
[FG] completion at /path/to/sample.py:0:21 [found 2 items] (1ms)
[FG] completion at /path/to/sample.py:0:22 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:22 [found 1 items] (0ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:23 ...
[FG]   parsing: /path/to/sample.py (0ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:0:23 [found 1 items] (1ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (0ms)
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   checking: /path/to/sample.py (0ms)
[BG(1)] analyzing: /path/to/sample.py (0ms)
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: resumeAnalysis
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   parsing: /path/to/sample.py (1ms)
[BG(1)]   binding: /path/to/sample.py (0ms)
[BG(1)]   checking: /path/to/sample.py (6ms)
[BG(1)] analyzing: /path/to/sample.py (7ms)
Background analysis message: resumeAnalysis
Background analysis message: analyze
Background analysis message: getSemanticTokens
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   parsing: /path/to/sample.py (0ms)
[BG(1)]   binding: /path/to/sample.py (0ms)
[BG(1)]   checking: /path/to/sample.py (7ms)
[BG(1)] analyzing: /path/to/sample.py (7ms)
Background analysis message: resumeAnalysis
Background analysis message: getSemanticTokens
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
[FG] completion at /path/to/sample.py:2:1 ...
[FG]   parsing: /path/to/sample.py (1ms)
[FG]   binding: /path/to/sample.py (0ms)
[FG] completion at /path/to/sample.py:2:1 [found 10 items] (3ms)
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (1ms)
[BG(1)] binding: /path/to/sample.py (0ms)
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   checking: /path/to/sample.py (1ms)
[BG(1)] analyzing: /path/to/sample.py (1ms)
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: getSemanticTokens
[BG(1)] parsing: /path/to/sample.py (0ms)
[BG(1)] binding: /path/to/sample.py (0ms)
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   checking: /path/to/sample.py (0ms)
[BG(1)] analyzing: /path/to/sample.py (0ms)
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: setFileOpened
Background analysis message: markFilesDirty
Background analysis message: analyze
[BG(1)] analyzing: /path/to/sample.py ...
[BG(1)]   parsing: /path/to/sample.py (1ms)
[BG(1)]   binding: /path/to/sample.py (0ms)
[BG(1)]   checking: /path/to/sample.py (4ms)
[BG(1)] analyzing: /path/to/sample.py (5ms)
Background analysis message: resumeAnalysis
Background analysis message: getSemanticTokens
Background analysis message: markFilesDirty
Background analysis message: analyze

Code Snippet / Additional information

python

@judej judej added the needs investigation Could be an issue - needs investigation label Nov 25, 2020
@github-actions github-actions bot removed the triage label Nov 25, 2020
@heejaechang
Copy link
Contributor

I can repo this. will take a look.

@heejaechang heejaechang added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Nov 30, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.12.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020120-2-december-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants