-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bat panics on simple Vue file #915
Comments
This happens because we didn't have a syntax for "Stylo" source code, which is included from the Vue syntax when using |
I meet same error with single Vue component file with |
Thank you for reporting this. That's unfortunate. It should be possible to somehow verify that syntaxes do not include broken references when building the binary assets. This might need to be fixed upstream (in |
I don't understand how to reproduce the problem. Can someone please provide a Vue component file with |
I think you can take the one from the first post and replace |
Turns out it was necessary to also change % echo "<template lang='pug'>\n</template>" > /tmp/crash.vue && bat /tmp/crash.vue
[...]
thread 'main' panicked at 'Can only call resolve on linked references: ByScope { scope: <text.pug>, sub_context: None }', [...] |
I've created a PR which will add a new API to syntect for this, but I'm sure it could be improved: trishume/syntect#332 See also #1492 |
Fantastic - thank you! If we implement #1616, we would need to add the necessary "child" syntaxes to further include the Vue syntax, right? |
Yep, that's right :) |
I started work on #1616, and realised the output from syntect wasn't helpful enough, so I created trishume/syntect#338 Linking to this "version" of syntect, now when building assets in
|
What does it take to integrate this into |
A tiny bit of additional code (to print the warnings to the console at asset building time) - I have already made the necessary changes locally, just waiting for a |
Ah, right.
Unfortunately, no. We can do this on |
syntect released on Aug 2: https://github.com/trishume/syntect/releases/tag/v4.6.0 |
Here is a working prototype that should fix this and all other panics in the same family, namely panics caused by attempts to embed syntaxes that are missing: Enselic#52 The proposed solution makes The prototype includes a commit that adjust the Vue syntax regression test to also include a snippet of Pug: <template lang='pug'>
#container.col
p This shall be formated as Plain Text as long as a Pug syntax definition is missing
</template> Current bat crashes in Vue files with the above, but the prototype handles it well (continues to highlight subsequent Vue code as before). Further progress on this currently blocked mostly by trishume/syntect#382 which the If you have any concerns with regards to falling back to |
@sharkdp Nope, Vue still has unresolved syntaxes (
) I am still convinced that my proposed approach to solve it "once and for all" (#915 (comment)) is the right one, but I actually think we should wait with fixing this until after 0.19.0. It is a bit tricky to get the code right in syntect, and trishume seems busy these days, so there is a risk that that work would delay a release several months more in the worst case. |
Understood, thank you. Removed the milestone (which - anyway - was only a suggestion). |
I finally got around polishing the prototype code, and opened a PR with production ready code for syntect that fixes this whole class of bugs: trishume/syntect#427 (Before this is fixed in bat, syntect needs to release 5.0.0 and bat needs to start depending on that release of course, so it might still take a while before this is fixed for bat end-users) |
Closes sharkdp#915 Closes sharkdp#951 Closes sharkdp#1846 Closes sharkdp#1854
When calling
bat
on this Vue fileit panics with:
found with the Python script in #913.
The text was updated successfully, but these errors were encountered: