Skip to content

Language server not recognising True or False as builtins #3274

Closed

Description

@jarshwah

Environment data

  • VS Code version: 1.28.2
  • Extension version (available under the Extensions sidebar): 2018.10.0
  • OS and version: OSX
  • Python version (& distribution if applicable, e.g. Anaconda): python2.7 pyenv
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pyenv virtualenv

Language Server: Microsoft Python Language Server version 0.1.60.0 (from startup logs)

Actual behavior

False and True are now being marked as use before defined, suggesting they're no longer recognised as built ins.

false-undefined

Expected behavior

The poor booleans are not targeted as being issues.

Steps to reproduce:

See screenshot above.

Activity

  1. DonJayamanne commented on Nov 12, 2018

    @DonJayamanne

    Interesting, I cannot replicate this at my end.
    Are you able to replicate this consistently?

  2. joelhock commented on Nov 13, 2018

    @joelhock

    i have the same issue; even a simple test case like this triggers it:

    if True:
        print "hi"

    VS Code version: 1.28.2 and 1.29.0
    Extension version (available under the Extensions sidebar): 2018.10.0
    OS and version: OSX 10.14
    Python version (& distribution if applicable, e.g. Anaconda): python 2.7.15 from homebrew
    Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
    Language Server: Microsoft Python Language Server version 0.1.60.0 (from startup logs)

  3. jakebailey commented on Nov 13, 2018

    @jakebailey
    Member

    I can make this happen on my machine, but only once, then it goes away for all files. I'll look into this upstream (and keep discussion there).

  4. DonJayamanne commented on Nov 14, 2018

    @DonJayamanne

    This issue was moved to microsoft/python-language-server#394

  5. jarshwah commented on Nov 15, 2018

    @jarshwah
    Author

    I can no longer replicate this issue within the same project for what it's worth.

  6. jakebailey commented on Nov 15, 2018

    @jakebailey
    Member

    I can't either, unfortunately. Making it very hard to track down...

  7. jarshwah commented on Nov 18, 2018

    @jarshwah
    Author

    Ok, I have been able to replicate this in my python 2.7 project.

    When the project is first opened everything is fine. I notice that once the project has finished being analysed I see the underlining of True/False with use before def error.

    I'm not sure if the warning is shown some time before analysis is completed though - as it takes about 10 minutes on my project and watching a single value for that long is tricky.

  8. mikew commented on Nov 19, 2018

    @mikew

    Same here:

    screen shot 2018-11-19 at 12 29 34 pm

  9. zbyszek-matuszewski commented on Nov 22, 2018

    @zbyszek-matuszewski

    I also see this problem.

    VS Code version: 1.26.1
    Extension version: 2018.10.1
    OS and version: Ubuntu Linux 17.10, 64-bit
    Python version: 2.7.14 and 3.6.6
    Language Server: Microsoft Python Language Server version 0.1.60.0

  10. crucialfelix commented on Nov 26, 2018

    @crucialfelix

    I have had it consistently for many weeks.

    • VS Code Version 1.29.1 (1.29.1)
    • Python (microsoft) extension 2018.10.1
    • Python 2.7.10 64-bit
    • Microsoft Python Language Server version 0.1.60.0
    • OSX
    • Python Extension Pack 1.4.0 (includes Magic Python syntax highlighting)

    and ... just deactivated Python Extension Pack and the bug is gone. I think it was linter vs linter.

    EDIT: I spoke too soon. I have disabled Python Extension Pack but the selected language mode still shows as "Magic Python"

    pylint is currently not enabled and I'm getting a dialog advising me to activate it.

    I still have many:

    ⚠️[Python] 'True' used before definition [use-before-def]

    Visual Studio IntelliCode - Preview is on.
    visualstudioexptteam.vscodeintellicode
    Preview

    No other python extensions enabled.

  11. bennettandrews commented on Nov 29, 2018

    @bennettandrews

    screen shot 2018-11-29 at 11 20 43 am

    • VS Code Version 1.29.1
    • Python (ms-python.python) 2018.10.1
    • Python 2.7.10 64-bit
    • OSX

    settings.json

    {
        "python.linting.enabled": true,
        "python.linting.mypyEnabled": false,
        "python.linting.flake8Enabled": true,
        "python.linting.pylintEnabled": false,
    }
    
  12. Evanlec commented on Dec 3, 2018

    @Evanlec

    I have this issue as well, amongst other random/erroneous things that Python linter reports as being used before definition. (tuple built-in type for example)

  13. jakebailey commented on Dec 3, 2018

    @jakebailey
    Member

    This is an upstream issue with the language server. If you have issues with True/False beign reported as use-before-def, we'd appreciate it if you could report it in microsoft/python-language-server#391, or create a new issue if it's detecting something other than True/False as use-before-def.

    I've been attempting to reproduce this for the past few weeks without any luck, so if you can make it happen consistently in some setup, I'd appreciate knowing (again, in the other repo's issue tracker).

  14. brettcannon commented on Jul 8, 2019

    @brettcannon
    Member

    Fixed upstream.

  15. locked as resolved and limited conversation to collaborators on Jul 15, 2019
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

    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions