`shellsession` language not highlighting first command
sventec opened this issue · comments
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
When using the syntax highlighter shellsession
, the first bash command on the line is inconsistently formatted, compared to subsequent commands. This can be seen directly in the Playground by using a command such as:
user@test$ echo -n $EDITOR | grep -E "vim"
As seen in this screenshot, grep
and -E
are stylized, while cat
and -n
are not:
Here is another example with ;
instead of |
:
Reproduction
Type a compound command with e.g. |
or ;
using the shellsession
language in the Playground
Contributes
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests
For more context, here is the Playground highlighting the examples from above using the shell
grammar. This is what seems to be referenced in tm-grammars as the grammar to use for everything after the $
in shellsession
.
As can be seen, the syntax highlighting doesn't match with the highlighting after $
in shellsession
.
I have the same issue. Using console.log()
to output token
in tokenizeWithTheme()
function, I found that the code was not tokenized correctly. I'm not familiar with this project, but it seems like a bug in the grammar file or its loading process or vscode-textmate.
{ content: 'user@test$', offset: 0, color: '#569CD6', fontStyle: 0 }
{ content: ' echo -n ', offset: 10, color: '#CCCCCC', fontStyle: 0 }
{ content: '$EDITOR', offset: 19, color: '#9CDCFE', fontStyle: 0 }
{ content: ' ', offset: 26, color: '#CCCCCC', fontStyle: 0 }
{ content: '|', offset: 27, color: '#D4D4D4', fontStyle: 0 }
{ content: ' ', offset: 28, color: '#CCCCCC', fontStyle: 0 }
{ content: 'grep', offset: 29, color: '#DCDCAA', fontStyle: 0 }
{ content: ' ', offset: 33, color: '#CCCCCC', fontStyle: 0 }
{ content: '-E', offset: 34, color: '#569CD6', fontStyle: 0 }
{ content: ' ', offset: 36, color: '#CCCCCC', fontStyle: 0 }
{ content: '"vim"', offset: 37, color: '#CE9178', fontStyle: 0 }
Thanks for investigating @Robot-Inventor! In that case it's a grammar issue but not Shiki's, please report upstream. Once it get fixed upstream, Shiki will sync them back automatically.