From 40969ad4528bbb774e2b95dce0749b1dd3734ebf Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 15 Dec 2021 17:46:40 +0900 Subject: Partly fix latex highlights and add markup scope docs --- runtime/queries/latex/highlights.scm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'runtime/queries/latex') diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index f045c82d..8406bd04 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -318,60 +318,60 @@ ["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX (chapter - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) (part - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) (section - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) (subsection - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) (subsubsection - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) (paragraph - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) (subparagraph - text: (brace_group) @text.title) + text: (brace_group) @markup.heading) ((environment (begin name: (word) @_frame) (brace_group - child: (text) @text.title)) + child: (text) @markup.heading)) (#eq? @_frame "frame")) ((generic_command name:(generic_command_name) @_name arg: (brace_group - (text) @text.title)) + (text) @markup.heading)) (#eq? @_name "\\frametitle")) ;; Formatting ((generic_command name:(generic_command_name) @_name - arg: (_) @text.emphasis) + arg: (_) @markup.italic) (#eq? @_name "\\emph")) ((generic_command name:(generic_command_name) @_name - arg: (_) @text.emphasis) + arg: (_) @markup.italic) (#match? @_name "^(\\\\textit|\\\\mathit)$")) ((generic_command name:(generic_command_name) @_name - arg: (_) @text.strong) + arg: (_) @markup.bold) (#match? @_name "^(\\\\textbf|\\\\mathbf)$")) ((generic_command name:(generic_command_name) @_name . - arg: (_) @text.uri) + arg: (_) @markup.underline.link) (#match? @_name "^(\\\\url|\\\\href)$")) (ERROR) @error -- cgit v1.2.3-70-g09d2 From 9c484e88cf522ad76d94195faf2820260cf88624 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 17 Dec 2021 16:56:00 +0900 Subject: highlights: @include -> @keyword.control.import --- runtime/queries/latex/highlights.scm | 2 +- runtime/queries/ledger/highlights.scm | 2 +- runtime/queries/ocaml/highlights.scm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/queries/latex') diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index 8406bd04..2e308f77 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -278,7 +278,7 @@ "\\includeinkscape" "\\usepgflibrary" "\\usetikzlibrary" -] @include +] @keyword.control.import [ "\\part" diff --git a/runtime/queries/ledger/highlights.scm b/runtime/queries/ledger/highlights.scm index bdf5f2db..02a9ea9a 100644 --- a/runtime/queries/ledger/highlights.scm +++ b/runtime/queries/ledger/highlights.scm @@ -12,7 +12,7 @@ ((account) @variable.other.member) ((commodity) @text.literal) -"include" @include +"include" @keyword.local.import [ "account" diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm index 15f46cc1..a08b1267 100644 --- a/runtime/queries/ocaml/highlights.scm +++ b/runtime/queries/ocaml/highlights.scm @@ -90,7 +90,7 @@ ["exception" "try"] @keyword.control.exception -["include" "open"] @include +["include" "open"] @keyword.control.import ["for" "to" "downto" "while" "do" "done"] @keyword.control.repeat -- cgit v1.2.3-70-g09d2 From 7c01d926536bcaacc92bbf4a2b1a06e96e6268a0 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sun, 19 Dec 2021 00:05:43 +0530 Subject: Add link and quote queries for markdown - Rename markup.underline.link to markup.link.url - Add markup.link.label - Add markup.quote (The constructor theme scope was missing from the docs, so unrelated to this commit). --- book/src/themes.md | 6 ++++-- runtime/queries/latex/highlights.scm | 2 +- runtime/queries/markdown/highlights.scm | 7 ++++--- runtime/queries/svelte/highlights.scm | 4 ++-- theme.toml | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) (limited to 'runtime/queries/latex') diff --git a/book/src/themes.md b/book/src/themes.md index b6de7002..fce2c0ca 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -105,6 +105,7 @@ We use a similar set of scopes as - `type` - Types - `builtin` - Primitive types provided by the language (`int`, `usize`) +- `constructor` - `constant` (TODO: constant.other.placeholder for %v) - `builtin` Special constants provided by the language (`true`, `false`, `nil` etc) @@ -169,8 +170,9 @@ We use a similar set of scopes as - `numbered` - `bold` - `italic` - - `underline` - - `link` + - `link` + - `url` + - `label` - `quote` - `raw` - `inline` diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index 2e308f77..0a030b31 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -371,7 +371,7 @@ ((generic_command name:(generic_command_name) @_name . - arg: (_) @markup.underline.link) + arg: (_) @markup.link.url) (#match? @_name "^(\\\\url|\\\\href)$")) (ERROR) @error diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm index a102719b..a0bd3462 100644 --- a/runtime/queries/markdown/highlights.scm +++ b/runtime/queries/markdown/highlights.scm @@ -10,15 +10,16 @@ (fenced_code_block) ] @markup.raw.block +(block_quote) @markup.quote + (code_span) @markup.raw.inline (emphasis) @markup.italic (strong_emphasis) @markup.bold -(link_destination) @markup.underline.link - -; (link_label) @markup.label ; TODO: rename +(link_destination) @markup.link.url +(link_label) @markup.link.label [ (list_marker_plus) diff --git a/runtime/queries/svelte/highlights.scm b/runtime/queries/svelte/highlights.scm index f9eef6b5..22b0c551 100644 --- a/runtime/queries/svelte/highlights.scm +++ b/runtime/queries/svelte/highlights.scm @@ -20,12 +20,12 @@ ((element (start_tag (tag_name) @_tag) (text) @markup.inline) (#match? @_tag "^(code|kbd)$")) -((element (start_tag (tag_name) @_tag) (text) @markup.underline.link) +((element (start_tag (tag_name) @_tag) (text) @markup.link.url) (#eq? @_tag "a")) ((attribute (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @markup.underline.link)) + (quoted_attribute_value (attribute_value) @markup.link.url)) (#match? @_attr "^(href|src)$")) (tag_name) @tag diff --git a/theme.toml b/theme.toml index 0a79861e..b316e814 100644 --- a/theme.toml +++ b/theme.toml @@ -31,7 +31,7 @@ label = "honey" "markup.heading" = "lilac" "markup.bold" = { modifiers = ["bold"] } "markup.italic" = { modifiers = ["italic"] } -"markup.underline.link" = { fg = "silver", modifiers = ["underlined"] } +"markup.link.url" = { fg = "silver", modifiers = ["underlined"] } "markup.raw" = "almond" # TODO: diferentiate doc comment -- cgit v1.2.3-70-g09d2 From fd7080498e2580d1e59580db8fd007fb081257fd Mon Sep 17 00:00:00 2001 From: Mathis Brossier Date: Thu, 20 Jan 2022 16:50:06 +0100 Subject: tree sitter comments injections (#1527) * tree sitter comments injections * trailing newlines & julia fix * Update runtime/queries/julia/injections.scm Co-authored-by: Michael Davis Co-authored-by: Michael Davis --- runtime/queries/bash/injections.scm | 2 ++ runtime/queries/c-sharp/injections.scm | 2 ++ runtime/queries/css/injections.scm | 2 ++ runtime/queries/dart/injections.scm | 2 ++ runtime/queries/go/injections.scm | 2 ++ runtime/queries/haskell/injections.scm | 2 ++ runtime/queries/html/injections.scm | 3 +++ runtime/queries/java/injections.scm | 2 ++ runtime/queries/julia/injections.scm | 6 ++---- runtime/queries/latex/injections.scm | 2 ++ runtime/queries/lua/injections.scm | 2 ++ runtime/queries/make/injections.scm | 2 ++ runtime/queries/ocaml-interface/injections.scm | 2 ++ runtime/queries/ocaml/injections.scm | 2 ++ runtime/queries/perl/injections.scm | 2 ++ runtime/queries/php/injections.scm | 3 +++ runtime/queries/protobuf/injections.scm | 2 ++ runtime/queries/ruby/injections.scm | 2 ++ runtime/queries/scala/injections.scm | 3 ++- runtime/queries/toml/injections.scm | 2 ++ runtime/queries/tsx/injections.scm | 1 + runtime/queries/typescript/injections.scm | 1 + runtime/queries/vue/injections.scm | 3 +++ runtime/queries/wgsl/injections.scm | 2 ++ runtime/queries/yaml/injections.scm | 2 +- runtime/queries/zig/injections.scm | 2 ++ 26 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 runtime/queries/bash/injections.scm create mode 100644 runtime/queries/c-sharp/injections.scm create mode 100644 runtime/queries/css/injections.scm create mode 100644 runtime/queries/dart/injections.scm create mode 100644 runtime/queries/go/injections.scm create mode 100644 runtime/queries/haskell/injections.scm create mode 100644 runtime/queries/java/injections.scm create mode 100644 runtime/queries/latex/injections.scm create mode 100644 runtime/queries/lua/injections.scm create mode 100644 runtime/queries/make/injections.scm create mode 100644 runtime/queries/ocaml-interface/injections.scm create mode 100644 runtime/queries/ocaml/injections.scm create mode 100644 runtime/queries/perl/injections.scm create mode 100644 runtime/queries/protobuf/injections.scm create mode 100644 runtime/queries/ruby/injections.scm create mode 100644 runtime/queries/toml/injections.scm create mode 100644 runtime/queries/tsx/injections.scm create mode 100644 runtime/queries/typescript/injections.scm create mode 100644 runtime/queries/wgsl/injections.scm create mode 100644 runtime/queries/zig/injections.scm (limited to 'runtime/queries/latex') diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/bash/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/c-sharp/injections.scm b/runtime/queries/c-sharp/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/c-sharp/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/css/injections.scm b/runtime/queries/css/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/css/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/dart/injections.scm b/runtime/queries/dart/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/dart/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/go/injections.scm b/runtime/queries/go/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/go/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/haskell/injections.scm b/runtime/queries/haskell/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/haskell/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/html/injections.scm b/runtime/queries/html/injections.scm index 71e7c3ae..ef58f415 100644 --- a/runtime/queries/html/injections.scm +++ b/runtime/queries/html/injections.scm @@ -1,3 +1,6 @@ +((comment) @injection.content + (#set! injection.language "comment")) + ((script_element (raw_text) @injection.content) (#set! injection.language "javascript")) diff --git a/runtime/queries/java/injections.scm b/runtime/queries/java/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/java/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/julia/injections.scm b/runtime/queries/julia/injections.scm index 3cf7339f..1c1e804e 100644 --- a/runtime/queries/julia/injections.scm +++ b/runtime/queries/julia/injections.scm @@ -1,7 +1,5 @@ -; TODO: re-add when markdown is added. -; ((triple_string) @injection.content -; (#offset! @injection.content 0 3 0 -3) -; (#set! injection.language "markdown")) +((triple_string) @injection.content + (#set! injection.language "markdown")) ((comment) @injection.content (#set! injection.language "comment")) diff --git a/runtime/queries/latex/injections.scm b/runtime/queries/latex/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/latex/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/lua/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/make/injections.scm b/runtime/queries/make/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/make/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/ocaml-interface/injections.scm b/runtime/queries/ocaml-interface/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/ocaml-interface/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/ocaml/injections.scm b/runtime/queries/ocaml/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/ocaml/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/perl/injections.scm b/runtime/queries/perl/injections.scm new file mode 100644 index 00000000..cab5f53d --- /dev/null +++ b/runtime/queries/perl/injections.scm @@ -0,0 +1,2 @@ +((comments) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/php/injections.scm b/runtime/queries/php/injections.scm index 16d5736b..614a3850 100644 --- a/runtime/queries/php/injections.scm +++ b/runtime/queries/php/injections.scm @@ -1,3 +1,6 @@ ((text) @injection.content (#set! injection.language "html") (#set! injection.combined)) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/protobuf/injections.scm b/runtime/queries/protobuf/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/protobuf/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/ruby/injections.scm b/runtime/queries/ruby/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/ruby/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/scala/injections.scm b/runtime/queries/scala/injections.scm index 4bb7d675..321c90ad 100644 --- a/runtime/queries/scala/injections.scm +++ b/runtime/queries/scala/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/toml/injections.scm b/runtime/queries/toml/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/toml/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/tsx/injections.scm b/runtime/queries/tsx/injections.scm new file mode 100644 index 00000000..1b61e36d --- /dev/null +++ b/runtime/queries/tsx/injections.scm @@ -0,0 +1 @@ +; inherits: typescript diff --git a/runtime/queries/typescript/injections.scm b/runtime/queries/typescript/injections.scm new file mode 100644 index 00000000..ff0ddfac --- /dev/null +++ b/runtime/queries/typescript/injections.scm @@ -0,0 +1 @@ +; inherits: javascript diff --git a/runtime/queries/vue/injections.scm b/runtime/queries/vue/injections.scm index 8ee34ffb..73df868b 100644 --- a/runtime/queries/vue/injections.scm +++ b/runtime/queries/vue/injections.scm @@ -15,3 +15,6 @@ ((style_element (raw_text) @injection.content) (#set! injection.language "css")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/wgsl/injections.scm b/runtime/queries/wgsl/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/wgsl/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/yaml/injections.scm b/runtime/queries/yaml/injections.scm index 39bda293..321c90ad 100644 --- a/runtime/queries/yaml/injections.scm +++ b/runtime/queries/yaml/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content +((comment) @injection.content (#set! injection.language "comment")) diff --git a/runtime/queries/zig/injections.scm b/runtime/queries/zig/injections.scm new file mode 100644 index 00000000..3df95897 --- /dev/null +++ b/runtime/queries/zig/injections.scm @@ -0,0 +1,2 @@ +([(line_comment) (doc_comment)] @injection.content + (#set! injection.language "comment")) -- cgit v1.2.3-70-g09d2