aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
Commit message (Collapse)AuthorAge
* fix(ui): close floating window on BufLeave event (#16557)ii142021-12-15
| | | | | | | | | When buffer is visible in two splits simultaneously, BufHidden event is not triggered, causing the floating window to remain on screen after switching to another buffer. Remove BufHidden event from close_events defaults, and close the window if we changed the buffer to something other than the buffer that spawned the floating window or the floating window buffer itself.
* feat(treesitter): multiline match predicatesLewis Russell2021-12-12
|
* feat(ts): add support for multiline nodes in get_node_text (#14999)Mathias Fußenegger2021-12-12
| | | | | | Based on https://github.com/neovim/neovim/pull/14445 This extends `vim.treesitter.query.get_node_text` to return the text that spans a node's range even if start_row ~= end_row.
* refactor: replace deprecated lua functions with their new versions (#16603)dundargoc2021-12-10
| | | | | | Calling vim.lsp.buf.definition() sometimes gives a deprecation warning. This will likely solve that. Co-authored-by: Christian Clason <christian.clason@uni-due.de>
* fix(lsp): create lsp requests with position offsets considering client ↵Rishikesh Vaishnav2021-12-10
| | | | | | encoding (#16382) Co-authored-by: black-desk <clx814727823@gmail.com> Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
* fix(diagnostic): set effective buffer number in autocmd (again) (#16589)Gregory Anders2021-12-08
| | | Follow up to #16474.
* refactor(diagnostic): remove bufnr parameter from open_float (#16579)Gregory Anders2021-12-08
| | | | | | | | | | | | | | The overwhelming majority of use cases for `open_float` are to view diagnostics from the current buffer in a floating window. Thus, most use cases will just `0` or `nil` as the first argument, which makes the argument effectively useless and wasteful. In the cause of optimizing for the primary use case, make the `bufnr` parameter an optional parameter in the options table. This still allows using an alternative buffer for those that wish to do so, but makes the "primary" use case much easier. The old signature is preserved for backward compatibility, though it can likely be fully deprecated at some point.
* docs(lsp): fix resolve_capabilities docstring (#16577)Gregory Anders2021-12-08
|
* refactor(diagnostic): add warning to deprecated functions (#16536)dundargoc2021-12-08
|
* refactor(lsp): remove usage of deprecated function (#16539)Gregory Anders2021-12-07
|
* feat(lsp): use `vim.ui.select` for selecting lsp client (#16531)Anshuman Medhi2021-12-07
|
* refactor: format diagnostic.lua (#16540)Gregory Anders2021-12-05
|
* fix(diagnostic): escape special chars in file names (#16527)Matthew Toohey2021-12-05
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
* refactor: remove unused runtime lua functions (#16535)dundargoc2021-12-05
|
* docs(lsp): re-add client.requests documentation (#16530)Anshuman Medhi2021-12-05
| | | | | | | Closes #16528 Added in this PR: https://github.com/neovim/neovim/commit/d1c470957b49380ec5ceba603dbd85a14f60f09b#diff-6b5f3071d65558aab177912061ac6a2f5312660655a449276c83697686f28e72R627 Removed by regeneration in this PR: https://github.com/neovim/neovim/commit/2d340a3746dd5d6caf17b2c2e78380fa423409e8#diff-6b5f3071d65558aab177912061ac6a2f5312660655a449276c83697686f28e72L631
* Merge pull request #15996 from gpanders/nvim_get_option_valueGregory Anders2021-12-04
|\ | | | | feat(api): add nvim_{get,set}_option_value
| * feat(api): add nvim_get_option_valueGregory Anders2021-12-04
| |
* | feat(lsp,diagnostic): open folds in jump-related functions (#16520)Dmytro Meleshko2021-12-04
|/
* fix(diagnostic): clamp diagnostics on negative line numbers (#16496)Michael Lingelbach2021-12-02
| | | | | | | | | Closes https://github.com/neovim/neovim/issues/16492 Despite having logic for setting the maximum diagnostic line number to at minimum 0, previously the conditional statement only checked if lnum and end_lnum were greater than the line count. Fix: also check if lnum and end_lnum are less than 0.
* fix(diagnostic): set effective buffer number for DiagnosticChanged autocmd ↵Gregory Anders2021-12-01
| | | | | | (#16474) This enables use of <abuf> in autocommand handlers for DiagnosticChanged.
* fix(lsp): progress handlers should return vim.NIL on error (#16472)Michael Lingelbach2021-11-30
|
* fix(lsp): change rpc start notify level to warn (#16467)Michael Lingelbach2021-11-30
| | | This is less obtrusive, and does not require a confirmation to dismiss
* Merge pull request #16460 from dundargoc/chore/typosBjörn Linse2021-11-30
|\ | | | | chore: fix typos
| * docs(lsp): do not use nvim_command for Vimscript examplesGregory Anders2021-11-30
| | | | | | | | | | | | The examples are relevant and applicable for both Lua and Vimscript configurations and the `vim.api.nvim_command` prefixes just add noise that doesn't contribute to the example.
| * docs(lsp): do not use | as argument separatorGregory Anders2021-11-30
| | | | | | | | This translates into a tag in the help doc.
| * docs(lsp): add annotations for private functionsGregory Anders2021-11-30
| |
* | feat(lsp): add 'focus' option to open_floating_preview (#16465)Gregory Anders2021-11-29
| | | | | | | | | | | | | | | | | | When the 'focusable' and 'focus_id' parameters are set, `open_floating_preview` assumes that it should always move focus to an existing floating window with the same 'focus_id'. However, there are cases where we want to make a floating window focusable, but do not want to focus it upon calling `open_floating_preview`. To distinguish these cases, add a boolean parameter 'focus' that, when false, prevents moving focus.
* | fix(lsp): do not attempt to index nil client in progress handler (#16463)Michael Lingelbach2021-11-29
| |
* | feat(diagnostic): use `scope = 'line'` by default for `open_float()` (#16456)cbarrete2021-11-28
|/ | | | | Closes #16453 Co-authored-by: Cédric Barreteau <cbarrete@users.noreply.github.com>
* fix(diagnostic): make set() go through cache when calling show()Gregory Anders2021-11-27
| | | | | | | | | | | | | | | | When `vim.diagnostic.set()` is called, the diagnostics passed to it are added to the diagnostic cache. `set()` then calls `show()` and passes those diagnostics along exactly as they were given to `set()`. However, we sometimes want to do some kind of post-processing on diagnostics when they come out of the cache, e.g. clamping line numbers. By forwarding the diagnostics to `show()` verbatim, `set()` skips this post-processing which can cause other bugs downstream. Instead of passing the diagnostics directly, make the `show()` call from within `set()` retrieve diagnostics from the cache. In general, all diagnostics operations should follow the pattern of "producers put things in the cache" and "consumers get things out of the cache" and this change better adheres to that pattern.
* chore: fix typos (#16361)dundargoc2021-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com> Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
* fix(lua): fix vim.deepcopy for metatables & cycled tables (#16435)Shadman2021-11-26
| | | | | vim.deepcopy previously didn't retain metatables in copies and caused stackoverflow on recursive tables/cycled tables this fixes these issues
* fix(lsp): send textDocument/didChange for each buffer (#16431)Michael Lingelbach2021-11-26
| | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
* fix(lsp): require bufnr for apply_text_edits (#16444)Michael Lingelbach2021-11-26
|
* feat(diagnostic)!: make DiagnosticChanged a first class autocmd (#16098)Gregory Anders2021-11-25
| | | | | | | This allows users to hook into diagnostic events with finer granularity (e.g. per-buffer or file). BREAKING CHANGE: DiagnosticsChanged and LspDiagnosticsChanged user autocommands are removed.
* feat(lsp): use uv_spawn to check if server executable (#16430)Michael Lingelbach2021-11-25
| | | | | | | | Previously, the built-in language server client checked if the first argument of cmd was executable via vim.fn.executable. This ignores PATH injected via cmd_env. Instead, we now start the client via uv.spawn, and handle the failure mode, reporting the error back to the user. Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
* Merge pull request #16434 from gpanders/diagnostic-clampageMichael Lingelbach2021-11-25
|\ | | | | fix(diagnostic): line clamping fixes
| * fix(diagnostic): don't clamp line numbers in setqflistGregory Anders2021-11-24
| | | | | | | | | | | | | | | | | | | | | | | | Reverts 5b0d8f85fdb705b07143fc4019189a9dcfe3c108. Diagnostic producers can send diagnostics for buffers that are not loaded, for which we cannot retrieve the line count to clamp line numbers. This means that some diagnostics in the quickfix list could be line-clamped and others not. The quickfix list can already handle line numbers past the end of the buffer (i.e. it *already* clamps line numbers) so just use the "raw" diagnostic positions sent from the producer.
| * fix(diagnostic): get line count per buffer when clampingGregory Anders2021-11-24
| | | | | | | | | | | | Fixes a bug when `get_diagnostics` is called with a nil `bufnr`. Diagnostics should be clamped for the buffer they reside in, not the current buffer.
* | fix(diagnostic): do not focus floats in goto functions (#16433)Gregory Anders2021-11-24
|/ | | | | Floating windows opened by `goto_next` and `goto_prev` should not be focused when repeating the `goto_` function. The float can still be focused by calling `open_float` with `scope = "cursor"`.
* perf(lsp)!: use faster line retrieval for utf-16 to byte idx conversion (#16360)Mathias Fußenegger2021-11-24
|
* fix(ui): use nowait for q mapping in floating window (#16427)ii142021-11-24
|
* fix(diagnostic): resolve buffer number in get() (#16407)Gregory Anders2021-11-22
|
* fix(diagnostics): don't allow 0 bufnr for metatable index (#16405)Gregory Anders2021-11-22
| | | | | | | | | | | | | | | | | | | | 04bfd20bb introduced a subtle bug where using 0 as the buffer number in the diagnostic cache resets the cache for the current buffer. This happens because we were not checking to see if the _resolved_ buffer number already existed in the cache; rather, when the __index metamethod was called we assumed the index did not exist so we set its value to an empty table. The fix for this is to check `rawget()` for the resolved buffer number to see if the index already exists. However, the reason this bug was introduced in the first place was because we are simply being too clever by allowing a 0 buffer number as the index which is automatically resolved to a real buffer number. In the interest of minimizing metatable magic, remove this "feature" by requiring the buffer number index to always be a valid buffer. This ensures that the __index metamethod is only ever called for non-existing buffers (which is what we wanted originally) as well as reduces some of the cognitive overhead for understanding how the diagnostic cache works. The tradeoff is that all public API functions must now resolve 0 buffer numbers to the current buffer number.
* fix(lsp): avoid indexing vim.NIL for null workspaceFolders (#16404)Michael Lingelbach2021-11-22
| | | | * internally represent no workspaceFolders as nil instead of vim.NIL * rename workspaceFolders -> workspace_folders for consistency
* fix(diagnostic): remove invalid buffers from cache (#16397)smolck2021-11-21
| | | | | | | | | Errors were being caused by invalid buffers being kept around in diagnostic_cache, so add a metatable to diagnostic_cache which attaches to new buffers in the cache, removing them after they are invalidated. Closes #16391. Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
* Merge pull request #16370 from gpanders/diagnostic-column-clampGregory Anders2021-11-21
|\
| * fix(diagnostic): clamp line numbers in setqflist and setloclistGregory Anders2021-11-19
| |
| * fix(diagnostic): fix navigation with diagnostics placed past end of lineGregory Anders2021-11-19
| |
| * fix(diagnostic): deepcopy diagnostics before clamping line numbersGregory Anders2021-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current 'clamp_line_numbers' implementation modifies diagnostics in place, which can have adverse downstream side effects. Before clamping line numbers, make a copy of the diagnostic. This commit also merges the 'clamp_line_numbers' method into a new 'get_diagnostics' local function which also implements the more general "get" method. The public 'vim.diagnostic.get()' API now just uses this function (without clamping). This has the added benefit that other internal API functions that need to use get() no longer have to go through vim.validate. Finally, reorganize the source code a bit by grouping all of the data structures together near the top of the file.