Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Duplicate symbols when using list comprehension or isinstance method #539

Description

@d3r3kk

jahan01 commented on Tue Dec 25 2018

When using list comprehension in a method, variables assigned inside the comprehension is listed twice in the symbol list / outline view.

Same happens when isinstance method is used inside a method. Not sure if it is related to same issue as above because it causes all the symbols inside a function scope to be duplicated.

Sample Code:

class Test:
    
    def method(self, arg1, arg2):
        var1 = {}
        var2 = [_value for _key, _value in arg1.items()]
    
    def method2(self, param1, param2):
        test1 = {}
        test2 = []
        if isinstance(test, dict):
            test3 = 1

Note: I have disables jedi, and this happens in microsoft language server. Cannot use jedi right now because, jedi doesnt detect functions with return type annotation specified.

Environment data

  • VS Code version: 1.30
  • Extension version (available under the Extensions sidebar): 2018.12.1
  • OS and version: OSX 10.14.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6 (Conda)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Conda

Expected behaviour

No duplicate symbols

image

Actual behaviour

image

Logs

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

tarting Microsoft Python language server.
##########Linting Output - mypy##########
##########Linting Output - pylint##########
************* Module test_symbols
Microsoft Python Language Server version 0.1.72.0
Initializing for /Users/me/anaconda3/envs/venv/bin/python

Derek Keeler (@d3r3kk) commented on Thu Jan 17 2019

Thanks for the report jahan01, I can reproduce this issue on the latest version of our extension + language server given the information you have provided.

Reproduced in latest insiders against extension version 2018.12.1:

3804_duplicate_outline_symbols

Sample workspace:

Run conda create -n 3804_dup_sym to get a conda environment setup beforehand.

3804_duplicate_symbols.zip

Activity

  1. jakebailey commented on Jan 17, 2019

    @jakebailey
    Member

    #521 changed the way we discover/display symbols. 0.1.77.0 shows the example code as:

    image

    Closing this as fixed. I believe insiders edition should download 0.1.77.0 (or newer) and have this change (at whatever interval the extension checks for updates), as I've already pushed it to the beta channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions