Skip to content

Syntax highlighting in python gets weird when line begins with * #10331

@TansyArron

Description

@TansyArron

I initially reported this in the wrong place. See microsoft/vscode#91456 (comment) for the initial report.

Environment data

  • VS Code version: Code 1.42.0 (ae08d5460b5a45169385ff3fd44208f431992451, 2020-02-06T10:51:33.119Z)
  • Extension version (available under the Extensions sidebar): 2020.2.64397
  • OS and version: Darwin x64 18.7.0
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: NA
  • Relevant/affected Python-related VS Code extensions and their versions: NA
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Jedi
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Syntax highlighting of arguments should look like that below when the line begins with any argument, including *.

Screen Shot 2020-02-25 at 14 33 38

Actual behaviour

When a list of arguments is on more than one line and a * is the first argument on the line, the syntax highlighting gets very odd. Everything on that line is a pale green color.

Screen Shot 2020-02-25 at 14 40 53

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

Everything is fine here:

def my_func(*, foo, bar, baz=True)

Here the middle line turns pale green:

def my_func(
  *, foo, bar, baz=True,
)

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

XXX

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions