summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/shared.lua
AgeCommit message (Collapse)AuthorFiles
2022-10-12fix(docs-html): update parserJustin M. Keyes1
- Improve generated HTML by updating parser which includes fixes for single "'" and single "|": https://github.com/neovim/tree-sitter-vimdoc/pull/31 - Updated parser also fixes the conceal issue for "help" highlight queries https://github.com/neovim/tree-sitter-vimdoc/issues/23 by NOT including whitespace in nodes. - But this means we need to restore the getws() function which scrapes leading whitespace from the original input (buffer). (cherry picked from commit a7a83bc4c25d63f3ae0a7a56e5211df1444699c4)
2022-09-25fix(docs): invalid :help links #20345Justin M. Keyes1
Fix those naughty single quotes. closes #20159
2022-09-14docs(treesitter): clean up and update treesitter.txt (#20142)Christian Clason1
* add type annotations to code * clean up and expand static documentation * consistent use of tags for static and generated docs
2022-09-07Use weak tables in tree-sitter code (#17117)Thomas Vigouroux1
feat(treesitter): use weak tables when possible Also add the defaulttable function to create a table whose values are created when a key is missing.
2022-08-08docs(lua): add Lua 5.1 reference manual (#19663)dundargoc1
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>
2022-07-07refactor(lua): reformat with stylua 0.14.0 (#19264)Christian Clason1
* reformat Lua runtime to make lint CI pass * reduce max line length to 100
2022-05-11docs(api): improve shared lua functions docs (#17933)adrian51
2022-05-09chore: format runtime with styluaChristian Clason1
2022-05-01fix(shared): avoid indexing unindexable values in vim.tbl_get() (#18337)William Boman1
2022-03-24feat: add vim.tbl_get (#17831)Michael Lingelbach1
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.
2022-03-17chore: fix typos (#17670)dundargoc1
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-07refactor(lua): make vim submodule lazy loading declarativebfredl1
This will allow us to also use the same logic for lua threads and processes, later.
2022-03-06docs(lua): reference runtime/lua/vim/_editor.luazeertzjq1
2022-01-01fix(diagnostic): improve validation for list arguments (#16855)Gregory Anders1
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.
2022-01-01feat(lua): add support for multiple optional types in vim.validate (#16864)Shadman1
2021-11-30docs(lsp): add annotations for private functionsGregory Anders1
2021-11-26fix(lua): fix vim.deepcopy for metatables & cycled tables (#16435)Shadman1
vim.deepcopy previously didn't retain metatables in copies and caused stackoverflow on recursive tables/cycled tables this fixes these issues
2021-11-06feat(lua): enable stack traces in error output (#16228)Gregory Anders1
2021-09-25refactor: use kwargs parameter in vim.splitGregory Anders1
2021-09-25feat: add trimempty optional parameter to vim.splitGregory Anders1
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.
2021-09-10perf(lua): optimize vim.deep_equal #15236Javier Lopez1
By remembering the keys already compared in repeating a comparison is avoided. Thanks: https://stackoverflow.com/a/32660766
2021-08-22docs: make Lua docstrings consistent #15255Gregory Anders1
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.
2021-07-19docs: made can_merge private (#15138)Folke Lemaitre1
2021-07-19fix(shared): do not treat empty tables as list in deep extend (#15094)Folke Lemaitre1
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 } }`
2021-03-09lsp: add incremental text synchronizationMichael Lingelbach1
* Implementation derived from and validated by vim-lsc authored by Nate Bosch
2020-11-12lsp: vim.lsp.diagnostic (#12655)TJ DeVries1
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)
2020-10-05test/vim.validate(): assert normalized stacktraceJustin M. Keyes1
- 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()
2020-10-05vim.validate(): include stacktrace in messageTJ DeVries1
2020-08-31docs, remove 'guifontset' #11708Justin M. Keyes1
- 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...).
2020-07-02doc: fix scripts and regenerate (#12506)TJ DeVries1
* 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
2020-06-04lua: fix behavior when split empty string (#12429)notomo1
* lua: fix behavior when split empty string * test: lsp.util.apply_text_edits with an empty edit
2020-06-02lua: fix infinite loop for vim.split on empty string (#12420)notomo1
2020-05-17lua: add tbl_deep_extend (#11969)Hirokazu Hata1
2020-04-19lua: allow deepcopy of functions (#12136)Tristan Konolige1
2020-03-01lua: add vim.tbl_len() #11889Hirokazu Hata1
2020-02-18lua: move test helper function, map and filter, to vim.shared moduleHirokazu Hata1
2020-02-14lua: if second argument is vim.empty_dict(), vim.tbl_extend uses ↵Hirokazu Hata1
empty_dict() instead of {}
2020-02-13lua: vim.deepcopy uses empty_dict() instead of {} for empty_dict()Hirokazu Hata1
fix: https://github.com/neovim/nvim-lsp/issues/94
2020-01-26terminal: absolute CWD in term:// URI #11289Chris LaRose1
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>
2020-01-12doc [ci skip] #11656Justin M. Keyes1
2020-01-01lua: metatable for empty dict valueBjörn Linse1
2019-12-01Add vim.startswith and vim.endswith (#11248)Ashkan Kiani1
2019-11-25doc + extmarks tweaks #11421Justin M. Keyes1
- nvim_buf_get_extmarks: rename "amount" => "limit" - rename `set_extmark_index_from_obj`
2019-11-24Merge branch 'master' into lsp-followupAshkan Kiani1
2019-11-24Lua: vim.env, vim.{g,v,w,bo,wo} #11442Ashkan Kiani1
- 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.
2019-11-20Extend list_extend to take start/finish.Ashkan Kiani1
2019-11-13lua LSP client: initial implementation (#11336)Ashkan Kiani1
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.
2019-11-10Lua: Use vim.validate() instead of assert()Justin M. Keyes1
2019-11-10Lua: vim.validate()Justin M. Keyes1
2019-11-10Lua: vim.validate()Hirokazu Hata1
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