Add README for editor support directory

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
This commit is contained in:
Torin Sandall
2018-03-21 11:15:51 -07:00
parent f5f2b3eaa5
commit eb6c59ec5a
6 changed files with 12 additions and 295 deletions
+12
View File
@@ -0,0 +1,12 @@
# Editor and IDE Support
OPA can be integrated into editors and IDEs to provide features like query
evaluation, policy coverage, and more. This directory contains simple syntax
highlighters for common editors.
## Integrations
| Editor | Link |
| --- | --- |
| Vim | [https://github.com/tsandall/vim-rego](https://github.com/tsandall/vim-rego) |
| Visual Studio Code | [https://github.com/tsandall/vscode-opa](https://github.com/tsandall/vscode-opa) |
-3
View File
@@ -1,3 +0,0 @@
# vim-rego
For the latest version of the vim-rego plugin see https://github.com/tsandall/vim-rego.
-15
View File
@@ -1,15 +0,0 @@
# rego README
This is a visual studio extension for syntax highlighting Rego, the open-policy-agent (OPA) policy language.
## Installation
To install, copy the `rego` folder to the `~/.vscode/extensions` folder and restart Code.
## Auto-generation
You can regenerate this folder by running the `yo` utility
and pointing it at the `../textmate/Rego.tmLanguage` file.
For more details, follow these [instructions](https://code.visualstudio.com/docs/tools/yocode).
Don't forget to copy this file into the result and update it.
@@ -1,22 +0,0 @@
{
"comments": {
"lineComment": "#"
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
]
}
@@ -1,26 +0,0 @@
{
"name": "rego",
"displayName": "rego",
"description": "Syntax highlighter for Rego, the open-policy-agent (OPA) policy language",
"version": "1.0.0",
"publisher": "Open Policy Agent",
"engines": {
"vscode": "^1.5.0"
},
"categories": [
"Languages"
],
"contributes": {
"languages": [{
"id": "rego",
"aliases": ["Rego", "rego"],
"extensions": [".rego"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "rego",
"scopeName": "source.rego",
"path": "./syntaxes/rego.tmLanguage"
}]
}
}
@@ -1,229 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>Rego</string>
</array>
<key>name</key>
<string>Rego</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#comment</string>
</dict>
<dict>
<key>include</key>
<string>#keyword</string>
</dict>
<dict>
<key>include</key>
<string>#operator</string>
</dict>
<dict>
<key>include</key>
<string>#head</string>
</dict>
<dict>
<key>include</key>
<string>#term</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>call</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>support.function.any-method.rego</string>
</dict>
</dict>
<key>match</key>
<string>([a-zA-Z_][a-zA-Z0-9_]*)\(</string>
<key>name</key>
<string>meta.function-call.rego</string>
</dict>
<key>comment</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.rego</string>
</dict>
</dict>
<key>match</key>
<string>(#).*$\n?</string>
<key>name</key>
<string>comment.line.number-sign.rego</string>
</dict>
<key>constant</key>
<dict>
<key>match</key>
<string>\b(?:true|false|null)\b</string>
<key>name</key>
<string>constant.language.rego</string>
</dict>
<key>head</key>
<dict>
<key>begin</key>
<string>^([[:alpha:]_][[:alnum:]_]*)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.function.declaration</string>
</dict>
</dict>
<key>end</key>
<string>(=|{|\n)</string>
<key>name</key>
<string>meta.function.rego</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#term</string>
</dict>
</array>
</dict>
<key>keyword</key>
<dict>
<key>match</key>
<string>(^|\s+)(?:(default|not|package|import|as|with|else))\s+</string>
<key>name</key>
<string>keyword.other.rego</string>
</dict>
<key>number</key>
<dict>
<key>match</key>
<string>(?x: # turn on extended mode
-? # an optional minus
(?:
0 # a zero
| # ...or...
[1-9] # a 1-9 character
\d* # followed by zero or more digits
)
(?:
(?:
\. # a period
\d+ # followed by one or more digits
)?
(?:
[eE] # an e character
[+-]? # followed by an option +/-
\d+ # followed by one or more digits
)? # make exponent optional
)? # make decimal portion optional
)</string>
<key>name</key>
<string>constant.numeric.rego</string>
</dict>
<key>operator</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\=|\!\=|&gt;|&lt;|&lt;\=|&gt;\=|\+|-|\*|%|/|\||&amp;|:\=</string>
<key>name</key>
<string>keyword.operator.comparison.rego</string>
</dict>
</array>
</dict>
<key>string</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.rego</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.rego</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.rego</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?x: # turn on extended mode
\\ # a literal backslash
(?: # ...followed by...
["\\/bfnrt] # one of these characters
| # ...or...
u # a u
[0-9a-fA-F]{4} # and four hex digits
)
)</string>
<key>name</key>
<string>constant.character.escape.rego</string>
</dict>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>invalid.illegal.unrecognized-string-escape.rego</string>
</dict>
</array>
</dict>
<key>term</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#constant</string>
</dict>
<dict>
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#number</string>
</dict>
<dict>
<key>include</key>
<string>#call</string>
</dict>
<dict>
<key>include</key>
<string>#variable</string>
</dict>
</array>
</dict>
<key>variable</key>
<dict>
<key>match</key>
<string>\b[[:alpha:]_][[:alnum:]_]*\b</string>
<key>name</key>
<string>meta.identifier.rego</string>
</dict>
</dict>
<key>scopeName</key>
<string>source.rego</string>
<key>uuid</key>
<string>165D3571-322B-4C57-ABAD-9EB3922FB004</string>
</dict>
</plist>