| Commit message (Collapse) | Author | Age |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 "?".
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| | |
Fix hang after running vim.system() with sanitizers.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
---
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
|
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
- fix lint / analysis warnings
- locations_to_items(): get default offset_encoding from active client
- character_offset(): get default offset_encoding from active client
|
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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).
|
| | |
|
| |
| |
| |
| |
| |
| | |
Problem: PEM files are not recognized.
Solution: Add patterns to match PEM files. (closes vim/vim#12582)
https://github.com/vim/vim/commit/0256d76a3392aef270b38d1cf7633008e45c2003
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |\ |
|
| | | |
|
| | |
| | |
| | |
| | | |
gen_help_html: truncate parse-error sample text
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Problem: BUCK files are not recognized.
Solution: Recognize BUCK files as "bzl". (Son Luong Ngoc, closes vim/vim#12564)
https://github.com/vim/vim/commit/b46e0f3263acd99c61df06ee3c4d1f6e0b471bc3
Co-authored-by: Son Luong Ngoc <sluongng@gmail.com>
|
| |\ \
| | | |
| | | | |
fix(filetype): correctly detect bash-fc-{id} files as "sh" (vim-patch:9.0.1644)
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Problem:
On running `zig fmt` manually, the on_lines callback and the
server both detach (for some reason), and both of them call
`clear()`. This fixes it, otherwise the second one to detach
has an error in `reset_timer` since the bufstate doesn't exist
Solution:
* exit early in clear if `bufstates[bufnr]` is nil
* set bufstatte.enabled to true on reload instead of making bufstate nil
|
| | | | |
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Problem:
The decoration provider clears the whole buffer then redraws all the hints every
time the window was redrawn. This may lead to an infinite loop.
Solution:
Store the last applied version for a line and only clear and redraw the line if
the buffer version has changed.
|
| | |
| | |
| | |
| | |
| | | |
Since https://github.com/neovim/neovim/pull/23681 there is dynamic
registration support. We should use that for new features unless there
is a good reason to turn it off.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Problem: zserio files are not recognized.
Solution: Add a pattern for zserio files. (Dominique Pellé,
closes vim/vim#12544)
https://github.com/vim/vim/commit/2b994da57a0ac6ec0ec09fe3783f48ecd2bce610
Co-authored-by: =?UTF-8?q?Dominique=20Pell=C3=A9?= <dominique.pelle@gmail.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
There is no need for two ways to access all clients of a buffer.
This doesn't add a `vim.deprecate` call yet, as the function is probably
used a lot, but removes it from the documentation and annotates it with
`@deprecated`
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Enforce consistent terminology (defined in
`gen_help_html.lua:spell_dict`) for common misspellings.
This does not spellcheck English in general (perhaps a future TODO,
though it may be noisy).
|
| | |
| | |
| | |
| | | |
With the title carry-over logic in the `$/progress` handler it's not
necessary to group again in vim.lsp.status
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Problem:
Since #23925, Version.build may be vim.NIL, which causes tostring() to fail:
E5108: Error executing lua E5114: Error while converting print argument #1: …/version.lua:129:
attempt to concatenate field 'build' (a userdata value)
stack traceback:
[C]: in function 'print'
[string ":lua"]:1: in main chunk
Solution:
Handle vim.NIL in Version:__tostring().
|
| | | |
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Problem:
Spacing around inlay hints has the same highlight as the hint itself.
The LSP spec for inlay hints specifically mentions the padding should not be
coloured:
/**
Render padding before the hint.
Note: Padding should use the editor's background color, not the
background color of the hint itself. That means padding can be used
to visually align/separate an inlay hint.
*/
paddingLeft?: boolean;
/**
Render padding after the hint.
Note: Padding should use the editor's background color, not the
background color of the hint itself. That means padding can be used
to visually align/separate an inlay hint.
*/
paddingRight?: boolean;
Solution:
Add the space as separate parts of the virtual text, don't add the space to the
text itself.
|
| |
| |
| | |
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
|
| |
| |
| |
| |
| |
| | |
(#24074)
disabling before enabling throws an error otherwise, because bufstate[bufnr]
doesn't exist
|
| | |
|
| |
| |
| |
| | |
M.enable already clears bufstate[bufnr] and the namespace,
the duplicate callbacks cause an error (indexing bufstate[bufnr] fails)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add automatic refresh and a public interface on top of #23736
* add on_reload, on_detach handlers in `enable()` buf_attach, and
LspDetach autocommand in case of manual detach
* unify `__buffers` and `hint_cache_by_buf`
* use callback bufnr in `on_lines` callback, bufstate: remove __index override
* move user-facing functions into vim.lsp.buf, unify enable/disable/toggle
Closes #18086
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- nvim requires rpc responses in reverse order. https://github.com/neovim/neovim/issues/19932
- NVIM_APPNAME: UIs normally should NOT set this.
ref #23520
fix #24050
fix #23660
fix #23353
fix #23337
fix #22213
fix #19161
fix #18088
fix #20693
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Co-authored by: zeertzjq <zeertzjq@outlook.com>
Co-authored by: Steven Todd McIntyre II <114119064+stmii@users.noreply.github.com>
Co-authored by: nobe4 <nobe4@users.noreply.github.com>
- docs: mention --luadev-mod to run with lua runtime files
When changing a lua file in the ./runtime folder, a new contributor
might expect changes to be applied to the built Neovim binary.
|
| |
| |
| |
| |
| | |
Problem: Treesitter highlighting base priority cannot be customized.
Solution: Use `vim.highlight.priorities.treesitter` instead of hard-coded value.
|
| |
| |
| |
| |
| |
| |
| | |
Problem: Current implementation of "remove trailing /" doesn't
account for the case of literal '/' as path.
Solution: Remove trailing / only if it preceded by something else.
Co-authored by: notomo <notomo.motono@gmail.com>
|