| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
| |
Problem:
`vim.fs.find()` checks `type` against the symlink itself, so
`{ type='file', follow=true }` skips symlinked files (e.g. `:helptags`).
Solution:
With `follow=true`, a symlink has the type of its target. Thus
`type='link'` only matches broken symlinks (like `find -L -type l`).
|
| |
|
|
|
|
|
|
|
| |
Problem: Argument type mismatches are excluded from EmmyLua checks.
Solution: Correct runtime annotations and calls, document local checker
workarounds, and enable the diagnostic.
AI-assisted
|
| |
|
|
| |
AI-assisted
|
| |
|
|
|
|
|
|
|
|
|
| |
Enable EmmyLua's assign-type-mismatch diagnostic after correcting the
runtime annotations and assignments it flags.
Correct option, tuple, and return types, and use separate locals when a
value changes representation. Add guards and narrow casts where needed
so the runtime passes the stricter check. Regenerate the affected docs.
AI-assisted
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Problem:
An upward find() searches its initial directory before checking stop,
so path=stop can return a match or continue above the stop directory.
Downward search already stops before searching when path equals stop.
Solution:
Check the starting path before searching upward, matching the existing
downward search behavior.
AI-assisted
|
| |
|
|
|
|
|
|
|
|
| |
Make gen_helptags.lua call help.lua instead of keeping its own tag
parser. Builds and :helptags now use the same code.
Allow the shared code to run without Neovim, and fail the build when tag
generation reports an error.
AI-assisted
|
| |
|
|
|
|
|
|
| |
Only join paths for matches and entries needed for traversal. This
avoids string processing for rejected files and improves selective
searches across the Neovim tree by about 19-25%.
AI-assisted
|
| |
|
|
|
|
|
|
|
|
| |
Enable checks for unused code, deprecated calls, return types, and
annotations.
Fix the warnings and replace the deprecated highlight function. Keep
exceptions where old APIs are still needed or the checker gets it wrong.
AI-assisted
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: LuaLS struggles with the generics used in Nvim's runtime,
requiring broad diagnostic suppressions. Indexing is also slow.
Solution: Use EmmyLua for type checks in the build and CI. It offers
more sophisticated type checking, substantially better support for
generics, and much better flow analysis.
Correct the affected annotations. Use `@internal`, supported directly by
EmmyLua, instead of `@nodoc` for shared internal declarations, and
support it in the help parser.
AI-assisted
|
| |
|
|
|
|
|
|
|
|
| |
Problem:
`vim.fs.slug()` does not handle URIs like `term://foo//123:bash`,
so callers (e.g. terminal persistence) must strip the scheme before
calling `slug()`.
Solution:
Detect `scheme://` from the raw input before `normalize()` and
replace it with a `=uri-<scheme>-` prefix.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
`opts.plain=true` does not expand tildes in addition to environment
variables, unlike `opts.expand_env=false`.
`opts.expand_env=false` is soft-deprecated.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Several subsystems need to derive a short, filesystem-safe identifier from an
arbitrary path, and each reinvents it ad-hoc:
- `'undodir'` and `swapfiles` encode the full path into a single filename, which
may exceed filesystem length-limits.
- `:connect ssh://` needs the SSH ControlPath socket name to stay under the
104-byte `sun_path` limit on macOS; today the path overflows it.
- the upcoming :terminal state dir.
- arbitrary plugin purposes.
Solution:
Provide `vim.fs.slug()`, which generates a bounded, one-way filename from an
arbitrary string. The input is normalized so equivalent paths produce the
same result. An 8-char hash is appended for uniqueness
|
| | |
|
| |
|
|
|
| |
Adds optional parameters to `vim.fs.abspath`:
1. `cwd` to specify directory akin to `--relative-from` in `realpath(1)`.
2. `plain` disables expansion of tilde (~) in paths.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Problem:
`vim.fs` does not provide a directory creation helper matching its
filesystem API shape.
Solution:
Add `vim.fs.mkdir()` as a thin wrapper around `vim.fn.mkdir()`, with
`parents` and `mode` options.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
vim.fs.dir() and vim.fs.find() drop errors returned by uv.fs_scandir().
Solution:
- vim.fs.dir():
- Return root scan failures as a secondary return value.
- Propagate recursive scan failures through the iterator. This allows
callers to distinguish unreadable directories from empty ones.
- vim.fs.find(): Collect errors during search, and return the list as
a second retval.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Currently, only some filesystems (Btrfs, ext2, ext3, ext4) have full
support of accessing the `dirent` entry-type. On other filesystems,
`uv.fs_scandir_next` may return `nil` for an existing but unsupported
entry-type.
This means consumers (such as `fs.dir()`), cannot know if `nil` means
"non-existent" or "unsupported".
Solution:
Fall back to `uv.fs_lstat` when `etype` is `nil`; return "unknown" if it
fails.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
61e99217e684 replaced usages of `vim.fn`. This duplicates non-trivial
logic and may have introduced bugs like 38e38d1b401e.
Later on, b02eeb6a7281 graduated `fnamemodify` to `fast`, so avoiding it
in `vim.fs` is no longer necessary.
Solution:
Use `vim.fn` to deduplicate `vim.fs.dirname()` and `vim.fs.basename()`.
Note: the "nvim -l" test-runner switch from the original PR (#30483) is
already done by 9432e6c1e2e9 (#39676).
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Checking the extension of a file is done often, e.g. in Nvim's codebase
for differentiating Lua and Vimscript files in the runtime. The current
way to do this in Lua is (1) a Lua pattern match, which has pitfalls
such as not considering filenames starting with a dot, or (2)
fnamemodify() which is both hard to discover and hard to use / read if
not very familiar with the possible modifiers.
vim.fs.ext() returns the file extension including the leading dot of
the extension. Similar to the "file extension" implementation of many
other stdlibs (including fnamemodify(file, ":e")), a leading dot
doesn't indicate the start of the extension. E.g.: the .git folder in a
repository doesn't have the extension .git, but it simply has no
extension, similar to a folder named git or any other filename without
dot(s).
|
| |
|
|
|
|
|
|
|
|
|
|
| |
refactor(lua): add integer coercion helpers
Add vim._tointeger() and vim._ensure_integer(), including optional base
support, and switch integer-only tonumber()/assert call sites in the Lua
runtime to use them.
This also cleans up related integer parsing in LSP, health, loader, URI,
tohtml, and Treesitter code.
supported by AI
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
vim.fs.joinpath treats empty string as a path segment
(it adds a path separator for each empty item):
print(vim.fs.joinpath('', 'after/lsp', '')) -- '/after/lsp/'
print(vim.fs.joinpath('', '')) -- '/'
Especially problematic if the empty segment is the first segment, as
that converts the path to an absolute path.
Solution:
Ignore empty (length of 0) path segments.
Benchmark:
local function test(func)
local t = vim.uv.hrtime()
for _ = 1, 100000, 1 do
func('', 'this/is', 'a/very/long/path', '', 'it', 'really', 'is')
end
print(math.floor((vim.uv.hrtime() - t) / 1e6), 'ms')
end
- with Iter():filter() --> 370 ms
- building new segments table --> 208 ms
- with vim.tbl_filter --> 232 ms
- Instead of gsub split on `/` in all parts --> 1870 ms
|
| |
|
|
| |
fix #37583
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Problem: vim.fs.root uses vim.fn.fnamemodify. vim.fn table isn't
available from nvim -ll or thread contexts.
Solution: Swap out vim.fn.fnamemodify for vim.fs.abspath.
This is a temporary workaround and may be reverted since the
long-term plan is to use more fast=true "fn" functions from vim.fs
where possible.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
| |
Follow the pattern of vim.fs.find.Opts
|
| | |
|
| | |
|
| |
|
| |
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
|
| |
|
|
|
|
|
| |
Problem:
Following symlinks can have surprising behavior and slow performance.
Solution:
Do not set it by default.
|
| | |
|
| |
|
|
|
|
|
|
| |
Problem:
vim.fs.dir(), vim.fs.find() do not follow symlinks.
Solution:
- Add "follow" flag.
- Enable it by default.
|
| |
|
|
|
| |
This is needed to replace the nvim-lspconfig function is_descendant that
some lspconfg configurations still use.
|
| |
|
|
|
| |
Also add tests for the current path casing behavior so it doesn't get
accidentally changed.
|
| | |
|