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

Unexpected scopes when grammar is embedded in HTML grammar. #112189

Closed
alexr00 opened this issue Dec 7, 2020 · 5 comments
Closed

Unexpected scopes when grammar is embedded in HTML grammar. #112189

alexr00 opened this issue Dec 7, 2020 · 5 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@alexr00
Copy link
Member

alexr00 commented Dec 7, 2020

TS and JS Grammar Extension version: 0.0.55 / latest

When embedding the grammar in another grammar (HTML) there is unexpected behavior. The scope of the : is odd. The same onclick handler in a js file does not have this problem.

Code

<input type="button" onclick="window.location.href='https://vismaya.us/"

image

Originally from @vismodo in #111394

@sheetalkamat
Copy link
Member

sheetalkamat commented Dec 7, 2020

@mjbvz this seems like vscode issue and not grammar issue.
I dont have permissions to tranfer issue to vscode

@vismodo
Copy link

vismodo commented Dec 8, 2020

If I am not wrong, I think the correct syntax for an input is:

The same happens even with the correct syntax. The https is in a different color too. Only that the = inside the onclick parameter is white in color. I use the default Visual Studio Dark theme with no extension that may affect JavaScript or HTML.

@mjbvz mjbvz self-assigned this Dec 10, 2020
@mjbvz mjbvz transferred this issue from microsoft/TypeScript-TmLanguage Dec 10, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Dec 10, 2020

The string seems to be getting split into two parts: 'http: and then //vismaya. The second part is parsed as a comment

Not sure why this is happening and I haven't been able to repo it in a normal JS file yet

@mjbvz
Copy link
Collaborator

mjbvz commented Dec 10, 2020

@alexr00 I believe this line may be to blame:

"match": "([^\\n\"/]|/(?![/*]))+"

Specifically, the match rule: ([^\\n\"/]|/(?![/*]))+ seems to stop parsing if // appears anywhere in the JS, even inside of a string

@alexr00
Copy link
Member Author

alexr00 commented Dec 30, 2020

Thanks @mjbvz for looking! Marking issue as upstream: textmate/html.tmbundle#113

@alexr00 alexr00 closed this as completed Dec 30, 2020
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream labels Dec 30, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants