From 3c7528a29458a94dff3730f08356b7505a9bbda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Camlet?= Date: Thu, 6 Aug 2020 12:09:20 +0200 Subject: [PATCH 1/5] Add noremap option to mappings --- lua/nvim-treesitter/incremental_selection.lua | 2 +- lua/nvim-treesitter/refactor/navigation.lua | 2 +- lua/nvim-treesitter/refactor/smart_rename.lua | 2 +- lua/nvim-treesitter/textobjects.lua | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/nvim-treesitter/incremental_selection.lua b/lua/nvim-treesitter/incremental_selection.lua index 3e1b51b9b..dce5f112a 100644 --- a/lua/nvim-treesitter/incremental_selection.lua +++ b/lua/nvim-treesitter/incremental_selection.lua @@ -105,7 +105,7 @@ function M.attach(bufnr) mode = 'v' end local cmd = string.format(":lua require'nvim-treesitter.incremental_selection'.%s()", funcname) - api.nvim_buf_set_keymap(buf, mode, mapping, cmd, { silent = true }) + api.nvim_buf_set_keymap(buf, mode, mapping, cmd, { silent = true, noremap = true }) end end diff --git a/lua/nvim-treesitter/refactor/navigation.lua b/lua/nvim-treesitter/refactor/navigation.lua index 160fbd2e3..a3fee20e8 100644 --- a/lua/nvim-treesitter/refactor/navigation.lua +++ b/lua/nvim-treesitter/refactor/navigation.lua @@ -56,7 +56,7 @@ function M.attach(bufnr) for fn_name, mapping in pairs(config.keymaps) do local cmd = string.format([[:lua require'nvim-treesitter.refactor.navigation'.%s(%d)]], fn_name, bufnr) - api.nvim_buf_set_keymap(bufnr, 'n', mapping, cmd, { silent = true }) + api.nvim_buf_set_keymap(bufnr, 'n', mapping, cmd, { silent = true, noremap = true }) end end diff --git a/lua/nvim-treesitter/refactor/smart_rename.lua b/lua/nvim-treesitter/refactor/smart_rename.lua index af4890e46..cad746ba4 100644 --- a/lua/nvim-treesitter/refactor/smart_rename.lua +++ b/lua/nvim-treesitter/refactor/smart_rename.lua @@ -51,7 +51,7 @@ function M.attach(bufnr) for fn_name, mapping in pairs(config.keymaps) do local cmd = string.format([[:lua require'nvim-treesitter.refactor.smart_rename'.%s(%d)]], fn_name, bufnr) - api.nvim_buf_set_keymap(bufnr, 'n', mapping, cmd, { silent = true }) + api.nvim_buf_set_keymap(bufnr, 'n', mapping, cmd, { silent = true, noremap = true }) end end diff --git a/lua/nvim-treesitter/textobjects.lua b/lua/nvim-treesitter/textobjects.lua index 2d6a25ff5..7227b9e0e 100644 --- a/lua/nvim-treesitter/textobjects.lua +++ b/lua/nvim-treesitter/textobjects.lua @@ -86,8 +86,8 @@ function M.attach(bufnr, lang) end if query then local cmd = ":lua require'nvim-treesitter.textobjects'.select_textobject('"..query.."')" - api.nvim_buf_set_keymap(buf, "o", mapping, cmd, {silent = true}) - api.nvim_buf_set_keymap(buf, "v", mapping, cmd, {silent = true}) + api.nvim_buf_set_keymap(buf, "o", mapping, cmd, {silent = true, noremap = true }) + api.nvim_buf_set_keymap(buf, "v", mapping, cmd, {silent = true, noremap = true }) end end end From 81d444c498c94a5f159dfa5e9e2c8017583a8beb Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Sat, 1 Aug 2020 23:52:20 -0500 Subject: [PATCH 2/5] RST: update queries --- queries/rst/highlights.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm index 3f7254719..3f719d9f3 100644 --- a/queries/rst/highlights.scm +++ b/queries/rst/highlights.scm @@ -5,6 +5,7 @@ "|" "--" "__" + ":" "::" "bullet" "adornment" @@ -32,10 +33,12 @@ [ (literal_block) (line_block) - (block_quote) (doctest_block) ] @text.literal +(block_quote + (attribution)? @text.emphasis) @text.literal + (substitution_definition name: (substitution) @constant) @@ -49,6 +52,16 @@ name: (reference)? @constant link: (_) @text.literal) +;; Lists + +; Definition lists +(list_item + (term) @text.strong + (classifier)? @text.emphasis) + +; Field lists +(field (field_name) @constant) + ;; Inline markup (emphasis) @text.emphasis @@ -110,8 +123,6 @@ (title) @text.title -(attribution) @text.emphasis - (comment) @comment (comment "..") @comment From 94a505626991f2423dc3b986186f2f6cb857aabb Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Fri, 7 Aug 2020 10:47:17 +0200 Subject: [PATCH 3/5] highlights(rust): add async/await keywords --- queries/rust/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 9e66a0f93..3c4859708 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -119,6 +119,8 @@ "type" "union" "unsafe" +"async" +"await" "use" "where" (mutable_specifier) From 6133257ed6dcaec35feaa31f9afa0245668dfe48 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Fri, 7 Aug 2020 10:47:39 +0200 Subject: [PATCH 4/5] highlights(rust): fix some type highlights. --- queries/rust/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 3c4859708..9b873b2f6 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -43,6 +43,9 @@ name: (identifier) @type) (#match? @type "^[A-Z]")) +(use_list (identifier) @type (#match? @type "^[A-Z]")) +(use_as_clause alias: (identifier) @type (#match? @type "^[A-Z]")) + ;; Correct enum constructors (call_expression function: (scoped_identifier From 688161c174279c278454020c735aa186a52ccaca Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Sat, 1 Aug 2020 15:33:44 -0500 Subject: [PATCH 5/5] Add troubleshooting for when a parser changes This should be merged after https://github.com/nvim-treesitter/nvim-treesitter/pull/243 --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32394dae9..55d34081b 100644 --- a/README.md +++ b/README.md @@ -287,7 +287,8 @@ You can also manually add query paths to the runtime path by adding this to your ## Troubleshooting -Before doing anything run `:checkhealth nvim_treesitter`. This will help you find where the bug might come from. +Before doing anything make sure you have the latest version of this plugin and run `:checkhealth nvim_treesitter`. +This will help you find where the bug might come from. ### Feature `X` does not work for `{language}`... @@ -297,6 +298,13 @@ If everything is okay, then it might be an actual error. In both cases, feel free to [open an issue here](https://github.com/nvim-treesitter/nvim-treesitter/issues/new/choose). +### I get `Error detected while processing .../plugin/nvim-treesitter.vim` everytime I open Neovim + +This is probably due to a change in a parser's grammar or its queries. +Try updating the parser that you suspect has changed (`:TSUpdate {language}`) or all of them (`:TSUpdate`). +If the error persists after updating all parsers, +please [open an issue](https://github.com/nvim-treesitter/nvim-treesitter/issues/new/choose). + ### I experience weird highlighting issues similar to [#78](https://github.com/nvim-treesitter/nvim-treesitter/issues/78) This is a well known issue, which arise when the tree and the buffer are getting out of sync.