-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Add support for more complex command prompts #583
Add support for more complex command prompts #583
Conversation
The bashsession lexer did only recognized command prompts starting with one of the characters '#$%>'. This commit adds support for a prefixed block of the form [.*], which is a common layout for command prompts.
Can you add a test for this please? See lexers/README for details. |
The command output is highlighted by the bash lexer. eg. if you use |
To avoid false positives, the regex to detect a command prompt was made more restrictive. It now enforces an '@' character within a [...] block and only allows one optional space before the prompt special character.
Leading spaces within a command were simply ignored by the bashsession lexer. This is now changed and the spaces are assigned to the Text group.
Added a few test cases to test the detection of [...] blocks in front of command prompts.
Sorry I misread, I see you were referring to output. It's up to the theme what to do with the tokens and I think |
Thanks! |
Added test cases as requested. Concerning the highlighting of the command output: I actually mean the output of the command, not the command itself (e.g. just the Is there any reason why certain themes do not add colors to specific syntax groups? Would it make sense to add a default color in these themes or is that not desired? |
The bashsession lexer did only recognize command prompts starting with
one of the characters
#$%>
. This commit adds support for a prefixedblock of the form
[.*]
, which is a common layout for command prompts.The highlighting could accidentally trigger on text starting with something like
[+] $
but I guess this is okay. To make it more restrictive, one could also thing about removing the spaces between the last closing bracket and the special prompt character#$%>
. If this is desired, I could change it.Furthermore, one could also think about changing the highlighting of the command output. The current highlighting for the command output is
GenericOutput
, which seems to leave the output just in ordinary text color. This makes it hard to distinguish from surrounding text. Maybe it would be better to choose a dedicated highlighting for that, as it is done by GitHub:However, I'm not familiar with your default styles and themes and not sure which highlighting option would be the best. If you have a suggestion, just mention it and I will add it to this PR :)
Best regards,
Tobias