summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/fs_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-03-20feat(stdlib): vim.fs.ext() returns file extension #36997Yochem van Rosmalen1
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).
2026-03-12test: fs_spec fails if home is a symlink #38258Willaaaaaaa1
2026-02-27fix(vim.fs): joinpath() should ignore empty items #38077Yochem van Rosmalen1
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
2026-02-12docs: lsp, options, promptbufJustin M. Keyes1
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>
2026-02-10fix(vim.fs): make `rm()` work with symlink to a directoryEvgeni Chasnovski1
2025-11-16fix(vim.fs): abspath(".") returns "/…/." #36583Justin M. Keyes1
2025-11-16fix(vim.fs): root() should always return absolute path #36466Cameron Ring1
2025-09-24test: remove a few more redundant clear() calls (#35903)zeertzjq1
2025-06-09feat(vim.fs): root() can specify "equal priority" #34276Siddhant Agarwal1
2025-05-02feat(build): build.zig MVP: build and run functionaltests on linuxbfredl1
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
2025-01-14feat(vim.fs): find(), dir() can "follow" symlinks #31551Mike1
Problem: vim.fs.dir(), vim.fs.find() do not follow symlinks. Solution: - Add "follow" flag. - Enable it by default.
2025-01-13feat: add vim.fs.relpathdundargoc1
This is needed to replace the nvim-lspconfig function is_descendant that some lspconfg configurations still use.
2025-01-09docs: misc #31867Justin M. Keyes1
2025-01-04fix(vim.fs.normalize): normalize case for windows drive letterdundargoc1
Also add tests for the current path casing behavior so it doesn't get accidentally changed.
2025-01-01fix(vim.fs.abspath): correctly handle UNC pathsdundargoc1
2025-01-01docs: misc #31479Justin M. Keyes1
2024-12-31fix(vim.fs): joinpath() does not normalize slashes on Windows #31782Gustav Eikaas1
2024-12-28feat(lua): add `vim.fs.abspath`Famiu Haque1
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.
2024-12-03test(main_spec): use CMakePresets.json instead of .git for root markerJames McCoy1
2024-09-21test: support upvalues in exec_luaLewis Russell1
2024-08-02test: allow exec_lua to handle functionsLewis Russell1
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.
2024-05-24fix(fs): make vim.fs.root work for relative paths and unnamed buffers (#28964)Gregory Anders1
If a buffer does not have a backing file then fall back to the current working directory.
2024-04-24feat(fs): add vim.fs.root (#28477)Gregory Anders1
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.
2024-04-23test: improve test conventionsdundargoc1
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.
2024-04-16feat(lua): vim.fs.normalize() resolves ".", ".." #28203Famiu Haque1
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"
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-03-30fix: support UNC paths in vim.fs.normalizedundargoc1
Closes https://github.com/neovim/neovim/issues/27068.
2024-03-29fix(fs): allow backslash characters in unix pathsJames Trew1
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.
2024-03-25fix(test): typingLewis Russell1
2024-01-17test: refactor PathsLewis Russell1
2024-01-12test: use vim.mpack and vim.uv directlyLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-12-26test: simplify vim.fs testsdundargoc1
The exec_lua wrapper is no longer necessary.
2023-09-15test(windows): unskip working tests (#25153)dundargoc1
Also simplify home detection with os_homedir()
2023-07-18fix(fs.lua): normalize slash truncation (#23753)Mike1
Preserve last slash in windows' root drive directories
2023-06-18fix(fs): make `normalize()` work with '/' path (#24047)Evgeni Chasnovski1
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>
2023-05-20feat(fs): expose join_paths as `vim.fs.joinpath` (#23685)Christian Clason1
This is a small function but used a lot in some plugins.
2023-05-18build: bundle uncrustifydundargoc1
Uncrustify is sensitive to version changes, which causes friction for contributors that doesn't have that exact version. It's also simpler to download and install the correct version than to have bespoke version checking.
2023-04-05test(vim.fs.normalize): enable test on Windowsdundargoc1
2023-04-04test: replace lfs with luv and vim.fsdundargoc1
test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
2023-03-05test: don't search entire repo for filesdundargoc1
Searching the entire repo for a directory named "contrib" causes failure if there happens to be another subdirectory with the name "contrib". Instead, point directly to the correct contrib directory.
2023-03-01feat(vim.fs): pass path to find() predicate, lazy evaluate #22378Mike1
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.
2023-01-03fix(fs): duplicate path separator #21509Eric Haynes1
Fixes #21497
2022-12-22test(lua/fs_spec): fix vim.fs.dir() test (#21503)zeertzjq1
2022-12-22fix(ci): skip test on windows (#21502)Lewis Russell1
2022-12-20feat(fs): add opts argument to vim.fs.dir()Lewis Russell1
Added option depth to allow recursively searching a directory tree.
2022-12-01refactor(fs): replace vim.fn/vim.env in vim.fs (#20379)Mike1
Avoid using vim.env and vim.fn in vim.fs functions so that they can be used in "fast" contexts.
2022-11-22test: simplify platform detection (#21020)dundargoc1
Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
2022-09-13feat(fs): extend fs.find to accept predicate (#20193)Mathias Fußenegger1
Makes it possible to use `vim.fs.find` to find files where only a substring is known. This is useful for `vim.lsp.start` to get the `root_dir` for languages where the project-file is only known by its extension, not by the full name. For example in .NET projects there is usually a `<projectname>.csproj` file in the project root. Example: vim.fs.find(function(x) return vim.endswith(x, '.csproj') end, { upward = true })