tht13 / Python-vscode

A Python language pack for Visual Studio Code
MIT License
17 stars 11 forks source link

Syntax highlighting incorrect for methods with type hinting for complex return with this loaded. #27

Open bedge opened 5 years ago

bedge commented 5 years ago

With this extension loaded, the syntax highlighting breaks for methods with a non-scalar type-annotated ret val.

I disabled all extensions one at a time and confirmed that this is the one triggering the behavior.

The problem does not occur with this extension disabled.

VS Code version: Version 1.28.0-insider (1.28.0-insider) vsc python Extension version: 2018.8.0 vsc magicpython Extension version: 1.0.12 vsc Python for VSCode Extension version: 0.2.3 OS and version: MacOS High Sierra 10.13.6 (17G65) Python version (& distribution if applicable, e.g. Anaconda): Virtualenv 3.6 Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv

Expected behavior get_args method comment, and string should be formatted as they are in get_args_no_hints

screen shot 2018-10-02 at 4 50 22 pm

Steps to reproduce: Add type hints to method. The return value of anything other than a simple scalar causes this.

Microsoft/vscode-python#2768 https://github.com/MagicStack/MagicPython/issues/162

thomasmatecki commented 4 years ago

I believe I am having a similar issue, but it occurs for "simple" return types.

This appears to be correctly highlighted:

Screen Shot 2020-08-24 at 7 55 55 PM

... then with a return type annotation, highlight does not appear correct:

Screen Shot 2020-08-24 at 7 56 30 PM
mxmaxime commented 3 years ago

Same issue here, does anyone have a solution for this issue? I've uninstalled the package...

thomasmatecki commented 3 years ago

I haven't dug too far into the weeds on this, but the after disabling the Python for VS Code extension, the issue is gone for me.

It is not obvious to me why this would interfere with syntax highlighting provided by the Python or MagicPython extensions.

zlatko-minev commented 3 years ago

I have a similar issue image

Servot commented 3 years ago

Any updates on this?

vkresch commented 3 years ago

Have similar issue.

ikariwing commented 2 years ago

+1

reporter123 commented 2 years ago

Python for VS Code tries to ship its own syntax highlighting which happens to override syntax files provided by other extensions if they load first. Syntax file in Python for VS Code should be removed or updated to match upstream.

evanstjabadi commented 2 years ago

Thanks, @reporter123 - this just helped me. Disabled the plug in

techfreaque commented 1 year ago

I still have the issue. I disabled all extension and resetted to defaults. Linting doesnt work for imports (local and installed packages) and class methods

reporter123 commented 1 year ago

@techfreaque this bug isn't even about linting and is several years old.

overwenyan commented 5 months ago

Similar issue here. I think the bug is still not fixed. Does it means that VScode dosen't recommend us to use the annotation?

overwenyan commented 5 months ago

Thanks @reporter123. After uninstall the outdated Python for VScode, everything is fixed.