aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md34
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.yml65
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md27
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.yml20
-rw-r--r--.github/ISSUE_TEMPLATE/lsp_bug_report.md58
-rw-r--r--.github/ISSUE_TEMPLATE/lsp_bug_report.yml69
-rw-r--r--.github/workflows/ci.yml1
-rw-r--r--.gitignore1
-rw-r--r--runtime/doc/api.txt5
-rw-r--r--runtime/doc/lsp.txt26
-rw-r--r--runtime/doc/treesitter.txt40
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua55
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua4
-rw-r--r--runtime/lua/vim/treesitter/query.lua5
-rw-r--r--runtime/syntax/syncolor.vim2
-rw-r--r--runtime/syntax/synload.vim6
-rw-r--r--src/nvim/main.c5
-rw-r--r--src/nvim/tui/tui.c7
-rw-r--r--test/functional/plugin/lsp_spec.lua5
-rw-r--r--test/functional/treesitter/highlight_spec.lua43
-rw-r--r--test/functional/treesitter/parser_spec.lua13
21 files changed, 348 insertions, 143 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index ae30f00f31..0000000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-name: Bug report
-about: Report a problem in Nvim
-title: ''
-labels: bug
-
----
-
-<!-- Before reporting: search existing issues and check the FAQ. -->
-
-- `nvim --version`:
-- Operating system/version:
-- Terminal name/version:
-- `$TERM`:
-
-<!--
-If this report is about different behaviour between Nvim and Vim, make sure to
-read `:h vim-differences` first. Otherwise remove the next line.
--->
-[ ] `vim -u DEFAULTS` (version: ) behaves differently
-
-### Steps to reproduce using `nvim -u NORC`
-
-```
-nvim -u NORC
-# Alternative for shell-related problems:
-# env -i TERM=ansi-256color "$(which nvim)"
-
-```
-
-### Actual behaviour
-
-### Expected behaviour
-
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000000..643a06c2cf
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,65 @@
+name: Bug Report
+description: Report a problem in Neovim
+labels: [bug]
+body:
+
+ - type: markdown
+ attributes:
+ value: |
+ Before reporting: search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ).
+
+ - type: input
+ attributes:
+ label: "Neovim Version"
+ description: "`nvim --version`:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Operating system/version:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Terminal name/version:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "TERM environment variable"
+ description: "echo `$TERM`:"
+ validations:
+ required: true
+
+ - type: input
+ attributes:
+ label: "Installation"
+ description: "How did you install neovim: build from repo / system package manager / appimage / homebrew / snap / chocolatey / other (please specify)?"
+ placeholder: "Arch User Repository (AUR)"
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: "Steps to reproduce"
+ description: |
+ Steps to reproduce using `nvim -u NORC`.
+ If you are reporting build failures, please list the exact sequence of steps including all CMake flags (if any).
+
+ - type: checkboxes
+ attributes:
+ options:
+ - label: "Please check the box if it's possible to reproduce the bug with `nvim --clean` as well"
+
+ - type: input
+ attributes:
+ label: "Vim"
+ description: "Does Vim behave differently when called with `vim -u DEFAULTS`? If yes, which version of Vim are you using (`vim --version`):"
+
+ - type: textarea
+ attributes:
+ label: "Expected behavior"
+ - type: textarea
+ attributes:
+ label: "Actual behavior"
+ description: "A description of the behavior you expected. May optionally include logs, images, or videos."
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
deleted file mode 100644
index 928cde894c..0000000000
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,27 +0,0 @@
----
-name: Feature request
-about: Request an enhancement for Nvim
-title: ''
-labels: enhancement
-
----
-
-<!-- Before reporting: search existing issues and check the FAQ. -->
-
-- `nvim --version`:
-- `vim -u DEFAULTS` (version: ) behaves differently?
-- Operating system/version:
-- Terminal name/version:
-- `$TERM`:
-
-### Steps to reproduce using `nvim -u NORC`
-
-```
-nvim -u NORC
-
-```
-
-### Actual behaviour
-
-### Expected behaviour
-
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000000..a9ed2824cb
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,20 @@
+name: Feature request
+description: Request an enhancement for Neovim
+labels: [enhancement]
+body:
+
+ - type: markdown
+ attributes:
+ value: |
+ Before requesting: search [existing issues](https://github.com/neovim/neovim/labels/enhancement) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ).
+
+ - type: input
+ attributes:
+ label: "Feature already in Vim?"
+ description: "Does the feature already exist in Vim? If possible, please specify which version of Vim it was introduced in."
+
+ - type: textarea
+ attributes:
+ label: "Feature description"
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.md b/.github/ISSUE_TEMPLATE/lsp_bug_report.md
deleted file mode 100644
index d2488a14e8..0000000000
--- a/.github/ISSUE_TEMPLATE/lsp_bug_report.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-name: Language server client bug report
-about: Report a built-in lsp problem in Nvim
-title: ''
-labels: bug, lsp
-
----
-
-<!--
-Before reporting: search existing issues and check the FAQ. Usage questions
-such as "How do I...?" or "Why isn't X language server/feature working?" belong
-on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will
-be closed.
--->
-
-- `nvim --version`:
-- language server name/version:
-- Operating system/version:
-
-<details>
-<summary>nvim -c ":checkhealth nvim lspconfig"</summary>
-
-<!-- Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here. -->
-
-</details>
-
-<details>
-<summary>lsp.log</summary>
-
-<!--
-Please paste the lsp log before and after the problem.
-
-You can set log level like this.
-`:lua vim.lsp.set_log_level("debug")`
-
-You can find the location of the log with the following command.
-`:lua print(vim.lsp.get_log_path())`
--->
-
-</details>
-
-### Steps to reproduce using nvim -u minimal_init.lua
-<!--
- Note, if the issue is with an autocompletion or other LSP plugin, please
- report to the upstream tracker. Download the minmal config with
- wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua
- and modify it to include any specific commands or servers pertaining to your issues.
--->
-
-
-```
-nvim -u minimal_init.lua
-```
-
-### Actual behaviour
-
-### Expected behaviour
-
diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
new file mode 100644
index 0000000000..ff25bb0a23
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
@@ -0,0 +1,69 @@
+name: Language server client bug report
+description: Report a built-in lsp problem in Neovim
+labels: [bug, lsp]
+body:
+
+ - type: markdown
+ attributes:
+ value: |
+ Before reporting: search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). Usage questions such as "How do I...?" or "Why isn't X language server/feature working?" belong on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will be closed.
+
+ - type: input
+ attributes:
+ label: "Neovim Version"
+ description: "`nvim --version`:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Language server name/version:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Operating system/version:"
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Checkhealth
+ description: |
+ Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here:
+ render: markdown
+
+ - type: markdown
+ attributes:
+ value: |
+ Note: if the issue is with an autocompletion or other LSP plugin, please report it at that plugin's issue tracker. Download the minimal config with `wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua` and modify it to include any specific commands or servers pertaining to your issues.
+ - type: textarea
+ attributes:
+ label: "Steps to reproduce"
+ description: |
+ Steps to reproduce using `nvim -u minimal_init.lua`:
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: "Expected behavior"
+ - type: textarea
+ attributes:
+ label: "Actual behavior"
+ description: "A description of the behavior you expected. May optionally include logs, images, or videos."
+
+ - type: markdown
+ attributes:
+ value: |
+ Please upload `lsp.log` before and after the problem in a [secret gist](https://gist.github.com/). Paste the url to the gist in the text field below.
+
+ You can set the log level by adding the Lua command
+ `vim.lsp.set_log_level("debug")`
+ after setting up LSP in your config.
+
+ You can find the location of the log with the command
+ `:lua print(vim.lsp.get_log_path())`
+
+ - type: input
+ attributes:
+ label: "Link to uploaded log file"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aa16a94802..3b89730434 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -34,6 +34,7 @@ jobs:
runner: ubuntu-20.04
os: linux
runs-on: ${{ matrix.runner }}
+ timeout-minutes: 45
if: github.event.pull_request.draft == false
env:
CC: ${{ matrix.cc }}
diff --git a/.gitignore b/.gitignore
index 163140c6e1..e07ce4906e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ compile_commands.json
/tmp/
/.clangd/
/.cache/clangd/
+/.ccls-cache/
.DS_Store
*.mo
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 4dcf5b7bbc..9b8259c2fb 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -2334,8 +2334,9 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
inserted (true for right, false for left).
Defaults to false.
• priority: a priority value for the highlight
- group. For example treesitter highlighting
- uses a value of 100.
+ group. Default: 4096. For example, treesitter
+ highlighting uses a default value of 100 (see
+ |lua-treesitter-highlight-priority|).
Return: ~
Id of the created/updated extmark
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 62f529b463..a15c74d148 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -1470,12 +1470,36 @@ save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()*
save_extmarks({bufnr}, {client_id})
TODO: Documentation
+set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()*
+ Sets the quickfix list
+
+ Parameters: ~
+ {opts} table|nil Configuration table. Keys:
+ • {open}: (boolean, default true)
+ • Open quickfix list after set
+
+ • {client_id}: (number)
+ • If nil, will consider all clients attached to
+ buffer.
+
+ • {severity}: (DiagnosticSeverity)
+ • Exclusive severity to consider. Overrides
+ {severity_limit}
+
+ • {severity_limit}: (DiagnosticSeverity)
+ • Limit severity of diagnostics found. E.g.
+ "Warning" means { "Error", "Warning" } will be
+ valid.
+
+ • {workspace}: (boolean, default true)
+ • Set the list with workspace diagnostics
+
set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()*
Sets the location list
Parameters: ~
{opts} table|nil Configuration table. Keys:
- • {open_loclist}: (boolean, default true)
+ • {open}: (boolean, default true)
• Open loclist after set
• {client_id}: (number)
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 416ea3a08a..cabcb67921 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -226,6 +226,18 @@ Here is a list of built-in predicates :
Each predicate has a `not-` prefixed predicate that is just the negation of
the predicate.
+ *vim.treesitter.query.add_predicate()*
+vim.treesitter.query.add_predicate({name}, {handler})
+
+This adds a predicate with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate)
+<
+ *vim.treesitter.query.list_predicates()*
+vim.treesitter.query.list_predicates()
+
+This lists the currently available predicates to use in queries.
+
Treesitter Query Directive *lua-treesitter-directives*
Treesitter queries can also contain `directives`. Directives store metadata for a node
@@ -249,6 +261,21 @@ Here is a list of built-in directives:
`({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})`
The default key is "offset".
+ *vim.treesitter.query.add_directive()*
+vim.treesitter.query.add_directive({name}, {handler})
+
+This adds a directive with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate, metadata)
+Handlers can set match level data by setting directly on the metadata object `metadata.key = value`
+Handlers can set node level data by using the capture id on the metadata table
+`metadata[capture_id].key = value`
+
+ *vim.treesitter.query.list_directives()*
+vim.treesitter.query.list_directives()
+
+This lists the currently available directives to use in queries.
+
Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
NOTE: This is a partially implemented feature, and not usable as a default
@@ -294,6 +321,19 @@ identical identifiers, highlighting both as |hl-WarningMsg|: >
((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right)
(eq? @WarningMsg.left @WarningMsg.right))
<
+Treesitter Highlighting Priority *lua-treesitter-highlight-priority*
+
+Tree-sitter uses |nvim_buf_set_extmark()| to set highlights with a default
+priority of 100. This enables plugins to set a highlighting priority lower or
+higher than tree-sitter. It is also possible to change the priority of an
+individual query pattern manually by setting its `"priority"` metadata attribute: >
+
+ (
+ (super_important_node) @ImportantHighlight
+ ; Give the whole query highlight priority higher than the default (100)
+ (set! "priority" 105)
+ )
+<
==============================================================================
Lua module: vim.treesitter *lua-treesitter-core*
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 9a97e5db2f..246665602d 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -1249,10 +1249,10 @@ function M.reset(client_id, buffer_client_map)
end)
end
---- Sets the location list
+--- Gets diagnostics, converts them to quickfix/location list items, and applies the item_handler callback to the items.
+---@param item_handler function Callback to apply to the diagnostic items
+---@param command string|nil Command to execute after applying the item_handler
---@param opts table|nil Configuration table. Keys:
---- - {open_loclist}: (boolean, default true)
---- - Open loclist after set
--- - {client_id}: (number)
--- - If nil, will consider all clients attached to buffer.
--- - {severity}: (DiagnosticSeverity)
@@ -1261,9 +1261,8 @@ end
--- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
--- - {workspace}: (boolean, default false)
--- - Set the list with workspace diagnostics
-function M.set_loclist(opts)
+local function apply_to_diagnostic_items(item_handler, command, opts)
opts = opts or {}
- local open_loclist = if_nil(opts.open_loclist, true)
local current_bufnr = api.nvim_get_current_buf()
local diags = opts.workspace and M.get_all(opts.client_id) or {
[current_bufnr] = M.get(current_bufnr, opts.client_id)
@@ -1280,13 +1279,51 @@ function M.set_loclist(opts)
return true
end
local items = util.diagnostics_to_items(diags, predicate)
- local win_id = vim.api.nvim_get_current_win()
- util.set_loclist(items, win_id)
- if open_loclist then
- vim.cmd [[lopen]]
+ item_handler(items)
+ if command then
+ vim.cmd(command)
end
end
+--- Sets the quickfix list
+---@param opts table|nil Configuration table. Keys:
+--- - {open}: (boolean, default true)
+--- - Open quickfix list after set
+--- - {client_id}: (number)
+--- - If nil, will consider all clients attached to buffer.
+--- - {severity}: (DiagnosticSeverity)
+--- - Exclusive severity to consider. Overrides {severity_limit}
+--- - {severity_limit}: (DiagnosticSeverity)
+--- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
+--- - {workspace}: (boolean, default true)
+--- - Set the list with workspace diagnostics
+function M.set_qflist(opts)
+ opts = opts or {}
+ opts.workspace = if_nil(opts.workspace, true)
+ local open_qflist = if_nil(opts.open, true)
+ local command = open_qflist and [[copen]] or nil
+ apply_to_diagnostic_items(util.set_qflist, command, opts)
+end
+
+--- Sets the location list
+---@param opts table|nil Configuration table. Keys:
+--- - {open}: (boolean, default true)
+--- - Open loclist after set
+--- - {client_id}: (number)
+--- - If nil, will consider all clients attached to buffer.
+--- - {severity}: (DiagnosticSeverity)
+--- - Exclusive severity to consider. Overrides {severity_limit}
+--- - {severity_limit}: (DiagnosticSeverity)
+--- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
+--- - {workspace}: (boolean, default false)
+--- - Set the list with workspace diagnostics
+function M.set_loclist(opts)
+ opts = opts or {}
+ local open_loclist = if_nil(opts.open, true)
+ local command = open_loclist and [[lopen]] or nil
+ apply_to_diagnostic_items(util.set_loclist, command, opts)
+end
+
--- Disable diagnostics for the given buffer and client
--- @param bufnr (optional, number): Buffer handle, defaults to current
--- @param client_id (optional, number): Disable diagnostics for the given
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 84b6a5f135..cf3cdf4505 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -248,7 +248,7 @@ local function on_line_impl(self, buf, line)
end
while line >= state.next_row do
- local capture, node = state.iter()
+ local capture, node, metadata = state.iter()
if capture == nil then break end
@@ -260,7 +260,7 @@ local function on_line_impl(self, buf, line)
{ end_line = end_row, end_col = end_col,
hl_group = hl,
ephemeral = true,
- priority = 100 -- Low but leaves room below
+ priority = tonumber(metadata.priority) or 100 -- Low but leaves room below
})
end
if start_row > line then
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index b81eb18945..0ba44ced1a 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -351,6 +351,11 @@ function M.add_directive(name, handler, force)
directive_handlers[name] = handler
end
+--- Returns the list of currently supported directives
+function M.list_directives()
+ return vim.tbl_keys(directive_handlers)
+end
+
--- Returns the list of currently supported predicates
function M.list_predicates()
return vim.tbl_keys(predicate_handlers)
diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim
index 5b907a3b83..27cc3360c4 100644
--- a/runtime/syntax/syncolor.vim
+++ b/runtime/syntax/syncolor.vim
@@ -25,6 +25,8 @@ else
endif
endif
+let did_syncolor = 1
+
" Many terminals can only use six different colors (plus black and white).
" Therefore the number of colors used is kept low. It doesn't look nice with
" too many colors anyway.
diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim
index 3863a84c1a..aee9ba8b8e 100644
--- a/runtime/syntax/synload.vim
+++ b/runtime/syntax/synload.vim
@@ -14,10 +14,8 @@ endif
" let others know that syntax has been switched on
let syntax_on = 1
-" Set the default highlighting colors. Use a color scheme if specified.
-if exists("colors_name")
- exe "colors " . colors_name
-else
+" Set the default highlighting colors
+if !exists("colors_name") && !exists("did_syncolor")
runtime! syntax/syncolor.vim
endif
diff --git a/src/nvim/main.c b/src/nvim/main.c
index d6eedf7010..ed40da5866 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -372,6 +372,11 @@ int main(int argc, char **argv)
// If using the runtime (-u is not NONE), enable syntax & filetype plugins.
if (params.use_vimrc == NULL || !strequal(params.use_vimrc, "NONE")) {
+ // Source syncolor.vim to set up default UI highlights if the user didn't
+ // already enable a colorscheme
+ if (!get_var_value("g:colors_name")) {
+ source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL);
+ }
// Does ":filetype plugin indent on".
filetype_maybe_enable();
// Sources syntax/syntax.vim, which calls `:filetype on`.
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 70d39339c3..dcc086a0cf 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1123,10 +1123,9 @@ static void tui_mode_change(UI *ui, String mode, Integer mode_idx)
data->showing_mode = (ModeShape)mode_idx;
}
-static void tui_grid_scroll(UI *ui, Integer g, Integer startrow, Integer endrow,
- Integer startcol, Integer endcol,
- Integer rows,
- Integer cols FUNC_ATTR_UNUSED) // -V751
+static void tui_grid_scroll(UI *ui, Integer g, Integer startrow, // -V751
+ Integer endrow, Integer startcol, Integer endcol,
+ Integer rows, Integer cols FUNC_ATTR_UNUSED)
{
TUIData *data = ui->data;
UGrid *grid = &data->grid;
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index e38ed10ab9..e5533af73b 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -14,6 +14,7 @@ local retry = helpers.retry
local NIL = helpers.NIL
local read_file = require('test.helpers').read_file
local write_file = require('test.helpers').write_file
+local isCI = helpers.isCI
-- Use these to get access to a coroutine so that I can run async tests and use
-- yield.
@@ -262,8 +263,8 @@ describe('LSP', function()
end)
it('should succeed with manual shutdown', function()
- if 'openbsd' == helpers.uname() then
- pending('hangs the build on openbsd #14028, re-enable with freeze timeout #14204')
+ if isCI() then
+ pending('hangs the build on CI #14028, re-enable with freeze timeout #14204')
return
end
local expected_handlers = {
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua
index 05e0c5fe2c..175525b3f2 100644
--- a/test/functional/treesitter/highlight_spec.lua
+++ b/test/functional/treesitter/highlight_spec.lua
@@ -570,4 +570,47 @@ describe('treesitter highlighting', function()
]]}
screen:expect{ unchanged=true }
end)
+
+ it("supports highlighting with priority", function()
+ if pending_c_parser(pending) then return end
+
+ insert([[
+ int x = INT_MAX;
+ #define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))
+ #define foo void main() { \
+ return 42; \
+ }
+ ]])
+
+ exec_lua [[
+ local parser = vim.treesitter.get_parser(0, "c")
+ test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = hl_query..'\n((translation_unit) @Error (set! "priority" 101))\n'}})
+ ]]
+ -- expect everything to have Error highlight
+ screen:expect{grid=[[
+ {12:int}{8: x = INT_MAX;} |
+ {8:#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))}|
+ {8:#define foo void main() { \} |
+ {8: return 42; \} |
+ {8: }} |
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], attr_ids={
+ [1] = {bold = true, foreground = Screen.colors.Blue1};
+ [8] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
+ -- bold will not be overwritten at the moment
+ [12] = {background = Screen.colors.Red, bold = true, foreground = Screen.colors.Grey100};
+ }}
+ end)
end)
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index d2f9148e8f..d9df5fbc0d 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -646,6 +646,19 @@ int x = INT_MAX;
{2, 29, 2, 68} -- READ_STRING_OK(x, y) (char_u *)read_string((x), (size_t)(y))
}, get_ranges())
end)
+ it("should list all directives", function()
+ local res_list = exec_lua[[
+ local query = require'vim.treesitter.query'
+
+ local list = query.list_directives()
+
+ table.sort(list)
+
+ return list
+ ]]
+
+ eq({ 'offset!', 'set!' }, res_list)
+ end)
end)
end)