Skip to content

Commit

Permalink
Merge pull request #15 from okhaimie-dev/lang-update
Browse files Browse the repository at this point in the history
Lang update
  • Loading branch information
trbutler4 authored Sep 4, 2024
2 parents 4070ac6 + f57c42b commit d04089f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extension.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
id = "cairo"
name = "Cairo"
version = "0.0.4"
version = "0.0.5"
schema_version = 1
authors = ["Thomas Robert Butler IV trbiv@proton.me", "Okhai Omotuebe okhaio@protonmail.com"]
description = "Cairo language support for the Zed editor"
repository = "https://github.com/trbutler4/zed-cairo"

[grammars.cairo]
repository = "https://github.com/starkware-libs/tree-sitter-cairo"
commit = "e3a0212261c125cb38248458cd856c0ffee2b398"
commit = "d5733e05aa19ab69a47026780b1cece213d3e015"

[language_servers.cairo]
name = "Cairo LSP"
Expand Down
Binary file modified grammars/cairo.wasm
Binary file not shown.
4 changes: 4 additions & 0 deletions languages/cairo/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"<"
">"
] @punctuation.bracket)
(closure_parameters
"|" @punctuation.bracket)

; ---
; Variables
Expand All @@ -92,6 +94,8 @@
(parameter
pattern: (identifier) @variable.parameter)

(closure_parameters
(identifier) @variable.parameter)
; -------
; Keywords
; -------
Expand Down
10 changes: 10 additions & 0 deletions languages/cairo/indents.scm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@
(#not-same-line? @expr-start @pattern-guard)
) @indent

; Align closure parameters if they span more than one line
(closure_parameters
"|"
.
(_) @anchor
(_) @expr-end
.
(#not-same-line? @anchor @expr-end)
) @align

(for_expression
"in" @in
.
Expand Down
3 changes: 3 additions & 0 deletions languages/cairo/locals.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
(type_item)
(trait_item)
(impl_item)
(closure_expression)
(block)
] @local.scope

Expand All @@ -20,6 +21,8 @@
(constrained_type_parameter
left: (type_identifier) @local.definition)

(closure_parameters (identifier) @local.definition)

; References
(identifier) @local.reference
(type_identifier) @local.reference
6 changes: 6 additions & 0 deletions languages/cairo/textobjects.scm
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
(function_item
body: (_) @function.inside) @function.around

(closure_expression
body: (_) @function.inside) @function.around

(struct_item
body: (_) @class.inside) @class.around

Expand All @@ -16,6 +19,9 @@
(parameters
((_) @parameter.inside . ","? @parameter.around) @parameter.around)

(closure_parameters
((_) @parameter.inside . ","? @parameter.around) @parameter.around)

(type_parameters
((_) @parameter.inside . ","? @parameter.around) @parameter.around)

Expand Down

0 comments on commit d04089f

Please sign in to comment.