aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/userfunc.c
Commit message (Collapse)AuthorAge
* refactor: convert function comments to doxygen format (#17710)dundargoc2022-03-24
|
* refactor: remove redundant castsDundar Göc2022-03-06
|
* feat(lua): show proper verbose output for lua configurationshadmansaleh2022-02-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `: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.
* refactor(misc1): move out high-level input functions to a new file: input.cBjörn Linse2021-12-10
| | | | | Possibly dialog code is messages.c could be moved here as well. misc1.c is now empty, so delete it.
* refactor: saner options for uncrustify (#16204)dundargoc2021-11-19
| | | | | | | | | | | | | | | | | | | | | | | | * sp_enum_after_assign = force * sp_brace_typedef = force * nl_do_brace = remove * sp_do_brace_open = force * sp_brace_close_while = force * sp_before_semi = remove * sp_before_semi_for = remove * sp_before_semi_for_empty = remove * sp_between_semi_for_empty = remove * sp_after_semi_for_empty = remove * sp_before_square = remove * sp_before_squares = remove * sp_inside_square = remove * sp_inside_fparens = remove * sp_inside_fparen = remove * sp_inside_tparen = remove * sp_after_tparen_close = remove * sp_return_paren = force * pos_bool = lead * sp_pp_concat = remove * sp_pp_stringify = remove * fixup: disable formatting for the INIT section
* refactor: reduce number of explicit char casts (#16077)dundargoc2021-11-16
| | | * refactor: reduce number of explicit char casts
* vim-patch:8.1.0779: argument for message functions is inconsistentJames McCoy2021-11-01
| | | | | | Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *". https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | 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
* refactor: saner options for uncrustify #16196dundargoc2021-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor: general good option changes sp_deref = remove sp_not = remove sp_inv = remove sp_inside_paren_cast = remove mod_remove_duplicate_include = true sp_after_semi = add sp_after_semi_for = force sp_sizeof_paren = remove nl_return_expr = remove nl_else_brace = remove nl_else_if = remove * refactor: mod_remove_extra_semicolon = true * refactor: nl_max = 3 * refactor: sp_bool = force * refactor: sp_compare = force * refactor: sp_inside_paren = remove * refactor: sp_paren_paren = remove * refactor: sp_inside_sparen = remove * refactor: sp_before_sparen = force * refactor: sp_sign = remove * refactor: sp_addr = remove * refactor: sp_member = remove * refactor: nl_struct_brace = remove * refactor: nl_before_if_closing_paren = remove * refactor: nl_fdef_brace = force * refactor: sp_paren_comma = force * refactor: mod_full_brace_do = add
* vim-patch:8.1.2396: using old C style commentsDundar Göc2021-10-21
| | | | | | Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/e38eab22c1fb950127f0307a9904de6d4561dc70
* refactor: convert to doxygen-style comments #16013dundargoc2021-10-17
|
* fixup! vim-patch:8.1.2396: using old C style commentsDundar Göc2021-10-16
|
* Refactor/uncrustify (#15790)dundargoc2021-09-29
| | | | | | | | | | | | | * refactor: format with uncrustify * fixup(dundar): fix functions comments * fixup(dundar): remove space between variable and ++/-- * fixup(dundar): better workaround for macro attributes This is done to be able to better use uncrustify rules for macros * fixup(justin): make preprocessors follow neovim style guide
* refactor: format with uncrustify #15778dundargoc2021-09-25
| | | * fixup: force exactly one whitespace between type and variable
* refactor: reformat with uncrustify #15736dundargoc2021-09-20
| | | | * fix function parameter comments * remove space after star in function names
* refactor: format #15702dundargoc2021-09-18
|
* vim-patch:8.1.1195: Vim script debugger functionality needs cleanupSean Dewar2021-09-13
| | | | | | | | | | | Problem: Vim script debugger functionality needs cleanup. Solution: Move debugger code to a separate file. Add more tests. (Yegappan Lakshmanan, closes vim/vim#4285) https://github.com/vim/vim/commit/eead75c5e8e1f965548c55ee3a9388b2cb3afc36 Good to have for eval_expr_restore in v8.2.3417. Doesn't actually add any tests.
* refactor: replace TRUE/FALSE with true/false #15647dundargoc2021-09-13
|
* feat(v:lua): support calling v:lua as a methodSean Dewar2021-08-13
|
* fix(v:lua): fix emsg when calling v:lua directlySean Dewar2021-08-12
| | | | | | | | | | v:lua expressions are represented using vvlua_partial. As v:lua isn't intended to be called directly, it's given an empty pt_name. Because of this, calling v:lua directly like "v:lua()" will cause "E117: Unknown function: ", with an empty name. Instead, have call_func() show the name "v:lua" in the emsg.
* vim-patch:8.1.1878: negative float before method not parsed correctlySean Dewar2021-08-12
| | | | | | Problem: Negative float before method not parsed correctly. Solution: Apply "!" and "-" in front of expression before using ->. https://github.com/vim/vim/commit/9cfe8f6e68de4bfb5942d84f4465de914a747b3f
* vim-patch:8.1.1863: confusing error when using a builtin function as methodSean Dewar2021-08-12
| | | | | | | Problem: Confusing error when using a builtin function as method while it does not support that. Solution: Add a specific error message. https://github.com/vim/vim/commit/9174639a82799011cfa0013cbc4c4709b3833bf0
* vim-patch:8.1.1820: using expr->FuncRef() does not workSean Dewar2021-08-12
| | | | | | Problem: Using expr->FuncRef() does not work. Solution: Make FuncRef work as a method. https://github.com/vim/vim/commit/761fdf01c6e307c448cec2684f8b315ba6d1f454
* vim-patch:8.1.1816: cannot use a user defined function as a methodSean Dewar2021-08-12
| | | | | | | Problem: Cannot use a user defined function as a method. Solution: Pass the base as the first argument to the user defined function after "->". (partly by FUJIWARA Takuya) https://github.com/vim/vim/commit/fcfe1a9b8950b8b211ab3b24d84b17c6847ea43f
* vim-patch:8.1.1803: all builtin functions are globalSean Dewar2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: All builtin functions are global. Solution: Add the method call operator ->. Implemented for a limited number of functions. https://github.com/vim/vim/commit/ac92e25a33c37ec5becbfffeccda136c73b761ac - Note that to *exactly* port hunk @@ -7376,18 +7444,19 from handle_subscript(), we need the :scriptversion patches (I have an open PR for those, but this patch works fine without them anyway). - Port call_internal_func() from v7.4.2058. - Adjust some error messages in tests, as they rely on the Blob patches. - Add a modeline to test_method.vim. Ignore the global_functions and base_method tables and prefer the current GPerf implementation. Instead, add an extra base_arg field to VimLFuncDef that holds the number of the argument to use as the base (1-indexed, so that 0 may be used to refer to functions that cannot be used as methods). This also means we support using any argument as a base from the get-go, rather than just the first (Vim includes this ability in future patches, however). To mark a function as usable as a method, use the "base" key as described in eval.lua.
* vim-patch:8.1.1800: function call functions have too many argumentsSean Dewar2021-08-12
| | | | | | | | | | Problem: Function call functions have too many arguments. Solution: Pass values in a funcexe_T struct. https://github.com/vim/vim/commit/c6538bcc1cdd1fb83732f22fdc69bd9bb66f968a Use FUNCEXE_INIT to initialize funcexe_T instances. call_callback() and other Vim listener related stuff is N/A.
* refactor: replace TRUE/FALSE with true/falseDundar Göc2021-07-30
|
* vim-patch:8.2.3089: garbage collection has useless code #15027dundargoc2021-07-08
| | | | | Problem: Garbage collection has useless code. Solution: Bail out when aborting. (closes vim/vim#8504) https://github.com/vim/vim/commit/20cc52832067d22a3cd47dfb0805251228c32e7d
* chore: use codespell to spell check #15016dundargoc2021-07-07
|
* vim-patch:8.1.0897: can modify a:000 when using a reference (#14902)Jan Edmund Lazo2021-06-26
| | | | | | Problem: Can modify a:000 when using a reference. Solution: Make check for locked variable stricter. (Ozaki Kiichi, closes vim/vim#3930) https://github.com/vim/vim/commit/05c00c038bc16e862e17f9e5c8d5a72af6cf7788
* userfunc: pvs/v547Jan Edmund Lazo2021-06-05
| | | | vim_strsave() returns nonnull.
* coverity/331366: fname_trans_sid: Avoid buffer overrunJames McCoy2021-05-06
| | | | | Since we're printf()ing into an offset of fname_buf, we need to reduce the max length by the same amount.
* vim-patch:8.2.2764: memory leak when default function argument is allocatedJan Edmund Lazo2021-04-15
| | | | | | Problem: Memory leak when default function argument is allocated. Solution: Free the expression result. https://github.com/vim/vim/commit/b47bed2f7ada4dfae78f76f27473b83507e40315
* fixup! vim-patch:8.1.1310: named function arguments are never optionalJan Edmund Lazo2021-02-22
|
* vim-patch:8.1.1310: named function arguments are never optionalerw72021-02-22
| | | | | | | Problem: Named function arguments are never optional. Solution: Support optional function arguments with a default value. (Andy Massimino, closes vim/vim#3952) https://github.com/vim/vim/commit/42ae78cfff171fbd7412306083fe200245d7a7a6
* vim-patch:8.2.0928: many type casts are used for vim_strnsave()Jan Edmund Lazo2020-12-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Many type casts are used for vim_strnsave(). Solution: Make the length argument size_t instead of int. (Ken Takata, closes vim/vim#5633) Remove some type casts. https://github.com/vim/vim/commit/df44a27b53586fccfc6a3aedc89061fdd9a515ff N/A patches for version.c: vim-patch:8.2.0315: build failure on HP-UX system Problem: Build failure on HP-UX system. Solution: Use LONG_LONG_MIN instead of LLONG_MIN. Add type casts for switch statement. (John Marriott) https://github.com/vim/vim/commit/c593bec4120f122e8a9129ec461968f1bd214435 vim-patch:8.2.1052: build failure with older compilers Problem: Build failure with older compilers. Solution: Move declaration to start of block. https://github.com/vim/vim/commit/7acde51832f383f9a6d2e740cd0420b433ea841a vim-patch:8.2.2229: build failure without the +eval feature Problem: build failure without the +eval feature. Solution: Add #ifdef. https://github.com/vim/vim/commit/39cb2dab18e85fc60f116a4543e433616872b690 vim-patch:8.2.2232: compiler error for falling through into next case Problem: Compiler error for falling through into next case. Solution: Move FALLTHROUGH below the #endif https://github.com/vim/vim/commit/9618a25b9c054f0ee4e267d2db96b6e7c113ed7a
* vim-patch:8.2.2142: memory leak when heredoc is not terminatedJan Edmund Lazo2020-12-22
| | | | | | Problem: Memory leak when heredoc is not terminated. Solution: Free heredoc_trimmed. https://github.com/vim/vim/commit/fffdf4754f4fd789c64596bdd9ea069725e63784
* eval: use VAR_UNLOCKED enum, not the direct valueJan Edmund Lazo2020-11-21
|
* vim-patch:8.2.0506: Coverity complains about ignoring return valueJan Edmund Lazo2020-10-25
| | | | | | Problem: Coverity complains about ignoring return value. Solution: Add (void). https://github.com/vim/vim/commit/d1e9dc272355fe3ab112af5f04b0516b2e9a4fa6
* vim-patch:8.2.0268: trycatch test failsJan Edmund Lazo2020-10-21
| | | | | | | Problem: Trycatch test fails. Solution: When calling function fails only check for following command, do not give another error. https://github.com/vim/vim/commit/40d9da2a4395025169ebaf53a63618adfa737e96
* userfunc: abort early on invalid refsJan Edmund Lazo2020-09-30
| | | | Cherry-pick set_ref_in_call_stack() changes from patch 8.1.1575.
* vim-patch:8.2.0042: clearing funccal values twiceJan Edmund Lazo2020-09-30
| | | | | | Problem: Clearing funccal values twice. Solution: Remove clearing individual fields. https://github.com/vim/vim/commit/eac7ce01e92f3dee6bbccaf7e88680fe2ce286eb
* vim-patch:8.2.0499: calling a lambda is slower than evaluating a stringJan Edmund Lazo2020-09-30
| | | | | | | | | | Problem: Calling a lambda is slower than evaluating a string. Solution: Make calling a lambda faster. (Ken Takata, closes vim/vim#5727) https://github.com/vim/vim/commit/f10806b25090879fdc1a86cc0da2f4f34fd21921 Port "uf_flags" constants from patch 8.2.1054 to sync with Vim. Port user_func_error() from patch 8.2.0149. Port Test_lambda_scope() changes from patch 8.1.0736 so that it passes.
* vim-patch:8.1.1319: computing function length name in many placesJan Edmund Lazo2020-09-30
| | | | | | | | | | | Problem: Computing function length name in many places. Solution: compute name length in call_func(). https://github.com/vim/vim/commit/6ed8819822994512c160006bd1204aa11ae3c494 In call_func(), reassign "len" param to (int)STRLEN(funcname) instead of using vim_strsave() which runs strlen(). "len" param is checked for v:lua functions. call_func() states that strlen() is used if "len" is set to -1.
* vim-patch:8.1.1563: crash when using closureserw72020-09-30
| | | | | | | Problem: Crash when using closures. Solution: Set reference in varlist of funccal when running the garbage collector. (Ozaki Kiichi, closes vim/vim#4554, closes vim/vim#4547) https://github.com/vim/vim/commit/6e5000d493b4f385f901eb97f3ce0c8088373403
* lua: cleanup naming conventions of executor functionsBjörn Linse2020-09-10
|
* vim-patch:8.2.0607: gcc warns for using uninitialized variableJan Edmund Lazo2020-08-19
| | | | | | Problem: Gcc warns for using uninitialized variable. (John Marriott) Solution: Set name_end also for environment variables. https://github.com/vim/vim/commit/2bb76accc66d17f2c027c04396082c46f410bfea
* userfunc: fix pvs/v547Jan Edmund Lazo2020-08-15
| | | | xcalloc() never returns NULL.
* lua: Add ability to pass tables with __callTJ DeVries2020-07-10
| | | | | | | | | | | | vim-patch:8.2.1054: not so easy to pass a lua function to Vim vim-patch:8.2.1084: Lua: registering function has useless code I think I have also opened up the possibility for people to use these callbacks elsewhere, since I've added a new struct that we should be able to use. Also, this should allow us to determine what the state of a list is in Lua or a dictionary in Lua, since we now can track the luaref as we go.
* lua: Add ability to pass lua functions directly to vimLTJ DeVries2020-07-10
|