aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/fs_spec.lua
Commit message (Collapse)AuthorAge
* fix(vim.fs): find{follow=true} skips symlink targets of the given `type` #42246Justin M. Keyes2026-10-05
| | | | | | | | | 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`).
* test: fix wrong order of args to eq(), neq() #41499zeertzjq2026-08-26
|
* feat(vim.fs): slug() supports URI #41241Willaaaaaaa2026-08-16
| | | | | | | | | | 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.
* docs: misc, :bcd, slug()Justin M. Keyes2026-08-06
|
* feat(fs): vim.fs.normalize{plain:boolean} #41127Olivia Kinnear2026-08-05
| | | | | | `opts.plain=true` does not expand tildes in addition to environment variables, unlike `opts.expand_env=false`. `opts.expand_env=false` is soft-deprecated.
* feat(lua): vim.fs.slug() #41005Willaaaaaaa2026-08-04
| | | | | | | | | | | | | | | | 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
* test(fs): "fs.find() follows symlinks" #41105Justin M. Keyes2026-08-02
| | | | | | | | | Problem: Test fails if other "build*/" dirs exist with a "nvim" file, e.g. `build-asan/bin/nvim`. Solution: Do the test in an isolated dir. This also fixes the test for the zig build.
* docs: func/expr options, misc #41102Justin M. Keyes2026-08-01
|
* feat(vim.fs): abspath({cwd, plain}) #40597AlexCodesApps2026-08-01
| | | | | 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.
* feat(vim.fs): dir(opts.normalize)Barrett Ruth2026-07-25
|
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
* refactor(test): unify XDG path handling (cmake vs zig)bfredl2026-07-06
| | | | fixes #40381
* feat(vim.fs): dir() ergonomicsJustin M. Keyes2026-07-01
|
* fix(vim.fs): dir(), find() error-reportingJustin M. Keyes2026-07-01
|
* feat(vim.fs): dir(), find() error-reportingRudrajeet Pal2026-07-01
| | | | | | | | | | | | | | 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.
* fix(vim.fs): fs.dir() may return nil "type" on some filesystems #39749abdulahmoda2026-05-29
| | | | | | | | | | | | | | 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.
* test(vim.fs): basename(), dirname() trim trailing slashes #39790Justin M. Keyes2026-05-14
| | | close #37698
* feat(stdlib): vim.fs.ext() returns file extension #36997Yochem van Rosmalen2026-03-20
| | | | | | | | | | | | | | | | | 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).
* test: fs_spec fails if home is a symlink #38258Willaaaaaaa2026-03-12
|
* fix(vim.fs): joinpath() should ignore empty items #38077Yochem van Rosmalen2026-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* docs: lsp, options, promptbufJustin M. Keyes2026-02-12
| | | | | | | | | | | | | Close #37630 Close #37682 Close #37762 Close #37785 Co-authored-by: Daniel Schmitt <d.schmitt@lansoftware.de> Co-authored-by: Duane Hilton <duane9@gmail.com> Co-authored-by: NeOzay <colpaert.benoit@gmail.com> Co-authored-by: Yi Ming <ofseed@foxmail.com> Co-authored-by: "Justin M. Keyes" <justinkz@gmail.com>
* fix(vim.fs): make `rm()` work with symlink to a directoryEvgeni Chasnovski2026-02-10
|
* fix(vim.fs): abspath(".") returns "/…/." #36583Justin M. Keyes2025-11-16
|
* fix(vim.fs): root() should always return absolute path #36466Cameron Ring2025-11-16
|
* test: remove a few more redundant clear() calls (#35903)zeertzjq2025-09-24
|
* feat(vim.fs): root() can specify "equal priority" #34276Siddhant Agarwal2025-06-09
|
* feat(build): build.zig MVP: build and run functionaltests on linuxbfredl2025-05-02
| | | | | | | | | | | | | | | | | | | | | NEW BUILD SYSTEM! This is a MVP implementation which supports building the "nvim" binary, including cross-compilation for some targets. As an example, you can build a aarch64-macos binary from an x86-64-linux-gnu host, or vice versa Add CI target for build.zig currently for functionaltests on linux x86_64 only Follow up items: - praxis for version and dependency bumping - windows 💀 - full integration of libintl and gettext (or a desicion not to) - update help and API metadata files - installation into a $PREFIX - more tests and linters
* feat(vim.fs): find(), dir() can "follow" symlinks #31551Mike2025-01-14
| | | | | | | | Problem: vim.fs.dir(), vim.fs.find() do not follow symlinks. Solution: - Add "follow" flag. - Enable it by default.
* feat: add vim.fs.relpathdundargoc2025-01-13
| | | | | This is needed to replace the nvim-lspconfig function is_descendant that some lspconfg configurations still use.
* docs: misc #31867Justin M. Keyes2025-01-09
|
* fix(vim.fs.normalize): normalize case for windows drive letterdundargoc2025-01-04
| | | | | Also add tests for the current path casing behavior so it doesn't get accidentally changed.
* fix(vim.fs.abspath): correctly handle UNC pathsdundargoc2025-01-01
|
* docs: misc #31479Justin M. Keyes2025-01-01
|
* fix(vim.fs): joinpath() does not normalize slashes on Windows #31782Gustav Eikaas2024-12-31
|
* feat(lua): add `vim.fs.abspath`Famiu Haque2024-12-28
| | | | | | Problem: There is currently no way to check if a given path is absolute or convert a relative path to an absolute path through the Lua stdlib. `vim.fs.joinpath` does not work when the path is absolute. There is also currently no way to resolve `C:foo\bar` style paths in Windows. Solution: Add `vim.fs.abspath`, which allows converting any path to an absolute path. This also allows checking if current path is absolute by doing `vim.fs.abspath(path) == path`. It also has support for `C:foo\bar` style paths in Windows.
* test(main_spec): use CMakePresets.json instead of .git for root markerJames McCoy2024-12-03
|
* test: support upvalues in exec_luaLewis Russell2024-09-21
|
* test: allow exec_lua to handle functionsLewis Russell2024-08-02
| | | | | | | | | | | Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
* fix(fs): make vim.fs.root work for relative paths and unnamed buffers (#28964)Gregory Anders2024-05-24
| | | | If a buffer does not have a backing file then fall back to the current working directory.
* feat(fs): add vim.fs.root (#28477)Gregory Anders2024-04-24
| | | | | | vim.fs.root() is a function for finding a project root relative to a buffer using one or more "root markers". This is useful for LSP and could be useful for other "projects" designs, as well as for any plugins which work with a "projects" concept.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
* feat(lua): vim.fs.normalize() resolves ".", ".." #28203Famiu Haque2024-04-16
| | | | | | | | | | | | | | | | | | | | | Problem: `vim.fs.normalize` does not resolve `.` and `..` components. This makes no sense as the entire point of normalization is to remove redundancy from the path. The path normalization functions in several other languages (Java, Python, C++, etc.) also resolve `.` and `..` components. Reference: - Python: https://docs.python.org/3/library/os.path.html#os.path.normpath - Java: https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#normalize-- - C++: https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal Solution: Resolve "." and ".." in `vim.fs.normalize`. Before: "~/foo/bar/../baz/./" => "~/foo/bar/../baz/." After: "~/foo/bar/../baz/./" => "~/foo/baz"
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* fix: support UNC paths in vim.fs.normalizedundargoc2024-03-30
| | | | Closes https://github.com/neovim/neovim/issues/27068.
* fix(fs): allow backslash characters in unix pathsJames Trew2024-03-29
| | | | | | | Backslashes are valid characters in unix style paths. Fix the conversion of backslashes to forward slashes in several `vim.fs` functions when not on Windows. On Windows, backslashes will still be converted to forward slashes.
* fix(test): typingLewis Russell2024-03-25
|
* test: refactor PathsLewis Russell2024-01-17
|
* test: use vim.mpack and vim.uv directlyLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|