aboutsummaryrefslogtreecommitdiff
path: root/runtime
Commit message (Collapse)AuthorAge
* Add documentation for the userregfun setting.Josh Rahm2021-10-05
|
* Add colorcol character documentation.Josh Rahm2021-10-05
|
* feat(diagnostic): allow customized diagnostic messages (#15742)Gregory Anders2021-09-22
| | | | Provide a 'format' option for virtual text and floating window previews that allows the displayed text of a diagnostic to be customized.
* Merge pull request #14115 from mfussenegger/lsp-commandsMichael Lingelbach2021-09-22
|\ | | | | lsp: Add a registry for client side code action commands
| * feat(lsp): add a registry for client side code action commandsMathias Fussenegger2021-09-20
| | | | | | | | | | This builds on https://github.com/neovim/neovim/pull/14112 and closes https://github.com/neovim/neovim/issues/12326
| * feat(lsp): include original request params in handler ctxMathias Fussenegger2021-09-20
| | | | | | | | | | | | | | | | | | | | | | This is mostly motivated by https://github.com/neovim/neovim/issues/12326 Client side commands might need to access the original request parameters. Currently this is already possible by using closures with `vim.lsp.buf_request`, but the global handlers so far couldn't access the request parameters.
* | vim-patch:34cc7d8c034f #15753Christian Clason2021-09-22
| | | | | | | | Update runtime files https://github.com/vim/vim/commit/34cc7d8c034f2bc5b57455577051db8d72e2b87c
* | refactor(diagnostic): remove get_virt_text_chunks()Gregory Anders2021-09-21
| | | | | | | | | | | | | | | | | | This function isn't compatible with including diagnostic sources when "source" is "if_many" since it only has access to diagnostics for a single line. Rather than having an inconsistent or incomplete interface, make this function private. It is still exported as part of the module for backward compatibility with vim.lsp.diagnostics, but it can eventually be made into a local function.
* | feat(diagnostic): add option to include diagnostic sourceGregory Anders2021-09-21
| | | | | | | | | | Add an option to virtual text display and floating window previews to include diagnostic source in the diagnostic message.
* | fix(diagnostic): preserve fields from LSP diagnostics via user_data (#15735)masterGregory Anders2021-09-21
| | | | | | * preserve fields from LSP diagnostics via adding a user_data table to the diagnostic, which can hold arbitrary data in addition to the lsp diagnostic information.
* | fix(lsp): update lsp-handler signature in call_hierarchy (#15738)Mathias Fußenegger2021-09-21
|/ | | | | | | | This fixes the handler signature and also prevents n+1 requests firing if there are multiple clients. (The first `prepareCallHierarchy` handler is called once per client, each invocation used `buf_request` to make more requests using *all* clients)
* fix(diagnostic): clamp line numbers in display layer (#15729)Gregory Anders2021-09-20
| | | | | | Some parts of LSP need to use cached diagnostics as sent from the LSP server unmodified. Rather than fixing invalid line numbers when diagnostics are first set, fix them when they are displayed to the user (e.g. in show() or one of the get_next/get_prev family of functions).
* feat(diagnostic): match(), tolist(), fromlist() #15704Gregory Anders2021-09-19
| | | | | | * feat(diagnostic): add vim.diagnostic.match() Provide vim.diagnostic.match() to generate a diagnostic from a string and a Lua pattern. * feat(diagnostic): add tolist() and fromlist()
* vim-patch:8.2.3424: a sequence of spaces is hard to see in list modezeertzjq2021-09-19
| | | | | | Problem: A sequence of spaces is hard to see in list mode. Solution: Add the "multispace" option to 'listchars'. (closes vim/vim#8834) https://github.com/vim/vim/commit/f14b8ba1373f569705cb80419248054100b02360
* vim-patch:8.1.1071: cannot get composing characters from the screenzeertzjq2021-09-19
| | | | | | | Problem: Cannot get composing characters from the screen. Solution: Add screenchars() and screenstring(). (partly by Ozaki Kiichi, closes vim/vim#4059) https://github.com/vim/vim/commit/2912abb3a2fd72074e3901c8ae1d4a77ce764675
* fix(diagnostic): only update decorations for loaded buffers (#15715)Gregory Anders2021-09-18
| | | | | When vim.diagnostic.config() is called, the decorations for diagnostics are re-displayed to use the new configuration. This should only be done for loaded buffers.
* feat(lsp): improve vim.lsp.util.apply_text_edits (#15561)hrsh7th2021-09-18
| | | | | - Fix the cursor position after applying TextEdits - Support reversed range of TextEdit - Invoke nvim_buf_set_text one by one
* fix(diagnostic): resolve nil bufnr in show_line_diagnosticsGregory Anders2021-09-18
|
* refactor(runtime): always use DIP_START when searching for runtime filesBjörn Linse2021-09-18
| | | | | | | | Now remove the addition of "start/*" packages in 'packpath' as explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming very long when using a lot of plugins as packages. To get the effective search path as a list, use |nvim_list_runtime_paths()|
* fix(diagnostic): remove check on nil return valueGregory Anders2021-09-17
| | | | | vim.diagnostic._set_signs doesn't return anything, so checking the return value will always fail.
* refactor(diagnostic): combine config() and set() callsGregory Anders2021-09-17
|
* refactor(diagnostic): group local functions togetherGregory Anders2021-09-17
|
* fix(diagnostic): change default severity_sort orderGregory Anders2021-09-17
| | | | | | | When severity_sort is true, higher severities should be displayed before lower severities (e.g. ERROR is displayed over WARN). Also improved the test case for this.
* Merge pull request #15696 from gpanders/diagnostic-sign-fixMichael Lingelbach2021-09-17
|\ | | | | Diagnostic hot fixes
| * fix(diagnostic): support severity_sortGregory Anders2021-09-17
| |
| * fix(diagnostic): correctly handle folder level diagnosticsGregory Anders2021-09-17
| |
| * docs(diagnostics): fix typosGregory Anders2021-09-17
| |
| * fix(diagnostic): fix wrong data type in setqflist()Gregory Anders2021-09-17
| |
| * fix(diagnostic): don't overwrite existing sign definitionsGregory Anders2021-09-17
| |
* | fix(termdebug): replace mapset with nvim_set_keymap (#15699)ii142021-09-17
| | | | | | Co-authored-by: ii14 <ii14@users.noreply.github.com>
* | fix(typo): overriden -> overridden (RE: PR #14159) (#15360)Oliver Marriott2021-09-17
|/
* Merge pull request #15580 from seandewar/vim-8.2.3378Jan Edmund Lazo2021-09-17
|\ | | | | vim-patch:8.2.{3378,3379,3384,3386,3398,3400}
| * vim-patch:8.2.3400: ":z!" is not supportedSean Dewar2021-09-10
| | | | | | | | | | | | | | Problem: ":z!" is not supported. Solution: Make ":z!" work and add tests. (Dominique Pellé, closes vim/vim#8836) Use display height instead of current window height. https://github.com/vim/vim/commit/7f2dd1e90c1d4a30c791fae20014594641769a1e
| * vim-patch:8.2.3384: cannot disable modeline for an individual fileSean Dewar2021-09-10
| | | | | | | | | | | | | | | | Problem: Cannot disable modeline for an individual file. Solution: Recognize "nomodeline" in a modeline. (Hu Jialun, closes vim/vim#8798) https://github.com/vim/vim/commit/9dcd349ca85e1df1abd1cbf1c29c0f1574b70bf8 Cherry-pick missing modeline for test_modeline.vim (heh) from v8.2.1432.
* | fix(diagnostic): don't convert diagnostic table twiceChristian Clason2021-09-17
| | | | | | | | | | | | | | | | The recursive implementation of vim.lsp.diagnostic.get() applied `diagnostic_vim_to_lsp` twice, and the second time gave wrong results because of the unexpected format. Fixes https://github.com/neovim/neovim/issues/15689
* | fix(diagnostic): show_line_diagnostic with empty lnumChristian Clason2021-09-17
| | | | | | | | | | | | | | The documentation claims to default to the current line number if the argument `lnum` is nil, but that was never actually done. Fixes https://github.com/neovim/neovim/issues/15690
* | fix(diagnostic): nvim_echo takes three args (#15687)Christian Clason2021-09-17
| | | | | | | | Fixup for https://github.com/neovim/neovim/pull/15585 Closes https://github.com/neovim/neovim/issues/15686
* | fix(diagnostic): remove useless highlight links (#15683)Gregory Anders2021-09-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These links were actually defined backwards: the highlight groups actually being used for display are the new "Diagnostic*" groups, so linking the old "LspDiagnostics*" groups to these does absolutely nothing, since there is nothing actually being highlighted with the LspDiagnostics* groups. These links were made in an attempt to preserve backward compatibility with existing colorschemes. We could reverse the links to maintain this preservation, but then that disallows us from actually defining default values for the new highlight groups. Instead, just remove the links and be done with the old LspDiagnostics* highlight groups. This is not technically a breaking change: the breaking change already happened in #15585, but this PR just makes that explicit.
* | fix(diagnostic): don't override existing highlight groups #15682Gregory Anders2021-09-16
| | | | | | | | | | Use the 'default' keyword to prevent overriding existing highlight groups. ref #15585
* | Merge #15585 refactor: move vim.lsp.diagnostic to vim.diagnosticJustin M. Keyes2021-09-16
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Overview - Move vim.lsp.diagnostic to vim.diagnostic - Refactor client ids to diagnostic namespaces - Update tests - Write/update documentation and function signatures Currently, non-LSP diagnostics in Neovim must hook into the LSP subsystem. This is what e.g. null-ls and nvim-lint do. This is necessary because none of the diagnostic API is exposed separately from the LSP subsystem. This commit addresses this by generalizing the diagnostic subsystem beyond the scope of LSP. The `vim.lsp.diagnostic` module is now simply a specific diagnostic producer and primarily maintains the interface between LSP clients and the broader diagnostic API. The current diagnostic API uses "client ids" which only makes sense in the context of LSP. We replace "client ids" with standard API namespaces generated from `nvim_create_namespace`. This PR is *mostly* backward compatible (so long as plugins are only using the publicly documented API): LSP diagnostics will continue to work as usual, as will pseudo-LSP clients like null-ls and nvim-lint. However, the latter can now use the new interface, which looks something like this: ```lua -- The namespace *must* be given a name. Anonymous namespaces will not work with diagnostics local ns = vim.api.nvim_create_namespace("foo") -- Generate diagnostics local diagnostics = generate_diagnostics() -- Set diagnostics for the current buffer vim.diagnostic.set(ns, diagnostics, bufnr) ``` Some public facing API utility methods were removed and internalized directly in `vim.diagnostic`: * `vim.lsp.util.diagnostics_to_items` ## API Design `vim.diagnostic` contains most of the same API as `vim.lsp.diagnostic` with `client_id` simply replaced with `namespace`, with some differences: * Generally speaking, functions that modify or add diagnostics require a namespace as their first argument, e.g. ```lua vim.diagnostic.set({namespace}, {bufnr}, {diagnostics}[, {opts}]) ``` while functions that read or query diagnostics do not (although in many cases one may be supplied optionally): ```lua vim.diagnostic.get({bufnr}[, {namespace}]) ``` * We use our own severity levels to decouple `vim.diagnostic` from LSP. These are designed similarly to `vim.log.levels` and currently include: ```lua vim.diagnostic.severity.ERROR vim.diagnostic.severity.WARN vim.diagnostic.severity.INFO vim.diagnostic.severity.HINT ``` In practice, these match the LSP diagnostic severity levels exactly, but we should treat this as an interface and not assume that they are the same. The "translation" between the two severity types is handled transparently in `vim.lsp.diagnostic`. * The actual "diagnostic" data structure is: (**EDIT:** Updated 2021-09-09): ```lua { lnum = <number>, col = <number>, end_lnum = <number>, end_col = <number>, severity = <vim.diagnostic.severity>, message = <string> } ``` This differs from the LSP definition of a diagnostic, so we transform them in the handler functions in vim.lsp.diagnostic. ## Configuration The `vim.lsp.with` paradigm still works for configuring how LSP diagnostics are displayed, but this is a specific use-case for the `publishDiagnostics` handler. Configuration with `vim.diagnostic` is instead done with the `vim.diagnostic.config` function: ```lua vim.diagnostic.config({ virtual_text = true, signs = false, underline = true, update_in_insert = true, severity_sort = false, }[, namespace]) ``` (or alternatively passed directly to `set()` or `show()`.) When the `namespace` argument is `nil`, settings are set globally (i.e. for *all* diagnostic namespaces). This is what user's will typically use for their local configuration. Diagnostic producers can also set configuration options for their specific namespace, although this is generally discouraged in order to respect the user's global settings. All of the values in the table passed to `vim.diagnostic.config()` are resolved in the same way that they are in `on_publish_diagnostics`; that is, the value can be a boolean, a table, or a function: ```lua vim.diagnostic.config({ virtual_text = function(namespace, bufnr) -- Only enable virtual text in buffer 3 return bufnr == 3 end, }) ``` ## Misc Notes * `vim.diagnostic` currently depends on `vim.lsp.util` for floating window previews. I think this is okay for now, although ideally we'd want to decouple these completely.
| * | fix(lint): remove unused parameters from deprecated functionsGregory Anders2021-09-16
| | |
| * | refactor: remove UTF to byte col conversionGregory Anders2021-09-16
| | |
| * | refactor: move vim.lsp.diagnostic to vim.diagnosticGregory Anders2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This generalizes diagnostic handling outside of just the scope of LSP. LSP clients are now a specific case of a diagnostic producer, but the diagnostic subsystem is decoupled from the LSP subsystem (or will be, eventually). More discussion at [1]. [1]: https://github.com/neovim/neovim/pull/15585
* | | Merge pull request #15211 from seandewar/blob-portJan Edmund Lazo2021-09-16
|\ \ \ | | | | | | | | Port VimL's Blob type - vim-patch:8.1.{0735,0736,0738,0741,0742,0755,0756,0757,0765,0793,0797,0798,0802,1022,1023,1671},8.2.{0121,0184,0404,0521,0829,1473,1866,2712}
| * | | doc(eval): include latest relevant Blob changesSean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also includes some small relevant nearby non-Blob changes and typo fixes. Changes are included from: - v8.1.0815 - v8.1.0846 - v8.1.1084 - v8.1.2326 - v8.2.1969 - d89682477c - d09091d495 - 53f7fccc94
| * | | feat(f_msgpackparse): support parsing from BlobSean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that it is not possible for msgpack_unpack_next() and msgpack_unpacker_next() to return MSGPACK_UNPACK_EXTRA_BYTES, so it should be fine to abort() on that. Lua 5.1 doesn't support string hex escapes (\xXX) like VimL does (though LuaJIT does), so convert them to decimal escapes (\DDD) in tests.
| * | | feat(f_msgpackdump): support dumping to BlobSean Dewar2021-09-16
| | | |
| * | | feat(f_chansend): support Blob data argumentSean Dewar2021-09-16
| | | |
| * | | fix(eval): partially port v8.2.3284Sean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were issues that I found while porting that I fixed upstream. :^) Very little of the patch can be exactly ported as we're a bit behind on dependant patches (we also can't use the exact :for emsg, as we don't support iterating over Strings yet), so just translate the fixes as best as we can for now. Include latest relevant doc changes from: - v8.1.0815 - v8.2.2658
| * | | vim-patch:8.2.1473: items in a list given to :const can still be modifiedSean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Items in a list given to :const can still be modified. Solution: Work like ":lockvar! name" but don't lock referenced items. Make locking a blob work. https://github.com/vim/vim/commit/021bda56710d98c09a6b35610a476ab2dd8c58ad