diff --git a/language/syntax/.vscodeignore b/language/syntax/.vscodeignore new file mode 100755 index 00000000000..f369b5e55b6 --- /dev/null +++ b/language/syntax/.vscodeignore @@ -0,0 +1,4 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md diff --git a/language/syntax/CHANGELOG.md b/language/syntax/CHANGELOG.md new file mode 100755 index 00000000000..dd83c085db2 --- /dev/null +++ b/language/syntax/CHANGELOG.md @@ -0,0 +1,9 @@ +# Change Log + +All notable changes to the "rudder-language" extension will be documented in this file. + +Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. + +## [Unreleased] + +- Initial release \ No newline at end of file diff --git a/language/syntax/README.md b/language/syntax/README.md new file mode 100755 index 00000000000..dc0b17a64af --- /dev/null +++ b/language/syntax/README.md @@ -0,0 +1,65 @@ +# rudder-language README + +This is the README for your extension "rudder-language". After writing up a brief description, we recommend including the following sections. + +## Features + +Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. + +For example if there is an image subfolder under your extension project workspace: + +\!\[feature X\]\(images/feature-x.png\) + +> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. + +## Requirements + +If you have any requirements or dependencies, add a section describing those and how to install and configure them. + +## Extension Settings + +Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. + +For example: + +This extension contributes the following settings: + +* `myExtension.enable`: enable/disable this extension +* `myExtension.thing`: set to `blah` to do something + +## Known Issues + +Calling out known issues can help limit users opening duplicate issues against your extension. + +## Release Notes + +Users appreciate release notes as you update your extension. + +### 1.0.0 + +Initial release of ... + +### 1.0.1 + +Fixed issue #. + +### 1.1.0 + +Added features X, Y, and Z. + +----------------------------------------------------------------------------------------------------------- + +## Working with Markdown + +**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: + +* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux) +* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux) +* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets + +### For more information + +* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) +* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) + +**Enjoy!** diff --git a/language/syntax/language-configuration.json b/language/syntax/language-configuration.json new file mode 100755 index 00000000000..0714e6e4c34 --- /dev/null +++ b/language/syntax/language-configuration.json @@ -0,0 +1,67 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": "#" + }, + // symbols used as brackets + "brackets": [ + [ + "{", + "}" + ], + [ + "[", + "]" + ], + [ + "(", + ")" + ] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + [ + "{", + "}" + ], + [ + "[", + "]" + ], + [ + "(", + ")" + ], + [ + "\"", + "\"" + ], + [ + "'", + "'" + ] + ], + // symbols that can be used to surround a selection + "surroundingPairs": [ + [ + "{", + "}" + ], + [ + "[", + "]" + ], + [ + "(", + ")" + ], + [ + "\"", + "\"" + ], + [ + "'", + "'" + ] + ] +} \ No newline at end of file diff --git a/language/syntax/package.json b/language/syntax/package.json new file mode 100755 index 00000000000..ad99857dc4e --- /dev/null +++ b/language/syntax/package.json @@ -0,0 +1,34 @@ +{ + "name": "rudder-language", + "displayName": "Rudder Language", + "description": "Rudder configuration language support", + "version": "0.0.1", + "engines": { + "vscode": "^1.47.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [ + { + "id": "rudder-language", + "aliases": [ + "Rudder", + "rudder-language" + ], + "extensions": [ + ".rl" + ], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "rudder-language", + "scopeName": "source.rudder-language", + "path": "./syntaxes/rudder-language.tmLanguage.json" + } + ] + } +} \ No newline at end of file diff --git a/language/syntax/syntaxes/rudder-language.tmLanguage.json b/language/syntax/syntaxes/rudder-language.tmLanguage.json new file mode 100755 index 00000000000..03cc6aa8576 --- /dev/null +++ b/language/syntax/syntaxes/rudder-language.tmLanguage.json @@ -0,0 +1,152 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Rudder", + "fileTypes": [ + "rl" + ], + "foldingStartMarker": "\\{\\s*$", + "foldingStopMarker": "^\\s*\\}", + "patterns": [ + { + "include": "#keywords" + }, + { + "include": "#strings" + }, + { + "include": "#comment" + }, + { + "include": "#metadata" + }, + { + "include": "#state" + }, + { + "include": "#resource" + } + ], + "repository": { + "comment": { + "captures": { + "1": { + "name": "comment.line.number-sign.rudder-language" + }, + "2": { + "name": "punctuation.definition.comment.rudder-language" + } + }, + "match": "\\s*((#).*)$" + }, + "condition": { + "captures": { + "1": { + "name": "keyword.control.rudder-language" + }, + "2": { + "name": "variable.parameter.rudder-language" + }, + "3": { + "name": "keyword.control.rudder-language" + } + }, + "match": "\\b(if)\\s+(.*)\\s+(=>)" + }, + "resource": { + "captures": { + "0": { + "name": "meta.entity.name.function.rudder-language" + }, + "1": { + "name": "entity.name.type.rudder-language" + }, + "2": { + "name": "entity.name.function.rudder-language" + } + }, + "match": "\\b(resource)\\s+(\\w+)\\s*\\(\\)\\s*" + }, + "metadata": { + "captures": { + "1": { + "name": "comment.line.at.rudder-language" + }, + "2": { + "name": "source.toml.embedded.rudder-language", + "patterns": [ + { + "include": "source.toml" + } + ] + } + }, + "match": "\\s*(@)(.*)$", + "include": "source.toml" + }, + "keywords": { + "patterns": [ + { + "name": "keyword.control.rudder-language", + "match": "\\b(if|return|fail|log_info|log_debug|log_warn)\\b" + }, + { + "name": "keyword.operator.rudder-language", + "match": "\\b(=)\\b" + } + ] + }, + "strings": { + "name": "string.quoted.double.rudder-language", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.rudder-language", + "match": "\\\\." + } + ] + }, + "state": { + "beginCaptures": { + "0": { + "name": "meta.entity.name.function.rudder-language" + }, + "1": { + "name": "entity.name.function.rudder-language" + }, + "2": { + "name": "entity.name.type.rudder-language" + }, + "3": { + "name": "entity.name.function.rudder-language" + }, + "4": { + "name": "meta.block.start.rudder-language" + } + }, + "endCaptures": { + "0": { + "name": "meta.block.end.rudder-language" + } + }, + "begin": "\\s*(\\w+)\\s*(state)\\s*(\\w+)\\s*\\(\\)\\s*({)", + "end": "}", + "contentName": "meta.function", + "patterns": [ + { + "include": "#metadata" + }, + { + "include": "#comment" + }, + { + "include": "#condition" + }, + { + "include": "#keywords" + } + ] + } + }, + "scopeName": "source.rudder-language" +} \ No newline at end of file diff --git a/language/syntax/vsc-extension-quickstart.md b/language/syntax/vsc-extension-quickstart.md new file mode 100755 index 00000000000..e3cac1990a0 --- /dev/null +++ b/language/syntax/vsc-extension-quickstart.md @@ -0,0 +1,29 @@ +# Welcome to your VS Code Extension + +## What's in the folder + +* This folder contains all of the files necessary for your extension. +* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension. +* `syntaxes/rudder-language.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization. +* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets. + +## Get up and running straight away + +* Make sure the language configuration settings in `language-configuration.json` are accurate. +* Press `F5` to open a new window with your extension loaded. +* Create a new file with a file name suffix matching your language. +* Verify that syntax highlighting works and that the language configuration settings are working. + +## Make changes + +* You can relaunch the extension from the debug toolbar after making changes to the files listed above. +* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. + +## Add more language features + +* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs + +## Install your extension + +* To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. +* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.