summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim
AgeCommit message (Collapse)AuthorFiles
2023-07-24fix(lsp): noisy warning about offset_encodings #24441Keith Smiley1
In the case you hit this warning in a buffer (like with C++ and clangd), this message potentially fires over and over again making it difficult to use the editor at all.
2023-07-24fix(gx): move to to _init_default_mappings #24420marshmallow1
Problem: netrw may conflict with the Nvim default "gx" mapping. Solution: Initialize keymapping earlier by moving it to vim._init_default_mappings(). That also avoids needing to check maparg().
2023-07-24fix(treesitter): stop() should treat 0 as current buffer #24450Micah Halter1
2023-07-22refactor(lsp): use LspNotify for inlay_hint (#24411)Chris AtLee2
2023-07-22fix(api/options): validate buf and winLewis Russell1
Fixes #24398
2023-07-22docs(lua): add missing word in docs for vim.empty_dict (#24401)Gnik1
2023-07-21fix(ui.open): some URLs fail on Windowsmarshmallow1
Problem: On Windows, `explorer.exe` fails to open some URLs, for example: :lua vim.ui.open('https://devdocs.io/#q=lua%20lua_call') https://github.com/neovim/neovim/pull/23401#issuecomment-1641015704 Solution: Use rundll32 instead.
2023-07-20feat(lsp): implement textDocument/diagnostic (#24128)Chris AtLee6
2023-07-19docs(lua): clarify fs.find() documentation #24394futsuuu1
2023-07-19feat(lsp): handle multiple clients in omnifunc (#24381)Mathias Fußenegger1
Also fixes https://github.com/neovim/neovim/issues/24369 by adding an extra `vim.schedule` to ensure the `vim.fn.complete` call happens outside of a luv callback
2023-07-18docs(lua): more improvements (#24387)Lewis Russell34
* docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-07-18fix(fs.lua): normalize slash truncation (#23753)Mike1
Preserve last slash in windows' root drive directories
2023-07-17Merge pull request #24363 from lewis6991/docs/luatypesLewis Russell13
docs(lua): move some function docs to lua files
2023-07-17feat(lsp)!: rename vim.lsp.get_active_clients to get_clients (#24113)Mathias Fußenegger4
2023-07-17fix: doc errorsLewis Russell1
2023-07-17fix: luacheckLewis Russell8
2023-07-17docs(lua): change *lua-foo* -> *vim.foo*Lewis Russell7
2023-07-17docs(lua): move function docs to lua filesLewis Russell9
2023-07-17refactor: rename _meta.lua to _options.luaLewis Russell2
2023-07-16fix(lsp): markdown code fence should allow space before info string #24364Mike1
Problem: Bash language server returns "hover" markdown content that starts with a code fence and info string of `man` preceded by whitespace, which Nvim does not render properly. See https://github.com/bash-lsp/bash-language-server/blob/0ee73c53cebdc18311d4a4ad9367185ea4d98a03/server/src/server.ts#L821C15-L821C15 ```typescript function getMarkdownContent(documentation: string, language?: string): LSP.MarkupContent { return { value: language ? // eslint-disable-next-line prefer-template ['``` ' + language, documentation, '```'].join('\n') : documentation, kind: LSP.MarkupKind.Markdown, } } ``` For example, ``` ``` man NAME git - the stupid content tracker ``` ``` If I remove the white space, then it is properly formatted. ``` ```man instead of ``` man ``` Per CommonMark Spec https://spec.commonmark.org/0.30/#info-string whitespace is allowed before and after the `info string` which identifies the language in a codeblock. > The line with the opening code fence may optionally contain some text > following the code fence; this is trimmed of leading and trailing > spaces or tabs and called the [info > string](https://spec.commonmark.org/0.30/#info-string). If the [info > string](https://spec.commonmark.org/0.30/#info-string) comes after > a backtick fence, it may not contain any backtick characters. (The > reason for this restriction is that otherwise some inline code would > be incorrectly interpreted as the beginning of a fenced code block.) Solution: Adjust stylize_markdown() to allow whitespace before codeblock info.
2023-07-14feat(lsp): map K to hover by default #24331Mathias Fußenegger1
Related: https://github.com/neovim/neovim/issues/24252
2023-07-14fix(lsp): remove unknown LSP protocol property (#24345)Techatrix1
'hierarchicalWorkspaceSymbolSupport' is not part of the LSP Specification
2023-07-13docs(lua): adds links to related keymap functions to keymap.set (#24337)Mathias Fußenegger1
Might help with discovery, given that there is no `keymap.get()`
2023-07-12feat(lsp): add method filter to get_active_clients (#24319)Mathias Fußenegger2
2023-07-10fix(lint): lint warnings #24226Raphael11
2023-07-08fix(defaults): visual star (*) on text with "?"Justin M. Keyes1
regression from 6318edadc32acce3ed41a6995a5faa5395b5f562
2023-07-08fix(defaults): visual hash (#) on text with "?"Justin M. Keyes1
Problem: The default "#" mapping fails on the following example after v$h# with cursor at start of the first line: aa?/\bb aa aa?/\bb Solution: Also escape "?".
2023-07-08docs: MAINTAIN.md, nvim_get_markJustin M. Keyes1
2023-07-08fix(lsp): don't use hl_mode = combine for inlay hints #24276Chinmay Dalal1
Problem: `hl_mode` for inlay hints is `combine`, causing bugs like inlay hints using highlights from the previous character (#24152, #24068) Solution: Don't use hl_mode=combine for inlay hints.
2023-07-07feat(lua): allow vim.wo to be double indexed (#20288)Lewis Russell1
* feat(lua): allow vim.wo to be double indexed Problem: `vim.wo` does not implement `setlocal` Solution: Allow `vim.wo` to be double indexed Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2023-07-07fix(treesitter): update folds in all relevant windows (#24230)Jaehwang Jung1
Problem: When using treesitter foldexpr, * :diffput/get open diff folds, and * folds are not updated in other windows that contain the updated buffer. Solution: Update folds in all windows that contain the updated buffer and use expr foldmethod.
2023-07-06refactor(defaults): use vim.region for visual star (*,#)Justin M. Keyes1
Problem: The parent commit added a new vim.get_visual_selection() function to improve visual star. But that is redundant with vim.region(). Any current limitations of vim.region() should be fixed instead of adding a new function. Solution: Delete vim.get_visual_selection(). Use vim.region() to get the visual selection. TODO: fails with visual "block" selections.
2023-07-06fix(defaults): visual mode star (*,#) is fragileSteven Ward1
Problem: Visual mode "*", "#" mappings don't work on text with "/", "\", "?", and newlines. Solution: Get the visual selection and escape it as a search pattern. Add functions vim.get_visual_selection and _search_for_visual_selection. Fix #21676
2023-07-06fix(vim.system): close check handle (#24270)zeertzjq1
Fix hang after running vim.system() with sanitizers.
2023-07-05fix(vim.ui.open): return (don't show) error messageJustin M. Keyes2
Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
2023-07-04fix(gx): visual selection, expand env varsJustin M. Keyes2
--- Rejected experiment: move vim.ui.open() to vim.env.open() Problem: `vim.ui` is where user-interface "providers" live, which can be overridden. It would also be useful to have a "providers" namespace for platform-specific features such as "open", clipboard, python, and the other providers listed in `:help providers`. We could overload `vim.ui` to serve that purpose as the single "providers" namespace, but `vim.ui.nodejs()` for example seems awkward. Solution: `vim.env` currently has too narrow of a purpose. Overload it to also be a namespace for `vim.env.open`. diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 913f1fe20348..17d05ff37595 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -37,8 +37,28 @@ local options_info = setmetatable({}, { end, }) -vim.env = setmetatable({}, { - __index = function(_, k) +vim.env = setmetatable({ + open = setmetatable({}, { + __call = function(_, uri) + print('xxxxx'..uri) + return true + end, + __tostring = function() + local v = vim.fn.getenv('open') + if v == vim.NIL then + return nil + end + return v + end, + }) + }, + { + __index = function(t, k, ...) + if k == 'open' then + error() + -- vim.print({...}) + -- return rawget(t, k) + end local v = vim.fn.getenv(k) if v == vim.NIL then return nil
2023-07-04feat(vim.ui): vim.ui.open, "gx" without netrwmarshmallow2
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com> Co-authored-by: ii14 <59243201+ii14@users.noreply.github.com>
2023-07-04fix(lsp): revert change to buf.clear_references() #24238Raphael2
Problem: in #24046 the signature of buf.clear_references() changed, which indirectly breaks callers that were passing "ignored" args. Solution: because util.buf_clear_references() already defaulted to "current buffer", the change to buf.clear_references() isn't actually needed, so just revert it.
2023-07-02perf(treesitter): cache fold query (#24222)Jaehwang Jung1
perf(treesitter): cache vim.treesitter.query.get Problem: vim.treesitter.query.get searches and reads query files every time it's called, if user hasn't overridden the query. So this can incur slowdown when called frequently. This can happen when using treesitter foldexpr. For example, when using `:h :range!` in markdown file to format fenced codeblock, on_changedtree in _fold.lua is triggered many times despite that the tree doesn't have syntactic changes (might be a bug in LanguageTree). (Incidentally, the resulting fold is incorrect due to a bug in `:h range!`.) on_changedtree calls vim.treesitter.query.get for each tree changes. In addition, it may request folds queries for injected languages without fold queries, such as markdown_inline. Solution: * Cache the result of vim.treesitter.query.get. * If query file was not found, fail quickly at later calls.
2023-07-01fix(lsp): lint warnings, default offset_encoding #24046Raphael6
- fix lint / analysis warnings - locations_to_items(): get default offset_encoding from active client - character_offset(): get default offset_encoding from active client
2023-07-01feat(treesitter): bundle markdown parser and queries (#22481)Christian Clason1
* bundle split Markdown parser from https://github.com/MDeiml/tree-sitter-markdown * add queries from https://github.com/nvim-treesitter/nvim-treesitter/tree/main * upstream `#trim!` and `#inject-language!` directives Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-06-30fix(lsp): fix attempt to call non existent function (#24212)Sanchayan Maity1
Commit 37079fc moved inlay_hint to vim.lsp() but in the process did missed converting a call to disable/enable which are now local. Fixes the below error when trying to toggle inlay hints. E5108: Error executing lua /usr/local/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:248: attempt to call field 'disable' (a nil value) stack traceback: /usr/local/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:248: in function 'toggle' /usr/local/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:310: in function 'inlay_hint' [string ":lua"]:1: in main chunk
2023-06-30feat(lsp): move inlay_hint() to vim.lsp (#24130)Mathias Fußenegger4
Allows to keep more functions hidden and gives a path forward for further inlay_hint related functions - like applying textEdits. See https://github.com/neovim/neovim/pull/23984#pullrequestreview-1486624668
2023-06-29fix(lsp): inlay_hint nil reference error #24202Chinmay Dalal1
Problem: vim_lsp_inlayhint: Error executing lua: .../lsp/_inlay_hint.lua:249: attempt to index field 'applied' (a nil value) Solution: Assign {} to bufstates.applied in on_reload fixes #24172
2023-06-27fix(treesitter): handle empty region when logging (#24173)Jaehwang Jung1
2023-06-27fix(treesitter): make foldexpr work without highlighting (#24167)Jaehwang Jung1
Problem: Treesitter fold is not updated if treesitter hightlight is not active. More precisely, updating folds requires `LanguageTree:parse()`. Solution: Call `parse()` before computing folds and compute folds when lines are added/removed. This doesn't guarantee correctness of the folds, because some changes that don't add/remove line won't update the folds even if they should (e.g. adding pair of braces). But it is good enough for most cases, while not introducing big overhead. Also, if highlighting is active, it is likely that `TSHighlighter._on_buf` already ran `parse()` (or vice versa).
2023-06-27docs(diagnostic): return value of get() #24144NAKAI Tsuyoshi1
2023-06-27vim-patch:9.0.1668: PEM files are not recognized (#24169)ObserverOfTime1
Problem: PEM files are not recognized. Solution: Add patterns to match PEM files. (closes vim/vim#12582) https://github.com/vim/vim/commit/0256d76a3392aef270b38d1cf7633008e45c2003
2023-06-26vim-patch:9.0.1632: not all cabal config files are recognized (#24025)Jonas Strittmatter1
Problem: Not all cabal config files are recognized. Solution: Add a couple of patterns. (Marcin Szamotulski, closes vim/vim#12463) https://github.com/vim/vim/commit/166cd7b801ebe4aa042a9bbd6007d1951800aaa9 Also: - Do not expand Lua patterns in environment variables used in file patterns. - Test $XDG_CONFIG_HOME on Windows, as it can be used by Nvim (and the runner sets it). Co-authored-by: Marcin Szamotulski <coot@coot.me>
2023-06-25Merge #24116 from justinmk/docJustin M. Keyes5