From: Brendan Hansen Date: Wed, 27 Oct 2021 16:23:10 +0000 (-0500) Subject: added vscode support X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=ea2795f47573b54812d00f3b141f686395433826;p=onyx.git added vscode support --- diff --git a/.gitignore b/.gitignore index 87b9b022..07641e0a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ session.vim *.rdbg tmp/ .vimspector.json +.vscode/ \ No newline at end of file diff --git a/build.sh b/build.sh index 41bde8ac..1f30e66e 100755 --- a/build.sh +++ b/build.sh @@ -20,7 +20,7 @@ else TARGET='./bin/onyx' fi -BUILD_DIR='.' +BUILD_DIR='./build' mkdir -p "$BUILD_DIR" for file in $C_FILES ; do diff --git a/misc/vscode/language-configuration.json b/misc/vscode/language-configuration.json new file mode 100644 index 00000000..78b4387f --- /dev/null +++ b/misc/vscode/language-configuration.json @@ -0,0 +1,28 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": "//", + // symbols used for start and end a block comment. Remove this entry if your language does not support block comments + "blockComment": [ "/*", "*/" ] + }, + // symbols used as brackets + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""] + ], + // symbols that that can be used to surround a selection + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""] + ] +} \ No newline at end of file diff --git a/misc/vscode/onyx-0.0.1.vsix b/misc/vscode/onyx-0.0.1.vsix new file mode 100644 index 00000000..3b6f9e23 Binary files /dev/null and b/misc/vscode/onyx-0.0.1.vsix differ diff --git a/misc/vscode/package.json b/misc/vscode/package.json new file mode 100644 index 00000000..afd7aae3 --- /dev/null +++ b/misc/vscode/package.json @@ -0,0 +1,38 @@ +{ + "name": "onyx", + "displayName": "Onyx", + "description": "Onyx syntax highlighting.", + "version": "0.0.1", + "publisher": "brendanfh", + "engines": { + "vscode": "^1.42.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [{ + "id": "onyx", + "aliases": ["Onyx", "onyx"], + "extensions": [".onyx"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "onyx", + "scopeName": "source.onyx", + "path": "./syntaxes/onyx.tmLanguage" + }], + "problemMatchers": [{ + "name": "onyx", + "owner": "onyx", + "fileLocation": "absolute", + "pattern": { + "regexp": "^\\(([^:]+):([0-9]+),([0-9]+)\\) (.*)", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + }] + } +} diff --git a/misc/vscode/syntaxes/onyx.tmLanguage b/misc/vscode/syntaxes/onyx.tmLanguage new file mode 100644 index 00000000..d420035d --- /dev/null +++ b/misc/vscode/syntaxes/onyx.tmLanguage @@ -0,0 +1,425 @@ + + + + + name + Jai + scopeName + source.onyx + fileTypes + + onyx + + patterns + + + include + #comments + + + include + #types + + + include + #keywords + + + include + #functions_and_declarations + + + include + #strings + + + include + #string_escaped_char + + + repository + + block_comment + + name + comment.block.onyx + begin + /\* + end + \*/ + patterns + + + include + #block_comment + name + comment.block.onyx + + + + line_comment + + begin + (^[ \t]+)?((?=//)|(?=#!)) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.onyx + + + end + (?!\G) + patterns + + + begin + // + beginCaptures + + 0 + + name + punctuation.definition.comment.onyx + + + end + \n + name + comment.line.double-slash.onyx + patterns + + + match + (?>\\\s*\n) + name + punctuation.separator.continuation.onyx + + + + + begin + #! + beginCaptures + + 0 + + name + punctuation.definition.comment.onyx + + + end + \n + name + comment.line.double-slash.onyx + patterns + + + match + (?>\\\s*\n) + name + punctuation.separator.continuation.onyx + + + + + + comments + + patterns + + + include + #block_comment + + + match + \*/.*\n + name + invalid.illegal.stray-comment-end.onyx + + + + include + #line_comment + + + + keywords + + patterns + + + match + \b(if|else|elseif|for|while|defer|return|do)\b + name + keyword.control.onyx + + + match + \b(break|continue|fallthrough|switch|case)\b + name + keyword.control.onyx + + + match + \b(use|macro|package)\b + name + keyword.control.onyx + + + match + \b(it|it_index)\b + name + keyword.other.onyx + + + match + \b(null|null_proc|null_str|true|false)\b + name + constant.language.onyx + + + match + \b(\d(\d|_)*(.\d(\d|_)*)?)((e|E)(\+|-)?\d+)?[ijk]?\b + name + constant.numeric.onyx + + + match + \b((0b(0|1|_)+)|(0o(\d|_)+)|(0d(\d|_)+)|(0[xXh](\h|_)+))[ijk]?\b + name + constant.numeric.onyx + + + match + --- + name + constant.numeric.onyx + + + match + \b(struct|enum)\b + name + storage.type.onyx + + + match + \b(cast)\b + name + keyword.function.onyx + + + match + ([#]\s*\b([[:alpha:]_]+[[:alnum:]_]*)\b) + name + keyword.tag.onyx + + + match + @[^\s;]+ + name + keyword.tag.onyx + + + + types + + patterns + + + match + \b(struct|enum)\b(?:(\{)(\}))? + name + storage.type.onyx + + + match + \$\s*(\b([[:alpha:]_]+[[:alnum:]_]*)\b) + name + storage.type.onyx + + + + match + \b(i8|i16|i32|i64)\b + name + storage.type.onyx + + + match + \b(u8|u16|u32|u64)\b + name + storage.type.onyx + + + match + \b(f32|f64)\b + name + storage.type.onyx + + + match + \b(bool)\b + name + storage.type.onyx + + + match + \b(str|cstr)\b + name + storage.type.onyx + + + match + \b(i8x16|i16x8|i32x4|i64x2|f32x4|f64x2|v128)\b + name + storage.type.onyx + + + match + \b(void)\b + name + storage.type.onyx + + + + functions_and_declarations + + patterns + + + match + \b(sizeof|alignof|typeof)\b\s*\( + captures + + 1 + + name + keyword.function.onyx + + + + + match + (\b[[:alpha:]_]+[[:alnum:]_]*\b)\s*[!]?\s*[\(] + captures + + 1 + + name + support.function.onyx + + + + + match + \b(\b[[:alpha:]_]+[[:alnum:]_]*\b)\s*[:]\s*[:]\s*(struct|enum) + captures + + 1 + + name + meta.type.onyx entity.name.type.onyx + + 2 + + name + storage.type.onyx + + + + + match + \b(\b[[:alpha:]_]+[[:alnum:]_]*\b)\s*[:]\s*[:]\s*([#]\s*type) + captures + + 1 + + name + meta.type.onyx entity.name.type.onyx + + 2 + + name + keyword.tag.onyx + + + + + match + \b(\b[[:alpha:]_]+[[:alnum:]_]*\b)\s*[:]\s*[:]\s* + captures + + 1 + + name + meta.constant.onyx entity.name.type.onyx + + + + + + string_escaped_char + + patterns + + + match + \\(\\|[abefnrut"0]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-7]{3}) + name + constant.character.escape.onyx + + + match + \\. + name + invalid.illegal.unknown-escape.onyx + + + + strings + + patterns + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.onyx + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.onyx + + + name + string.quoted.double.onyx + patterns + + + include + #string_placeholder + + + include + #string_escaped_char + + + + + + + +