From d1b434d2304218673b7e7564f9e59910b475349c Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 11 Oct 2021 21:10:14 -0500 Subject: add highlights query from elixir-lang/tree-sitter-elixir --- runtime/queries/elixir/highlights.scm | 301 ++++++++++++++++++++-------------- 1 file changed, 179 insertions(+), 122 deletions(-) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index 6bf93a21..bb88e450 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -1,125 +1,186 @@ -["when" "and" "or" "not in" "not" "in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword - -[(true) (false) (nil)] @constant.builtin - -(keyword - [(keyword_literal) - ":"] @tag) - -(keyword - (keyword_string - [(string_start) - (string_content) - (string_end)] @tag)) - -[(atom_literal) - (atom_start) - (atom_content) - (atom_end)] @tag - -[(comment) - (unused_identifier)] @comment - -(escape_sequence) @escape - -(call function: (function_identifier) @keyword - (#match? @keyword "^(defmodule|defexception|defp|def|with|case|cond|raise|import|require|use|defmacrop|defmacro|defguardp|defguard|defdelegate|defstruct|alias|defimpl|defprotocol|defoverridable|receive|if|for|try|throw|unless|reraise|super|quote|unquote|unquote_splicing)$")) - -(call function: (function_identifier) @keyword - [(call - function: (function_identifier) @function - (arguments - [(identifier) @variable.parameter - (_ (identifier) @variable.parameter) - (_ (_ (identifier) @variable.parameter)) - (_ (_ (_ (identifier) @variable.parameter))) - (_ (_ (_ (_ (identifier) @variable.parameter)))) - (_ (_ (_ (_ (_ (identifier) @variable.parameter)))))])) - (binary_op - left: - (call - function: (function_identifier) @function - (arguments - [(identifier) @variable.parameter - (_ (identifier) @variable.parameter) - (_ (_ (identifier) @variable.parameter)) - (_ (_ (_ (identifier) @variable.parameter))) - (_ (_ (_ (_ (identifier) @variable.parameter)))) - (_ (_ (_ (_ (_ (identifier) @variable.parameter)))))])) +; Reserved keywords + +["when" "and" "or" "not" "in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword + +; Operators + +; * doc string +(unary_operator + operator: "@" @comment.doc + operand: (call + target: (identifier) @comment.doc.__attribute__ + (arguments + [ + (string) @comment.doc + (charlist) @comment.doc + (sigil + quoted_start: _ @comment.doc + quoted_end: _ @comment.doc) @comment.doc + (boolean) @comment.doc + ])) + (#match? @comment.doc.__attribute__ "^(moduledoc|typedoc|doc)$")) + +; * module attribute +(unary_operator + operator: "@" @attribute + operand: [ + (identifier) @attribute + (call + target: (identifier) @attribute) + (boolean) @attribute + (nil) @attribute + ]) + +; * capture operand +(unary_operator + operator: "&" + operand: (integer) @operator) + +(operator_identifier) @operator + +(unary_operator + operator: _ @operator) + +(binary_operator + operator: _ @operator) + +(dot + operator: _ @operator) + +(stab_clause + operator: _ @operator) + +; Literals + +[ + (boolean) + (nil) +] @constant + +[ + (integer) + (float) +] @number + +(alias) @type + +(char) @constant + +; Quoted content + +(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded + +(escape_sequence) @string.escape + +[ + (atom) + (quoted_atom) + (keyword) + (quoted_keyword) +] @string.special.symbol + +[ + (string) + (charlist) +] @string + +; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters + +(sigil + (sigil_name) @__name__ + quoted_start: _ @string + quoted_end: _ @string + (#match? @__name__ "^[sS]$")) @string + +(sigil + (sigil_name) @__name__ + quoted_start: _ @string.regex + quoted_end: _ @string.regex + (#match? @__name__ "^[rR]$")) @string.regex + +(sigil + (sigil_name) @__name__ + quoted_start: _ @string.special + quoted_end: _ @string.special) @string.special + +; Calls + +; * definition keyword +(call + target: (identifier) @keyword + (#match? @keyword "^(def|defdelegate|defexception|defguard|defguardp|defimpl|defmacro|defmacrop|defmodule|defn|defnp|defoverridable|defp|defprotocol|defstruct)$")) + +; * kernel or special forms keyword +(call + target: (identifier) @keyword + (#match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$")) + +; * function call +(call + target: [ + ; local + (identifier) @function + ; remote + (dot + right: (identifier) @function) + ]) + +; * just identifier in function definition +(call + target: (identifier) @keyword + (arguments + [ + (identifier) @function + (binary_operator + left: (identifier) @function operator: "when") - (binary_op - left: (identifier) @variable.parameter - operator: _ @function - right: (identifier) @variable.parameter)] - (#match? @keyword "^(defp|def|defmacrop|defmacro|defguardp|defguard|defdelegate)$")) - -(call (function_identifier) @keyword - [(call - function: (function_identifier) @function) - (identifier) @function - (binary_op - left: - [(call - function: (function_identifier) @function) - (identifier) @function] - operator: "when")] - (#match? @keyword "^(defp|def|defmacrop|defmacro|defguardp|defguard|defdelegate)$")) - -(anonymous_function - (stab_expression - left: (bare_arguments - [(identifier) @variable.parameter - (_ (identifier) @variable.parameter) - (_ (_ (identifier) @variable.parameter)) - (_ (_ (_ (identifier) @variable.parameter))) - (_ (_ (_ (_ (identifier) @variable.parameter)))) - (_ (_ (_ (_ (_ (identifier) @variable.parameter)))))]))) - -(unary_op - operator: "@" - (call (identifier) @attribute - (heredoc - [(heredoc_start) - (heredoc_content) - (heredoc_end)] @doc)) - (#match? @attribute "^(doc|moduledoc)$")) - -(module) @type - -(unary_op - operator: "@" @attribute - [(call - function: (function_identifier) @attribute) - (identifier) @attribute]) - -(unary_op - operator: _ @operator) - -(binary_op - operator: _ @operator) - -(heredoc - [(heredoc_start) - (heredoc_content) - (heredoc_end)] @string) - -(string - [(string_start) - (string_content) - (string_end)] @string) - -(sigil_start) @string.special -(sigil_content) @string -(sigil_end) @string.special - -(interpolation - "#{" @punctuation.special - "}" @punctuation.special) + ]) + (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$")) + +; * pipe into identifier (definition) +(call + target: (identifier) @keyword + (arguments + (binary_operator + operator: "|>" + right: (identifier) @variable)) + (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$")) + +; * pipe into identifier (function call) +(binary_operator + operator: "|>" + right: (identifier) @function) + +; Identifiers + +; * special +( + (identifier) @constant.builtin + (#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$") +) + +; * unused +( + (identifier) @comment.unused + (#match? @comment.unused "^_") +) + +; * regular +(identifier) @variable + +; Comment + +(comment) @comment + +; Punctuation + +[ + "%" +] @punctuation [ "," - "->" - "." + ";" ] @punctuation.delimiter [ @@ -132,7 +193,3 @@ "<<" ">>" ] @punctuation.bracket - -(special_identifier) @function.special - -(ERROR) @warning -- cgit v1.2.3-70-g09d2 From 5db248cc1ce6077293e4bc96513daf6448f12774 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 11 Oct 2021 21:47:49 -0500 Subject: describe atoms as tags --- runtime/queries/elixir/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index bb88e450..e37f9b8d 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -77,7 +77,7 @@ (quoted_atom) (keyword) (quoted_keyword) -] @string.special.symbol +] @tag [ (string) -- cgit v1.2.3-70-g09d2 From 95ab40d1718b3ed4c4cfef6cf02603651e6159f6 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 11 Oct 2021 21:48:14 -0500 Subject: use the warning type for tree-sitter ERRORs --- runtime/queries/elixir/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index e37f9b8d..f9ceb46e 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -193,3 +193,5 @@ "<<" ">>" ] @punctuation.bracket + +(ERROR) @warning -- cgit v1.2.3-70-g09d2 From b2655a7f5ca0edfffcaabb8ab84b53571afba19a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 11 Oct 2021 21:59:07 -0500 Subject: add LICENSE snippet at elixir hightlights top --- runtime/queries/elixir/highlights.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index f9ceb46e..a840018a 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -1,3 +1,20 @@ +; The following code originates mostly from +; https://github.com/elixir-lang/tree-sitter-elixir, with minor edits to +; align the captures with helix. The following should be considered +; Copyright 2021 The Elixir Team +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; https://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + ; Reserved keywords ["when" "and" "or" "not" "in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword -- cgit v1.2.3-70-g09d2 From c502cafecc42cc6099241e7ba129727bedf150d7 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 12 Oct 2021 16:14:32 -0500 Subject: highlight calls to erlang modules as types connects https://github.com/elixir-lang/tree-sitter-elixir/pull/5 --- runtime/queries/elixir/highlights.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index a840018a..a5b3884e 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -81,6 +81,10 @@ (alias) @type +(call + target: (dot + left: (atom) @type)) + (char) @constant ; Quoted content -- cgit v1.2.3-70-g09d2 From 4771cc7ee49ebf59f837a6899a6b1d7e044c011a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 14 Oct 2021 13:45:32 -0500 Subject: align highlight scopes with documented scopes --- book/src/themes.md | 2 ++ runtime/queries/elixir/highlights.scm | 45 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 23 deletions(-) (limited to 'runtime') diff --git a/book/src/themes.md b/book/src/themes.md index a99e3a59..2d75ac57 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -120,6 +120,8 @@ We use a similar set of scopes as - `path` - `url` +- `symbol` - Elixir atoms, Ruby symbols, Clojure keywords + - `comment` - Code comments - `line` - Single line comments (`//`) - `block` - Block comments (e.g. (`/* */`) diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index a5b3884e..82ef081d 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -23,29 +23,29 @@ ; * doc string (unary_operator - operator: "@" @comment.doc + operator: "@" @comment.block.documentation operand: (call - target: (identifier) @comment.doc.__attribute__ + target: (identifier) @comment.block.documentation.__attribute__ (arguments [ - (string) @comment.doc - (charlist) @comment.doc + (string) @comment.block.documentation + (charlist) @comment.block.documentation (sigil - quoted_start: _ @comment.doc - quoted_end: _ @comment.doc) @comment.doc - (boolean) @comment.doc + quoted_start: _ @comment.block.documentation + quoted_end: _ @comment.block.documentation) @comment.block.documentation + (boolean) @comment.block.documentation ])) - (#match? @comment.doc.__attribute__ "^(moduledoc|typedoc|doc)$")) + (#match? @comment.block.documentation.__attribute__ "^(moduledoc|typedoc|doc)$")) ; * module attribute (unary_operator - operator: "@" @attribute + operator: "@" @variable.property operand: [ - (identifier) @attribute + (identifier) @variable.property (call - target: (identifier) @attribute) - (boolean) @attribute - (nil) @attribute + target: (identifier) @variable.property) + (boolean) @variable.property + (nil) @variable.property ]) ; * capture operand @@ -69,10 +69,9 @@ ; Literals -[ - (boolean) - (nil) -] @constant +(nil) @constant.builtin + +(boolean) @constant.builtin.boolean [ (integer) @@ -85,20 +84,20 @@ target: (dot left: (atom) @type)) -(char) @constant +(char) @constant.character ; Quoted content -(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded +(interpolation "#{" @escape "}" @escape) @embedded -(escape_sequence) @string.escape +(escape_sequence) @escape [ (atom) (quoted_atom) (keyword) (quoted_keyword) -] @tag +] @symbol [ (string) @@ -182,8 +181,8 @@ ; * unused ( - (identifier) @comment.unused - (#match? @comment.unused "^_") + (identifier) @comment + (#match? @comment "^_") ) ; * regular -- cgit v1.2.3-70-g09d2 From 8f658f0dceffa7bcf2ea18cd6fd0a7dab4e37663 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 14 Oct 2021 13:46:58 -0500 Subject: use latest tree-sitter-elixir with 'not in' query support connects https://github.com/elixir-lang/tree-sitter-elixir/issues/9 --- helix-syntax/languages/tree-sitter-elixir | 2 +- runtime/queries/elixir/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/helix-syntax/languages/tree-sitter-elixir b/helix-syntax/languages/tree-sitter-elixir index 7ae20df1..f5d7bda5 160000 --- a/helix-syntax/languages/tree-sitter-elixir +++ b/helix-syntax/languages/tree-sitter-elixir @@ -1 +1 @@ -Subproject commit 7ae20df181b86c79d826abd5aec7a3e32e3d8438 +Subproject commit f5d7bda543da788bd507b05bd722627dde66c9ec diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index 82ef081d..33a84ace 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -17,7 +17,7 @@ ; Reserved keywords -["when" "and" "or" "not" "in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword +["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword ; Operators -- cgit v1.2.3-70-g09d2 From 80b54f2f69165897bfab376d031fab8e040331b6 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 14 Oct 2021 13:58:08 -0500 Subject: use special.string.symbol instead of symbol this aligns better with how ruby highlights symbols --- book/src/themes.md | 3 +-- runtime/queries/elixir/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/book/src/themes.md b/book/src/themes.md index 2d75ac57..5a4d0403 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -119,8 +119,7 @@ We use a similar set of scopes as - `special` - `path` - `url` - -- `symbol` - Elixir atoms, Ruby symbols, Clojure keywords + - `symbol` - Erlang/Elixir atoms, Ruby symbols, Clojure keywords - `comment` - Code comments - `line` - Single line comments (`//`) diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index 33a84ace..a882fb63 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -97,7 +97,7 @@ (quoted_atom) (keyword) (quoted_keyword) -] @symbol +] @string.special.symbol [ (string) -- cgit v1.2.3-70-g09d2 From 4d8eb09b7c436a82e3deff09cbf65a8c68201522 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 15 Oct 2021 17:39:05 -0500 Subject: scope arities in captures as operators --- runtime/queries/elixir/highlights.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index a882fb63..08e09f37 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -48,10 +48,17 @@ (nil) @variable.property ]) -; * capture operand +; * capture operator (unary_operator operator: "&" - operand: (integer) @operator) + operand: [ + (integer) @operator + (binary_operator + left: [ + (call target: (dot left: (_) right: (identifier) @function)) + (identifier) @function + ] operator: "/" right: (integer) @operator) + ]) (operator_identifier) @operator -- cgit v1.2.3-70-g09d2 From bb011f9fb22ce8bce7720668d02790b2524e5c3c Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Mon, 18 Oct 2021 09:01:53 +0800 Subject: Add indents for python, but it's not perfect. (#837) * add indents for python, but it's not Perfect * add last line--- runtime/queries/python/indents.toml | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 runtime/queries/python/indents.toml (limited to 'runtime') diff --git a/runtime/queries/python/indents.toml b/runtime/queries/python/indents.toml new file mode 100644 index 00000000..6bc68486 --- /dev/null +++ b/runtime/queries/python/indents.toml @@ -0,0 +1,39 @@ +indent = [ + "list", + "tuple", + "dictionary", + "set", + + "if_statement", + "for_statement", + "while_statement", + "with_statement", + "try_statement", + "import_from_statement", + + "parenthesized_expression", + "generator_expression", + "list_comprehension", + "set_comprehension", + "dictionary_comprehension", + + "tuple_pattern", + "list_pattern", + "argument_list", + "parameters", + "binary_operator", + + "function_definition", + "class_definition", +] + +outdent = [ + ")", + "]", + "}", + "return_statement", + "pass_statement", + "raise_statement", +] + +ignore = ["string"] -- cgit v1.2.3-70-g09d2 From c278b43319b1a8beea872bc9b9678f3cef230fd7 Mon Sep 17 00:00:00 2001 From: Ray Gervais Date: Sun, 17 Oct 2021 21:31:57 -0400 Subject: adds: base16 theme for Helix editor (#833) --- runtime/themes/base16_default_dark.toml | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 runtime/themes/base16_default_dark.toml (limited to 'runtime') diff --git a/runtime/themes/base16_default_dark.toml b/runtime/themes/base16_default_dark.toml new file mode 100644 index 00000000..625fc5ab --- /dev/null +++ b/runtime/themes/base16_default_dark.toml @@ -0,0 +1,50 @@ +# Author: RayGervais + +"ui.background" = { bg = "base00" } +"ui.menu" = "base01" +"ui.menu.selected" = { fg = "base04", bg = "base01" } +"ui.linenr" = {fg = "base01" } +"ui.popup" = { bg = "base01" } +"ui.window" = { bg = "base01" } +"ui.liner.selected" = "base02" +"ui.selection" = "base02" +"comment" = "base03" +"ui.statusline" = {fg = "base04", bg = "base01" } +"ui.help" = { fg = "base04", bg = "base01" } +"ui.cursor" = { fg = "base05", modifiers = ["reversed"] } +"ui.text" = { fg = "base05" } +"operator" = "base05" +"ui.text.focus" = { fg = "base05" } +"variable" = "base08" +"number" = "base09" +"constant" = "base09" +"attributes" = "base09" +"type" = "base0A" +"ui.cursor.match" = { fg = "base0A", modifiers = ["underlined"] } +"strings" = "base0B" +"property" = "base0B" +"escape" = "base0C" +"function" = "base0D" +"constructor" = "base0D" +"special" = "base0D" +"keyword" = "base0E" +"label" = "base0E" +"namespace" = "base0E" + +[palette] +base00 = "#181818" # Default Background +base01 = "#282828" # Lighter Background (Used for status bars, line number and folding marks) +base02 = "#383838" # Selection Background +base03 = "#585858" # Comments, Invisibles, Line Highlighting +base04 = "#b8b8b8" # Dark Foreground (Used for status bars) +base05 = "#d8d8d8" # Default Foreground, Caret, Delimiters, Operators +base06 = "#e8e8e8" # Light Foreground (Not often used) +base07 = "#f8f8f8" # Light Background (Not often used) +base08 = "#ab4642" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted +base09 = "#dc9656" # Integers, Boolean, Constants, XML Attributes, Markup Link Url +base0A = "#f7ca88" # Classes, Markup Bold, Search Text Background +base0B = "#a1b56c" # Strings, Inherited Class, Markup Code, Diff Inserted +base0C = "#86c1b9" # Support, Regular Expressions, Escape Characters, Markup Quotes +base0D = "#7cafc2" # Functions, Methods, Attribute IDs, Headings +base0E = "#ba8baf" # Keywords, Storage, Selector, Markup Italic, Diff Changed +base0F = "#a16946" # Deprecated, Opening/Closing Embedded Language Tags, e.g. -- cgit v1.2.3-70-g09d2 From 2ac9d30bf3614a08f2d0216010f5d73845c205fa Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Mon, 18 Oct 2021 15:39:54 +0800 Subject: improve menu selected color for nord (#873) --- runtime/themes/nord.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/themes/nord.toml b/runtime/themes/nord.toml index ee7c8865..de5f1add 100644 --- a/runtime/themes/nord.toml +++ b/runtime/themes/nord.toml @@ -2,7 +2,7 @@ # "ui.linenr.selected" = { fg = "#d8dee9" } "ui.text.focus" = { fg = "#88c0d0", modifiers= ["bold"] } -# "ui.menu.selected" = { fg = "#e5ded6", bg = "#313f4e" } +"ui.menu.selected" = { fg = "#88c0d0", bg = "#313f4e" } # "info" = "#b48ead" # "hint" = "#a3be8c" -- cgit v1.2.3-70-g09d2 From 7146ae9388bc523d56d2388b1898eab611cb13c3 Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Tue, 19 Oct 2021 11:17:05 +0800 Subject: Refactor nord theme (#874) * refactor again * remove useless color--- runtime/themes/nord.toml | 104 +++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 43 deletions(-) (limited to 'runtime') diff --git a/runtime/themes/nord.toml b/runtime/themes/nord.toml index de5f1add..29f3875d 100644 --- a/runtime/themes/nord.toml +++ b/runtime/themes/nord.toml @@ -1,84 +1,102 @@ # Author : RayGervais -# "ui.linenr.selected" = { fg = "#d8dee9" } -"ui.text.focus" = { fg = "#88c0d0", modifiers= ["bold"] } -"ui.menu.selected" = { fg = "#88c0d0", bg = "#313f4e" } +"ui.linenr.selected" = { fg = "nord4" } +"ui.text.focus" = { fg = "nord8", modifiers= ["bold"] } +"ui.menu.selected" = { fg = "nord8", bg = "nord2" } -# "info" = "#b48ead" -# "hint" = "#a3be8c" +"info" = "nord8" +"hint" = "nord8" # Polar Night # nord0 - background color -"ui.background" = { bg = "#2e3440" } -"ui.statusline.inactive" = { fg = "#d8dEE9", bg = "#2e3440" } +"ui.background" = { bg = "nord0" } +"ui.statusline.inactive" = { fg = "nord4", bg = "nord0" } # nord1 - status bars, panels, modals, autocompletion -"ui.statusline" = { fg = "#88c0d0", bg = "#3b4252" } +"ui.statusline" = { fg = "nord8", bg = "nord1" } "ui.popup" = { bg = "#232d38" } "ui.window" = { bg = "#232d38" } -"ui.help" = { bg = "#232d38", fg = "#e5ded6" } +"ui.help" = { bg = "#232d38", fg = "nord4" } # nord2 - active line, highlighting -"ui.selection" = { bg = "#434c5e" } -"ui.cursor.match" = { bg = "434c5e" } +"ui.selection" = { bg = "nord2" } +"ui.cursor.match" = { bg = "nord2" } -# nord3 - comments -"comment" = "#616E88" -"ui.linenr" = { fg = "#616E88" } +# nord3 - comments, nord3 based lighter color +# relative: https://github.com/arcticicestudio/nord/issues/94 +"comment" = "gray" +"ui.linenr" = { fg = "gray" } # Snow Storm # nord4 - cursor, variables, constants, attributes, fields -"ui.cursor.primary" = { fg = "#d8dee9", modifiers = ["reversed"] } -"attribute" = "#d8dee9" -"variable" = "#d8dee9" -"constant" = "#d8dee9" -"variable.builtin" = "#d8dee9" -"constant.builtin" = "#d8dee9" -"namespace" = "#d8dee9" +"ui.cursor.primary" = { fg = "nord4", modifiers = ["reversed"] } +"attribute" = "nord4" +"variable" = "nord4" +"constant" = "nord4" +"variable.builtin" = "nord4" +"constant.builtin" = "nord4" +"namespace" = "nord4" # nord5 - suble UI text # nord6 - base text, punctuation -"ui.text" = { fg = "#eceff4" } -"punctuation" = "#eceff4" +"ui.text" = { fg = "nord6" } +"punctuation" = "nord6" # Frost # nord7 - classes, types, primiatives -"type" = "#8fbcbb" -"type.builtin" = { fg = "#8fbcbb"} -"label" = "#8fbcbb" +"type" = "nord7" +"type.builtin" = { fg = "nord7"} +"label" = "nord7" # nord8 - declaration, methods, routines -"constructor" = "#88c0d0" -"function" = "#88c0d0" -"function.macro" = { fg = "#88c0d0" } -"function.builtin" = { fg = "#88c0d0" } +"constructor" = "nord8" +"function" = "nord8" +"function.macro" = { fg = "nord8" } +"function.builtin" = { fg = "nord8" } # nord9 - operator, tags, units, punctuations -"punctuation.delimiter" = "#81a1c1" -"operator" = { fg = "#81a1c1" } -"property" = "#81a1c1" +"punctuation.delimiter" = "nord9" +"operator" = { fg = "nord9" } +"property" = "nord9" # nord10 - keywords, special -"keyword" = { fg = "#5e81ac" } -"keyword.directive" = "#5e81ac" -"variable.parameter" = "#5e81ac" +"keyword" = { fg = "nord10" } +"keyword.directive" = "nord10" +"variable.parameter" = "nord10" # Aurora # nord11 - error -"error" = "#bf616a" +"error" = "nord11" # nord12 - annotations, decorators -"special" = "#d08770" -"module" = "#d08770" +"special" = "nord12" +"module" = "nord12" # nord13 - warnings, escape characters, regex -"warning" = "#ebcb8b" -"escape" = { fg = "#ebcb8b" } +"warning" = "nord13" +"escape" = { fg = "nord13" } # nord14 - strings -"string" = "#a3be8c" +"string" = "nord14" # nord15 - integer, floating point -"number" = "#b48ead" +"number" = "nord15" + +[palette] +nord0 = "#2e3440" +nord1 = "#3b4252" +nord2 = "#434c5e" +nord4 = "#d8dee9" +nord6 = "#eceff4" +nord7 = "#8fbcbb" +nord8 = "#88c0d0" +nord9 = "#81a1c1" +nord10 = "#5e81ac" +nord11 = "#bf616a" +nord12 = "#d08770" +nord13 = "#ebcb8b" +nord14 = "#a3be8c" +nord15 = "#b48ead" +gray = "#616e88" -- cgit v1.2.3-70-g09d2 From 2edc85e953e003f8b8121e7757e9d45f5216f649 Mon Sep 17 00:00:00 2001 From: Ray Gervais Date: Thu, 21 Oct 2021 20:58:49 -0400 Subject: fixes: missing info, warning diagnostic (#890) --- runtime/themes/base16_default_dark.toml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/themes/base16_default_dark.toml b/runtime/themes/base16_default_dark.toml index 625fc5ab..a5dc0852 100644 --- a/runtime/themes/base16_default_dark.toml +++ b/runtime/themes/base16_default_dark.toml @@ -1,7 +1,7 @@ # Author: RayGervais "ui.background" = { bg = "base00" } -"ui.menu" = "base01" +"ui.menu" = "base01" "ui.menu.selected" = { fg = "base04", bg = "base01" } "ui.linenr" = {fg = "base01" } "ui.popup" = { bg = "base01" } @@ -12,24 +12,33 @@ "ui.statusline" = {fg = "base04", bg = "base01" } "ui.help" = { fg = "base04", bg = "base01" } "ui.cursor" = { fg = "base05", modifiers = ["reversed"] } -"ui.text" = { fg = "base05" } -"operator" = "base05" +"ui.text" = { fg = "base05" } +"operator" = "base05" "ui.text.focus" = { fg = "base05" } "variable" = "base08" -"number" = "base09" -"constant" = "base09" +"number" = "base09" +"constant" = "base09" "attributes" = "base09" "type" = "base0A" "ui.cursor.match" = { fg = "base0A", modifiers = ["underlined"] } "strings" = "base0B" "property" = "base0B" "escape" = "base0C" -"function" = "base0D" +"function" = "base0D" "constructor" = "base0D" -"special" = "base0D" +"special" = "base0D" "keyword" = "base0E" -"label" = "base0E" +"label" = "base0E" "namespace" = "base0E" +"ui.popup" = { bg = "base01" } +"ui.window" = { bg = "base00" } +"ui.help" = { bg = "base01", fg = "base06" } + +"info" = "base03" +"hint" = "base03" +"debug" = "base03" +"diagnostic" = "base03" +"error" = "base0E" [palette] base00 = "#181818" # Default Background -- cgit v1.2.3-70-g09d2 From 787ba4f233a38e42cfeab5c5125122d7d7b85e8f Mon Sep 17 00:00:00 2001 From: ath3 Date: Sat, 23 Oct 2021 01:57:21 +0200 Subject: CMake support (#888) --- .gitmodules | 4 ++ helix-syntax/languages/tree-sitter-cmake | 1 + languages.toml | 8 +++ runtime/queries/cmake/highlights.scm | 97 ++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 160000 helix-syntax/languages/tree-sitter-cmake create mode 100644 runtime/queries/cmake/highlights.scm (limited to 'runtime') diff --git a/.gitmodules b/.gitmodules index 01260b84..7ed34ad3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -130,3 +130,7 @@ path = helix-syntax/languages/tree-sitter-tsq url = https://github.com/tree-sitter/tree-sitter-tsq shallow = true +[submodule "helix-syntax/languages/tree-sitter-cmake"] + path = helix-syntax/languages/tree-sitter-cmake + url = https://github.com/uyha/tree-sitter-cmake + shallow = true diff --git a/helix-syntax/languages/tree-sitter-cmake b/helix-syntax/languages/tree-sitter-cmake new file mode 160000 index 00000000..f6616f1e --- /dev/null +++ b/helix-syntax/languages/tree-sitter-cmake @@ -0,0 +1 @@ +Subproject commit f6616f1e417ee8b62daf251aa1daa5d73781c596 diff --git a/languages.toml b/languages.toml index 67f4d3d6..a393b4a6 100644 --- a/languages.toml +++ b/languages.toml @@ -346,3 +346,11 @@ file-types = ["scm"] roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } + +[[language]] +name = "cmake" +scope = "source.cmake" +file-types = ["cmake", "CMakeLists.txt"] +roots = [] +comment-token = "#" +indent = { tab-width = 2, unit = " " } diff --git a/runtime/queries/cmake/highlights.scm b/runtime/queries/cmake/highlights.scm new file mode 100644 index 00000000..71e9b5d9 --- /dev/null +++ b/runtime/queries/cmake/highlights.scm @@ -0,0 +1,97 @@ +[ + (quoted_argument) + (bracket_argument) + ] @string + +(variable) @variable + +[ + (bracket_comment) + (line_comment) + ] @comment + +(normal_command (identifier) @function) + +["ENV" "CACHE"] @string.special.symbol +["$" "{" "}" "<" ">"] @punctuation +["(" ")"] @punctuation.bracket + +[ + (function) + (endfunction) + (macro) + (endmacro) + ] @keyword.function + +[ + (if) + (elseif) + (else) + (endif) + ] @keyword.control.conditional + +[ + (foreach) + (endforeach) + (while) + (endwhile) + ] @keyword.control.repeat + +(function_command + (function) + . (argument) @function + (argument)* @variable.parameter + ) + +(macro_command + (macro) + . (argument) @function.macro + (argument)* @variable.parameter + ) + +(normal_command + (identifier) @function.builtin + . (argument) @variable + (#match? @function.builtin "^(?i)(set)$")) + +(normal_command + (identifier) @function.builtin + . (argument) + (argument) @constant + (#match? @constant "^(?:PARENT_SCOPE|CACHE)$") + (#match? @function.builtin "^(?i)(unset)$")) + +(normal_command + (identifier) @function.builtin + . (argument) + . (argument) + (argument) @constant + (#match? @constant "^(?:PARENT_SCOPE|CACHE|FORCE)$") + (#match? @function.builtin "^(?i)(set)$") + ) + +((argument) @constant.builtin.boolean + (#match? @constant.builtin.boolean "^(?i)(?:1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$") + ) + +(if_command + (if) + (argument) @operator + (#match? @operator "^(?:NOT|AND|OR|COMMAND|POLICY|TARGET|TEST|DEFINED|IN_LIST|EXISTS|IS_NEWER_THAN|IS_DIRECTORY|IS_SYMLINK|IS_ABSOLUTE|MATCHES|LESS|GREATER|EQUAL|LESS_EQUAL|GREATER_EQUAL|STRLESS|STRGREATER|STREQUAL|STRLESS_EQUAL|STRGREATER_EQUAL|VERSION_LESS|VERSION_GREATER|VERSION_EQUAL|VERSION_LESS_EQUAL|VERSION_GREATER_EQUAL)$") +) + +(normal_command + (identifier) @function.builtin + . (argument) + (argument) @constant + (#match? @constant "^(?:ALL|COMMAND|DEPENDS|BYPRODUCTS|WORKING_DIRECTORY|COMMENT|JOB_POOL|VERBATIM|USES_TERMINAL|COMMAND_EXPAND_LISTS|SOURCES)$") + (#match? @function.builtin "^(?i)(add_custom_target)$") + ) + +(normal_command + (identifier) @function.builtin + (argument) @constant + (#match? @constant "^(?:OUTPUT|COMMAND|MAIN_DEPENDENCY|DEPENDS|BYPRODUCTS|IMPLICIT_DEPENDS|WORKING_DIRECTORY|COMMENT|DEPFILE|JOB_POOL|VERBATIM|APPEND|USES_TERMINAL|COMMAND_EXPAND_LISTS)$") + (#match? @function.builtin "^(?i)(add_custom_command)$") + ) + -- cgit v1.2.3-70-g09d2 From 4ee92cad19cc94f0751f91fa9391d1899353d740 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 23 Oct 2021 08:11:19 +0530 Subject: Add treesitter textobjects (#728) * Add treesitter textobject queries Only for Go, Python and Rust for now. * Add tree-sitter textobjects Only has functions and class objects as of now. * Fix tests * Add docs for tree-sitter textobjects * Add guide for creating new textobject queries * Add parameter textobject Only parameter.inside is implemented now, parameter.around will probably require custom predicates akin to nvim' `make-range` since we want to select a trailing comma too (a comma will be an anonymous node and matching against them doesn't work similar to named nodes) * Simplify TextObject cell init--- book/src/SUMMARY.md | 2 ++ book/src/guides/README.md | 4 +++ book/src/guides/textobject.md | 30 ++++++++++++++++++++ book/src/usage.md | 13 +++++++-- helix-core/src/indent.rs | 1 + helix-core/src/syntax.rs | 43 ++++++++++++++++++++++++++-- helix-core/src/textobject.rs | 51 ++++++++++++++++++++++++++++++++++ helix-term/src/commands.rs | 19 +++++++++++++ runtime/queries/go/textobjects.scm | 21 ++++++++++++++ runtime/queries/python/textobjects.scm | 14 ++++++++++ runtime/queries/rust/textobjects.scm | 26 +++++++++++++++++ 11 files changed, 219 insertions(+), 5 deletions(-) create mode 100644 book/src/guides/README.md create mode 100644 book/src/guides/textobject.md create mode 100644 runtime/queries/go/textobjects.scm create mode 100644 runtime/queries/python/textobjects.scm create mode 100644 runtime/queries/rust/textobjects.scm (limited to 'runtime') diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index 3fa8e067..56f50e21 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -8,3 +8,5 @@ - [Keymap](./keymap.md) - [Key Remapping](./remapping.md) - [Hooks](./hooks.md) +- [Guides](./guides/README.md) + - [Adding Textobject Queries](./guides/textobject.md) diff --git a/book/src/guides/README.md b/book/src/guides/README.md new file mode 100644 index 00000000..96e62978 --- /dev/null +++ b/book/src/guides/README.md @@ -0,0 +1,4 @@ +# Guides + +This section contains guides for adding new language server configurations, +tree-sitter grammers, textobject queries, etc. diff --git a/book/src/guides/textobject.md b/book/src/guides/textobject.md new file mode 100644 index 00000000..50b3b574 --- /dev/null +++ b/book/src/guides/textobject.md @@ -0,0 +1,30 @@ +# Adding Textobject Queries + +Textobjects that are language specific ([like functions, classes, etc][textobjects]) +require an accompanying tree-sitter grammar and a `textobjects.scm` query file +to work properly. Tree-sitter allows us to query the source code syntax tree +and capture specific parts of it. The queries are written in a lisp dialect. +More information on how to write queries can be found in the [official tree-sitter +documentation](tree-sitter-queries). + +Query files should be placed in `runtime/queries/{language}/textobjects.scm` +when contributing. Note that to test the query files locally you should put +them under your local runtime directory (`~/.config/helix/runtime` on Linux +for example). + +The following [captures][tree-sitter-captures] are recognized: + +| Capture Name | +| --- | +| `function.inside` | +| `function.around` | +| `class.inside` | +| `class.around` | +| `parameter.inside` | + +[Example query files][textobject-examples] can be found in the helix GitHub repository. + +[textobjects]: ../usage.md#textobjects +[tree-sitter-queries]: https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax +[tree-sitter-captures]: https://tree-sitter.github.io/tree-sitter/using-parsers#capturing-nodes +[textobject-examples]: https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l= diff --git a/book/src/usage.md b/book/src/usage.md index 2de8d01a..d31e03a1 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -51,9 +51,10 @@ Multiple characters are currently not supported, but planned. ## Textobjects -Currently supported: `word`, `surround`. +Currently supported: `word`, `surround`, `function`, `class`, `parameter`. ![textobject-demo](https://user-images.githubusercontent.com/23398472/124231131-81a4bb00-db2d-11eb-9d10-8e577ca7b177.gif) +![textobject-treesitter-demo](https://user-images.githubusercontent.com/23398472/132537398-2a2e0a54-582b-44ab-a77f-eb818942203d.gif) - `ma` - Select around the object (`va` in vim, `` in kakoune) - `mi` - Select inside the object (`vi` in vim, `` in kakoune) @@ -62,5 +63,11 @@ Currently supported: `word`, `surround`. | --- | --- | | `w` | Word | | `(`, `[`, `'`, etc | Specified surround pairs | - -Textobjects based on treesitter, like `function`, `class`, etc are planned. +| `f` | Function | +| `c` | Class | +| `p` | Parameter | + +Note: `f`, `c`, etc need a tree-sitter grammar active for the current +document and a special tree-sitter query file to work properly. [Only +some grammars](https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l=) +currently have the query file implemented. Contributions are welcome ! diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index d9a0155f..20f034ea 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -464,6 +464,7 @@ where unit: String::from(" "), }), indent_query: OnceCell::new(), + textobject_query: OnceCell::new(), }], }); diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 0929e38f..f4b4535b 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -49,7 +49,7 @@ pub struct Configuration { #[serde(rename_all = "kebab-case")] pub struct LanguageConfiguration { #[serde(rename = "name")] - pub(crate) language_id: String, + pub language_id: String, pub scope: String, // source.rust pub file_types: Vec, // filename ends_with? pub roots: Vec, // these indicate project roots <.git, Cargo.toml> @@ -76,6 +76,8 @@ pub struct LanguageConfiguration { #[serde(skip)] pub(crate) indent_query: OnceCell>, + #[serde(skip)] + pub(crate) textobject_query: OnceCell>, } #[derive(Debug, Serialize, Deserialize)] @@ -105,6 +107,32 @@ pub struct IndentQuery { pub outdent: HashSet, } +#[derive(Debug)] +pub struct TextObjectQuery { + pub query: Query, +} + +impl TextObjectQuery { + /// Run the query on the given node and return sub nodes which match given + /// capture ("function.inside", "class.around", etc). + pub fn capture_nodes<'a>( + &'a self, + capture_name: &str, + node: Node<'a>, + slice: RopeSlice<'a>, + cursor: &'a mut QueryCursor, + ) -> Option>> { + let capture_idx = self.query.capture_index_for_name(capture_name)?; + let captures = cursor.captures(&self.query, node, RopeProvider(slice)); + + captures + .filter_map(move |(mat, idx)| { + (mat.captures[idx].index == capture_idx).then(|| mat.captures[idx].node) + }) + .into() + } +} + fn load_runtime_file(language: &str, filename: &str) -> Result { let path = crate::RUNTIME_DIR .join("queries") @@ -153,7 +181,6 @@ impl LanguageConfiguration { // highlights_query += "\n(ERROR) @error"; let injections_query = read_query(&language, "injections.scm"); - let locals_query = read_query(&language, "locals.scm"); if highlights_query.is_empty() { @@ -203,6 +230,18 @@ impl LanguageConfiguration { .as_ref() } + pub fn textobject_query(&self) -> Option<&TextObjectQuery> { + self.textobject_query + .get_or_init(|| -> Option { + let lang_name = self.language_id.to_ascii_lowercase(); + let query_text = read_query(&lang_name, "textobjects.scm"); + let lang = self.highlight_config.get()?.as_ref()?.language; + let query = Query::new(lang, &query_text).ok()?; + Some(TextObjectQuery { query }) + }) + .as_ref() + } + pub fn scope(&self) -> &str { &self.scope } diff --git a/helix-core/src/textobject.rs b/helix-core/src/textobject.rs index b965f6df..975ed115 100644 --- a/helix-core/src/textobject.rs +++ b/helix-core/src/textobject.rs @@ -1,9 +1,13 @@ +use std::fmt::Display; + use ropey::RopeSlice; +use tree_sitter::{Node, QueryCursor}; use crate::chars::{categorize_char, char_is_whitespace, CharCategory}; use crate::graphemes::next_grapheme_boundary; use crate::movement::Direction; use crate::surround; +use crate::syntax::LanguageConfiguration; use crate::Range; fn find_word_boundary(slice: RopeSlice, mut pos: usize, direction: Direction) -> usize { @@ -51,6 +55,15 @@ pub enum TextObject { Inside, } +impl Display for TextObject { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::Around => "around", + Self::Inside => "inside", + }) + } +} + // count doesn't do anything yet pub fn textobject_word( slice: RopeSlice, @@ -108,6 +121,44 @@ pub fn textobject_surround( .unwrap_or(range) } +/// Transform the given range to select text objects based on tree-sitter. +/// `object_name` is a query capture base name like "function", "class", etc. +/// `slice_tree` is the tree-sitter node corresponding to given text slice. +pub fn textobject_treesitter( + slice: RopeSlice, + range: Range, + textobject: TextObject, + object_name: &str, + slice_tree: Node, + lang_config: &LanguageConfiguration, + _count: usize, +) -> Range { + let get_range = move || -> Option { + let byte_pos = slice.char_to_byte(range.cursor(slice)); + + let capture_name = format!("{}.{}", object_name, textobject); // eg. function.inner + let mut cursor = QueryCursor::new(); + let node = lang_config + .textobject_query()? + .capture_nodes(&capture_name, slice_tree, slice, &mut cursor)? + .filter(|node| node.byte_range().contains(&byte_pos)) + .min_by_key(|node| node.byte_range().len())?; + + let len = slice.len_bytes(); + let start_byte = node.start_byte(); + let end_byte = node.end_byte(); + if start_byte >= len || end_byte >= len { + return None; + } + + let start_char = slice.byte_to_char(start_byte); + let end_char = slice.byte_to_char(end_byte); + + Some(Range::new(start_char, end_char)) + }; + get_range().unwrap_or(range) +} + #[cfg(test)] mod test { use super::TextObject::*; diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 9f54292d..272a9d9a 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4465,9 +4465,28 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { let (view, doc) = current!(cx.editor); let text = doc.text().slice(..); + let textobject_treesitter = |obj_name: &str, range: Range| -> Range { + let (lang_config, syntax) = match doc.language_config().zip(doc.syntax()) { + Some(t) => t, + None => return range, + }; + textobject::textobject_treesitter( + text, + range, + objtype, + obj_name, + syntax.tree().root_node(), + lang_config, + count, + ) + }; + let selection = doc.selection(view.id).clone().transform(|range| { match ch { 'w' => textobject::textobject_word(text, range, objtype, count), + 'c' => textobject_treesitter("class", range), + 'f' => textobject_treesitter("function", range), + 'p' => textobject_treesitter("parameter", range), // TODO: cancel new ranges if inconsistent surround matches across lines ch if !ch.is_ascii_alphanumeric() => { textobject::textobject_surround(text, range, objtype, ch, count) diff --git a/runtime/queries/go/textobjects.scm b/runtime/queries/go/textobjects.scm new file mode 100644 index 00000000..9bcfc690 --- /dev/null +++ b/runtime/queries/go/textobjects.scm @@ -0,0 +1,21 @@ +(function_declaration + body: (block)? @function.inside) @function.around + +(func_literal + (_)? @function.inside) @function.around + +(method_declaration + body: (block)? @function.inside) @function.around + +;; struct and interface declaration as class textobject? +(type_declaration + (type_spec (type_identifier) (struct_type (field_declaration_list (_)?) @class.inside))) @class.around + +(type_declaration + (type_spec (type_identifier) (interface_type (method_spec_list (_)?) @class.inside))) @class.around + +(parameter_list + (_) @parameter.inside) + +(argument_list + (_) @parameter.inside) diff --git a/runtime/queries/python/textobjects.scm b/runtime/queries/python/textobjects.scm new file mode 100644 index 00000000..a52538af --- /dev/null +++ b/runtime/queries/python/textobjects.scm @@ -0,0 +1,14 @@ +(function_definition + body: (block)? @function.inside) @function.around + +(class_definition + body: (block)? @class.inside) @class.around + +(parameters + (_) @parameter.inside) + +(lambda_parameters + (_) @parameter.inside) + +(argument_list + (_) @parameter.inside) diff --git a/runtime/queries/rust/textobjects.scm b/runtime/queries/rust/textobjects.scm new file mode 100644 index 00000000..e3132687 --- /dev/null +++ b/runtime/queries/rust/textobjects.scm @@ -0,0 +1,26 @@ +(function_item + body: (_) @function.inside) @function.around + +(struct_item + body: (_) @class.inside) @class.around + +(enum_item + body: (_) @class.inside) @class.around + +(union_item + body: (_) @class.inside) @class.around + +(trait_item + body: (_) @class.inside) @class.around + +(impl_item + body: (_) @class.inside) @class.around + +(parameters + (_) @parameter.inside) + +(closure_parameters + (_) @parameter.inside) + +(arguments + (_) @parameter.inside) -- cgit v1.2.3-70-g09d2 From d4d16ca1b06ed18843ec3382f485c09b04e35e18 Mon Sep 17 00:00:00 2001 From: Ray Gervais Date: Sun, 24 Oct 2021 21:18:04 -0400 Subject: runtime: Rose Pine colorscheme (#897) --- runtime/themes/rose_pine.toml | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 runtime/themes/rose_pine.toml (limited to 'runtime') diff --git a/runtime/themes/rose_pine.toml b/runtime/themes/rose_pine.toml new file mode 100644 index 00000000..a982fd6e --- /dev/null +++ b/runtime/themes/rose_pine.toml @@ -0,0 +1,61 @@ +# Author: RayGervais + +"ui.background" = { bg = "base" } +"ui.menu" = "surface" +"ui.menu.selected" = { fg = "iris", bg = "surface" } +"ui.linenr" = {fg = "subtle" } +"ui.popup" = { bg = "overlay" } +"ui.window" = { bg = "overlay" } +"ui.liner.selected" = "highlightOverlay" +"ui.selection" = "highlight" +"comment" = "subtle" +"ui.statusline" = {fg = "foam", bg = "surface" } +"ui.help" = { fg = "foam", bg = "surface" } +"ui.cursor" = { fg = "rose", modifiers = ["reversed"] } +"ui.text" = { fg = "text" } +"operator" = "rose" +"ui.text.focus" = { fg = "base05" } +"variable" = "text" +"number" = "iris" +"constant" = "gold" +"attributes" = "gold" +"type" = "foam" +"ui.cursor.match" = { fg = "gold", modifiers = ["underlined"] } +"string" = "gold" +"property" = "foam" +"escape" = "subtle" +"function" = "rose" +"function.builtin" = "rose" +"function.method" = "foam" +"constructor" = "gold" +"special" = "gold" +"keyword" = "pine" +"label" = "iris" +"namespace" = "pine" +"ui.popup" = { bg = "overlay" } +"ui.window" = { bg = "base" } +"ui.help" = { bg = "overlay", fg = "foam" } +"text" = "text" + +"info" = "gold" +"hint" = "gold" +"debug" = "rose" +"diagnostic" = "rose" +"error" = "love" + +[palette] +base = "#191724" +surface = "#1f1d2e" +overlay = "#26233a" +inactive = "#555169" +subtle = "#6e6a86" +text = "#e0def4" +love = "#eb6f92" +gold = "#f6c177" +rose = "#ebbcba" +pine = "#31748f" +foam = "#9ccfd8" +iris = "#c4a7e7" +highlight = "#2a2837" +highlightInactive = "#211f2d" +highlightOverlay = "#3a384a" -- cgit v1.2.3-70-g09d2 From bf20e51044323f96f3fad7a543dc06bb745246ec Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 26 Oct 2021 08:25:56 -0500 Subject: use punctuation.special for interpolation #{ } --- runtime/queries/elixir/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index 08e09f37..3fd5d1cb 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -95,7 +95,7 @@ ; Quoted content -(interpolation "#{" @escape "}" @escape) @embedded +(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded (escape_sequence) @escape -- cgit v1.2.3-70-g09d2 From 7e6ade9290882e2be4be98d9a01ac554552334c5 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 26 Oct 2021 08:26:17 -0500 Subject: fix: string.regex{=>p} --- runtime/queries/elixir/highlights.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index 3fd5d1cb..b7b0cab6 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -121,9 +121,9 @@ (sigil (sigil_name) @__name__ - quoted_start: _ @string.regex - quoted_end: _ @string.regex - (#match? @__name__ "^[rR]$")) @string.regex + quoted_start: _ @string.regexp + quoted_end: _ @string.regexp + (#match? @__name__ "^[rR]$")) @string.regexp (sigil (sigil_name) @__name__ -- cgit v1.2.3-70-g09d2 From a1c7e55e3be95be6769d3a08518c8a41c257016f Mon Sep 17 00:00:00 2001 From: Houkime Date: Fri, 29 Oct 2021 05:11:19 +0000 Subject: update cpp queries (#930) Co-authored-by: Houkime <>--- helix-syntax/languages/tree-sitter-cpp | 2 +- runtime/queries/cpp/highlights.scm | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/helix-syntax/languages/tree-sitter-cpp b/helix-syntax/languages/tree-sitter-cpp index c6121241..e8dcc9d2 160000 --- a/helix-syntax/languages/tree-sitter-cpp +++ b/helix-syntax/languages/tree-sitter-cpp @@ -1 +1 @@ -Subproject commit c61212414a3e95b5f7507f98e83de1d638044adc +Subproject commit e8dcc9d2b404c542fd236ea5f7208f90be8a6e89 diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm index 3315fde0..3348ef3c 100644 --- a/runtime/queries/cpp/highlights.scm +++ b/runtime/queries/cpp/highlights.scm @@ -3,7 +3,7 @@ ; Functions (call_expression - function: (scoped_identifier + function: (qualified_identifier name: (identifier) @function)) (template_function @@ -13,15 +13,14 @@ name: (field_identifier) @function) (template_function - name: (scoped_identifier - name: (identifier) @function)) + name: (identifier) @function) (function_declarator - declarator: (scoped_identifier + declarator: (qualified_identifier name: (identifier) @function)) (function_declarator - declarator: (scoped_identifier + declarator: (qualified_identifier name: (identifier) @function)) (function_declarator -- cgit v1.2.3-70-g09d2 From ea452bec80d8701c91e8fa3aadbd960d46ecc6fb Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 30 Oct 2021 10:47:51 +0530 Subject: Update onedark theme (#936) - Use named color palette - Remove blue highlight for variables (too much noise) - Add purple highlight for control statements (if, match, etc)--- runtime/themes/onedark.toml | 103 ++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 43 deletions(-) (limited to 'runtime') diff --git a/runtime/themes/onedark.toml b/runtime/themes/onedark.toml index 37057f58..40ed1abe 100644 --- a/runtime/themes/onedark.toml +++ b/runtime/themes/onedark.toml @@ -1,54 +1,71 @@ # Author : Gokul Soumya -"attribute" = { fg = "#E5C07B" } -"comment" = { fg = "#5C6370", modifiers = ['italic'] } -"constant" = { fg = "#56B6C2" } -"constant.builtin" = { fg = "#61AFEF" } -"constructor" = { fg = "#61AFEF" } -"escape" = { fg = "#D19A66" } -"function" = { fg = "#61AFEF" } -"function.builtin" = { fg = "#61AFEF" } -"function.macro" = { fg = "#C678DD" } -"keyword" = { fg = "#E06C75" } -"keyword.directive" = { fg = "#C678DD" } -"label" = { fg = "#C678DD" } -"namespace" = { fg = "#61AFEF" } -"number" = { fg = "#D19A66" } -"operator" = { fg = "#C678DD" } -"property" = { fg = "#E06C75" } -"special" = { fg = "#61AFEF" } -"string" = { fg = "#98C379" } -"type" = { fg = "#E5C07B" } -"type.builtin" = { fg = "#E5C07B" } -"variable" = { fg = "#61AFEF" } -"variable.builtin" = { fg = "#61AFEF" } -"variable.parameter" = { fg = "#E06C75" } +"attribute" = { fg = "yellow" } +"comment" = { fg = "light-gray", modifiers = ["italic"] } +"constant" = { fg = "cyan" } +"constant.builtin" = { fg = "blue" } +"constructor" = { fg = "blue" } +"escape" = { fg = "gold" } +"function" = { fg = "blue" } +"function.builtin" = { fg = "blue" } +"function.macro" = { fg = "purple" } +"keyword" = { fg = "red" } +"keyword.control" = { fg = "purple" } +"keyword.directive" = { fg = "purple" } +"label" = { fg = "purple" } +"namespace" = { fg = "blue" } +"number" = { fg = "gold" } +"operator" = { fg = "purple" } +"property" = { fg = "red" } +"special" = { fg = "blue" } +"string" = { fg = "green" } +"type" = { fg = "yellow" } +"type.builtin" = { fg = "yellow" } +# "variable" = { fg = "blue" } +"variable.builtin" = { fg = "blue" } +"variable.parameter" = { fg = "red" } diagnostic = { modifiers = ["underlined"] } -"info" = { fg = "#61afef", modifiers = ['bold'] } -"hint" = { fg = "#98c379", modifiers = ['bold'] } -"warning" = { fg = "#e5c07b", modifiers = ['bold'] } -"error" = { fg = "#e06c75", modifiers = ['bold'] } +"info" = { fg = "blue", modifiers = ["bold"] } +"hint" = { fg = "green", modifiers = ["bold"] } +"warning" = { fg = "yellow", modifiers = ["bold"] } +"error" = { fg = "red", modifiers = ["bold"] } -"ui.background" = { bg = "#282C34" } +"ui.background" = { bg = "black" } -"ui.cursor" = { fg = "#ABB2BF", modifiers = ["reversed"] } -"ui.cursor.primary" = { fg = "#ABB2BF", modifiers = ["reversed"] } -"ui.cursor.match" = { fg = "#61AFEF", modifiers = ['underlined']} +"ui.cursor" = { fg = "white", modifiers = ["reversed"] } +"ui.cursor.primary" = { fg = "white", modifiers = ["reversed"] } +"ui.cursor.match" = { fg = "blue", modifiers = ["underlined"]} -"ui.selection" = { bg = "#5C6370" } -"ui.selection.primary" = { bg = "#3E4452" } +"ui.selection" = { bg = "light-gray" } +"ui.selection.primary" = { bg = "gray" } -"ui.linenr" = { fg = "#4B5263", modifiers = ['dim'] } -"ui.linenr.selected" = { fg = "#ABB2BF" } +"ui.linenr" = { fg = "linenr", modifiers = ["dim"] } +"ui.linenr.selected" = { fg = "white" } -"ui.statusline" = { fg = "#ABB2BF", bg = "#2C323C" } -"ui.statusline.inactive" = { fg = "#5C6370", bg = "#2C323C" } +"ui.statusline" = { fg = "white", bg = "light-black" } +"ui.statusline.inactive" = { fg = "light-gray", bg = "light-black" } -"ui.text" = { fg = "#ABB2BF" } -"ui.text.focus" = { fg = "#ABB2BF", bg = "#2C323C", modifiers = ['bold'] } +"ui.text" = { fg = "white" } +"ui.text.focus" = { fg = "white", bg = "light-black", modifiers = ["bold"] } -"ui.help" = { bg = "#3E4452" } -"ui.popup" = { bg = "#3E4452" } -"ui.window" = { bg = "#3E4452" } -"ui.menu.selected" = { fg = "#282C34", bg = "#61AFEF" } +"ui.help" = { bg = "gray" } +"ui.popup" = { bg = "gray" } +"ui.window" = { bg = "gray" } +"ui.menu.selected" = { fg = "black", bg = "blue" } + +[palette] + +yellow = "#E5C07B" +blue = "#61AFEF" +red = "#E06C75" +purple = "#C678DD" +green = "#98C379" +gold = "#D19A66" +cyan = "#56B6C2" +white = "#ABB2BF" +black = "#282C34" +light-black = "#2C323C" +gray = "#3E4452" +light-gray = "#5C6370" +linenr = "#4B5263" -- cgit v1.2.3-70-g09d2 From 9e247bf6eef34978d66cdcee535da5e4f5ba13e9 Mon Sep 17 00:00:00 2001 From: Daniel Poulin Date: Mon, 1 Nov 2021 10:41:55 -0400 Subject: Add indents definition based on the one from nvim-treesitter --- runtime/queries/php/indents.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 runtime/queries/php/indents.toml (limited to 'runtime') diff --git a/runtime/queries/php/indents.toml b/runtime/queries/php/indents.toml new file mode 100644 index 00000000..85c104db --- /dev/null +++ b/runtime/queries/php/indents.toml @@ -0,0 +1,17 @@ +indent = [ + "array_creation_expression", + "arguments", + "formal_parameters", + "compound_statement", + "declaration_list", + "binary_expression", + "return_statement", + "expression_statement", + "switch_block", + "anonymous_function_use_clause", +] + +oudent = [ + "}", + ")", +] -- cgit v1.2.3-70-g09d2 From ee889aaa854d0036da3bae16252bc382e50b0df6 Mon Sep 17 00:00:00 2001 From: Kirawi Date: Tue, 2 Nov 2021 23:00:52 -0400 Subject: Updated tree-sitter query scopes (#896) * updated theme scopes variable.property -> variable.field property -> variable.field * updated theme scopes * update book and themes updated book and themes to reflect scope changes * wip * update more queries * update dark_plus.toml--- book/src/themes.md | 10 +++--- helix-core/src/lib.rs | 1 + runtime/queries/bash/highlights.scm | 4 +-- runtime/queries/c-sharp/highlights.scm | 10 +++--- runtime/queries/c/highlights.scm | 6 ++-- runtime/queries/css/highlights.scm | 14 ++++---- runtime/queries/elixir/highlights.scm | 19 +++++------ runtime/queries/go/highlights.scm | 6 ++-- runtime/queries/haskell/highlights.scm | 6 ++-- runtime/queries/java/highlights.scm | 11 ++++--- runtime/queries/javascript/highlights.scm | 4 +-- runtime/queries/json/highlights.scm | 19 ++++++++--- runtime/queries/julia/highlights.scm | 12 +++---- runtime/queries/ledger/highlights.scm | 4 +-- runtime/queries/lua/highlights.scm | 6 ++-- runtime/queries/nix/highlights.scm | 12 +++---- runtime/queries/ocaml/highlights.scm | 8 ++--- runtime/queries/php/highlights.scm | 12 +++---- runtime/queries/protobuf/highlights.scm | 10 +++--- runtime/queries/python/highlights.scm | 11 +++---- runtime/queries/ruby/highlights.scm | 6 ++-- runtime/queries/rust/highlights.scm | 35 +++++++++++++------- runtime/queries/svelte/highlights.scm | 2 +- runtime/queries/toml/highlights.scm | 8 ++--- runtime/queries/tsq/highlights.scm | 4 +-- runtime/queries/yaml/highlights.scm | 10 +++--- runtime/queries/zig/highlights.scm | 8 ++--- runtime/themes/base16_default_dark.toml | 6 ++-- runtime/themes/bogster.toml | 6 ++-- runtime/themes/dark_plus.toml | 53 ++++++++++++++++++++----------- runtime/themes/everforest_dark.toml | 7 ++-- runtime/themes/gruvbox.toml | 7 ++-- runtime/themes/ingrid.toml | 6 ++-- runtime/themes/monokai.toml | 7 ++-- runtime/themes/nord.toml | 6 ++-- runtime/themes/rose_pine.toml | 4 +-- theme.toml | 2 +- 37 files changed, 198 insertions(+), 164 deletions(-) (limited to 'runtime') diff --git a/book/src/themes.md b/book/src/themes.md index 5a4d0403..ecbbb6e9 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -103,8 +103,6 @@ We use a similar set of scopes as [SublimeText](https://www.sublimetext.com/docs/scope_naming.html). See also [TextMate](https://macromates.com/manual/en/language_grammars) scopes. -- `escape` (TODO: rename to (constant).character.escape) - - `type` - Types - `builtin` - Primitive types provided by the language (`int`, `usize`) @@ -112,8 +110,11 @@ We use a similar set of scopes as - `builtin` Special constants provided by the language (`true`, `false`, `nil` etc) - `boolean` - `character` + - `escape` + - `numeric` (numbers) + - `integer` + - `float` -- `number` (TODO: rename to constant.number/.numeric.{integer, float, complex}) - `string` (TODO: string.quoted.{single, double}, string.raw/.unquoted)? - `regexp` - Regular expressions - `special` @@ -129,7 +130,8 @@ We use a similar set of scopes as - `variable` - Variables - `builtin` - Reserved language variables (`self`, `this`, `super`, etc) - `parameter` - Function parameters - - `property` + - `other` + - `member` - Fields of composite data types (e.g. structs, unions) - `function` (TODO: ?) - `label` diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index d971464a..96f88ee4 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -35,6 +35,7 @@ pub fn find_first_non_whitespace_char(line: RopeSlice) -> Option { line.chars().position(|ch| !ch.is_whitespace()) } +/// Find `.git` root. pub fn find_root(root: Option<&str>) -> Option { let current_dir = std::env::current_dir().expect("unable to determine current directory"); diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index 754faeda..57898f27 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -7,7 +7,7 @@ (command_name) @function -(variable_name) @property +(variable_name) @variable.other.member [ "case" @@ -31,7 +31,7 @@ (function_definition name: (word) @function) -(file_descriptor) @number +(file_descriptor) @constant.numeric.integer [ (command_substitution) diff --git a/runtime/queries/c-sharp/highlights.scm b/runtime/queries/c-sharp/highlights.scm index b76f4e60..6e84ad83 100644 --- a/runtime/queries/c-sharp/highlights.scm +++ b/runtime/queries/c-sharp/highlights.scm @@ -20,16 +20,16 @@ ] @type.builtin ;; Enum -(enum_member_declaration (identifier) @variable.property) +(enum_member_declaration (identifier) @variable.other.member) ;; Literals [ (real_literal) (integer_literal) -] @number +] @constant.numeric.integer +(character_literal) @constant.character [ - (character_literal) (string_literal) (verbatim_string_literal) (interpolated_string_text) @@ -40,8 +40,8 @@ "$@\"" ] @string +(boolean_literal) @constant.builtin.boolean [ - (boolean_literal) (null_literal) (void_keyword) ] @constant.builtin @@ -98,7 +98,7 @@ ;; Keywords (modifier) @keyword (this_expression) @keyword -(escape_sequence) @keyword +(escape_sequence) @constant.character.escape [ "as" diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index 2c42710f..918f3f66 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -60,8 +60,8 @@ (system_lib_string) @string (null) @constant -(number_literal) @number -(char_literal) @string +(number_literal) @constant.numeric.integer +(char_literal) @constant.character (call_expression function: (identifier) @function) @@ -73,7 +73,7 @@ (preproc_function_def name: (identifier) @function.special) -(field_identifier) @property +(field_identifier) @variable.other.member (statement_identifier) @label (type_identifier) @type (primitive_type) @type diff --git a/runtime/queries/css/highlights.scm b/runtime/queries/css/highlights.scm index 763661af..4dfc0c66 100644 --- a/runtime/queries/css/highlights.scm +++ b/runtime/queries/css/highlights.scm @@ -26,11 +26,11 @@ (pseudo_element_selector (tag_name) @attribute) (pseudo_class_selector (class_name) @attribute) -(class_name) @property -(id_name) @property -(namespace_name) @property -(property_name) @property -(feature_name) @property +(class_name) @variable.other.member +(id_name) @variable.other.member +(namespace_name) @variable.other.member +(property_name) @variable.other.member +(feature_name) @variable.other.member (attribute_name) @attribute @@ -55,8 +55,8 @@ (string_value) @string (color_value) @string.special -(integer_value) @number -(float_value) @number +(integer_value) @constant.numeric.integer +(float_value) @constant.numeric.float (unit) @type "#" @punctuation.delimiter diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm index b7b0cab6..76fd2af9 100644 --- a/runtime/queries/elixir/highlights.scm +++ b/runtime/queries/elixir/highlights.scm @@ -39,13 +39,13 @@ ; * module attribute (unary_operator - operator: "@" @variable.property + operator: "@" @variable.other.member operand: [ - (identifier) @variable.property + (identifier) @variable.other.member (call - target: (identifier) @variable.property) - (boolean) @variable.property - (nil) @variable.property + target: (identifier) @variable.other.member) + (boolean) @variable.other.member + (nil) @variable.other.member ]) ; * capture operator @@ -79,11 +79,8 @@ (nil) @constant.builtin (boolean) @constant.builtin.boolean - -[ - (integer) - (float) -] @number +(integer) @constant.numeric.integer +(float) @constant.numeric.float (alias) @type @@ -97,7 +94,7 @@ (interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded -(escape_sequence) @escape +(escape_sequence) @constant.character.escape [ (atom) diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index 3129c4b2..56384d4d 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -25,7 +25,7 @@ (variadic_parameter_declaration (identifier) @variable.parameter) (type_identifier) @type -(field_identifier) @property +(field_identifier) @variable.other.member (identifier) @variable (package_identifier) @variable @@ -130,13 +130,13 @@ (rune_literal) ] @string -(escape_sequence) @escape +(escape_sequence) @constant.character.escape [ (int_literal) (float_literal) (imaginary_literal) -] @number +] @constant.numeric.integer [ (true) diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index dada80b6..72187876 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -13,9 +13,9 @@ (constraint class: (class_name (type)) @class) (class (class_head class: (class_name (type)) @class)) (instance (instance_head class: (class_name (type)) @class)) -(integer) @number -(exp_literal (float)) @number -(char) @literal +(integer) @constant.numeric.integer +(exp_literal (float)) @constant.numeric.float +(char) @constant.character (con_unit) @literal (con_list) @literal (tycon_arrow) @operator diff --git a/runtime/queries/java/highlights.scm b/runtime/queries/java/highlights.scm index e7d793df..77902fce 100644 --- a/runtime/queries/java/highlights.scm +++ b/runtime/queries/java/highlights.scm @@ -59,14 +59,15 @@ (hex_integer_literal) (decimal_integer_literal) (octal_integer_literal) +] @constant.numeric.integer + +[ (decimal_floating_point_literal) (hex_floating_point_literal) -] @number +] @constant.numeric.float -[ - (character_literal) - (string_literal) -] @string +(character_literal) @constant.character +(string_literal) @string [ (true) diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm index e29829bf..6163b680 100644 --- a/runtime/queries/javascript/highlights.scm +++ b/runtime/queries/javascript/highlights.scm @@ -65,7 +65,7 @@ ; Properties ;----------- -(property_identifier) @property +(property_identifier) @variable.other.member ; Literals ;--------- @@ -88,7 +88,7 @@ ] @string (regex) @string.regexp -(number) @number +(number) @constant.numeric.integer ; Tokens ;------- diff --git a/runtime/queries/json/highlights.scm b/runtime/queries/json/highlights.scm index b08ea439..6df6c9eb 100644 --- a/runtime/queries/json/highlights.scm +++ b/runtime/queries/json/highlights.scm @@ -1,9 +1,20 @@ +[ + (true) + (false) +] @constant.builtin.boolean +(null) @constant.builtin +(number) @constant.numeric (pair key: (_) @keyword) (string) @string +(escape_sequence) @constant.character.escape +(ERROR) @error -(object - "{" @escape - (_) - "}" @escape) +"," @punctuation.delimiter +[ + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm index 7b7d426c..7c447985 100644 --- a/runtime/queries/julia/highlights.scm +++ b/runtime/queries/julia/highlights.scm @@ -15,7 +15,7 @@ (field_expression (identifier) - (identifier) @field .) + (identifier) @variable.other.member .) (function_definition name: (identifier) @function) @@ -80,14 +80,14 @@ (struct_definition name: (identifier) @type) -(number) @number +(number) @constant.numeric.integer (range_expression - (identifier) @number - (eq? @number "end")) + (identifier) @constant.numeric.integer + (eq? @constant.numeric.integer "end")) (range_expression (_ - (identifier) @number - (eq? @number "end"))) + (identifier) @constant.numeric.integer + (eq? @constant.numeric.integer "end"))) (coefficient_expression (number) (identifier) @constant.builtin) diff --git a/runtime/queries/ledger/highlights.scm b/runtime/queries/ledger/highlights.scm index 86c609c2..bdf5f2db 100644 --- a/runtime/queries/ledger/highlights.scm +++ b/runtime/queries/ledger/highlights.scm @@ -7,9 +7,9 @@ (date) (interval) (quantity) -] @number +] @constant.numeric.integer -((account) @field) +((account) @variable.other.member) ((commodity) @text.literal) "include" @include diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm index 40c2be70..e73b32d6 100644 --- a/runtime/queries/lua/highlights.scm +++ b/runtime/queries/lua/highlights.scm @@ -150,14 +150,14 @@ (table ["{" "}"] @constructor) (comment) @comment (string) @string -(number) @number +(number) @constant.numeric.integer (label_statement) @label ; A bit of a tricky one, this will only match field names -(field . (identifier) @property (_)) +(field . (identifier) @variable.other.member (_)) (shebang) @comment ;; Property -(property_identifier) @property +(property_identifier) @variable.other.member ;; Variable (identifier) @variable diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm index 741b73b5..66719e87 100644 --- a/runtime/queries/nix/highlights.scm +++ b/runtime/queries/nix/highlights.scm @@ -33,16 +33,14 @@ (uri) @string.special.uri -[ - (integer) - (float) -] @number +(integer) @constant.numeric.integer +(float) @constant.numeric.float (interpolation "${" @punctuation.special "}" @punctuation.special) @embedded -(escape_sequence) @escape +(escape_sequence) @constant.character.escape (function universal: (identifier) @variable.parameter @@ -66,8 +64,8 @@ (binary operator: _ @operator) -(attr_identifier) @property -(inherit attrs: (attrs_inherited (identifier) @property) ) +(attr_identifier) @variable.other.member +(inherit attrs: (attrs_inherited (identifier) @variable.other.member) ) [ ";" diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm index 160f2cb4..15f46cc1 100644 --- a/runtime/queries/ocaml/highlights.scm +++ b/runtime/queries/ocaml/highlights.scm @@ -51,14 +51,14 @@ ; Properties ;----------- -[(label_name) (field_name) (instance_variable_name)] @property +[(label_name) (field_name) (instance_variable_name)] @variable.other.member ; Constants ;---------- [(boolean) (unit)] @constant -[(number) (signed_number)] @number +[(number) (signed_number)] @constant.numeric.integer (character) @constant.character @@ -66,7 +66,7 @@ (quoted_string "{" @string "}" @string) @string -(escape_sequence) @string.escape +(escape_sequence) @constant.character.escape [ (conversion_specification) @@ -145,7 +145,7 @@ ; Attributes ;----------- -(attribute_id) @property +(attribute_id) @variable.other.member ; Comments ;--------- diff --git a/runtime/queries/php/highlights.scm b/runtime/queries/php/highlights.scm index 02904555..46b5d26c 100644 --- a/runtime/queries/php/highlights.scm +++ b/runtime/queries/php/highlights.scm @@ -30,12 +30,12 @@ ; Member (property_element - (variable_name) @property) + (variable_name) @variable.other.member) (member_access_expression - name: (variable_name (name)) @property) + name: (variable_name (name)) @variable.other.member) (member_access_expression - name: (name) @property) + name: (name) @variable.other.member) ; Variables @@ -56,10 +56,10 @@ (string) @string (heredoc) @string -(boolean) @constant.builtin +(boolean) @constant.builtin.boolean (null) @constant.builtin -(integer) @number -(float) @number +(integer) @constant.numeric.integer +(float) @constant.numeric.float (comment) @comment "$" @operator diff --git a/runtime/queries/protobuf/highlights.scm b/runtime/queries/protobuf/highlights.scm index cd021be1..c35c430e 100644 --- a/runtime/queries/protobuf/highlights.scm +++ b/runtime/queries/protobuf/highlights.scm @@ -34,16 +34,14 @@ [ (fieldName) (optionName) -] @property +] @variable.other.member (enumVariantName) @type.enum.variant (fullIdent) @namespace -[ - (intLit) - (floatLit) -] @number -(boolLit) @constant.builtin +(intLit) @constant.numeric.integer +(floatLit) @constant.numeric.float +(boolLit) @constant.builtin.boolean (strLit) @string (constant) @constant diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index f64fecb2..9131acc5 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -29,7 +29,7 @@ name: (identifier) @function) (identifier) @variable -(attribute attribute: (identifier) @property) +(attribute attribute: (identifier) @variable.other.member) (type (identifier) @type) ; Literals @@ -40,14 +40,11 @@ (false) ] @constant.builtin -[ - (integer) - (float) -] @number - +(integer) @constant.numeric.integer +(float) @constant.numeric.float (comment) @comment (string) @string -(escape_sequence) @escape +(escape_sequence) @constant.character.escape (interpolation "{" @punctuation.special diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm index 8617d6f0..898f8f79 100644 --- a/runtime/queries/ruby/highlights.scm +++ b/runtime/queries/ruby/highlights.scm @@ -55,7 +55,7 @@ [ (class_variable) (instance_variable) -] @property +] @variable.other.member ((identifier) @constant.builtin (#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$")) @@ -101,12 +101,12 @@ ] @string.special.symbol (regex) @string.regexp -(escape_sequence) @escape +(escape_sequence) @constant.character.escape [ (integer) (float) -] @number +] @constant.numeric.integer [ (nil) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 956a5dac..539d9550 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -15,15 +15,13 @@ ; Primitives ; --- -(escape_sequence) @escape +(escape_sequence) @constant.character.escape (primitive_type) @type.builtin (boolean_literal) @constant.builtin.boolean +(integer_literal) @constant.numeric.integer +(float_literal) @constant.numeric.float +(char_literal) @constant.character [ - (integer_literal) - (float_literal) -] @number -[ - (char_literal) (string_literal) (raw_string_literal) ] @string @@ -40,10 +38,10 @@ (enum_variant (identifier) @type.enum.variant) (field_initializer - (field_identifier) @property) + (field_identifier) @variable.other.member) (shorthand_field_initializer - (identifier) @variable.property) -(shorthand_field_identifier) @variable.property + (identifier) @variable.other.member) +(shorthand_field_identifier) @variable.other.member (lifetime "'" @label @@ -81,9 +79,24 @@ ] @punctuation.bracket) ; --- -; Parameters +; Variables ; --- +(let_declaration + pattern: [ + ((identifier) @variable) + ((tuple_pattern + (identifier) @variable)) + ]) + +; It needs to be anonymous to not conflict with `call_expression` further below. +(_ + value: (field_expression + value: (identifier)? @variable + field: (field_identifier) @variable.other.member)) + +(arguments + (identifier) @variable.parameter) (parameter pattern: (identifier) @variable.parameter) (closure_parameters @@ -336,4 +349,4 @@ (type_identifier) @type (identifier) @variable -(field_identifier) @property +(field_identifier) @variable.other.member diff --git a/runtime/queries/svelte/highlights.scm b/runtime/queries/svelte/highlights.scm index 4c6f5f35..4fcdfd66 100644 --- a/runtime/queries/svelte/highlights.scm +++ b/runtime/queries/svelte/highlights.scm @@ -29,7 +29,7 @@ (#match? @_attr "^(href|src)$")) (tag_name) @tag -(attribute_name) @property +(attribute_name) @variable.other.member (erroneous_end_tag_name) @error (comment) @comment diff --git a/runtime/queries/toml/highlights.scm b/runtime/queries/toml/highlights.scm index e4d6966f..2742b2be 100644 --- a/runtime/queries/toml/highlights.scm +++ b/runtime/queries/toml/highlights.scm @@ -1,17 +1,17 @@ ; Properties ;----------- -(bare_key) @property +(bare_key) @variable.other.member (quoted_key) @string ; Literals ;--------- -(boolean) @constant.builtin +(boolean) @constant.builtin.boolean (comment) @comment (string) @string -(integer) @number -(float) @number +(integer) @constant.numeric.integer +(float) @constant.numeric.float (offset_date_time) @string.special (local_date_time) @string.special (local_date) @string.special diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm index 9ba5699a..549895c1 100644 --- a/runtime/queries/tsq/highlights.scm +++ b/runtime/queries/tsq/highlights.scm @@ -35,12 +35,12 @@ (comment) @comment -(field_name) @property +(field_name) @variable.other.member (capture) @label (predicate_name) @function -(escape_sequence) @escape +(escape_sequence) @constant.character.escape (node_name) @variable diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm index 2955a4ce..a7efb5e7 100644 --- a/runtime/queries/yaml/highlights.scm +++ b/runtime/queries/yaml/highlights.scm @@ -1,12 +1,12 @@ -(block_mapping_pair key: (_) @property) -(flow_mapping (_ key: (_) @property)) +(block_mapping_pair key: (_) @variable.other.member) +(flow_mapping (_ key: (_) @variable.other.member)) (boolean_scalar) @constant.builtin.boolean (null_scalar) @constant.builtin (double_quote_scalar) @string (single_quote_scalar) @string -(escape_sequence) @string.escape -(integer_scalar) @number -(float_scalar) @number +(escape_sequence) @constant.character.escape +(integer_scalar) @constant.numeric.integer +(float_scalar) @constant.numeric.float (comment) @comment (anchor_name) @type (alias_name) @type diff --git a/runtime/queries/zig/highlights.scm b/runtime/queries/zig/highlights.scm index 404a8682..34dbeacd 100644 --- a/runtime/queries/zig/highlights.scm +++ b/runtime/queries/zig/highlights.scm @@ -14,7 +14,7 @@ parameter: (IDENTIFIER) @variable.parameter [ field_member: (IDENTIFIER) field_access: (IDENTIFIER) -] @variable.property +] @variable.other.member ;; assume TitleCase is a type ( @@ -75,9 +75,9 @@ field_constant: (IDENTIFIER) @constant ((BUILTINIDENTIFIER) @keyword.control.import (#any-of? @keyword.control.import "@import" "@cImport")) -(INTEGER) @number +(INTEGER) @constant.numeric.integer -(FLOAT) @number +(FLOAT) @constant.numeric.float [ (LINESTRING) @@ -85,7 +85,7 @@ field_constant: (IDENTIFIER) @constant ] @string (CHAR_LITERAL) @constant.character -(EscapeSequence) @escape +(EscapeSequence) @constant.character.escape (FormatSequence) @string.special [ diff --git a/runtime/themes/base16_default_dark.toml b/runtime/themes/base16_default_dark.toml index a5dc0852..d65995c0 100644 --- a/runtime/themes/base16_default_dark.toml +++ b/runtime/themes/base16_default_dark.toml @@ -16,14 +16,14 @@ "operator" = "base05" "ui.text.focus" = { fg = "base05" } "variable" = "base08" -"number" = "base09" +"constant.numeric" = "base09" "constant" = "base09" "attributes" = "base09" "type" = "base0A" "ui.cursor.match" = { fg = "base0A", modifiers = ["underlined"] } "strings" = "base0B" -"property" = "base0B" -"escape" = "base0C" +"variable.other.member" = "base0B" +"constant.character.escape" = "base0C" "function" = "base0D" "constructor" = "base0D" "special" = "base0D" diff --git a/runtime/themes/bogster.toml b/runtime/themes/bogster.toml index 37b9adbf..86a6c34b 100644 --- a/runtime/themes/bogster.toml +++ b/runtime/themes/bogster.toml @@ -8,7 +8,7 @@ "punctuation.delimiter" = "#dc7759" "operator" = { fg = "#dc7759", modifiers = ["bold"] } "special" = "#7fdc59" -"property" = "#c6b8ad" +"variable.other.member" = "#c6b8ad" "variable" = "#c6b8ad" "variable.parameter" = "#c6b8ad" "type" = "#dc597f" @@ -22,8 +22,8 @@ "constant" = "#59dcb7" "constant.builtin" = "#59dcb7" "string" = "#59dcb7" -"number" = "#59c0dc" -"escape" = { fg = "#7fdc59", modifiers = ["bold"] } +"constant.numeric" = "#59c0dc" +"constant.character.escape" = { fg = "#7fdc59", modifiers = ["bold"] } "label" = "#59c0dc" "module" = "#d32c5d" diff --git a/runtime/themes/dark_plus.toml b/runtime/themes/dark_plus.toml index c48a7e28..0554f827 100644 --- a/runtime/themes/dark_plus.toml +++ b/runtime/themes/dark_plus.toml @@ -7,7 +7,7 @@ "type.builtin" = { fg = "type" } "type.enum.variant" = { fg = "constant" } "constructor" = { fg = "constant" } -"property" = { fg = "variable" } +"variable.other.member" = { fg = "variable" } "keyword" = { fg = "keyword" } "keyword.directive" = { fg = "keyword" } @@ -31,47 +31,64 @@ "function.macro" = { fg = "keyword" } "attribute" = { fg = "fn_declaration" } -"comment" = { fg = "#6A9955" } +"comment" = { fg = "dark_green" } -"string" = { fg = "#ce9178" } -"string.regexp" = { fg = "regex" } -"number" = { fg = "#b5cea8" } -"escape" = { fg = "#d7ba7d" } +"string" = { fg = "orange" } +"constant.character" = { fg = "orange" } +"string.regexp" = { fg = "gold" } +"constant.numeric" = { fg = "pale_green" } +"constant.character.escape" = { fg = "gold" } -"ui.background" = { fg = "#d4d4d4", bg = "#1e1e1e" } +"ui.background" = { fg = "light_gray", bg = "dark_gray2" } "ui.window" = { bg = "widget" } "ui.popup" = { bg = "widget" } "ui.help" = { bg = "widget" } "ui.menu.selected" = { bg = "widget" } +# TODO: Alternate bg colour for `ui.cursor.match` and `ui.selection`. "ui.cursor" = { fg = "cursor", modifiers = ["reversed"] } "ui.cursor.primary" = { fg = "cursor", modifiers = ["reversed"] } "ui.cursor.match" = { bg = "#3a3d41", modifiers = ["underlined"] } "ui.selection" = { bg = "#3a3d41" } -"ui.selection.primary" = { bg = "#264f78" } +"ui.selection.primary" = { bg = "dark_blue" } -"ui.linenr" = { fg = "#858585" } -"ui.linenr.selected" = { fg = "#c6c6c6" } +"ui.linenr" = { fg = "dark_gray" } +"ui.linenr.selected" = { fg = "light_gray2" } -"ui.statusline" = { fg = "#ffffff", bg = "#007acc" } -"ui.statusline.inactive" = { fg = "#ffffff", bg = "#007acc" } +"ui.statusline" = { fg = "white", bg = "blue" } +"ui.statusline.inactive" = { fg = "white", bg = "blue" } "ui.text" = { fg = "text", bg = "background" } -"ui.text.focus" = { fg = "#ffffff" } +"ui.text.focus" = { fg = "white" } -"warning" = { fg = "#cca700" } -"error" = { fg = "#ff1212" } -"info" = { fg = "#75beff" } -"hint" = { fg = "#eeeeeeb3" } +"warning" = { fg = "gold2" } +"error" = { fg = "red" } +"info" = { fg = "light_blue" } +"hint" = { fg = "light_gray3" } diagnostic = { modifiers = ["underlined"] } [palette] +white = "#ffffff" +orange = "#ce9178" +gold = "#d7ba7d" +gold2 = "#cca700" +pale_green = "#b5cea8" +dark_green = "#6A9955" +light_gray = "#d4d4d4" +light_gray2 = "#c6c6c6" +light_gray3 = "#eeeeee" +dark_gray = "#858585" +dark_gray2 = "#1e1e1e" +blue = "#007acc" +light_blue = "#75beff" +dark_blue = "#264f78" +red = "#ff1212" + type = "#4EC9B0" keyword = "#569CD6" -regex = "#CE9178" special = "#C586C0" variable = "#9CDCFE" fn_declaration = "#DCDCAA" diff --git a/runtime/themes/everforest_dark.toml b/runtime/themes/everforest_dark.toml index 462c8265..bbd005e6 100644 --- a/runtime/themes/everforest_dark.toml +++ b/runtime/themes/everforest_dark.toml @@ -8,16 +8,16 @@ # Email: sainnhe@gmail.com # License: MIT License -"escape" = "orange" +"constant.character.escape" = "orange" "type" = "yellow" "constant" = "purple" -"number" = "purple" +"constant.numeric" = "purple" "string" = "grey2" "comment" = "grey0" "variable" = "fg" "variable.builtin" = "blue" "variable.parameter" = "fg" -"variable.property" = "fg" +"variable.other.member" = "fg" "label" = "aqua" "punctuation" = "grey2" "punctuation.delimiter" = "grey2" @@ -32,7 +32,6 @@ "attribute" = "aqua" "constructor" = "yellow" "module" = "blue" -"property" = "fg" "special" = "orange" "ui.background" = { bg = "bg0" } diff --git a/runtime/themes/gruvbox.toml b/runtime/themes/gruvbox.toml index 0a6eec07..0ff039ea 100644 --- a/runtime/themes/gruvbox.toml +++ b/runtime/themes/gruvbox.toml @@ -9,8 +9,7 @@ "punctuation.delimiter" = "orange1" "operator" = "purple1" "special" = "purple0" -"property" = "blue1" -"variable.property" = "blue1" +"variable.other.member" = "blue1" "variable" = "fg1" "variable.builtin" = "orange1" "variable.parameter" = "fg2" @@ -24,8 +23,8 @@ "constant" = { fg = "purple1" } "constant.builtin" = { fg = "purple1", modifiers = ["bold"] } "string" = "green1" -"number" = "purple1" -"escape" = { fg = "fg2", modifiers = ["bold"] } +"constant.numeric" = "purple1" +"constant.character.escape" = { fg = "fg2", modifiers = ["bold"] } "label" = "aqua1" "module" = "aqua1" diff --git a/runtime/themes/ingrid.toml b/runtime/themes/ingrid.toml index 6a177ec7..30829475 100644 --- a/runtime/themes/ingrid.toml +++ b/runtime/themes/ingrid.toml @@ -8,7 +8,7 @@ "punctuation.delimiter" = "#C97270" "operator" = { fg = "#D74E50", modifiers = ["bold"] } "special" = "#D68482" -"property" = "#89BEB7" +"variable.other.member" = "#89BEB7" "variable" = "#A6B6CE" "variable.parameter" = "#89BEB7" "type" = { fg = "#A6B6CE", modifiers = ["bold"] } @@ -22,8 +22,8 @@ "constant" = "#D4A520" "constant.builtin" = "#D4A520" "string" = "#D74E50" -"number" = "#D74E50" -"escape" = { fg = "#D74E50", modifiers = ["bold"] } +"constant.numeric" = "#D74E50" +"constant.character.escape" = { fg = "#D74E50", modifiers = ["bold"] } "label" = "#D68482" "module" = "#839A53" diff --git a/runtime/themes/monokai.toml b/runtime/themes/monokai.toml index a8f03ff3..38f9f170 100644 --- a/runtime/themes/monokai.toml +++ b/runtime/themes/monokai.toml @@ -7,7 +7,7 @@ "type.builtin" = { fg = "#66D9EF" } "type.enum.variant" = { fg = "text" } "constructor" = { fg = "text" } -"property" = { fg = "variable" } +"variable.other.member" = { fg = "variable" } "keyword" = { fg = "keyword" } "keyword.directive" = { fg = "keyword" } @@ -34,9 +34,10 @@ "comment" = { fg = "#88846F" } "string" = { fg = "#e6db74" } +"constant.character" = { fg = "#e6db74" } "string.regexp" = { fg = "regex" } -"number" = { fg = "#ae81ff" } -"escape" = { fg = "#ae81ff" } +"constant.numeric" = { fg = "#ae81ff" } +"constant.character.escape" = { fg = "#ae81ff" } "ui.background" = { fg = "text", bg = "background" } diff --git a/runtime/themes/nord.toml b/runtime/themes/nord.toml index 29f3875d..78736c3b 100644 --- a/runtime/themes/nord.toml +++ b/runtime/themes/nord.toml @@ -59,7 +59,7 @@ # nord9 - operator, tags, units, punctuations "punctuation.delimiter" = "nord9" "operator" = { fg = "nord9" } -"property" = "nord9" +"variable.other.member" = "nord9" # nord10 - keywords, special "keyword" = { fg = "nord10" } @@ -76,13 +76,13 @@ # nord13 - warnings, escape characters, regex "warning" = "nord13" -"escape" = { fg = "nord13" } +"constant.character.escape" = { fg = "nord13" } # nord14 - strings "string" = "nord14" # nord15 - integer, floating point -"number" = "nord15" +"constant.numeric" = "nord15" [palette] nord0 = "#2e3440" diff --git a/runtime/themes/rose_pine.toml b/runtime/themes/rose_pine.toml index a982fd6e..53777008 100644 --- a/runtime/themes/rose_pine.toml +++ b/runtime/themes/rose_pine.toml @@ -16,14 +16,14 @@ "operator" = "rose" "ui.text.focus" = { fg = "base05" } "variable" = "text" -"number" = "iris" +"constant.numeric" = "iris" "constant" = "gold" "attributes" = "gold" "type" = "foam" "ui.cursor.match" = { fg = "gold", modifiers = ["underlined"] } "string" = "gold" "property" = "foam" -"escape" = "subtle" +"constant.character.escape" = "subtle" "function" = "rose" "function.builtin" = "rose" "function.method" = "foam" diff --git a/theme.toml b/theme.toml index 82b71a7d..3956e25e 100644 --- a/theme.toml +++ b/theme.toml @@ -6,7 +6,7 @@ punctuation = "lavender" "punctuation.delimiter" = "lavender" operator = "lilac" special = "honey" -property = "white" +variable.other.member = "white" variable = "lavender" # variable = "almond" # TODO: metavariables only # "variable.parameter" = { fg = "lavender", modifiers = ["underlined"] } -- cgit v1.2.3-70-g09d2