| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
`vim.validate()` takes two forms when it only needs one.
Solution:
- Teach the fast form all the features of the spec form.
- Deprecate the spec form.
- General optimizations for both forms.
- Add a `message` argument which can be used alongside or in place
of the `optional` argument.
|
|
|
|
|
| |
- Also fix `vim.validate()` for PUC Lua when showing errors for values
that aren't string or number.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Problem:
`vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on
mingw/msys2.
Solution:
- Check for "mingw" when deciding `iswin`.
- Use `has("win32")` where possible, it works in "fast" contexts since
b02eeb6a7281df0561a021d7ae595c84be9a01be.
|
|
|
|
| |
Analogous to the shell `rm` command.
|
|
|
|
| |
If a buffer does not have a backing file then fall back to the current
working directory.
|
|
|
|
| |
~10% faster.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
vim.fs.normalize() normalizes too much vim.loader and is slow.
Solution:
Make it faster by doing less. This reduces the times spent in
vim.fs.normalize in vim.loader from ~13ms -> 1-2ms.
Numbers from a relative benchmark:
- Skipping `vim.validate()`: 285ms -> 230ms
- Skipping `path_resolve_dot()`: 285ms -> 60ms
- Skipping `double_slash`: 60ms -> 35ms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Re-normalizing a path after a `joinpath` isn't necessary. Calling
`normalize` on each child directory had quite a bit of impact when
traversing a large directory.
A simple test showed:
Before: ~144ms
After: ~80ms
running the following logic against a dir with 4367 child folders and
25826 files:
local files = {}
local start = uv.hrtime()
for name, type in vim.fs.dir(path, { depth = max_depth }) do
table.insert(files, { name, type })
end
local duration = uv.hrtime() - start
Relates to https://github.com/neovim/neovim/issues/23291
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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"
|
|
|
|
| |
Closes https://github.com/neovim/neovim/issues/27068.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added `@inlinedoc` so single use Lua types can be inlined into the
functions docs. E.g.
```lua
--- @class myopts
--- @inlinedoc
---
--- Documentation for some field
--- @field somefield integer
--- @param opts myOpts
function foo(opts)
end
```
Will be rendered as
```
foo(opts)
Parameters:
- {opts} (table) Object with the fields:
- somefield (integer) Documentation
for some field
```
- Marked many classes with with `@nodoc` or `(private)`.
We can eventually introduce these when we want to.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.
Solution:
Re-implement the flow using Lua, LPEG and treesitter.
- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
- LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
- LPEG for C parsing (see `scripts/cdoc_parser.lua`)
- Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
- Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
- `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* docs(lua): teach lua2dox how to table
* docs(lua): teach gen_vimdoc.py about local functions
No more need to mark local functions with @private
* docs(lua): mention @nodoc and @meta in dev-lua-doc
* fixup!
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
---------
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
|
|
|
| |
Preserve last slash in windows' root drive directories
|
| |
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
|
|
| |
This is a small function but used a lot in some plugins.
|
|
|
|
|
|
| |
- Add bindings to Treesitter ts_parser_set_logger and ts_parser_logger
- Add logfile with path STDPATH('log')/treesitter.c
- Rework existing LanguageTree loggin to use logfile
- Begin implementing log levels for vim.g.__ts_debug
|
|
|
|
|
|
|
|
|
|
|
| |
vim.fs.find(".luacheckrc")
```
c:\\projects\\neovim/.luacheckrc # before
c:/projects/neovim/.luacheckrc # after
```
Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
|
|
|
|
|
|
| |
- Add options argument with an option to expand env vars
- Resolve '//' -> '/'
- Use in vim.loader
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Fixes #21497
|
|
|
|
| |
Added option depth to allow recursively searching a directory tree.
|
|\
| |
| | |
feat(help): highlighted codeblocks
|
| | |
|
|/
|
|
| |
Avoid using vim.env and vim.fn in vim.fs functions so that
they can be used in "fast" contexts.
|
| |
|
|
|
|
| |
Co-Authored-By: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Co-Authored-By: zeertzjq <zeertzjq@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 })
|