Language-tools: `export let` in plain js script tags breaks syntax highlighting

Created on 18 Jul 2020  ·  5Comments  ·  Source: sveltejs/language-tools

Describe the bug
When adding an export let in plain javascript <script> tag, it breaks the rest of the syntax highlighting:

To Reproduce
Sample:

<script>
  import RightPanel from './RightPanel.svelte'

  export let start
</script>

<!-- a 'comment with dangling apostrophe -->
<RightPanel />
<PressTabHelp />

Expected behavior
The closing </script> tag should be recognized as the end of the javascript section.

Screenshots
image

System (please complete the following information):

  • OS: Mac OS 10.14.6
  • IDE: VSCode
  • Plugin/Package: "Svelte for VSCode" 101.3.0
bug

Most helpful comment

That was it! The Babel Javascript plugin (0.0.29) was the cause. Thanks.

On Sun, Jul 19, 2020 at 12:47 AM Lyu, Wei-Da notifications@github.com
wrote:

Can you try to disable any extension except svelte for vscode and see if
it persist? It might also be any other extension that alters the syntax
highlight.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sveltejs/language-tools/issues/320#issuecomment-660597752,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAABAJCOUP4DSNSFKXPT5DR4KJHNANCNFSM4PANJVLQ
.

All 5 comments

Sorry. I can't reproduce this. Maybe this is an upstream issue, the syntax highlight within script tag was defined to be like "hey IDE, handle js for me". What is your VSCode version?

Hmm, interesting. I wonder what else I could look for. Here is my VS Code version info:

Version: 1.47.0
Commit: d5e9aa0227e057a60c82568bf31c04730dc15dcd
Date: 2020-07-09T08:01:54.115Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 18.7.0

Possible hint: when I use lang="ts" it parses correctly.

Is there a way I can discover what parser/ecmascript version Svelte is handing it off to?

Can you try to disable any extension except svelte for vscode and see if it persist? Or try the same code in js file?
It might also be any other extension that alters the syntax highlight.

That was it! The Babel Javascript plugin (0.0.29) was the cause. Thanks.

On Sun, Jul 19, 2020 at 12:47 AM Lyu, Wei-Da notifications@github.com
wrote:

Can you try to disable any extension except svelte for vscode and see if
it persist? It might also be any other extension that alters the syntax
highlight.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sveltejs/language-tools/issues/320#issuecomment-660597752,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAABAJCOUP4DSNSFKXPT5DR4KJHNANCNFSM4PANJVLQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthewmueller picture matthewmueller  ·  3Comments

baileyherbert picture baileyherbert  ·  3Comments

PatrickG picture PatrickG  ·  3Comments

JAD3N picture JAD3N  ·  5Comments

opensas picture opensas  ·  4Comments