Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] embedded java script grammar doesn't end because of missing semicolon #70614

Open
Ahmed-Elswerky opened this issue Mar 16, 2019 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug html HTML support issues
Milestone

Comments

@Ahmed-Elswerky
Copy link

Ahmed-Elswerky commented Mar 16, 2019

  • VSCode Version: latest
  • OS Version: windows 10

Steps to Reproduce:

1.forget a semi-colon in a script tag in head (not required in JS for every line)
2.press ctrl + /

Does this issue occur when all extensions are disabled?: Yes

@roblourens
Copy link
Member

If your cursor is inside the JS script tag then // is correct. Please explain your issue some more.

@roblourens roblourens added the info-needed Issue requires more information from poster label Mar 16, 2019
@Ahmed-Elswerky
Copy link
Author

the cursor is outside the script tag, html elements being commented by "//" because I forgot a ";" in the single line script tag

@roblourens
Copy link
Member

Can you include a code sample or screenshot or something, I can't reproduce this

@Ahmed-Elswerky
Copy link
Author

image
image

sorry, I thought it could be easily reproduced

so here, when missing a semicolon, the html is commented by //
but when the semicolon is added, the html is commented the right way

@roblourens
Copy link
Member

Ah I see it in that case. I think it will parse the opening < as a JS operator. But probably works in a browser.

@roblourens roblourens removed the info-needed Issue requires more information from poster label Mar 16, 2019
@aeschli
Copy link
Contributor

aeschli commented Mar 27, 2019

We use the grammar to detect embedded ranges, and the HTML grammar embeds the JavaScript grammar which isn't aware that it's embedded.

A fix for textmate/html.tmbundle#85 would fix that

Alternative would be to not use text mate to detect embedded ranges.

Related issue:
#20488

@aeschli aeschli changed the title html commenting by keyboard is adding // [html] embedded java script grammar doesn't end because of missing semicolon Mar 27, 2019
@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label Mar 27, 2019
@aeschli aeschli added this to the Backlog milestone Mar 27, 2019
@aeschli aeschli added the html HTML support issues label Mar 27, 2019
@msftrncs
Copy link

msftrncs commented May 2, 2019

I think that textmate/html.tmbundle#85 will actually be fixed by microsoft/vscode-textmate#85, which I think was released this morning to 4.1.1 of the VS Code TextMate engine. Hopefully we'll see this in insiders tonight and can check it out.

@msftrncs
Copy link

msftrncs commented May 2, 2019

I don't think this issue will be fixed by microsoft/vscode-textmate#85, as I look at this, this specific issue is a limitation of TextMate, which lacks a construct that acts something between the Begin/End rules and the Begin/While rules. Begin/While rules solve a very specific problem, but cannot be used here. We really could use a Begin\Until system. Unlike a Begin\While rule, a Begin\Until rule would capture all the content of the line up to the point the Until pattern matched and process it with the current rule stack, before restoring the stack to the condition it was in before the Begin/Until rule began.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug html HTML support issues
Projects
None yet
Development

No branches or pull requests

4 participants