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

no intelliSense for python namedtuple #2377

Closed
chen19901225 opened this issue Aug 11, 2018 · 7 comments
Closed

no intelliSense for python namedtuple #2377

chen19901225 opened this issue Aug 11, 2018 · 7 comments
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@chen19901225
Copy link

chen19901225 commented Aug 11, 2018

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
@chen19901225 chen19901225 changed the title no intelliSense for python regular expression: re no intelliSense for python namedtuple Aug 11, 2018
@purpleP
Copy link

purpleP commented Aug 12, 2018

@chen19901225 This was discussed in my issue #2259

@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. needs verification labels Aug 13, 2018
@brettcannon brettcannon added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Aug 13, 2018
@brettcannon
Copy link
Member

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

@purpleP
Copy link

purpleP commented Aug 13, 2018

@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?

@MikhailArkhipov
Copy link

@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.

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug needs PR and removed needs decision feature-request Request for new features or functionality labels Aug 14, 2018
@DonJayamanne
Copy link

DonJayamanne commented Aug 14, 2018

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.

@louisabraham
Copy link

Hi, I have this issue as well.

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

@luabud
Copy link
Member

luabud commented Sep 11, 2019

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

@luabud luabud closed this as completed Sep 11, 2019
@ghost ghost removed the needs PR label Sep 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 18, 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

8 participants