From 00e4d3e5ca188156dee4e16b4bbcfba167b3ffce Mon Sep 17 00:00:00 2001 From: gabydd Date: Thu, 26 Oct 2023 11:10:02 -0400 Subject: [PATCH] switch to tree-sitter-ron --- languages.toml | 6 +++- runtime/queries/ron/highlights.scm | 45 +++++++++++++++++++++++++++++- runtime/queries/ron/indents.scm | 13 ++++++++- runtime/queries/ron/injections.scm | 3 +- 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/languages.toml b/languages.toml index 77c629e494626..7ea18f83695a3 100644 --- a/languages.toml +++ b/languages.toml @@ -1676,7 +1676,11 @@ file-types = ["ron"] roots = [] comment-token = "//" indent = { tab-width = 4, unit = " " } -grammar = "rust" +grammar = "ron" + +[[grammar]] +name = "ron" +source = { git = "https://github.com/zee-editor/tree-sitter-ron", rev = "7762d709a0f7c1f9e269d0125a2e8a7a69006146" } [[language]] name = "robot" diff --git a/runtime/queries/ron/highlights.scm b/runtime/queries/ron/highlights.scm index 43766a4f8125c..b9890570b8a8d 100644 --- a/runtime/queries/ron/highlights.scm +++ b/runtime/queries/ron/highlights.scm @@ -1 +1,44 @@ -; inherits: rust \ No newline at end of file +; Literals +;------------ + +(string) @string +(boolean) @constant.builtin.boolean +(integer) @constant.numeric.integer +(float) @constant.numeric.float +(char) @constant.character + +; Structs +;------------ + +(enum_variant) @type.enum.variant +(struct_entry (_) @variable.other.member ":") +(struct_name (identifier)) @type + + + + +; Comments +;------------ + +(line_comment) @comment.line +(block_comment) @comment.block + + +; Punctuation +;------------ + +"," @punctuation.delimiter +":" @punctuation.delimiter + +"(" @punctuation.bracket +")" @punctuation.bracket +"[" @punctuation.bracket +"]" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket + + +; Special +;------------ +(escape_sequence) @constant.character.escape +(ERROR) @error diff --git a/runtime/queries/ron/indents.scm b/runtime/queries/ron/indents.scm index 43766a4f8125c..e73bf9224c51e 100644 --- a/runtime/queries/ron/indents.scm +++ b/runtime/queries/ron/indents.scm @@ -1 +1,12 @@ -; inherits: rust \ No newline at end of file +[ + (array) + (map) + (tuple) + (struct) +] @indent + +[ + "}" + "]" + ")" +] @outdent diff --git a/runtime/queries/ron/injections.scm b/runtime/queries/ron/injections.scm index 43766a4f8125c..e4509a5fd317b 100644 --- a/runtime/queries/ron/injections.scm +++ b/runtime/queries/ron/injections.scm @@ -1 +1,2 @@ -; inherits: rust \ No newline at end of file +([(line_comment) (block_comment)] @injection.content + (#set! injection.language "comment"))