From 3caf0e88e455b27d759be51498fdaf7bdedef292 Mon Sep 17 00:00:00 2001 From: Brian Shu Date: Thu, 26 Aug 2021 19:46:03 -0400 Subject: [PATCH 1/6] added submodule --- .gitmodules | 3 +++ helix-syntax/languages/tree-sitter-ocaml | 1 + 2 files changed, 4 insertions(+) create mode 160000 helix-syntax/languages/tree-sitter-ocaml diff --git a/.gitmodules b/.gitmodules index e750198aee56..c25611bc7d59 100644 --- a/.gitmodules +++ b/.gitmodules @@ -102,3 +102,6 @@ path = helix-syntax/languages/tree-sitter-protobuf url = https://github.com/yusdacra/tree-sitter-protobuf.git shallow = true +[submodule "helix-syntax/languages/tree-sitter-ocaml"] + path = helix-syntax/languages/tree-sitter-ocaml + url = https://github.com/tree-sitter/tree-sitter-ocaml diff --git a/helix-syntax/languages/tree-sitter-ocaml b/helix-syntax/languages/tree-sitter-ocaml new file mode 160000 index 000000000000..23d419ba4578 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-ocaml @@ -0,0 +1 @@ +Subproject commit 23d419ba45789c5a47d31448061557716b02750a From ba4f271a2174e3d632d3fb9bce3f26960e84a1b0 Mon Sep 17 00:00:00 2001 From: Brian Shu Date: Thu, 26 Aug 2021 20:12:04 -0400 Subject: [PATCH 2/6] remove wrong one --- .gitmodules | 3 --- helix-syntax/languages/tree-sitter-ocaml | 1 - 2 files changed, 4 deletions(-) delete mode 160000 helix-syntax/languages/tree-sitter-ocaml diff --git a/.gitmodules b/.gitmodules index c25611bc7d59..e750198aee56 100644 --- a/.gitmodules +++ b/.gitmodules @@ -102,6 +102,3 @@ path = helix-syntax/languages/tree-sitter-protobuf url = https://github.com/yusdacra/tree-sitter-protobuf.git shallow = true -[submodule "helix-syntax/languages/tree-sitter-ocaml"] - path = helix-syntax/languages/tree-sitter-ocaml - url = https://github.com/tree-sitter/tree-sitter-ocaml diff --git a/helix-syntax/languages/tree-sitter-ocaml b/helix-syntax/languages/tree-sitter-ocaml deleted file mode 160000 index 23d419ba4578..000000000000 --- a/helix-syntax/languages/tree-sitter-ocaml +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 23d419ba45789c5a47d31448061557716b02750a From 68cdde956ea73b19a96bcb4cd8dd21dc31353492 Mon Sep 17 00:00:00 2001 From: Brian Shu Date: Thu, 26 Aug 2021 20:18:21 -0400 Subject: [PATCH 3/6] added highlights --- .gitmodules | 3 +++ helix-syntax/languages/tree-sitter-yaml | 1 + languages.toml | 8 ++++++ runtime/queries/yaml/highlights.scm | 33 +++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 160000 helix-syntax/languages/tree-sitter-yaml create mode 100644 runtime/queries/yaml/highlights.scm diff --git a/.gitmodules b/.gitmodules index e750198aee56..5658d0c9c26b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -102,3 +102,6 @@ path = helix-syntax/languages/tree-sitter-protobuf url = https://github.com/yusdacra/tree-sitter-protobuf.git shallow = true +[submodule "helix-syntax/languages/tree-sitter-yaml"] + path = helix-syntax/languages/tree-sitter-yaml + url = https://github.com/ikatyang/tree-sitter-yaml diff --git a/helix-syntax/languages/tree-sitter-yaml b/helix-syntax/languages/tree-sitter-yaml new file mode 160000 index 000000000000..0e36bed17176 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-yaml @@ -0,0 +1 @@ +Subproject commit 0e36bed171768908f331ff7dff9d956bae016efb diff --git a/languages.toml b/languages.toml index 47155523b87a..8469e955865f 100644 --- a/languages.toml +++ b/languages.toml @@ -224,6 +224,14 @@ roots = [] comment-token = ";" indent = { tab-width = 4, unit = " " } +[[language]] +name = "yaml" +scope = "source.yaml" +file-types = ["yml", "yaml"] +roots = [] +comment-token = "#" +indent = { tab-width = 2, unit = " " } + # [[language]] # name = "haskell" # scope = "source.haskell" diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm new file mode 100644 index 000000000000..818352bb7129 --- /dev/null +++ b/runtime/queries/yaml/highlights.scm @@ -0,0 +1,33 @@ +(block_mapping_pair key: (_) @field) +(flow_mapping (_ key: (_) @field)) +(boolean_scalar) @boolean +(null_scalar) @constant.builtin +(double_quote_scalar) @string +(single_quote_scalar) @string +(escape_sequence) @string.escape +(integer_scalar) @number +(float_scalar) @number +(comment) @comment +(anchor_name) @type +(alias_name) @type +(tag) @type +(yaml_directive) @keyword +(ERROR) @error + +[ +"," +"-" +":" +">" +"?" +"|" +] @punctuation.delimiter + +[ +"[" +"]" +"{" +"}" +] @punctuation.bracket + +["*" "&"] @punctuation.special From 8195381029010c5766fbdb56c98b0c3b3b34f3d7 Mon Sep 17 00:00:00 2001 From: Brian Shu Date: Thu, 26 Aug 2021 20:21:31 -0400 Subject: [PATCH 4/6] use property --- runtime/queries/yaml/highlights.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm index 818352bb7129..4ebb4440a7e3 100644 --- a/runtime/queries/yaml/highlights.scm +++ b/runtime/queries/yaml/highlights.scm @@ -1,5 +1,5 @@ -(block_mapping_pair key: (_) @field) -(flow_mapping (_ key: (_) @field)) +(block_mapping_pair key: (_) @property) +(flow_mapping (_ key: (_) @property)) (boolean_scalar) @boolean (null_scalar) @constant.builtin (double_quote_scalar) @string From 823665f25c44b95782e0ed6fdf375981029f88aa Mon Sep 17 00:00:00 2001 From: Brian Shu Date: Fri, 27 Aug 2021 10:33:01 -0400 Subject: [PATCH 5/6] add indents --- runtime/queries/yaml/indents.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 runtime/queries/yaml/indents.toml diff --git a/runtime/queries/yaml/indents.toml b/runtime/queries/yaml/indents.toml new file mode 100644 index 000000000000..ddc3578b1420 --- /dev/null +++ b/runtime/queries/yaml/indents.toml @@ -0,0 +1,3 @@ +indent = [ + "block_mapping_pair", +] From 600aade96c852801b7dcbcf3cd1199196323ae06 Mon Sep 17 00:00:00 2001 From: Brian Shu Date: Tue, 31 Aug 2021 08:54:44 -0400 Subject: [PATCH 6/6] shallow --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index 5658d0c9c26b..7ebb1a9cef06 100644 --- a/.gitmodules +++ b/.gitmodules @@ -105,3 +105,4 @@ [submodule "helix-syntax/languages/tree-sitter-yaml"] path = helix-syntax/languages/tree-sitter-yaml url = https://github.com/ikatyang/tree-sitter-yaml + shallow = true