Skip to content

ES2017 Object rest spread yields "Property assignment expected" validation error when used in JS embedded in HTML #19629

@ronjouch

Description

@ronjouch

This issue is a followup to @zoltanzf in #3804 (comment) saying:

As I see the .vue files are recognized as HTML by vscode, so the HTML syntax need to be extended with object rest/spread support.


Since this fix that landed in version 1.8, Code is fine with using Object rest spread in .js files.

However, in JS-embedded-in-HTML (or in .vue files via all of the extensions supporting it -- I tried vue, Vue Components, Vetur -- EDIT Vetur seems to be fine, see below discussion), a JS validation error Property assignment expected continues to be returned.

  • VSCode Version:
    • Version 1.9.0-insider
    • Commit fcac9b6
    • Date 2017-01-31T01:06:33.637Z
    • Shell 1.4.6
    • Renderer 53.0.2785.143
    • Node 6.5.0
  • OS Version:

Steps to Reproduce:

  1. Create two new files
  2. In the first file, paste this plain JS code and save as .js:
    var obj = { a:1, b: 2 }; var obj2 = { ...obj };
  3. In the second file, paste the code below and save as .html:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script>
        var obj = { a: 1, b: 2 };
        var obj2 = { ...obj };
    </script>
</head>
<body>
</body>
</html>

Expected:

None of the files should yield errors.

Actual

In the second case (js within html), Code's JS validator yields error Property assignment expected. on the var obj2 = { ...obj }; line

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugjavascriptJavaScript support issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions