aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
Commit message (Collapse)AuthorAge
...
* Merge pull request #29103 from gpanders/test-no-tgcGregory Anders2024-06-12
|\ | | | | test: do not set termguicolors in test runner
| * fix(vim.text): remove assert from vim.text.hexdecodeGregory Anders2024-05-31
| | | | | | | | Instead, return nil plus an error message if the input is invalid.
* | fix(types): use vararg return type annotationWill Hopkins2024-06-11
| | | | | | | | build(types): allow vararg returns in function types
* | refactor(lua): improve type annotationsLewis Russell2024-06-11
| |
* | refactor(lua): use tuple syntax everywhere #29111Ilia Choly2024-06-04
|/
* refactor: deprecate vim.region() #28416Justin M. Keyes2024-05-28
| | | | | | | Problem: `vim.region()` is redundant with `getregionpos()`. Solution: Deprecate `vim.region()`.
* perf: add fast path to vim.validate (#28977)Gregory Anders2024-05-27
| | | | | | For many small/simple functions (like those found in shared.lua), the runtime of vim.validate can far exceed the runtime of the function itself. Add an "overload" to vim.validate that uses a simple assertion pattern, rather than parsing a full "validation spec".
* refactor(lua): rewrite vim.highlight.range() (#28986)zeertzjq2024-05-25
| | | | - Use getregionpos(). - Use a single extmark for non-blockwise selection.
* 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.
* docs: extract health to its own filedundargoc2024-05-24
|
* docs: move vim.health documentation to lua.txtdundargoc2024-05-22
| | | | | | `vim.health` is not a "plugin" but part of our Lua API and the documentation should reflect that. This also helps make the documentation maintenance easier as it is now generated.
* fix(vim.iter): enable optimizations for arrays (lists with holes) (#28781)Gregory Anders2024-05-17
| | | | | | | | The optimizations that vim.iter uses for array-like tables don't require that the source table has no holes. The only thing that needs to change is the determination if a table is "list-like": rather than requiring consecutive, integer keys, we can simply test for (positive) integer keys only, and remove any holes in the original array when we make a copy for the iterator.
* docs: newsJustin M. Keyes2024-05-15
| | | | Set dev_xx.txt help files to use "flow" layout.
* docs(lua): restore missing indexing for vim.bo and vim.wo (#28751)zeertzjq2024-05-15
|
* docs: misc (#28609)dundargoc2024-05-15
| | | | | | | | | | | | Closes https://github.com/neovim/neovim/issues/28484. Closes https://github.com/neovim/neovim/issues/28719. Co-authored-by: Chris <crwebb85@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Jake B <16889000+jakethedev@users.noreply.github.com> Co-authored-by: Jonathan Raines <jonathan.s.raines@gmail.com> Co-authored-by: Yi Ming <ofseed@foxmail.com> Co-authored-by: Zane Dufour <zane@znd4.me> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor(snippet): rename exit() => stop() #28628Justin M. Keyes2024-05-06
|
* fix(vim.ui)!: change open() to return `result|nil, errmsg|nil` #28612Justin M. Keyes2024-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | reverts e0d92b9cc20b58179599f53dfa74ca821935a539 #28502 Problem: `vim.ui.open()` has a `pcall()` like signature, under the assumption that this is the Lua idiom for returning result-or-error. However, the `result|nil, errmsg|nil` pattern: - has precedent in: - `io.open` - `vim.uv` (`:help luv-error-handling`) - has these advantages: - Can be used with `assert()`: ``` local result, err = assert(foobar()) ``` - Allows LuaLS to infer the type of `result`: ``` local result, err = foobar() if err then ... elseif result then ... end ``` Solution: - Revert to the `result|nil, errmsg|nil` pattern. - Document the pattern in our guidelines.
* docs: add `hl-SnippetTabstop` tagEvgeni Chasnovski2024-05-02
|
* docs: misc #24163Justin M. Keyes2024-04-30
| | | | | | | | | | - Also delete old perl scripts which are not used since 8+ years ago. fix #23251 fix #27367 ref https://github.com/neovim/neovim/issues/2252#issuecomment-1902662577 Helped-by: Daniel Kongsgaard <dakongsgaard@gmail.com> Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
* fix(lsp): redundant vim.snippet.jumpable #28560Maria José Solano2024-04-29
|
* refactor(vim.iter)!: rename xxback() => rxx() #28503Justin M. Keyes2024-04-26
| | | | | | | | | | | | | | | | Problem: vim.iter has both `rfind()` and various `*back()` methods, which work in "reverse" or "backwards" order. It's inconsistent to have both kinds of names, and "back" is fairly uncommon (rust) compared to python (rfind, rstrip, rsplit, …). Solution: - Remove `nthback()` and let `nth()` take a negative index. - Because `rnth()` looks pretty obscure, and because it's intuitive for a function named `nth()` to take negative indexes. - Rename `xxback()` methods to `rxx()`. - This informally groups the "list-iterator" functions under a common `r` prefix, which helps discoverability. - Rename `peekback()` to `pop()`, in duality with the existing `peek`.
* fix: lua annotationsLewis Russell2024-04-26
|
* fix(vim.ui)!: change open() to return pcall-like values #28502Justin M. Keyes2024-04-25
| | | | | | | | | Problem: `vim.ui.open` unnecessarily invents a different success/failure convention. Its return type was changed in 57adf8c6e01d, so we might as well change it to have a more conventional form. Solution: Change the signature to use the `pcall` convention of `status, result`.
* 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.
* refactor(lua): deprecate tbl_flattenJustin M. Keyes2024-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Besides being redundant with vim.iter():flatten(), `tbl_flatten` has these problems: - Has `tbl_` prefix but only accepts lists. - Discards some results! Compare the following: - iter.flatten(): ``` vim.iter({1, { { a = 2 } }, { 3 } }):flatten():totable() ``` - tbl_flatten: ``` vim.tbl_flatten({1, { { a = 2 } }, { 3 } }) ``` Solution: Deprecate tbl_flatten. Note: iter:flatten() currently fails ("flatten() requires a list-like table") on this code from gen_lsp.lua: local anonym = vim.iter({ -- remove nil anonymous_num > 1 and '' or nil, '---@class ' .. anonymous_classname, }):flatten():totable() Should we enhance :flatten() to work for arrays?
* refactor(lua): rename tbl_isarray => isarrayJustin M. Keyes2024-04-21
| | | | | | | tbl_isarray was not released yet, so it will not go through a deprecation cycle. ref #24572
* refactor(lua): rename tbl_islist => islistJustin M. Keyes2024-04-21
| | | | ref #24572
* refactor(vim.iter)!: remove vim.iter.map/filter/totable #26138Justin M. Keyes2024-04-19
| | | | | | | | Problem: The use-case for the convenience functions vim.iter.map(), vim.iter.filter(), vim.iter.totable() is not clear. Solution: Drop them for now. We can revisit after 0.10 release.
* 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"
* fix: vim.validate() order is not deterministic #28377Justin M. Keyes2024-04-16
| | | | | | | | | | | | | Problem: The order of the validation performed by vim.validate() is unpredictable. - harder to write reliable tests. - confusing UX because validation result might return different errors randomly. Solution: Iterate the input using `vim.spairs()`. Future: Ideally, the caller could provide an "ordered dict".
* fix(vim.ui): open() may wait indefinitely #28325Justin M. Keyes2024-04-15
| | | | | | | | | | | | Problem: vim.ui.open "locks up" Nvim if the spawned process does not terminate. #27986 Solution: - Change `vim.ui.open()`: - Do not call `wait()`. - Return a `SystemObj`. The caller can decide if it wants to `wait()`. - Change `gx` to `wait()` only a short time. - Allows `gx` to show a message if the command fails, without the risk of waiting forever.
* feat(lua): pass keys before mapping to vim.on_key() callback (#28098)zeertzjq2024-03-31
| | | Keys before mapping (i.e. typed keys) are passed as the second argument.
* 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.
* docs: fix typos (#27868)dundargoc2024-03-28
| | | | | | | | | Co-authored-by: ite-usagi <77563904+ite-usagi@users.noreply.github.com> Co-authored-by: v-sim <56476039+v-sim@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Quico Augustijn <quico.public@gmail.com> Co-authored-by: nhld <nahnera@gmail.com> Co-authored-by: francisco souza <108725+fsouza@users.noreply.github.com>
* refactor(lua): type annotationsLewis Russell2024-03-16
|
* docs: adjust fswatch overflow message to mention docs with infoTomas Slusny2024-03-11
| | | | | | | | | - Add :h fswatch-limitations that notifies user about default inotify limitations on linux and how to adjust them - Check for Event queue overflow message from fswatch and refer user to new documentation Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* docs(editorconfig): move to sourceLewis Russell2024-03-10
|
* docs: more accurate typing for vim.tbl_extendRiley Bruins2024-03-10
|
* docs: support inline markdownLewis Russell2024-03-09
| | | | | | - Tags are now created with `[tag]()` - References are now created with `[tag]` - Code spans are no longer wrapped
* fix(type): remove incorrect arguments from vim.rpc*altermo2024-03-07
|
* feat(lua): deprecate vim.tbl_add_reverse_lookupMaria José Solano2024-03-07
|
* fix(fs): use generics for better typingaltermo2024-03-06
|
* refactor(types): more fixes (2)Lewis Russell2024-03-06
|
* refactor(types): more fixesLewis Russell2024-03-06
|
* docs(lua): improvements for LSP and DiagnosticLewis Russell2024-03-05
|
* docs(lua): clarify when `vim.bo`/`vim.wo` acts like `:setlocal` (#27708)Luna Saphie Mittelbach2024-03-04
|
* docs: improve/add documentation of Lua typesLewis Russell2024-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* docs(lpeg): remove double backticks from meta (#27659)Maria José Solano2024-02-29
|
* feat!: rewrite TOhtml in luaaltermo2024-02-28
| | | | | | Co-authored-by: wookayin <wookayin@gmail.com> Co-authored-by: clason <c.clason@uni-graz.at> Co-authored-by: Lewis Russell <me@lewisr.dev>
* docs(lpeg): merge upstream changesMaria José Solano2024-02-28
|