Whenever we run fs_stat() on a path, save this information in the loader
so it can be re-used.
- Loader.loadfile: Remove arguments `hash` as it is no longer needed.
- Loader.loader: Use _G.loadstring instead of Loader.load
This allows plugins to wrap loadstring to inspection and profiling
- factor out read file logic
Problem: No way to get the actual highlight attributes for a linked
group through |nvim_get_hl()| (not the attributes from the link target).
Solution: Return the actual attributes as well as the link target name.
Problem: Livebook files are not recognized.
Solution: Add a pattern for Livebook files. (Mathias Jean Johansen,
closesvim/vim#12203)
6400203517
Co-authored-by: Mathias Jean Johansen <mathias@mjj.io>
fix(api): use local LastSet structure in nvim_get_option_info
* nvim_get_option_info is deprecated.
It is always using the global LastSet information as reported in #15232.
* nvim_get_option_info2 is added.
The new function additionally accepts an 'opts' table {scope, buf, win}
allowing to specify the option scope and query local options from another
buffer or window.
Problem:
LSP docs hover (textDocument/hover) doesn't handle HTML escape seqs in markdown.
Solution:
Convert common HTML escape seqs to a nicer form, to display in the float.
closees #22757
Signed-off-by: Kasama <robertoaall@gmail.com>
Problem: "wat" and "wast" files are one filetype.
Solution: Add a separate filetype for "wat" files. (Amaan Qureshi,
closesvim/vim#12165)
3ea62381c5
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
Problem: no way of getting all highlight group definitions in a namespace.
Solution: add `nvim_get_hl()`, deprecate `nvim_get_hl_by_name()` and `nvim_get_hl_by_id()`.
Problem:
semver specifies that digit sequences in a prerelease string should be
compared as numbers, not lexically: https://semver.org/#spec-item-11
> Precedence for two pre-release versions with the same major, minor,
> and patch version MUST be determined by comparing each dot separated
> identifier from left to right until a difference is found as follows:
> 1. Identifiers consisting of only digits are compared numerically.
> 2. Identifiers with letters or hyphens are compared lexically in ASCII sort order.
> 3. Numeric identifiers always have lower precedence than non-numeric identifiers.
> 4. A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal.
Example:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
Solution:
cmp_prerel() treats all digit sequences in a prerelease string as
numbers. This doesn't _exactly_ match the spec, which specifies that
only dot-delimited digit sequences should be treated as numbers...
Problem:
- vim.split has more features than vim.gsplit.
- Cannot inspect the "separator" segments of vim.split or vim.gsplit.
Solution:
- Move common implementation from vim.split into vim.gsplit.
- TODO: deprecate vim.split in favor of vim.totable(vim.gsplit())?
- Introduce `keepsep` parameter.
Related: 84f66909e4
vim-patch:9.0.1419: Lean files are not recognized
Problem: Lean files are not recognized.
Solution: Add a pattern for Lean files. (Amaan Qureshi, closesvim/vim#12177)
4a5c39fc52
vim-patch:9.0.1421: Nu files are not recognized
Problem: Nu files are not recognized.
Solution: Add a pattern for Nu files. (Amaan Qureshi, closesvim/vim#12172)
8aa2a37f89
vim-patch:9.0.1422: Sage files are not recognized
Problem: Sage files are not recognized.
Solution: Add a pattern for Sage files. (Amaan Qureshi, closesvim/vim#12176)
d0639d717b
vim-patch:9.0.1423: WebAssembly Interface Type files are not recognized
Problem: WebAssembly Interface Type files are not recognized.
Solution: Add a pattern for WIT files. (Amaan Qureshi, closesvim/vim#12173)
890c772036
existing behavior of
:=
and
:[range]=
are unchanged. `|` is still allowed with this usage.
However,
:=p
and similar are changed in a way which could be construed as a breaking
change. Allowing |ex-flags| for := in the first place was a mistake as
any form of := DOES NOT MOVE THE CURSOR. So it would print one line number
and then print a completely different line contents after that.
Problem:
"tmux 3.2a" (output from "tmux -V") is not parsed easily.
Solution:
With `strict=false`, discard everything before the first digit.
- rename Semver => Version
- rename vim.version.version() => vim.version._version()
- rename matches() => has()
- remove `opts` from cmp()
Problem:
On Windows, :make does not display the output of the program it runs.
The cause is the default 'shellpipe'. On Linux, nvim uses `tee` to redirect the
output to both stdout and the error file. In Windows, for both cmd.exe and
powershell, the output is only redirected to the error file.
Solution:
- On Windows, change the 'shellpipe' default to "2>&1| tee".
- Nvim includes `tee` in its Windows package.
- Document recommended defaults for powershell.
Fixes#12910
Problem:
vim.treesitter.inspect_tree() and :InspectTree does not respect 'splitright'.
Solution:
- Change the default `command` from `topleft 60vnew` to `60vnew`.
- Change :InspectTree to respect command mods (`:vertical`, count, etc.).
Closes#22656
Problem: ILE RPG files are not recognized.
Solution: Add patterns for ILE RPG files. (Andreas Louv, issue vim/vim#12152)
e202ec8a0c
Co-authored-by: Andreas Louv <andreas@louv.dk>
Problem:
vim.deprecate() shows ":help deprecated" for third-party plugins. ":help
deprecated" only describes deprecations in Nvim, and is unrelated to any
3rd party deprecations.
Solution:
If `plugin` is specified, don't show ":help deprecated".
fix#22235
Problem:
When LSP client renames a directory, opened buffers in the edfitor are not
renamed or closed. Then `:wall` shows errors.
https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L776
works correctly if you try to rename a single file, but doesn't delete old
buffers with `old_fname` is a dir.
Solution:
Update the logic in runtime/lua/vim/lsp/util.lua:rename()
Fixes#22617
we cannot remove 'paste'. It is very common in plugins and configs.
'pastetoggle' can and should be removed though, it's a total waste of everyone's time because it generates bug reports and doesn't work well, and is useless because bracketed-paste works better.
Problem:
The function name `vim.pretty_print`:
1. is verbose, which partially defeats its purpose as sugar
2. does not draw from existing precedent or any sort of convention
(except external projects like penlight or python?), which reduces
discoverability, and degrades signaling about best practices.
Solution:
- Rename to `vim.print`.
- Change the behavior so that
1. strings are printed without quotes
2. each arg is printed on its own line
3. tables are indented with 2 instead of 4 spaces
- Example:
:lua ='a', 'b', 42, {a=3}
a
b
42
{
a = 3
}
Comparison of alternatives:
- `vim.print`:
- pro: consistent with Lua's `print()`
- pro: aligns with potential `nvim_print` API function which will
replace nvim_echo, nvim_notify, etc.
- con: behaves differently than Lua's `print()`, slightly misleading?
- `vim.echo`:
- pro: `:echo` has similar "pretty print" behavior.
- con: inconsistent with Lua idioms.
- `vim.p`:
- pro: very short, fits with `vim.o`, etc.
- con: not as discoverable as "echo"
- con: less opportunity for `local p = vim.p` because of potential shadowing.
scroll_delta contains how much the top line of a window moved since the
last time win_viewport was emitted. It is expected to be used to
implement smooth scrolling. For this purpose it only counts "virtual" or
"displayed" so folds should count as one line. Because of this it
adds extra information that cannot be computed from the topline
parameter.
Fixes#19227
Although using `buffer://` for unsaved file buffers fixes issues with
language servers like eclipse.jdt.ls or ansible-language-server, it
breaks completion and signature help for clangd.
A regression is worse than a fix for something else, so this reverts
commit 896d672736.
The spec change is also still in dicussion, see
https://github.com/microsoft/language-server-protocol/pull/1679#discussion_r1130704886
Problem: Cannot easily get the list of sourced scripts.
Solution: Add the getscriptinfo() function. (Yegappan Lakshmanan,
closesvim/vim#10957)
f768c3d19c
Cherry-pick usr_41.txt change from a later runtime update.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Highlight for popupmenu kind and extra cannot be set.
Solution: Add PmenuKind, PmenuKindSel, PmenuExtra and PmenuExtraSel
highlight groups and use them. (Gianmaria Bajo, closesvim/vim#12114)
6a7c774920
Co-authored-by: Gianmaria Bajo <mg1979.git@gmail.com>
Never return the changes an only notify them using the `on_changedtree`
callback.
It is not guaranteed for a plugin that it'll be the first one to call
`tree:parse()` and thus get the changes.
Closes#19915
This commit replaces the usage of math.floor((lo + hi) / 2) with the faster and equivalent bit.rshift(lo + hi, 1) for calculating the midpoint in binary search.
* Also fix newly found type mismatch.
* Note that it generates new warnings about using @private client
methods. A proper fix would be to revamp the lsp client documentation
altogether.
Problem:
Some built-in ftplugins set omnifunc/tagfunc/formatexpr which causes
lsp.lua:set_defaults() to skip setup of defaults for those filetypes.
For example the C++ ftplugin has:
omnifunc=ccomplete#Complete
Last set from /usr/share/nvim/runtime/ftplugin/c.vim line 30
so the changes done in #95c65a6b221fe6e1cf91e8322e7d7571dc511a71
will always be skipped for C++ files.
Solution:
Overwrite omnifunc/tagfunc/formatexpr options that were set by stock
ftplugin.
Fixes#21001
Problem:
If vim_tempdir mysteriously goes missing (typically by "antivirus" on
Windows), any plugins using tempname() will be broken for the rest of
the session. #1432#9833https://groups.google.com/g/vim_use/c/ef55jNm5czI
Steps:
mkdir foo
TMPDIR=./foo nvim
:echo tempname()
!rm -r foo
:echo tempname()
tempname() still uses the foo path even though it was deleted.
Solution:
- Don't assume that vim_tempdir exists.
- If it goes missing once, retry vim_mktempdir and log (silently) an error.
- If it goes missing again, retry vim_mktempdir and show an error.
Rejected in Vim for performance reasons:
https://groups.google.com/g/vim_use/c/qgRob9SWDv8/m/FAOFVVcDTv0Jhttps://groups.google.com/g/vim_dev/c/cogp-Vye4oo/m/d_SVFXBbnnoJ
But, logging shows that `vim_gettempdir` is not called frequently.
Fixes#1432Fixes#9833Fixes#11250
Related: stdpath("run") f50135a32e
When a buffer update callback is called, textlock is active so buffer
text cannot be changed, but cursor can still be moved. This can cause
problems when the buffer update is in the middle of an operator, like
the one mentioned in #16729. The solution is to save cursor position and
restore it afterwards, like how cursor is saved and restored when
evaluating an <expr> mapping.
Currently files to install in runtime/ is detected by recursive glob
pattern which has two problems:
- cmake needs to do a of work at config time and
build/runtime/cmake_install.cmake becomes HUGE (2.5MB, biggest config file)
- we need to explicitly specify each file suffix used in the entire
runtime, which is duplication of information.
These globs specify every single file in a subdirectory.
Thus, we can just install every runtime/ subdirectory as a single
install command. Furthermore, at the top-level, only .vim and .lua files
need to be installed.
Further possible refactor: we could move files which does not belong
in $PREFIX/runtime out of $REPO/runtime. Then runtime could be installed
with a single install_helper(DIRECTORY ...) command.
TODO:
Unfortunately, cannot (yet) use vim.version for tmux version comparison,
because `vim.version.parse(…,{strict=false})` does not coerce tmux's
funny "tmux 3.3a" version string.
6969d3d749/runtime/autoload/provider/clipboard.vim (L148)
Problem:
:Man command errors if given more than two arguments. Thus, it is
impossible to open man pages that contain spaces in their names.
Solution:
Adjust :Man so that it tries variants with spaces and underscores, and
uses the first found.
Problem: Value of MAXCOL not available in Vim script.
Solution: Add v:maxcol. (Naohiro Ono, closesvim/vim#9451)
56200eed62
The variable is always 2147483647, but introducing it makes functions
easier to document.
Co-authored-by: naohiro ono <obcat@icloud.com>
also make implicit submodules "uri" and "_inspector" work with completion
this is needed for `:lua=vim.uri_<tab>` wildmenu completion
to work even before uri or _inspector functions are used.
feat(lsp)!: change semantic token highlighting
Change the default highlights used, and add more highlights per token.
Add an LspTokenUpdate event and a highlight_token function.
:Inspect now shows any highlights applied by token highlighting rules,
default or user-defined.
BREAKING CHANGE: change the default highlight groups used by semantic
token highlighting.
Problem:
If major<major but minor>minor, cmp_version_core returns 1
Solution:
- Fix logic in cmp_version_core
- Delete most eq()/gt()/lt() tests, they are redundant.
- version.cmp(): assert valid version
- add test for loading vim.version (the other tests use shared.lua in
the test runner)
- reduce test scopes, reword test descriptions
Problem:
gen_vimdoc.py / lua2dox.lua does not support @defgroup or \defgroup
except for "api-foo" modules.
Solution:
Modify `gen_vimdoc.py` to look for section names based on `helptag_fmt`.
TODO:
- Support @module ?
https://github.com/LuaLS/lua-language-server/wiki/Annotations#module
Fixes:
Error SERVER_REQUEST_HANDLER_ERROR: "...di/dev/neovim/neovim/runtime/lua/vim/lsp/_watchfiles.lua
:200: bad argument #1 to 'ipairs' (table expected, got nil)"
Language servers can be started without root_dir or workspace_folders.
Problem:
Help tags like vim.treesitter.language.add() are confusing because
`vim.treesitter.language` is (thankfully) not a user-facing module.
Solution:
Ignore the "fstem" when generating "treesitter" tags.
When toggling anonymous nodes in the :InspectTree window, keep the
cursor fixed relative to the node within the tree. This prevents the
cursor from jumping.
Problem:
"show" is potentially a new verb that we can avoid (there is already
"open" and "echo"). Even if we can't avoid it, the behavior of
`show_tree` fits well in the "inspect" family of functions: a way for
users to introspect/reflect on the state of Nvim.
Existing "inspect" functions:
vim.inspect()
vim.inspect_pos()
vim.treesitter.inspect_language()
nvim__inspect_cell
Solution:
Rename `show_tree` to `inspect_tree`.
Problem:
No easy way to find files under certain directories (ex: grab all files under
`test/`) or exclude the content of certain paths (ex. `build/`, `.git/`)
Solution:
Pass the full `path` as an arg to the predicate.
If the LSP server fails to start then the client never initializes and
thus never calls its on_attach function and an LspAttach event is
never fired. However, the on_exit function still fires a LspDetach
event, so user autocommands that attempt to "clean up" in LspDetach may
run into problems if they assume that the buffer was already attached.
The solution is to only fire an LspDetach event if the buffer was
already attached in the first place.
This feature has long been obsolete. The 'keymap' option can be used
to support language keymaps, including hebrew and hebrewp (phonetic
mapping). There is no need to keep the old c code with hardcoded
keymaps for some languages.