Skip to content

Javascript syntax highlighting fails with ES6 arrow functions with arguments split over multiple lines, if arguments contain default array or string #499

@mjbvz

Description

@mjbvz

From @bjeanes on August 11, 2017 10:35

  • VSCode Version: Code 1.15.0 (8b95971d8cccd3afd86b35d4a0e098c189294ff2, 2017-08-09T20:06:21.685Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions:
Extension Author (truncated) Version
EditorConfig Edi 0.9.4
beautify Hoo 1.1.1
Ionide-fsharp Ion 2.32.0
vscode-docker Pet 0.0.16
html-css-class-completion Zig 1.8.0
project-manager ale 0.19.0
vscode-database baj 1.2.0
path-intellisense chr 1.4.2
vscode-eslint dba 1.2.11
githistory don 0.2.3
pgsql dou 0.0.8
gitlens eam 4.3.3
crystal-lang fau 0.2.17
auto-close-tag for 0.4.3
haml kar 0.7.2
comment kar 4.0.8
Go luk 0.6.63
vscode-elixir mjm 0.5.1
debugger-for-chrome msj 3.1.7
Ruby reb 0.13.0
RustyCode sav 0.19.1
vscode-parinfer sha 0.6.1
vim vsc 0.9.0
vscode-todo-highlight way 0.5.8
JavaScriptSnippets xab 1.4.1

(2 theme extensions excluded)


Steps to Reproduce:

  1. Just paste this code into a new buffer and configure it to be JavaScript:

    const fn = ({
      arg = [],
    }) => {
      return "This line should be highlighted correctly";
    }
  2. Compare highlighting between:

    1. Code above (incorrect highlighting):
      2017-08-11 at 8 30 pm

    2. Arguments on single line (correct highlighting):
      2017-08-11 at 8 32 pm

    3. No [] or "string" as default argument value (correct highlighting):
      2017-08-11 at 8 33 pm

This example is obviously simplified from where I encountered it. Highlighting resumed midway through my function after a ternary expression (the : specifically). I could replicate the behaviour with either a string or array default value (empty or non-empty did not matter).

Reproduces without extensions: Yes

Copied from original issue: microsoft/vscode#32310

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions