From a06792450799f7cfe24cebac099cb47d640a2be3 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> Date: Sun, 14 Jun 2020 11:57:09 +0200 Subject: [PATCH 01/14] Update issue templates Add some issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 34 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++++++ .github/ISSUE_TEMPLATE/language-request.md | 12 ++++++++ 3 files changed, 66 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/language-request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..06596fe11 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Output of `:checkhealth nvim_treesitter` *** +``` +Paste the output here +``` + +**Output of `nvim --version`** +``` +Paste your output here +``` + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..11fc491ef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/language-request.md b/.github/ISSUE_TEMPLATE/language-request.md new file mode 100644 index 000000000..b10287ea6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/language-request.md @@ -0,0 +1,12 @@ +--- +name: Language request +about: Request for a new language to be supported +title: '' +labels: enhancement, good first issue, help wanted +assignees: '' + +--- + +**Language informations** + +Please paste any useful informations here ! From 44108fe03e5c2cb761090c4abf8e7164225bf62f Mon Sep 17 00:00:00 2001 From: Steven Sojka Date: Fri, 12 Jun 2020 14:11:37 -0500 Subject: [PATCH 02/14] feat(queries): allow for user overrides --- README.md | 7 +++++++ lua/nvim-treesitter/query.lua | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c31ce8985..c19874593 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,13 @@ List of currently supported languages: - [ ] nix - [ ] markdown +## User Query Extensions + +You can add your own query files by placing a query file in vim's runtime path after `nvim-treesitter` is sourced. +If the language has a built in query file, that file will be appended to or it will be used (useful for languages not yet supported). +For example, you can add files to `/after/queries/lua/highlights.scm` to add more queries to lua highlights. +You can also manually add query paths to the runtime path by adding this to your vim config `set rtp+='path/to/queries'`. + ## Troubleshooting Before doing anything run `:checkhealth nvim_treesitter`. This will help you find where the bug might come from. diff --git a/lua/nvim-treesitter/query.lua b/lua/nvim-treesitter/query.lua index 644c33933..b914e5d7d 100644 --- a/lua/nvim-treesitter/query.lua +++ b/lua/nvim-treesitter/query.lua @@ -3,14 +3,21 @@ local ts = vim.treesitter local M = {} -local function read_query_file(fname) - return table.concat(vim.fn.readfile(fname), '\n') +local function read_query_files(filenames) + local contents = {} + + for _,filename in ipairs(filenames) do + vim.list_extend(contents, vim.fn.readfile(filename)) + end + + return table.concat(contents, '\n') end function M.get_query(ft, query_name) - local query_files = api.nvim_get_runtime_file(string.format('queries/%s/%s.scm', ft, query_name), false) + local query_files = api.nvim_get_runtime_file(string.format('queries/%s/%s.scm', ft, query_name), true) + if #query_files > 0 then - return ts.parse_query(ft, read_query_file(query_files[1])) + return ts.parse_query(ft, read_query_files(query_files)) end end From 45ea0df21a8494c7a8258bbb98ebd510716148e9 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Mon, 1 Jun 2020 00:22:59 +0200 Subject: [PATCH 03/14] Add tree-sitter-regex This might be interesting for injected highlighting --- README.md | 1 + lua/nvim-treesitter/configs.lua | 7 +++++++ queries/regex/highlights.scm | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 queries/regex/highlights.scm diff --git a/README.md b/README.md index c31ce8985..233487d7d 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,7 @@ List of currently supported languages: - [ ] yaml - [ ] nix - [ ] markdown +- [x] regex (maintained by @theHamsta) ## Troubleshooting Before doing anything run `:checkhealth nvim_treesitter`. This will help you find where the bug might come from. diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index f79fed00c..f7b5ff2cf 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -203,6 +203,13 @@ parsers.nix = { } } +parsers.regex = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-regex", + files = { "src/parser.c" } + } +} + -- @enable can be true or false -- @disable is a list of languages, only relevant if enable is true -- @keymaps list of user mappings for a given module if relevant diff --git a/queries/regex/highlights.scm b/queries/regex/highlights.scm new file mode 100644 index 000000000..48242543f --- /dev/null +++ b/queries/regex/highlights.scm @@ -0,0 +1,29 @@ +;; Forked from tree-sitter-regex +;; The MIT License (MIT) Copyright (c) 2014 Max Brunsfeld +[ + "(" + ")" + "(?" + "(?:" + "(?<" + ">" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(group_name) @property + +[ + (identity_escape) + (control_letter_escape) + (character_class_escape) + (control_escape) + (start_assertion) + (end_assertion) + (boundary_assertion) + (non_boundary_assertion) +] @escape + +[ "*" "+" "|" "=" "<=" "!" " Date: Sat, 23 May 2020 20:29:08 +0200 Subject: [PATCH 04/14] Introduce base languages for queries Some treesitter grammars just extend another treesitter grammar. This enables us to use the C queries also for C++. We only need to put additional queries in the C++ files. --- lua/nvim-treesitter/query.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/query.lua b/lua/nvim-treesitter/query.lua index b914e5d7d..788bfa126 100644 --- a/lua/nvim-treesitter/query.lua +++ b/lua/nvim-treesitter/query.lua @@ -13,11 +13,31 @@ local function read_query_files(filenames) return table.concat(contents, '\n') end +-- Some treesitter grammars extend others. +-- We can use that to import the queries of the base language +M.base_language_map = { + cpp = {'c'}, + typescript = {'javascript'}, + tsx = {'typescript', 'javascript'}, +} + function M.get_query(ft, query_name) local query_files = api.nvim_get_runtime_file(string.format('queries/%s/%s.scm', ft, query_name), true) + local query_string = '' if #query_files > 0 then - return ts.parse_query(ft, read_query_files(query_files)) + query_string = read_query_files(query_files)..query_string + end + + for _, base_lang in ipairs(M.base_language_map[ft] or {}) do + local base_files = api.nvim_get_runtime_file(string.format('queries/%s/%s.scm', base_lang, query_name), false) + if base_files and #base_files > 0 then + query_string = read_query_files(base_files)..query_string + end + end + + if #query_string > 0 then + return ts.parse_query(ft, query_string) end end From 167ce6339fb672af9bfd9b5e21a4d18b2f4fb253 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 23 May 2020 21:02:43 +0200 Subject: [PATCH 05/14] Add C++ highlights.scm --- README.md | 2 +- queries/c/highlights.scm | 3 ++ queries/cpp/highlights.scm | 97 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 queries/cpp/highlights.scm diff --git a/README.md b/README.md index 1b4fe210d..95bb5ae91 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ List of currently supported languages: - [x] ruby (maintained by @TravonteD) - [x] c (maintained by @vigoux) - [x] go (maintained by @theHamsta) -- [ ] cpp +- [x] cpp (maintained by @theHamsta, extends C queries) - [ ] rust - [x] python (maintained by @theHamsta) - [ ] javascript diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 4cfb042cc..80fb99749 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -71,6 +71,9 @@ (primitive_type) @type (sized_type_specifier) @type +((identifier) @type + (match? @type "^[A-Z]")) + ((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$")) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm new file mode 100644 index 000000000..e3bce91cb --- /dev/null +++ b/queries/cpp/highlights.scm @@ -0,0 +1,97 @@ +((identifier) @field + (match? @field "^_")) + +((identifier) @field + (match? @field "^m_")) + +((identifier) @field + (match? @field "_$")) + +;(field_expression) @parameter ;; How to highlight this? +(template_function + name: (identifier) @function) + +(template_method + name: (field_identifier) @method) + +(template_function + name: (scoped_identifier + name: (identifier) @function)) + +(namespace_identifier) @constant + +((namespace_identifier) @type + (match? @type "^[A-Z]")) +((namespace_identifier) @constant + (match? @constant "^[A-Z][A-Z_1-9]*$")) + +(destructor_name + name: (*) @function) + +(function_declarator + declarator: (scoped_identifier + name: (identifier) @function)) +((function_declarator + declarator: (scoped_identifier + name: (identifier) @constructor)) + (match? @constructor "^[A-Z]")) + +(call_expression + function: (scoped_identifier + name: (identifier) @function)) + +(call_expression + function: (field_expression + field: (field_identifier) @function)) + +((call_expression + function: (scoped_identifier + name: (identifier) @constructor)) +(match? @constructor "^[A-Z]")) + +((call_expression + function: (field_expression + field: (field_identifier) @function)) +(match? @function "^[A-Z]")) + +;; constructing a type in a intizializer list: Constructor (): **SuperType (1)** +((field_initializer + (field_identifier) @constructor + (argument_list)) + (match? @constructor "^[A-Z]")) + +(auto) @keyword +(class_specifier) + +; Constants + +;(this) @constant.builtin +(this) @keyword +(nullptr) @constant + +(true) @boolean +(false) @boolean + +; Keywords + +"catch" @exception +"class" @keyword +"constexpr" @keyword +"delete" @operator +"explicit" @keyword +"final" @exception +"friend" @keyword +"mutable" @keyword +"namespace" @keyword +"noexcept" @keyword +"new" @operator +"override" @keyword +"private" @keyword +"protected" @keyword +"public" @keyword +"template" @keyword +"throw" @keyword +"try" @exception +"typename" @keyword +"using" @keyword +"virtual" @keyword From b95e0af73b00dcba6e54e6f1ffa9b42e1aef5060 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 23 May 2020 21:03:03 +0200 Subject: [PATCH 06/14] Add @error highlight to c/highlights.scm --- queries/c/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 80fb99749..e758b0ed4 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -78,3 +78,5 @@ (match? @constant "^[A-Z][A-Z\\d_]+$")) (comment) @comment + +(ERROR) @error From 1badceea813d321d0d58319d5fc5dde07e98f18f Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 23 May 2020 21:23:05 +0200 Subject: [PATCH 07/14] Add cpp/locals.scm --- queries/cpp/highlights.scm | 11 ++++++--- queries/cpp/locals.scm | 49 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 queries/cpp/locals.scm diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index e3bce91cb..be79098c9 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -61,7 +61,11 @@ (match? @constructor "^[A-Z]")) (auto) @keyword -(class_specifier) + +;; Parameters +; normals +(parameter_list + (parameter_declaration) @parameter) ; Constants @@ -77,14 +81,14 @@ "catch" @exception "class" @keyword "constexpr" @keyword -"delete" @operator +"delete" @keyword "explicit" @keyword "final" @exception "friend" @keyword "mutable" @keyword "namespace" @keyword "noexcept" @keyword -"new" @operator +"new" @keyword "override" @keyword "private" @keyword "protected" @keyword @@ -95,3 +99,4 @@ "typename" @keyword "using" @keyword "virtual" @keyword +"::" @operator diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm new file mode 100644 index 000000000..00268442c --- /dev/null +++ b/queries/cpp/locals.scm @@ -0,0 +1,49 @@ + +;; Class / struct defintions +(class_specifier) @scope +(struct_specifier) @scope + + +(struct_specifier + name: (type_identifier) @definition.type) + +(struct_specifier + name: (scoped_type_identifier + name: (type_identifier) @definition.type) ) + +(class_specifier + name: (type_identifier) @definition.type) + +(class_specifier + name: (scoped_type_identifier + name: (type_identifier) @definition.type) ) + +;; Function defintions +(template_function + name: (identifier) @definition.function) @scope + +(template_method + name: (field_identifier) @definition.method) @scope + +(template_function + name: (scoped_identifier + name: (identifier) @definition.function)) @scope + +(function_declarator + declarator: (scoped_identifier + name: (type_identifier) @definition.function)) @scope + +(field_declaration + declarator: (function_declarator + (field_identifier) @definition.method)) + +(lambda_expression) @scope + +;; Control structures +(try_statement + body: (*) @scope) + +(catch_clause) @scope + +(destructor_name + name: (*) @constructor) From 148ad160e8be09b29a2e9547f4814b85147639a6 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 23 May 2020 21:50:52 +0200 Subject: [PATCH 08/14] Make =,~,! operators in C highlights --- queries/c/highlights.scm | 10 ++++++++++ queries/cpp/highlights.scm | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index e758b0ed4..307feb751 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -35,14 +35,20 @@ "->" @operator "!=" @operator "*" @operator +"/" @operator "&" @operator "&&" @operator "+" @operator "++" @operator "+=" @operator "<" @operator +"<=" @operator "==" @operator +"=" @operator +"~" @operator ">" @operator +">=" @operator +"!" @operator "||" @operator "." @delimiter @@ -79,4 +85,8 @@ (comment) @comment +;; Parameters +(parameter_list + (parameter_declaration) @parameter) + (ERROR) @error diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index be79098c9..d98099185 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -62,11 +62,6 @@ (auto) @keyword -;; Parameters -; normals -(parameter_list - (parameter_declaration) @parameter) - ; Constants ;(this) @constant.builtin From a0b912ff8ace8f58ff74843ffcfd12c0aa9700c5 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 23 May 2020 21:59:34 +0200 Subject: [PATCH 09/14] Add punctuation.bracket/punctuation.delimiter to C highlights --- queries/c/highlights.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 307feb751..c0df45d48 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -51,8 +51,17 @@ "!" @operator "||" @operator -"." @delimiter -";" @delimiter +"." @punctuation.delimiter +";" @punctuation.delimiter +":" @punctuation.delimiter +"," @punctuation.delimiter + +"(" @punctuation.bracket +")" @punctuation.bracket +"[" @punctuation.bracket +"]" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket (string_literal) @string (system_lib_string) @string From 95f4e10a62f8a90ba7f7db58cb6e8c360b0f61c9 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 23 May 2020 22:10:14 +0200 Subject: [PATCH 10/14] Add compound_statement to c queries --- queries/c/locals.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/c/locals.scm b/queries/c/locals.scm index b08d706ee..f7a4b84d2 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -36,3 +36,4 @@ (while_statement) @scope (translation_unit) @scope (function_definition) @scope +(compound_statement) @scope ; a block in curly braces From d88db9d71805bf9d759d4e0b8d571e6c952c3b0c Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 24 May 2020 13:31:13 +0200 Subject: [PATCH 11/14] Add operators /=,*=,|=,&= to C highlights --- queries/c/highlights.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index c0df45d48..d6e3a7a15 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -31,7 +31,6 @@ "--" @operator "-" @operator -"-=" @operator "->" @operator "!=" @operator "*" @operator @@ -40,7 +39,6 @@ "&&" @operator "+" @operator "++" @operator -"+=" @operator "<" @operator "<=" @operator "==" @operator @@ -51,6 +49,13 @@ "!" @operator "||" @operator +"-=" @operator +"+=" @operator +"*=" @operator +"/=" @operator +"|=" @operator +"&=" @operator + "." @punctuation.delimiter ";" @punctuation.delimiter ":" @punctuation.delimiter From e46baab8ca23855053900b8657a50e83ad76ba41 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 24 May 2020 13:40:43 +0200 Subject: [PATCH 12/14] Add better highlighting for preprocessor functions in C highlights --- queries/c/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index d6e3a7a15..3c2123383 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -84,6 +84,8 @@ declarator: (identifier) @function) (preproc_function_def name: (identifier) @function.macro) +(preproc_arg) @function.macro +; TODO (preproc_arg) @embedded (field_identifier) @property (statement_identifier) @label @@ -103,4 +105,7 @@ (parameter_list (parameter_declaration) @parameter) +(preproc_params + (identifier)) @parameter + (ERROR) @error From a5fc7b13ccfbc189deea031e692ba14b0e686279 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 7 Jun 2020 13:13:24 +0200 Subject: [PATCH 13/14] Update C/C++ highlights to new query syntax --- queries/c/highlights.scm | 5 +++-- queries/c/locals.scm | 2 +- queries/cpp/highlights.scm | 22 +++++++++++----------- queries/cpp/locals.scm | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 3c2123383..568ebaffa 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -94,10 +94,10 @@ (sized_type_specifier) @type ((identifier) @type - (match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((identifier) @constant - (match? @constant "^[A-Z][A-Z\\d_]+$")) + (#match? @constant "^[A-Z][A-Z\\d_]+$")) (comment) @comment @@ -109,3 +109,4 @@ (identifier)) @parameter (ERROR) @error + diff --git a/queries/c/locals.scm b/queries/c/locals.scm index f7a4b84d2..505db5b57 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -17,7 +17,7 @@ (declaration declarator: (identifier) @definition.var) (enum_specifier - name: (*) @definition.type + name: (_) @definition.type (enumerator_list (enumerator name: (identifier) @definition.var))) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index d98099185..68e5047ab 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,11 +1,11 @@ ((identifier) @field - (match? @field "^_")) + (#match? @field "^_")) ((identifier) @field - (match? @field "^m_")) + (#match? @field "^m_")) ((identifier) @field - (match? @field "_$")) + (#match? @field "_$")) ;(field_expression) @parameter ;; How to highlight this? (template_function @@ -21,12 +21,12 @@ (namespace_identifier) @constant ((namespace_identifier) @type - (match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((namespace_identifier) @constant - (match? @constant "^[A-Z][A-Z_1-9]*$")) + (#match? @constant "^[A-Z][A-Z_1-9]*$")) (destructor_name - name: (*) @function) + name: (_) @function) (function_declarator declarator: (scoped_identifier @@ -34,7 +34,7 @@ ((function_declarator declarator: (scoped_identifier name: (identifier) @constructor)) - (match? @constructor "^[A-Z]")) + (#match? @constructor "^[A-Z]")) (call_expression function: (scoped_identifier @@ -47,18 +47,18 @@ ((call_expression function: (scoped_identifier name: (identifier) @constructor)) -(match? @constructor "^[A-Z]")) +(#match? @constructor "^[A-Z]")) ((call_expression function: (field_expression - field: (field_identifier) @function)) -(match? @function "^[A-Z]")) + field: (field_identifier) @constructor)) +(#match? @function "^[A-Z]")) ;; constructing a type in a intizializer list: Constructor (): **SuperType (1)** ((field_initializer (field_identifier) @constructor (argument_list)) - (match? @constructor "^[A-Z]")) + (#match? @constructor "^[A-Z]")) (auto) @keyword diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index 00268442c..061153c04 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -41,9 +41,9 @@ ;; Control structures (try_statement - body: (*) @scope) + body: (_) @scope) (catch_clause) @scope (destructor_name - name: (*) @constructor) + name: (_) @constructor) From 8bc00cf02a5bc73541ba76ad8ea70fd928fffce2 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 14 Jun 2020 15:12:38 +0200 Subject: [PATCH 14/14] Change regexes in C/C++ highlights --- queries/c/highlights.scm | 2 +- queries/cpp/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 568ebaffa..0d718c223 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -97,7 +97,7 @@ (#match? @type "^[A-Z]")) ((identifier) @constant - (#match? @constant "^[A-Z][A-Z\\d_]+$")) + (#match? @constant "^[A-Z][A-Z0-9_]+$")) (comment) @comment diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 68e5047ab..92909f4d9 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -23,7 +23,7 @@ ((namespace_identifier) @type (#match? @type "^[A-Z]")) ((namespace_identifier) @constant - (#match? @constant "^[A-Z][A-Z_1-9]*$")) + (#match? @constant "^[A-Z][A-Z_0-9]*$")) (destructor_name name: (_) @function)