aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/shared.lua
Commit message (Collapse)AuthorAge
* docs(lua): add Lua 5.1 reference manual (#19663)dundargoc2022-08-08
| | | | | | | | based on http://www.vim.org/scripts/script.php?script_id=1291 reformatted to match Nvim documentation style; removed irrelevant sections Co-authored-by: dundargoc <gocundar@gmail.com> Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: Lewis Russell <lewis6991@gmail.com>
* refactor(lua): reformat with stylua 0.14.0 (#19264)Christian Clason2022-07-07
| | | | * reformat Lua runtime to make lint CI pass * reduce max line length to 100
* docs(api): improve shared lua functions docs (#17933)adrian52022-05-11
|
* chore: format runtime with styluaChristian Clason2022-05-09
|
* fix(shared): avoid indexing unindexable values in vim.tbl_get() (#18337)William Boman2022-05-01
|
* feat: add vim.tbl_get (#17831)Michael Lingelbach2022-03-24
| | | | | | vim.tbl_get takes a table with subsequent string arguments (variadic) that index into the table. If the value pointed to by the set of keys exists, the function returns the value. If the set of keys does not exist, the function returns nil.
* chore: fix typos (#17670)dundargoc2022-03-17
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor(lua): make vim submodule lazy loading declarativebfredl2022-03-07
| | | | | This will allow us to also use the same logic for lua threads and processes, later.
* docs(lua): reference runtime/lua/vim/_editor.luazeertzjq2022-03-06
|
* fix(diagnostic): improve validation for list arguments (#16855)Gregory Anders2022-01-01
| | | | | | Function arguments that expect a list should explicitly use tbl_islist rather than just checking for a table. This helps catch some simple errors where a single table item is passed as an argument, which passes validation (since it's a table), but causes other errors later on.
* feat(lua): add support for multiple optional types in vim.validate (#16864)Shadman2022-01-01
|
* docs(lsp): add annotations for private functionsGregory Anders2021-11-30
|
* fix(lua): fix vim.deepcopy for metatables & cycled tables (#16435)Shadman2021-11-26
| | | | | vim.deepcopy previously didn't retain metatables in copies and caused stackoverflow on recursive tables/cycled tables this fixes these issues
* feat(lua): enable stack traces in error output (#16228)Gregory Anders2021-11-06
|
* refactor: use kwargs parameter in vim.splitGregory Anders2021-09-25
|
* feat: add trimempty optional parameter to vim.splitGregory Anders2021-09-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `split()` VimL function trims empty items from the returned list by default, so that, e.g. split("\nhello\nworld\n\n", "\n") returns ["hello", "world"] The Lua implementation of vim.split does not do this. For example, vim.split("\nhello\nworld\n\n", "\n") returns {'', 'hello', 'world', '', ''} Add an optional parameter to the vim.split function that, when true, trims these empty elements from the front and back of the returned table. This is only possible for vim.split and not vim.gsplit; because vim.gsplit is an iterator, there is no way for it to know if the current item is the last non-empty item. Note that in order to preserve backward compatibility, the parameter for the Lua vim.split function is `trimempty`, while the VimL function uses `keepempty` (i.e. they are opposites). This means there is a disconnect between these two functions that may surprise users.
* perf(lua): optimize vim.deep_equal #15236Javier Lopez2021-09-10
| | | | By remembering the keys already compared in repeating a comparison is avoided. Thanks: https://stackoverflow.com/a/32660766
* docs: make Lua docstrings consistent #15255Gregory Anders2021-08-22
| | | | | | | | | | | | The official developer documentation in in :h dev-lua-doc specifies to use "--@" for special/magic tokens. However, this format is not consistent with EmmyLua notation (used by some Lua language servers) nor with the C version of the magic docstring tokens which use three comment characters. Further, the code base is currently split between usage of "--@", "---@", and "--- @". In an effort to remain consistent, change all Lua magic tokens to use "---@" and update the developer documentation accordingly.
* docs: made can_merge private (#15138)Folke Lemaitre2021-07-19
|
* fix(shared): do not treat empty tables as list in deep extend (#15094)Folke Lemaitre2021-07-19
| | | | | | | | | | An empty table was previously always treated as a list, which means that while merging tables, whenever an empty table was encountered it would always truncate any table on the left. `vim.tbl_deep_extend("force", { b = { a = 1 } }, { b = {} })` Before: `{ b = {} }` After: `{ b = { a = 1 } }`
* lsp: add incremental text synchronizationMichael Lingelbach2021-03-09
| | | | | * Implementation derived from and validated by vim-lsc authored by Nate Bosch
* lsp: vim.lsp.diagnostic (#12655)TJ DeVries2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Breaking Changes: - Deprecated all `vim.lsp.util.{*diagnostics*}()` functions. - Instead, all functions must be found in vim.lsp.diagnostic - For now, they issue a warning ONCE per neovim session. In a "little while" we will remove them completely. - `vim.lsp.callbacks` has moved to `vim.lsp.handlers`. - For a "little while" we will just redirect `vim.lsp.callbacks` to `vim.lsp.handlers`. However, we will remove this at some point, so it is recommended that you change all of your references to `callbacks` into `handlers`. - This also means that for functions like |vim.lsp.start_client()| and similar, keyword style arguments have moved from "callbacks" to "handlers". Once again, these are currently being forward, but will cease to be forwarded in a "little while". - Changed the highlight groups for LspDiagnostic highlight as they were inconsistently named. - For more information, see |lsp-highlight-diagnostics| - Changed the sign group names as well, to be consistent with |lsp-highlight-diagnostics| General Enhancements: - Rewrote much of the getting started help document for lsp. It also provides a much nicer configuration strategy, so as to not recommend globally overwriting builtin neovim mappings. LSP Enhancements: - Introduced the concept of |lsp-handlers| which will allow much better customization for users without having to copy & paste entire files / functions / etc. Diagnostic Enhancements: - "goto next diagnostic" |vim.lsp.diagnostic.goto_next()| - "goto prev diagnostic" |vim.lsp.diagnostic.goto_prev()| - For each of the gotos, auto open diagnostics is available as a configuration option - Configurable diagnostic handling: - See |vim.lsp.diagnostic.on_publish_diagnostics()| - Delay display until after insert mode - Configure signs - Configure virtual text - Configure underline - Set the location list with the buffers diagnostics. - See |vim.lsp.diagnostic.set_loclist()| - Better performance for getting counts and line diagnostics - They are now cached on save, to enhance lookups. - Particularly useful for checking in statusline, etc. - Actual testing :) - See ./test/functional/plugin/lsp/diagnostic_spec.lua - Added `guisp` for underline highlighting NOTE: "a little while" means enough time to feel like most plugins and plugin authors have had a chance to refactor their code to use the updated calls. Then we will remove them completely. There is no need to keep them, because we don't have any released version of neovim that exposes these APIs. I'm trying to be nice to people following HEAD :) Co-authored: [Twitch Chat 2020](https://twitch.tv/teej_dv)
* test/vim.validate(): assert normalized stacktraceJustin M. Keyes2020-10-05
| | | | | | | - The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches()
* vim.validate(): include stacktrace in messageTJ DeVries2020-10-05
|
* docs, remove 'guifontset' #11708Justin M. Keyes2020-08-31
| | | | | | | | | | | | | - remove redundant autocmd list This "grouped" list is useless, it only gets in the way when searching for event names. - intro.txt: cleanup - starting.txt: update, revisit - doc: `:help bisect` - mbyte.txt: update aliases 1656367b90bd. closes #11960 - options: remove 'guifontset'. Why: - It is complicated and is used by almost no one. - It is unlikely to be implemented by Nvim GUIs (complicated to parse, specific to Xorg...).
* doc: fix scripts and regenerate (#12506)TJ DeVries2020-07-02
| | | | | | | | | | | | | | | | | * Fix some small doc issues * doc: fixup * doc: fixup * Fix lint and rebase * Remove bad advice * Ugh, stupid mpack files... * Don't let people include these for now until they specifically want to * Prevent duplicate tag
* lua: fix behavior when split empty string (#12429)notomo2020-06-04
| | | | | * lua: fix behavior when split empty string * test: lsp.util.apply_text_edits with an empty edit
* lua: fix infinite loop for vim.split on empty string (#12420)notomo2020-06-02
|
* lua: add tbl_deep_extend (#11969)Hirokazu Hata2020-05-17
|
* lua: allow deepcopy of functions (#12136)Tristan Konolige2020-04-19
|
* lua: add vim.tbl_len() #11889Hirokazu Hata2020-03-01
|
* lua: move test helper function, map and filter, to vim.shared moduleHirokazu Hata2020-02-18
|
* lua: if second argument is vim.empty_dict(), vim.tbl_extend uses ↵Hirokazu Hata2020-02-14
| | | | empty_dict() instead of {}
* lua: vim.deepcopy uses empty_dict() instead of {} for empty_dict()Hirokazu Hata2020-02-13
| | | | fix: https://github.com/neovim/nvim-lsp/issues/94
* terminal: absolute CWD in term:// URI #11289Chris LaRose2020-01-26
| | | | | | | | | This makes it possible to restore the working directory of :terminal buffers when reading those buffers from a session file. Fixes #11288 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* doc [ci skip] #11656Justin M. Keyes2020-01-12
|
* lua: metatable for empty dict valueBjörn Linse2020-01-01
|
* Add vim.startswith and vim.endswith (#11248)Ashkan Kiani2019-12-01
|
* doc + extmarks tweaks #11421Justin M. Keyes2019-11-25
| | | | - nvim_buf_get_extmarks: rename "amount" => "limit" - rename `set_extmark_index_from_obj`
* Merge branch 'master' into lsp-followupAshkan Kiani2019-11-24
|\
| * Lua: vim.env, vim.{g,v,w,bo,wo} #11442Ashkan Kiani2019-11-24
| | | | | | | | | | | | | | | | - Add vim variable meta accessors: vim.env, vim.{g,v,w,bo,wo} - Redo gen_char_blob to generate multiple blobs instead of just one so that multiple Lua modules can be inlined. - Reorder vim.lua inclusion so that it can use previously defined C functions and utility functions like vim.shared and vim.inspect things. - Inline shared.lua into nvim, but also keep it available in runtime.
* | Extend list_extend to take start/finish.Ashkan Kiani2019-11-20
|/
* lua LSP client: initial implementation (#11336)Ashkan Kiani2019-11-13
| | | | | | Mainly configuration and RPC infrastructure can be considered "done". Specific requests and their callbacks will be improved later (and also served by plugins). There are also some TODO:s for the client itself, like incremental updates. Co-authored by at-tjdevries and at-h-michael, with many review/suggestion contributions.
* Lua: Use vim.validate() instead of assert()Justin M. Keyes2019-11-10
|
* Lua: vim.validate()Justin M. Keyes2019-11-10
|
* Lua: vim.validate()Hirokazu Hata2019-11-10
| | | | | | | We often want to do type checking of public function arguments. - test: Rename utility_function_spec.lua to vim_spec.lua - .luacov: Map lua module names
* runtime: Use module pattern with vim/shared.luaHirokazu Hata2019-10-23
| | | | | It's a bit cumbersome for us to add an export target every time we define a new function. It's also cumbersome to care about the order of definition when creating a new function by referring to other functions in the module.
* lua/stdlib: adjust some validation messages #11271Hirokazu Hata2019-10-26
| | | | close #11271
* test: Rename meth_pcall to pcall_errJustin M. Keyes2019-09-06
| | | | | | | - Rename `meth_pcall`. - Make `pcall_err` raise an error if the function does not fail. - Add `vim.pesc()` to treat a string as literal where a Lua pattern is expected.
* doc #10017Justin M. Keyes2019-05-25
| | | | | - gen_vimdoc.py: fancy "bullet" - rework `:help channel-callback` - rename `:help buffered` to `:help channel-buffered`