mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
Add default keyword to editor plugins
This commit is contained in:
@@ -96,9 +96,11 @@ repository:
|
||||
}
|
||||
]
|
||||
head:
|
||||
begin: "^([[:alpha:]_][[:alnum:]_]*)"
|
||||
begin: "^(default\s+)?([[:alpha:]_][[:alnum:]_]*)"
|
||||
beginCaptures:
|
||||
"1":
|
||||
name: "keyword.control.import.$1.rego"
|
||||
"2":
|
||||
name: "storage.type.function.rego"
|
||||
end: "(=|:-)"
|
||||
name: "meta.function.rego"
|
||||
|
||||
@@ -181,10 +181,15 @@
|
||||
<key>head</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^([[:alpha:]_][[:alnum:]_]*)</string>
|
||||
<string>^(default\s+)?([[:alpha:]_][[:alnum:]_]*)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.control.import.$1.rego</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.type.function.rego</string>
|
||||
|
||||
@@ -11,7 +11,7 @@ endif
|
||||
syn case match
|
||||
|
||||
" language keywords
|
||||
syn keyword regoKeyword package import as not with
|
||||
syn keyword regoKeyword package import as not with default
|
||||
|
||||
" comments
|
||||
syn match regoComment "#.*$" contains=regoTodo,@Spell
|
||||
@@ -29,7 +29,9 @@ syn match regoStringEscape "\\u[0-9a-fA-F]\{4}" contained
|
||||
syn match regoStringEscape "\\[nrfvb\\\"]" contained
|
||||
|
||||
" rule head
|
||||
syn match regoRuleName "^\w\+" nextgroup=regoRuleKey,regoRuleValue skipwhite
|
||||
" TODO: how to match 'default' here but highlight as keyword (and still
|
||||
" highlight rule name as function)?
|
||||
syn match regoRuleName "^\s*\(\w\+\)" nextgroup=regoRuleKey,regoRuleValue skipwhite
|
||||
syn region regoRuleKey start="\[" end="\]" contained skipwhite
|
||||
syn match regoRuleValue "=\w\+" nextgroup=regoIfThen skipwhite
|
||||
|
||||
|
||||
@@ -181,10 +181,15 @@
|
||||
<key>head</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^([[:alpha:]_][[:alnum:]_]*)</string>
|
||||
<string>^(default\s+)?([[:alpha:]_][[:alnum:]_]*)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.control.import.$1.rego</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.type.function.rego</string>
|
||||
|
||||
Reference in New Issue
Block a user