Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial Smithy support #6370

Merged
merged 7 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
| scheme | ✓ | | | |
| scss | ✓ | | | `vscode-css-language-server` |
| slint | ✓ | | ✓ | `slint-lsp` |
| smithy | ✓ | | | `cs` |
| sml | ✓ | | | |
| solidity | ✓ | | | `solc` |
| sql | ✓ | | | |
Expand Down
14 changes: 14 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2341,3 +2341,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" }
102 changes: 102 additions & 0 deletions runtime/queries/smithy/highlights.scm
the-mikedavis marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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