Add default keyword to editor plugins

This commit is contained in:
Torin Sandall
2017-02-02 12:32:50 -08:00
parent 1e1984748e
commit fb9e41ff2b
4 changed files with 19 additions and 5 deletions
@@ -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"
+6 -1
View File
@@ -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>
+4 -2
View File
@@ -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>