Skip to content

no intelliSense for python namedtuple #2377

Closed

Description

@chen19901225

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): python2018.7.1
  • OS and version: windows10
  • Python version (& distribution if applicable, e.g. Anaconda): python3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A

with config "python.jediEnabled": false

Actual behavior

from collections import namedtuple
RequestStartLine = namedtuple("RequestStartLine", "method path version".split())
start_line = RequestStartLine("GET", "/query", "HTTP/1.1")
print(start_line)
start_line.  # <- no suggestion

Activity

  1. changed the title [-]no intelliSense for python regular expression: re[/-] [+]no intelliSense for python namedtuple[/+] on Aug 11, 2018
  2. purpleP commented on Aug 12, 2018

    @purpleP

    chen19901225 This was discussed in my issue #2259

  3. added
    feature-requestRequest for new features or functionality
    and removed
    bugIssue identified by VS Code Team member as probable bug
    on Aug 13, 2018
  4. brettcannon commented on Aug 13, 2018

    @brettcannon
    Member

    It should be noted that supporting namedtuple for IntelliSense requires special handling due to how the module dynamically generates code.

  5. purpleP commented on Aug 13, 2018

    @purpleP

    Brett Cannon (@brettcannon) well, there's eval in namedtuple but it's harmless. If you're simulating code execution why exactly you can't simulate that eval also? You know, I get why pycharm haven't had namedtuple autocompletion for a long time. They only use static analysis, so they really have to use special handling here otherwise they would need basically emulate the whole interpreter to understand what this eval will do at runtime. But you claim that you have some simulation going on. So maybe you could just simulate code execution for namedtuple and inspect its output?

  6. MikhailArkhipov commented on Aug 13, 2018

    @MikhailArkhipov

    purpleP - code in libraries goes through lighter weight evaluation (as compared to user code) since otherwise performance suffers. In VS there used to be long process of building the library database. BTW, PyCharm does eval too ('building index...') but it also has a number of pre-cooked modules/heuristics for some common things.

    We just need to improve the eval.

  7. DonJayamanne commented on Aug 14, 2018

    @DonJayamanne

    Changing the labels, as this works when using Jedi.
    I.e. if it works in Jedi and not in language server, then its a bug and we should try to fix it in the language server.

  8. louisabraham commented on May 31, 2019

    @louisabraham

    Hi, I have this issue as well.

    Just wanted to remark that typing.NamedTuple should be used instead.

  9. luabud commented on Sep 11, 2019

    @luabud
    Member

    Closing as this isn't an extension issue. If you encounter this problem, please file an issue on the Language Server repo

  10. locked as resolved and limited conversation to collaborators on Sep 18, 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