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. 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 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 diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 9e66a0f93..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 @@ -119,6 +122,8 @@ "type" "union" "unsafe" +"async" +"await" "use" "where" (mutable_specifier)