diff options
author | zetashift | 2023-03-21 22:12:24 +0000 |
---|---|---|
committer | GitHub | 2023-03-21 22:12:24 +0000 |
commit | 0e0c16e6fa2610c02a4fa6a3f9f90ba5e32133bb (patch) | |
tree | f51d57aac78e114cc5a3517af97a0fbad6971fbc | |
parent | b0ceac608ebc117399af89b81fbd0837d370161d (diff) |
Add initial Smithy support (#6370)
-rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
-rw-r--r-- | languages.toml | 14 | ||||
-rw-r--r-- | runtime/queries/smithy/highlights.scm | 102 |
3 files changed, 117 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index f62b147f..3c18956a 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -123,6 +123,7 @@ | scheme | ✓ | | | | | scss | ✓ | | | `vscode-css-language-server` | | slint | ✓ | | ✓ | `slint-lsp` | +| smithy | ✓ | | | `cs` | | sml | ✓ | | | | | solidity | ✓ | | | `solc` | | sql | ✓ | | | | diff --git a/languages.toml b/languages.toml index 5a42d7a4..234b1313 100644 --- a/languages.toml +++ b/languages.toml @@ -2355,3 +2355,17 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "capnp" source = { git = "https://github.com/amaanq/tree-sitter-capnp", rev = "fc6e2addf103861b9b3dffb82c543eb6b71061aa" } + +[[language]] +name = "smithy" +scope = "source.smithy" +injection-regex = "smithy" +file-types = ["smithy"] +roots = ["smithy-build.json"] +comment-token = "//" +indent = { tab-width = 4, unit = " " } +language-server = { command = "cs", args = ["launch", "com.disneystreaming.smithy:smithy-language-server:latest.release", "--", "0"] } + +[[grammar]] +name = "smithy" +source = { git = "https://github.com/indoorvivants/tree-sitter-smithy", rev = "cf8c7eb9faf7c7049839585eac19c94af231e6a0" } diff --git a/runtime/queries/smithy/highlights.scm b/runtime/queries/smithy/highlights.scm new file mode 100644 index 00000000..269e9609 --- /dev/null +++ b/runtime/queries/smithy/highlights.scm @@ -0,0 +1,102 @@ +; Queries are taken from: https://github.com/indoorvivants/tree-sitter-smithy/blob/main/queries/highlights.scm +; Preproc +(control_key) @keyword.directive + +; Namespace +(namespace) @namespace + +; Includes +[ + "use" +] @keyword.control.import + +; Builtins +(primitive) @type.builtin +[ + "enum" + "intEnum" + "list" + "map" + "set" +] @type.builtin + +; Fields (Members) +; (field) @variable.other.member + +(key_identifier) @variable.other.member +(shape_member + (field) @variable.other.member) +(operation_field) @variable.other.member +(operation_error_field) @variable.other.member + +; Constants +(enum_member + (enum_field) @type.enum) + +; Types +(identifier) @type +(structure_resource + (shape_id) @type) + +; Attributes +(mixins + (shape_id) @attribute) +(trait_statement + (shape_id) @attribute) + +; Operators +[ + "@" + "-" + "=" + ":=" +] @operator + +; Keywords +[ + "namespace" + "service" + "structure" + "operation" + "union" + "resource" + "metadata" + "apply" + "for" + "with" +] @keyword + +; Literals +(string) @string +(escape_sequence) @constant.character.escape + +(number) @constant.numeric + +(float) @constant.numeric.float + +(boolean) @constant.builtin.boolean + +(null) @constant.builtin + +; Misc +[ + "$" + "#" +] @punctuation.special + +["{" "}"] @punctuation.bracket + +["(" ")"] @punctuation.bracket + +["[" "]"] @punctuation.bracket + +[ + ":" + "." +] @punctuation.delimiter + +; Comments +[ + (comment) + (documentation_comment) +] @comment |