Closed Robot-Inventor closed 8 months ago
Thanks for your effort in investigating and reporting. Unfortunately, neither of the options seems considerable to me. I think it's easier for Shiki to align with VS Code as much as possible (so we could count on the VS Code team to make sure the grammars are up to date and well maintained).
It would be hard to take immediate action about grammar on our side, as Shiki is about the highlighter, and we can't take care of all grammar for different languages.
I suggest you forget about the grammars Shiki has builtin for a moment. Instead you could provide your own grammars as documented https://shiki.style/guide/load-lang, to use another grammar one or fork your own - until VS Code fixes it and get synced down to Shiki.
Thank you.
Thank you for your kind response. I will use custom grammar.
For others who are interested in this issue: I created a project that automatically patches the VS Code grammar to generate a custom grammar for shellsession. If you need it, you can use it from here: https://github.com/Robot-Inventor/shell-session-syntax/
This issue is related to a problem with the first command in
shellsession
not being highlighted correctly (https://github.com/shikijs/shiki/issues/616)I reported the above issue upstream (https://github.com/jeff-hykin/better-shell-syntax/issues/79) and found that fixing this issue requires action in this repository, so here I am.
First, from a maintenance standpoint, I was told that it would be difficult to update the
shellscript
grammar to fix the issue. Also, the originalshellsession
grammar assumes that the grammar file in linguist is used to parseshellscript
, notbetter-shell-syntax
used in VS Code. If linguist is used to parseshellscript
,shellsession
will work correctly.Therefore, there are two ways to fix this issue.
better-shell-syntax
as theshellscript
grammarbetter-shell-syntax
andshellscript
grammars and modify eachI have confirmed that both options will fix the issue. The easiest to work with is option 1, but the possibility of breaking compatibility with other grammars cannot be ruled out. I would like to hear your opinion on this matter.
PS: It seems that only a very few commands are highlighted when linguist is used. Therefore, option 2 may be better if you do not consider the hassle.