commit b67e6f481d2f581615f2c92ce820f007468f20c1 Author: Artemy Date: Fri Dec 29 12:32:43 2023 +0300 feat: basic syntax highlighting diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..70e63ff --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Set default behavior to automatically normalize line endings. +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67dfeb3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +*.vsix \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0e191b5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +// A launch configuration that launches the extension inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ] + } + ] +} \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..f369b5e --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,4 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1e921f9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Change Log + +All notable changes to the "symboscript-vs" extension will be documented in this file. + +## [Unreleased] + +- Nothing + +## [0.1.0] - 2023-12-29 + +- Initial release diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4e906a4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Artemy Egorov (artegoser) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..243abc4 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# symboscript-vs README + +This extension adds support for the [Symboscript](https://github.com/symboscript/symboscript) programming language to VS Code. + +## Features + +- Syntax highlighting diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..37c940f Binary files /dev/null and b/icon.png differ diff --git a/language-configuration.json b/language-configuration.json new file mode 100644 index 0000000..fa4c2e6 --- /dev/null +++ b/language-configuration.json @@ -0,0 +1,32 @@ +{ + "comments": { + // symbol used for single line comment. + "lineComment": "#", + // symbols used for start and end a block comment. + "blockComment": ["#/", "/#"] + }, + // symbols used as brackets + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["`", "`"] + ], + // symbols that can be used to surround a selection + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["`", "`"] + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..a7c349e --- /dev/null +++ b/package.json @@ -0,0 +1,41 @@ +{ + "name": "symboscript-vs", + "displayName": "SymboScript-vs", + "description": "Official language support for SymboScrypt", + "version": "0.1.1", + "publisher": "symboscript", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/symboscript/symboscript-vs" + }, + "icon": "icon.png", + "engines": { + "vscode": "^1.85.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [ + { + "id": "symboscript", + "aliases": [ + "SymboScript", + "symboscript" + ], + "extensions": [ + ".syms" + ], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "symboscript", + "scopeName": "source.symboscript", + "path": "./syntaxes/symboscript.tmLanguage.json" + } + ] + } +} diff --git a/syntaxes/symboscript.tmLanguage.json b/syntaxes/symboscript.tmLanguage.json new file mode 100644 index 0000000..24e020a --- /dev/null +++ b/syntaxes/symboscript.tmLanguage.json @@ -0,0 +1,210 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "SymboScript", + "scopeName": "source.symboscript", + "patterns": [ + { "include": "#comment" }, + { "include": "#function" }, + { "include": "#number" }, + { "include": "#keyword" }, + { "include": "#punctuation" }, + { "include": "#string" }, + { "include": "#variables" } + ], + "repository": { + "comment": { + "comment": "Comments", + "patterns": [ + { + "name": "comment.block.doc.symboscript", + "begin": "#/", + "end": "/#" + }, + { + "name": "comment.line.symboscript", + "begin": "#", + "end": "\n" + } + ] + }, + + "function": { + "patterns": [ + { + "comment": "Function call", + "name": "meta.function.call.symboscript", + "match": "([A-Za-z0-9_]+)((\\[))", + "captures": { + "1": { + "name": "entity.name.function.symboscript" + }, + "2": { + "name": "punctuation.brackets.square.symboscript" + } + } + }, + { + "comment": "Function declaration", + "name": "meta.name.function.symboscript", + "match": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\[))", + "captures": { + "1": { + "name": "keyword.other.fn.symboscript" + }, + "2": { + "name": "entity.name.function.symboscript" + }, + "4": { + "name": "punctuation.brackets.square.symboscript" + } + } + } + ] + }, + + "number": { + "comment": "Numbers", + "patterns": [ + { + "name": "constant.numeric.symboscript", + "match": "(\\.|)[0-9]+" + } + ] + }, + + "keyword": { + "patterns": [ + { + "name": "keyword.control.symboscript", + "match": "\\b(if|else|while|for|loop|return|yield|async|await|break|continue|in)\\b" + }, + { + "name": "keyword.other.fn.symboscript", + "match": "\\b(fn)\\b" + }, + { + "name": "keyword.other.let.symboscript", + "match": "\\b(let)\\b" + }, + { + "name": "keyword.other.bool.symboscript", + "match": "\\b(true|false)\\b" + }, + { + "comment": "logical operators", + "name": "keyword.operator.logical.symboscript", + "match": "(\\||\\|\\||&|&&|<<|>>|!)(?!=)" + }, + { + "comment": "assignment operators", + "name": "keyword.operator.assignment.symboscript", + "match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)" + }, + { + "comment": "single equal", + "name": "keyword.operator.assignment.equal.symboscript", + "match": "(?])=(?!=|>)" + }, + { + "comment": "comparison operators", + "name": "keyword.operator.comparison.symboscript", + "match": "(=(=)?(?!>)|!=|<=|(?=)" + }, + { + "comment": "math operators", + "name": "keyword.operator.math.symboscript", + "match": "(\\^|([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" + }, + { + "comment": "range operator", + "name": "keyword.operator.range.symboscript", + "match": "\\.\\." + }, + { + "comment": "dot expr access", + "name": "keyword.operator.access.dot.expr.symboscript", + "match": "\\.[^\\w]" + }, + { + "comment": "dot access", + "name": "keyword.operator.access.dot.symboscript", + "match": "\\." + } + ] + }, + + "punctuation": { + "patterns": [ + { + "comment": "comma", + "name": "punctuation.comma.symboscript", + "match": "," + }, + { + "comment": "curly braces", + "name": "punctuation.brackets.curly.symboscript", + "match": "[{}]" + }, + { + "comment": "parentheses, round brackets", + "name": "punctuation.brackets.round.symboscript", + "match": "[()]" + }, + { + "comment": "semicolon", + "name": "punctuation.semi.symboscript", + "match": ";" + }, + { + "comment": "square brackets", + "name": "punctuation.brackets.square.symboscript", + "match": "[\\[\\]]" + } + ] + }, + + "string": { + "comment": "Strings", + "patterns": [ + { + "name": "string.quoted.double.symboscript", + "begin": "\"", + "end": "\"", + "patterns": [{ "include": "#escape" }] + }, + { + "name": "string.quoted.single.symboscript", + "begin": "'", + "end": "'", + "patterns": [{ "include": "#escape" }] + }, + { + "name": "string.quoted.other.symboscript", + "begin": "`", + "end": "`", + "patterns": [{ "include": "#escape" }] + } + ] + }, + + "escape": { + "name": "constant.character.escape.symboscript", + "match": "\\\\." + }, + + "variables": { + "patterns": [ + { + "comment": "variables", + "name": "variable.other.symboscript", + "match": "[a-z][a-z0-9_]*", + "captures": { + "1": { + "name": "constant.numeric.symboscript" + } + } + } + ] + } + } +}