From f0d1c855539cfeb8e66c3602a971857f8c20be0f Mon Sep 17 00:00:00 2001 From: farwyler <1705805+farwyler@users.noreply.github.com> Date: Mon, 6 Jun 2022 19:26:56 +0200 Subject: [PATCH] support for openscad (#2680) Co-authored-by: Michael Davis --- book/src/generated/lang-support.md | 1 + languages.toml | 15 ++++++ runtime/queries/openscad/highlights.scm | 63 +++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 runtime/queries/openscad/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index aa9fc1417..1d9b89a40 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -63,6 +63,7 @@ | ocaml | ✓ | | ✓ | `ocamllsp` | | ocaml-interface | ✓ | | | `ocamllsp` | | odin | ✓ | | | | +| openscad | ✓ | | | `openscad-language-server` | | org | ✓ | | | | | perl | ✓ | ✓ | ✓ | | | php | ✓ | ✓ | ✓ | `intelephense` | diff --git a/languages.toml b/languages.toml index 1f42ddcc0..7ab8ff845 100644 --- a/languages.toml +++ b/languages.toml @@ -1433,3 +1433,18 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "jsdoc" source = { git = "https://github.com/tree-sitter/tree-sitter-jsdoc", rev = "189a6a4829beb9cdbe837260653b4a3dfb0cc3db" } + + +[[language]] +name = "openscad" +scope = "source.openscad" +injection-regex = "openscad" +file-types = ["scad"] +roots = [] +comment-token = "//" +language-server = { command = "openscad-language-server" } +indent = { tab-width = 2, unit = "\t" } + +[[grammar]] +name = "openscad" +source = { git = "https://github.com/bollian/tree-sitter-openscad", rev = "5c3ce93df0ac1da7197cf6ae125aade26d6b8972" } diff --git a/runtime/queries/openscad/highlights.scm b/runtime/queries/openscad/highlights.scm new file mode 100644 index 000000000..c06738e85 --- /dev/null +++ b/runtime/queries/openscad/highlights.scm @@ -0,0 +1,63 @@ +(number) @constant.numeric +(string) @string +(boolean) @constant.builtin.boolean +(include_path) @string.special.path + +(parameters_declaration (identifier) @variable.parameter) +(function_declaration name: (identifier) @function) + +(function_call function: (identifier) @function) +(module_call name: (identifier) @function) + +(identifier) @variable +(special_variable) @variable.builtin + +[ + "function" + "let" + "assign" +] @keyword + +[ + "for" + "each" + "intersection_for" +] @keyword.control.repeat + +[ + "if" +] @keyword.control.conditional + +[ + "module" + "use" + "include" +] @keyword.control.import + +[ + "||" + "&&" + "==" + "!=" + "<" + ">" + "<=" + ">=" + "+" + "-" + "*" + "/" + "%" + "^" + "?" + "!" + ":" +] @operator + +[ + ";" + "," + "." +] @punctuation.delimiter + +(comment) @comment \ No newline at end of file