From 537fb0fcf2ba02d1a217bd6245c366bec80a98e0 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Mon, 19 Aug 2024 14:57:21 +0200 Subject: [PATCH] update tree sitter and update version --- Cargo.toml | 2 +- extension.toml | 4 +- languages/cadence/highlights.scm | 91 ++++++++++++++++++++++++-------- languages/cadence/locals.scm | 14 +---- 4 files changed, 73 insertions(+), 38 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ecc07be..a48f1d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cadence" -version = "0.0.1" +version = "0.0.2" edition = "2021" [lib] diff --git a/extension.toml b/extension.toml index c7f2538..bafeba7 100644 --- a/extension.toml +++ b/extension.toml @@ -1,6 +1,6 @@ id = "cadence" name = "Cadence Syntax Highlighting" -version = "0.0.1" +version = "0.0.2" schema_version = 1 authors = [ "Janez Podhostnik ", @@ -11,7 +11,7 @@ repository = "https://github.com/janezpodhostnik/cadence.zed" [grammars.cadence] repository = "https://github.com/bluesign/cadence-tree-sitter.git" -commit = "1d6a4fbd3e068e01546474589c777498d4ccfd72" +commit = "67f1b5e92159c3e3e6cf37ce6e77ec72dfaa1af8" [language_servers.cadence] name = "cadence" diff --git a/languages/cadence/highlights.scm b/languages/cadence/highlights.scm index 81d6b68..db99ca6 100644 --- a/languages/cadence/highlights.scm +++ b/languages/cadence/highlights.scm @@ -1,36 +1,83 @@ -[ - (blockComment) - (lineComment) -] @comment @spell -(compositeDeclaration) @type -(importDeclaration) @include -(identifier) @variable -(addressLocation) @variable -(field) @field -(stringLiteral) @string -(typeAnnotation) @type +(TypeIdentifier) @type +(TypeBuiltin) @type.builtin +(Identifier) @variable +((Identifier) @variable.builtin + (#eq? @variable.builtin "self")) + +(InitDeclaration) @constructor +(SpecialFunctionDeclaration) @function.builtin +(SpecialFunctionIdentifier) @function.builtin +(FunctionDeclaration name: (Identifier) @function) -(parameter identifier: (identifier) @parameter) +(StringLiteral) @string +(PathExpression) @string +(PathExpression (Identifier) @string) +(Address) @number +(IntegerLiteral) @number +(FixedPointLiteral) @number +(BooleanLiteral) @boolean + +(Parameter Identifier: (Identifier) @variable.parameter) [ "var" "let" ] @type.qualifier -(access) @keyword +(Access) @keyword +(transactionDeclaration) @keyword +(EntitlementIdentifier) @label + +(InterfaceMarker) @keyword +(CompositeDeclaration) @keyword [ - "contract" - "event" - "struct" - "resource" - "interface" - "enum" + "event" + "enum" + "fun" + "pre" + "post" + "execute" + "return" + "import" + "from" + "view" + "create" + "if" + "mapping" ] @keyword -(invokeExpression target: (identifierExpression) @function.call) ; foo() -(invokeExpression target: (memberAccessExpression) @function.call) ; foo() +[ + "(" + ")" + "}" + "{" + "[" + "]" +] @punctuation.bracket + +[ + "." + "," + ";" + "?" + ":" +] @punctuation.delimiter +(MultiplicativeOp) @operator +(AdditiveOp) @operator +(BitwiseShiftOp) @operator +(BitwiseAnd) @operator +(BitwiseXor) @operator +(BitwiseOr) @operator +(RelationalOP) @operator +(NilCoalescing) @operator +(EqualityOp) @operator +(LogicalAnd) @operator +(LogicalOr) @operator +(Transfer) @operator +(SwapStatement) @operator +(Move) @operator -(integerLiteral) @number +(Comment) @comment diff --git a/languages/cadence/locals.scm b/languages/cadence/locals.scm index abca5b0..83a069e 100644 --- a/languages/cadence/locals.scm +++ b/languages/cadence/locals.scm @@ -1,13 +1 @@ -(importDeclaration (identifier) @definition.import) -(functionDeclaration identifier: (identifier) @definition.function) -(compositeDeclaration identifier: (identifier) @definition.namespace) - -; Scopes -[ - (compositeDeclaration) - (forStatement) - (ifStatement) - (switchStatement) - (functionDeclaration) - (compositeDeclaration) -] @scope +(Program) @local.scope