Skip to content

Python language server didn't work properly when editing '__init__.py' #4226

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

Closed
CamberLoid opened this issue Jan 30, 2019 · 2 comments
Closed
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@CamberLoid
Copy link

CamberLoid commented Jan 30, 2019

Issue Type: Bug

Python language server raised an exception and caused problems when handling this import (modules),(),
After double-checking on my Windows, I am sure this is because of the extra comma in the import expression in __init__.py ,

Using Anaconda distribution. Have not tried to reproduce on other OS.

Environment data

  • Version: 1.30.2 (user setup)
  • Commit: 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
  • Date: 2019-01-07T22:54:13.295Z
  • Electron: 2.0.12
  • Chrome: 61.0.3163.100
  • Node.js: 8.9.3
  • V8: 6.1.534.41
  • OS: Windows_NT x64 10.0.18323

Actual behaviour

Cannot access origin libraries by Ctrl+(Modules), and the exceptions below.
It acts like this

issue

Expected behaviour

Access origin libraries by Ctrl+(Modules)
and no Exceptions

Logs

[Error - 1:18:14 AM] System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.SZArrayHelper.get_Item[T](Int32 index)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.ImportModule(ImportStatement& node, IModule& module, DottedName& moduleImportExpression, NameExpression& asNameExpression)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(ImportStatement node)
   at Microsoft.PythonTools.Parsing.Ast.ImportStatement.Walk(PythonWalker walker)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node)
   at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker)
   at Microsoft.PythonTools.Parsing.Ast.PythonAst.Walk(PythonWalker walker)
   at Microsoft.PythonTools.Analysis.AnalysisUnit.AnalyzeWorker(DDG ddg, CancellationToken cancel)
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Deque`1 queue, CancellationToken cancel, Action`1 reportQueueSize, Int32 reportQueueInterval)
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(CancellationToken cancel)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.GroupAnalysis.Analyze(CancellationToken cancel)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.HandleAnalyzable(IAnalyzable item, AnalysisPriority priority, CancellationToken cancellationToken)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.ConsumerLoop()

Extension version: 2019.1.0
VS Code version: Code 1.30.2 (61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8, 2019-01-07T22:54:13.295Z)
OS version: Windows_NT x64 10.0.18323

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.87GB (9.36GB free)
Process Argv
Screen Reader no
VM 0%
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Jan 30, 2019
@d3r3kk d3r3kk self-assigned this Jan 31, 2019
@d3r3kk d3r3kk added the triage label Jan 31, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jan 31, 2019
@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. upstream-language server and removed triage labels Jan 31, 2019
@d3r3kk d3r3kk removed their assignment Jan 31, 2019
@d3r3kk
Copy link

d3r3kk commented Jan 31, 2019

Verified, here's another gif that might help figure out the issue:

4226_intellisense_exception_on_import_trailing_comma

This is using Microsoft Python Language Server version 0.1.78.0, Miniconda3 on Windows with Python 3.7.2

@CamberLoid
Copy link
Author

Upstream fixed.

@ghost ghost removed the needs upstream fix label Feb 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants