Skip to content
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

Is it possible to recognise regex in bash conditional contexts? #5

Closed
beingmrkenny opened this issue Apr 30, 2020 · 2 comments
Closed

Comments

@beingmrkenny
Copy link

beingmrkenny commented Apr 30, 2020

For example:

if [[ "$firstLine" =~ ^\[[A-Za-z]+-[0-9]+\][[:space:]]+(.*) ]]; then
	blurb=${BASH_REMATCH[1]};
fi

Currently the regex there isn't highlighted.

@beingmrkenny beingmrkenny changed the title Is it possi Is it possible to recognise regex in bash conditional contexts? Apr 30, 2020
@Alhadis Alhadis closed this as completed in 4566501 May 4, 2020
@Alhadis
Copy link
Owner

Alhadis commented May 4, 2020

No, it's not (entirely) possible. Under normal circumstances, it would be; however, Atom now uses this annoying hybrid system where two partly-incompatible parsers are used to highlight source-code. Without going into specifics, there's a feature that both systems have that normally enables me to inject highlighting into unrelated grammars (that is, targeting files that aren't using the Regular Expression or Regular Expression (Extended) grammars). Since Atom introduced its new parsing system, however, that's no longer been an option.

I've added an injection for this, but you'll only see it if you disable Tree Sitter parsers:

Figure 1
(Under SettingsCore → Scroll to the bottom → Uncheck Use Tree Sitter Parsers)

😞 I apologise for the long-winded explanation, but there was no simple "yes/no" answer I could give that was completely accurate/honest.

EDIT: I should add that you may have to disable grammar-selector.hideDuplicateTextMateGrammars in order to select “legacy” grammars in the grammar selector:

Figure 2
(Found under SettingsPackages → Search for grammar-selectorSettings button)

@beingmrkenny
Copy link
Author

Hey thanks for the detailed explanation! Can't tell you how many times the railroad diagram has found an error that would otherwise go unnoticed, so thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants