Skip to content

syntax: highlight the and/or keywords - #482

Merged
sspaink merged 1 commit into
mainfrom
syntax-highlight-and-or-keywords
Aug 11, 2026
Merged

syntax: highlight the and/or keywords#482
sspaink merged 1 commit into
mainfrom
syntax-highlight-and-or-keywords

Conversation

@sspaink

@sspaink sspaink commented Aug 11, 2026

Copy link
Copy Markdown
Member

Adds highlighting for the new and and or keywords.

Part of open-policy-agent/opa#8999.

The `and` and `or` future keywords were added to OPA in main
(tokens.LogicalAnd / tokens.LogicalOr). Add them to the keyword
pattern so they're highlighted like the other keywords.

They are still gated behind an explicit import plus capabilities, but
a TextMate grammar can't condition on imports, so they're matched
unconditionally as `if`, `every` and `contains` already are.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
@sspaink
sspaink force-pushed the syntax-highlight-and-or-keywords branch from 5381797 to 5567620 Compare August 11, 2026 14:54

@johanfylling johanfylling left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

Comment thread syntaxes/Rego.tmLanguage
<dict>
<key>match</key>
<string>(^|\s+)(?:(default|not|package|import|as|with|else|some|in|every|if|contains))(?=\s|$)</string>
<string>(^|\s+)(?:(default|not|package|import|as|with|else|some|in|every|if|contains|and|or))(?=\s|$)</string>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This'll unconditionally highlight and/or regardless if they're imported or not. However, if that is even remotely complex to accomplish, we can live with it; since this will be part of the v2 syntax in the near future.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be hacky, lets just keep it as-is

@sspaink
sspaink added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit 9291e7c Aug 11, 2026
4 checks passed
@sspaink
sspaink deleted the syntax-highlight-and-or-keywords branch August 11, 2026 15:08
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

Successfully merging this pull request may close these issues.

2 participants