From 908529ccac153c12fd3b8e051a8f8ef68120d94d Mon Sep 17 00:00:00 2001 From: Triton171 Date: Sun, 30 Oct 2022 17:45:58 +0100 Subject: [PATCH] Update LaTex grammar (#4528) Fix comment injection & add highlighting for math delimiters. --- languages.toml | 2 +- runtime/queries/latex/highlights.scm | 6 ++++++ runtime/queries/latex/injections.scm | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/languages.toml b/languages.toml index 00e6459de..73915fc29 100644 --- a/languages.toml +++ b/languages.toml @@ -570,7 +570,7 @@ indent = { tab-width = 4, unit = "\t" } [[grammar]] name = "latex" -source = { git = "https://github.com/latex-lsp/tree-sitter-latex", rev = "b3b2cf27f33e71438ebe46934900b1153901c6f2" } +source = { git = "https://github.com/latex-lsp/tree-sitter-latex", rev = "8c75e93cd08ccb7ce1ccab22c1fbd6360e3bcea6" } [[language]] name = "lean" diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index e39226a27..3174d80b9 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -29,6 +29,12 @@ (#eq? @punctuation.delimiter "&")) ["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX +(math_delimiter + left_command: _ @punctuation.delimiter + left_delimiter: _ @punctuation.delimiter + right_command: _ @punctuation.delimiter + right_delimiter: _ @punctuation.delimiter +) ;; General environments (begin diff --git a/runtime/queries/latex/injections.scm b/runtime/queries/latex/injections.scm index 321c90add..d3fdb0ca7 100644 --- a/runtime/queries/latex/injections.scm +++ b/runtime/queries/latex/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content +((line_comment) @injection.content (#set! injection.language "comment"))