summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/lua/executor.c
AgeCommit message (Collapse)AuthorFiles
2022-06-14perf(memory): use an arena for RPC decodingbfredl1
drawback: tracing memory errors with ASAN is less accurate for arena allocated memory. Therefore, to start with it is being used for Object types around serialization/deserialization exclusively. This is going to have a large impact especially when TUI is refactored as a co-prosess as all UI events will be serialized and deserialized by nvim itself.
2022-06-09fix: correct nlua_wait error message #18867resolritter1
the message is wrapped in `if (timeout < 0)`, which means 0 is a valid value
2022-06-08fix(nvim_create_user_command): make `smods` work with `nvim_cmd`Famiu Haque1
Closes #18876.
2022-05-31feat: add preview functionality to user commandsFamiu Haque1
Adds a Lua-only `preview` flag to user commands which allows the command to be incrementally previewed like `:substitute` when 'inccommand' is set.
2022-05-29feat(nvim_create_user_command): pass structured modifiers to commandsFamiu Haque1
Adds an `smods` key to `nvim_create_user_command` Lua command callbacks, which has command modifiers but in a structured format. This removes the need to manually parse command modifiers. It also reduces friction in using `nvim_cmd` inside a Lua command callback.
2022-05-26Merge pull request #18306 from lewis6991/fnfastbfredl1
feat(lua): allow some viml functions to run in fast
2022-05-25refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc1
2022-05-17feat(lua): allow some viml functions to run in fastLewis Russell1
This change adds the necessary plumbing to annotate functions in funcs.c as being allowed in run in luv fast events.
2022-05-13Merge pull request #18489 from dundargoc/refactor/remove-char_ubfredl1
refactor: replace char_u variables and functions with char
2022-05-11refactor: replace char_u variables and functions with charDundar Goc1
Work on https://github.com/neovim/neovim/issues/459
2022-05-11feat(api): add `nvim_cmd`Famiu Haque1
Adds the API function `nvim_cmd` which allows executing an Ex-command through a Dictionary which can have the same values as the return value of `nvim_parse_cmd()`. This makes it much easier to do things like passing arguments with a space to commands that otherwise may not allow it, or to make commands interpret certain characters literally when they otherwise would not.
2022-05-09refactor: replace char_u variables and functions with charDundar Goc1
Work on https://github.com/neovim/neovim/issues/459
2022-05-05refactor: replace char_u variables and functions with charDundar Goc1
Work on https://github.com/neovim/neovim/issues/459
2022-05-04refactor: replace char_u variables and functions with charDundar Goc1
Work on https://github.com/neovim/neovim/issues/459
2022-05-03fix(coverity): use xstrndup() instead of vim_strsave() (#18363)zeertzjq1
2022-04-29refactor(uncrustify): change rules to better align with the style guideDundar Goc1
Add space around arithmetic operators '+' and '-'. Remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. Remove space between '((' or '))' of control statements. Add space between ')' and '{' of control statements. Remove space between function name and '(' on function declaration. Collapse empty blocks between '{' and '}'. Remove newline at the end of the file. Remove newline between 'enum' and '{'. Remove newline between '}' and ')' in a function invocation. Remove newline between '}' and 'while' of 'do' statement.
2022-04-13fix(api): correctly pass f-args for nvim_create_user_command (#18098)Gregory Anders1
Skip runs of whitespace and do not include `\` characters when followed by another `\` or whitespace. This matches the behavior of <f-args> when used with `:command`.
2022-03-18Merge pull request #17459 from rktjmp/lua-error-tostringbfredl1
feat: __tostring lua errors if possible before showing in messages
2022-03-10refactor(uncrustify): format all c filesDundar Göc1
2022-03-07fix(lua): don't use nlua_error when exiting earlybfredl1
Screen state is not initialized yet. Print directly to stderr instead.
2022-03-04refactor(lua): move only runtime lua file in src/ to runtime/luabfredl1
reorganize so that initialization is done in lua
2022-03-03refactor(lua): reorganize builtin modules, phase 1bfredl1
2022-03-01Merge pull request #15079 from shadmansaleh/feat/verbose_luabfredl1
feat(lua): add :verbose support for lua config
2022-02-28feat(lua): add missing changes to autocmds lost in the rebaseTJ DeVries1
Note: some of these changes are breaking, like change of API signatures
2022-02-28fix: anonymous sid not workingshadmansaleh1
2022-02-28feat(lua): show proper verbose output for lua configurationshadmansaleh1
`:verbose` didn't work properly with lua configs (For example: options or keymaps are set from lua, just say that they were set from lua, doesn't say where they were set at. This fixes that issue. Now `:verbose` will provide filename and line no when option/keymap is set from lua. Changes: - compiles lua/vim/keymap.lua as vim/keymap.lua - When souring a lua file current_sctx.sc_sid is set to SID_LUA - Moved finding scripts SID out of `do_source()` to `get_current_script_id()`. So it can be reused for lua files. - Added new function `nlua_get_sctx` that extracts current lua scripts name and line no with debug library. And creates a sctx for it. NOTE: This function ignores C functions and blacklist which currently contains only vim/_meta.lua so vim.o/opt wrappers aren't targeted. - Added function `nlua_set_sctx` that changes provided sctx to current lua scripts sctx if a lua file is being executed. - Added tests in tests/functional/lua/verbose_spec.lua - add primary support for additional types (:autocmd, :function, :syntax) to lua verbose Note: These can't yet be directly set from lua but once that's possible :verbose should work for them hopefully :D - add :verbose support for nvim_exec & nvim_command within lua Currently auto commands/commands/functions ... can only be defined by nvim_exec/nvim_command this adds support for them. Means if those Are defined within lua with vim.cmd/nvim_exec :verbose will show their location . Though note it'll show the line no on which nvim_exec call was made.
2022-02-27feat(lua): add api and lua autocmdsTJ DeVries1
2022-02-27feat(lua): add <f-args> to user commands callback (#17522)Javier Lopez1
Works similar to ex <f-args>. It only splits the arguments if the command has more than one posible argument. In cases were the command can only have 1 argument opts.fargs = { opts.args }
2022-02-26refactor(lua): use references directly on main threadBjörn Linse1
2022-02-26feat(lua): add proper support of luv threadserw71
2022-02-25feat: call __tostring on lua errors if possible before reporting to userOliver Marriott1
2022-02-18refactor(lua): call loadfile internallyLewis Russell1
.. instead of luaL_loadfile allows files to be cached
2022-01-30vim-patch:8.2.4241: some type casts are redundantDundar Göc1
Problem: Some type casts are redundant. Solution: Remove the type casts. (closes vim/vim#9643) https://github.com/vim/vim/commit/420fabcd4ffeaf79082a6e43db91e1d363f88f27 This is not a literal port but an equivalent one.
2022-01-27feat(ts): expose minimum language version to lua (#17186)Thomas Vigouroux1
2022-01-06fix(lua): print multiple return values with =expr (#16933)Shadman1
2022-01-04feat: filetype.lua (#16600)Gregory Anders1
Adds a new vim.filetype module that provides support for filetype detection in Lua.
2022-01-04feat(lua): make =expr print result of exprshadmansaleh1
2021-12-28feat(api): implement nvim_{add,del}_user_commandGregory Anders1
Add support for adding and removing custom user commands with the Nvim API.
2021-12-16perf: pre-compile embedded Lua source into bytecode (#16631)Gregory Anders1
The Lua modules that make up vim.lua are embedded as raw source files into the nvim binary. These sources are loaded by the Lua runtime on startuptime. We can pre-compile these sources into Lua bytecode before embedding them into the binary, which minimizes the size of the binary and improves startuptime.
2021-12-10refactor(misc1): move out high-level input functions to a new file: input.cBjörn Linse1
Possibly dialog code is messages.c could be moved here as well. misc1.c is now empty, so delete it.
2021-12-08fix: check for interrupt in nvim_echo, write_msg and nlua_print (#16537)ii141
Fixes `q` in more pager, where `:highlight` can be quit out of with a single `q` keystroke, while in `:lua print(vim.inspect(vim))` it just scrolls down a page.
2021-11-16refactor: reduce number of explicit char casts (#16077)dundargoc1
* refactor: reduce number of explicit char casts
2021-11-06feat(lua): enable stack traces in error output (#16228)Gregory Anders1
2021-11-01vim-patch:8.1.0779: argument for message functions is inconsistentJames McCoy1
Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *". https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c
2021-11-01vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy1
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
2021-10-26refactor: split executor.c into two filesDundar Göc1
2021-10-24feat: add vim.str_utf_pos functionMichael Lingelbach1
vim.str_utf_pos returns the codepoints for all utf-8 chars (only, currently) in a string
2021-10-17fix(runtime): don't use regexes inside lua require'mod'Björn Linse1
Fixes #15147 and fixes #15497. Also sketch "subdir" caching. Currently this only caches whether an rtp entry has a "lua/" subdir but we could consider cache other subdirs potentially or even "lua/mybigplugin/" possibly. Note: the async_leftpad test doesn't actually fail on master, at least not deterministically (even when disabling the fast_breakcheck throttling). It's still useful as a regression test for further changes and included as such.
2021-10-02refactor: format with uncrustify #15842dundargoc1
* refactor: format with uncrustify * refactor: convert function comments to doxygen
2021-09-26feat(lua): expose lua-cjson as vim.jsonMichael Lingelbach1
* add vim.json.encode and vim.json.decode * use vim.NIL instead of cjson.null * resolve strict-prototypes warnings * The following benchmark shows an approximately 2.5x (750 ms vs 300 ms) improvement in deserialization performance over vim.fn.json_decode on a medium package.json ```lua local uv = vim.loop local function readfile(path) return end local json_url = "https://raw.githubusercontent.com/rust-analyzer/rust-analyzer/b24c8d5c89ee93d1172b4127564f5da3b0c88dad/editors/code/package.json" io.popen(string.format('curl -v -f -L -O %q &> /dev/null', json_url)) local json_string = io.open('package.json'):read '*a' uv.update_time() local start = uv.hrtime() for i = 1,1000 do vim.fn.json_decode(json_string) end uv.update_time() print(string.format("Deserialization time vim.fn.json_decode: %s ms", (uv.hrtime() - start) * (1e-6))) uv.update_time() local start = uv.hrtime() for i = 1,1000 do vim.json.decode(json_string) end uv.update_time() print(string.format("Deserialization time vim.json.decode: %s ms", (uv.hrtime() - start) * (1e-6))) ``` Co-Authored-By: Björn Linse <bjorn.linse@gmail.com>