diff --git a/misc/syntax/README.md b/misc/syntax/README.md new file mode 100644 index 0000000000..349043e2f2 --- /dev/null +++ b/misc/syntax/README.md @@ -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) | \ No newline at end of file diff --git a/misc/syntax/vim/README.md b/misc/syntax/vim/README.md deleted file mode 100644 index f9b7f85754..0000000000 --- a/misc/syntax/vim/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# vim-rego - -For the latest version of the vim-rego plugin see https://github.com/tsandall/vim-rego. diff --git a/misc/syntax/visualstudio/rego/README.md b/misc/syntax/visualstudio/rego/README.md deleted file mode 100644 index 6933dae76d..0000000000 --- a/misc/syntax/visualstudio/rego/README.md +++ /dev/null @@ -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. diff --git a/misc/syntax/visualstudio/rego/language-configuration.json b/misc/syntax/visualstudio/rego/language-configuration.json deleted file mode 100644 index da929f3ad0..0000000000 --- a/misc/syntax/visualstudio/rego/language-configuration.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "comments": { - "lineComment": "#" - }, - "brackets": [ - ["{", "}"], - ["[", "]"], - ["(", ")"] - ], - "autoClosingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""] - ], - "surroundingPairs": [ - ["{", "}"], - ["[", "]"], - ["(", ")"], - ["\"", "\""] - ] -} diff --git a/misc/syntax/visualstudio/rego/package.json b/misc/syntax/visualstudio/rego/package.json deleted file mode 100644 index a7d3566f15..0000000000 --- a/misc/syntax/visualstudio/rego/package.json +++ /dev/null @@ -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" - }] - } -} diff --git a/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage b/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage deleted file mode 100644 index 8b0771a5df..0000000000 --- a/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage +++ /dev/null @@ -1,229 +0,0 @@ - - - - - fileTypes - - Rego - - name - Rego - patterns - - - include - #comment - - - include - #keyword - - - include - #operator - - - include - #head - - - include - #term - - - repository - - call - - captures - - 1 - - name - support.function.any-method.rego - - - match - ([a-zA-Z_][a-zA-Z0-9_]*)\( - name - meta.function-call.rego - - comment - - captures - - 1 - - name - punctuation.definition.comment.rego - - - match - (#).*$\n? - name - comment.line.number-sign.rego - - constant - - match - \b(?:true|false|null)\b - name - constant.language.rego - - head - - begin - ^([[:alpha:]_][[:alnum:]_]*) - beginCaptures - - 1 - - name - entity.name.function.declaration - - - end - (=|{|\n) - name - meta.function.rego - patterns - - - include - #term - - - - keyword - - match - (^|\s+)(?:(default|not|package|import|as|with|else))\s+ - name - keyword.other.rego - - number - - match - (?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 - ) - name - constant.numeric.rego - - operator - - patterns - - - match - \=|\!\=|>|<|<\=|>\=|\+|-|\*|%|/|\||&|:\= - name - keyword.operator.comparison.rego - - - - string - - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.rego - - - end - " - endCaptures - - 0 - - name - punctuation.definition.string.end.rego - - - name - string.quoted.double.rego - patterns - - - match - (?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 - ) - ) - name - constant.character.escape.rego - - - match - \\. - name - invalid.illegal.unrecognized-string-escape.rego - - - - term - - patterns - - - include - #constant - - - include - #string - - - include - #number - - - include - #call - - - include - #variable - - - - variable - - match - \b[[:alpha:]_][[:alnum:]_]*\b - name - meta.identifier.rego - - - scopeName - source.rego - uuid - 165D3571-322B-4C57-ABAD-9EB3922FB004 - -