aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Grieser <73286100+chrisgrieser@users.noreply.github.com>2025-02-19 18:37:18 +0100
committerGitHub <noreply@github.com>2025-02-19 18:37:18 +0100
commit36bbf518420918e965d11dad3d3f194803c47731 (patch)
tree0c330019c1b6b563d54b3cadae60ceb444228a3d
parentfix(css): do not fold top-level blocks (#7562) (diff)
downloadnvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.tar
nvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.tar.gz
nvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.tar.bz2
nvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.tar.lz
nvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.tar.xz
nvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.tar.zst
nvim-treesitter-36bbf518420918e965d11dad3d3f194803c47731.zip
feat(yaml): capture "boolean strings" (#7512)
See for example: https://www.bram.us/2022/01/11/yaml-the-norway-problem/ values based on: https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.truthy Parser targets YAML 1.2, which has stricter promotions.
-rw-r--r--queries/yaml/highlights.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/queries/yaml/highlights.scm b/queries/yaml/highlights.scm
index d41068359..9aed59ce4 100644
--- a/queries/yaml/highlights.scm
+++ b/queries/yaml/highlights.scm
@@ -80,3 +80,20 @@
"---"
"..."
] @punctuation.special
+
+; help deal with for yaml's norway problem https://www.bram.us/2022/01/11/yaml-the-norway-problem/
+; only using `true` and `false`, since Treesitter parser targets YAML spec 1.2 https://github.com/nvim-treesitter/nvim-treesitter/pull/7512#issuecomment-2565397302
+(block_mapping_pair
+ value: (block_node
+ (block_sequence
+ (block_sequence_item
+ (flow_node
+ (plain_scalar
+ (string_scalar) @boolean
+ (#any-of? @boolean "TRUE" "FALSE" "True" "False")))))))
+
+(block_mapping_pair
+ value: (flow_node
+ (plain_scalar
+ (string_scalar) @boolean
+ (#any-of? @boolean "TRUE" "FALSE" "True" "False"))))