Skip to content

Auto completion doesn't show values of variables whose value is known #813

Closed

Description

Environment data

VS Code version: 1.20.1
Python Extension version: 2018.1.0
Python Version: 2.7.12
OS and version: Ubuntu 16.04.3 amd64

Actual behavior

The auto completion support doesn't show the value of variables whose value is known which the autocomplete-python[-jedi] extensions for Atom does show. (The code in this extension seems copied and modified from it).

Expected behavior

It should show them like the extension for Atom does. The code in completion.py is already there. It's a matter of wiring it up into the VS Code API nicely (It's something the extension for Atom implemented and not a pure stock feature of Jedi).

Showing the values of stuff is done by this bit of code:
https://github.com/Microsoft/vscode-python/blob/fafd0f8888b8d6a9a995b8da4495c8a83d3f9a9e/pythonFiles/completion.py#L60-L70
Called from here:
https://github.com/Microsoft/vscode-python/blob/fafd0f8888b8d6a9a995b8da4495c8a83d3f9a9e/pythonFiles/completion.py#L220

It shows it on the right hand side of a completion suggestion. VS Code is calculating this but than not using this property. Only showing the doc string for the type of the completion which is what we are seeing (I think it might even be getting the doc string by itself rather than relying on Jedi).

Steps to reproduce:

  • Try auto completion for SPA below:
SPAM = 123

SPA

Screenshots

Atom

atom-autocomplete-value

VS Code

vscode-autocomplete-value

P.S. The code throws a bunch of lint warnings from a linter like flake8, and in particular ARGUMENT_RE is not defined for this bit of code:
https://github.com/Microsoft/vscode-python/blob/fafd0f8888b8d6a9a995b8da4495c8a83d3f9a9e/pythonFiles/completion.py#L254-L255
Though it's probably currently unused by this extension.

Originally: #171 (comment)

Mikhail Arkhipov (@MikhailArkhipov)

Activity

  1. DonJayamanne commented on Feb 17, 2018

    @DonJayamanne

    show values of variables whose value

    This isn't a feature that we support today. Even if it were possible it would introduce some complexity in providing these values.

  2. segevfiner commented on Feb 17, 2018

    @segevfiner
    Author

    Don Jayamanne (@DonJayamanne) Are you sure? As I noted, the code for getting the value is already there... (Copied from the Atom extension apparently).

  3. locked as resolved and limited conversation to collaborators on Jul 12, 2018
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.feature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions