aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
Commit message (Collapse)AuthorAge
* fix(filetype): normalize slashes in file pathsGregory Anders2022-01-05
|
* test(filetype): port test_filetype to LuaGregory Anders2022-01-05
| | | | | | | | | | Because filetype.lua is gated behind an opt-in variable, it's not tested during the "standard" test_filetype.vim test. So port the test into filetype_spec where we enable the opt-in variable. This means runtime Vim patches will need to update test_filetype in two places. This can eventually be removed if/when filetype.lua is made opt-out rather than opt-in.
* fix(filetype): match on <afile> rather than <abuf> (#16943)Gregory Anders2022-01-05
| | | | | | | Filetype detection runs on BufRead and BufNewFile autocommands, both of which can fire without an underlying buffer, so it's incorrect to use <abuf> to determine the file path. Instead, match on <afile> and assume that the buffer we're operating on is the current buffer. This is the same assumption that filetype.vim makes, so it should be safe.
* feat(lsp): enable default debounce of 150 ms (#16908)Michael Lingelbach2022-01-05
|
* feat(filetype.lua): add support for txt files (#16926)KillTheMule2022-01-04
|
* chore: ignore unused args in filetype functions (#16927)Gregory Anders2022-01-04
| | | Also mark the 'getline' helper function as private to avoid docgen.
* feat(filetype.lua): Add typescript extension to filetype detection (#16923)Robin Gagnon2022-01-04
| | | port from `filetype.vim`; also add `getline` convenience function
* chore: fix typos (#16816)dundargoc2022-01-04
| | | | | | | Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Sebastian Volland <seb@baunz.net> Co-authored-by: Lewis Russell <lewis6991@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(lsp): suppress ContentModified errors from UI (#16904)Sam McCall2022-01-04
| | | | | | | | | Fixes https://github.com/neovim/neovim/issues/16900 If clients receive a ContentModified error, it generally should not show it in the UI for the end-user. Clients can resend the request if they know how to do so. https://microsoft.github.io/language-server-protocol/specifications/specification-current/#implementationConsiderations
* feat: filetype.lua (#16600)Gregory Anders2022-01-04
| | | | Adds a new vim.filetype module that provides support for filetype detection in Lua.
* fix(lsp): explicitly pass bufnr in didSave handler (#16906)Michael Lingelbach2022-01-03
| | | | Addresses a regression introduced by the stricter type checking in lua api functions from https://github.com/neovim/neovim/pull/16745
* fix(lsp): resolve nil bufnr (#16902)Gregory Anders2022-01-03
| | | Related: #16889, #16745
* fix: resolve nil arguments to API functions (#16889)Gregory Anders2022-01-03
| | | | | | As revealed by #16745, some functions pass a nil value to API functions, which have been implicitly converted to 0. #16745 breaks this implicit conversion, so explicitly pass a resolved buffer number to these API functions.
* fix(lsp): always use target bufnr in location handler (#16876)Michael Lingelbach2022-01-02
|
* fix(diagnostic): improve validation for list arguments (#16855)Gregory Anders2022-01-01
| | | | | | Function arguments that expect a list should explicitly use tbl_islist rather than just checking for a table. This helps catch some simple errors where a single table item is passed as an argument, which passes validation (since it's a table), but causes other errors later on.
* feat(lua): add support for multiple optional types in vim.validate (#16864)Shadman2022-01-01
|
* chore: fix typos (#16506)dundargoc2021-12-28
| | | | | | | | | Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com> Co-authored-by: Alef Pereira <ealefpereira@gmail.com> Co-authored-by: AusCyber <willp@outlook.com.au> Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
* fix(uri): change scheme pattern to not include the comma character (#16797)Dmytro Meleshko2021-12-26
|
* feat(lsp): add buf_detach_client (#16250)Michael Lingelbach2021-12-21
| | | | | This allows the user to detach an active buffer from the language client. If no clients remain attached to a buffer, the on_lines callback is used to cancel nvim_buf_attach.
* fix(lsp): fix `nil`-index behavior for UTF-8 in `_str_*index_enc` methods ↵Rishikesh Vaishnav2021-12-20
| | | | | (#16731) Previously, the `_str_utfindex_enc` and `_str_byteindex_enc` helper functions would return `nil` when `offset_encoding == "utf-8"` and `index == nil`. Clearly, this doesn't reflect the expected behavior of the functions they're wrapping which would return the length of the line in this case. This should fix behavior with servers that use UTF-8 `offset_encoding` when applying text edits, formatting a range, and doing range code actions (though this isn't tested currently).
* fix(lsp): avoid attaching to unloaded buffers (#16723)Michael Lingelbach2021-12-19
| | | | | | | | | | | Closes https://github.com/neovim/neovim/issues/16562 https://github.com/neovim/neovim/issues/16249 https://github.com/neovim/neovim/issues/16297 * buf_attach_client can be called on an unloaded buffer * on_attach will prematurely fail, while the language server client tracks this buffer as attached * The language server client will track this buffer as attached despite textDocument/didChange notifications not being sent to the server * Instead, check if the buffer is loaded and return early, warning via the lsp logger that buf_attach_client was called on an invalid buffer
* fix(diagnostic): respect "if_many" source option for virtual text (#16653)Gregory Anders2021-12-17
| | | | | | | | The `prefix_source` function only evaluates the sources from the diagnostics passed to it; however, because each namespace draws its own virtual text, its diagnostics will never contain more than a single source (by definition). This requires changing the semantics of what "if_many" means from "multiple sources in a single 'batch' of diagnostics" to "multiple sources of all diagnostics within a buffer".
* fix(lsp): correctly align start and end range to codepoints during ↵Rishikesh Vaishnav2021-12-17
| | | | | | | | | | | | | | | | | | | | | incremental sync (#16670) Closes #16624 Fixes two issues with aligning the start position and end position to codepoints when calculating the start and end range. When aligning the start position: * use aligned byte index to calculate character index rather than the unadjusted byte When aligning the end position: * do not adjust the end byte if it falls on a UTF-8 codepoint * align byte to the first byte of the next codepoint rather than the last byte of the current codepoint * compute character character end range on the aligned byte index This commit also adds additional test coverage, including multibyte operations that previously failed before this commit.
* fix(lsp): call config on_exit handler before context is cleared (#16638)Gregory Anders2021-12-17
| | | | | | The on_exit handler provided to the client configuration is called after the client's context is cleared (e.g. which buffers the client was attached to). Calling the handler sooner allows these handlers to access the client object and do their own cleanup with the full context.
* refactor(diagnostic): remove hack (#16685)Gregory Anders2021-12-16
| | | No longer required since #16548.
* fix(diagnostic): assert that diagnostics have line number and column (#16683)Gregory Anders2021-12-16
| | | | | | | Line number and column are required and much of the diagnostic API assumes that these are both present. When one of the two is missing, cryptic errors pop up in other parts of the diagnostic subsystem. Instead, assert that diagnostics are well formed when they are entered into the cache, which provides a clearer error.
* 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.