-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(vue): update Vue grammar #5
Conversation
fccb31f
to
11a0bae
Compare
I’m seeing an increase in requests to other grammars from this change. Without it, setting up the |
11a0bae
to
a2a7c9a
Compare
I’ve seen this issue happen locally as well, with the grammar file not being cached by a service worker. It looks like parsing the XML grammar can be a bit flaky. |
ce7c93b
to
873e022
Compare
The issue with the failing XML grammar is reported as a semi-frequent issue by VueSchools. We should address it even if we don't have a perfect solution, perf-wise. I did a bunch of tests on why the updated Vue grammar would trigger more HTTP requests, and it boils down to its support of embedded languages, including The extra requests I’m seeing is mostly from the reference to the I also confirmed that if the project has any Still, I took the liberty to remove a few patterns for embedded languages from
The popularity of these patterns in the wild seemed quite low, and our previous grammar didn't support most of them anyway, so we can try not matching them to limit requests in projects which don't have |
We've had some reports by the Nuxt team and a few users that our Vue syntax highlighting fails at times. We have not been able to replicate the issue, but for the Nuxt team report at least it seemed linked to a couple things:
vue.tmLanguage
file (XML) failed to parse correctly.It's likely that this might be a glitch in how that file was served sometime around August and then cached by the user's service worker, and not necessarily a syntax issue in the file itself. So any update that increments the
@blitz/textmate
version that we use in URLs when fetching grammars would invalide the service worker cache and probably resolve this issue.But I’m also a bit wary of using the XML PLIST format, because it seems a bit more prone to parse errors by our TextMate grammar implementation than JSON.
And the
vue.tmLanguage
file we're using currently is 2 years old, so I suspect it might be missing support for a few Vue template syntax features by now.For all those reasons, I propose updating our Vue language syntax to a recent
vue.tmLanguage.json
sourced from https://github.com/vuejs/language-tools/blob/master/extensions/vscode/syntaxes/vue.tmLanguage.json