| Commit message (Collapse) | Author | Age |
|
|
| |
Result of `make iwyu` (after some "fixups").
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CID 516406: Error handling issues (CHECKED_RETURN)
/src/nvim/api/vimscript.c: 284 in nvim_call_dict_function()
278 Object rv = OBJECT_INIT;
279
280 typval_T rettv;
281 bool mustfree = false;
282 switch (dict.type) {
283 case kObjectTypeString:
>>> CID 516406: Error handling issues (CHECKED_RETURN)
>>> Calling "eval0" without checking return value (as is done elsewhere 10 out of 12 times).
284 TRY_WRAP(err, {
285 eval0(dict.data.string.data, &rettv, NULL, &EVALARG_EVALUATE);
286 clear_evalarg(&EVALARG_EVALUATE, NULL);
287 });
288 if (ERROR_SET(err)) {
289 return rv;
|
|
|
|
|
|
|
| |
Problem: Two separate try/end wrappers, that only marginally differ by
restoring a few variables. Wrappers that don't restore
previous state are dangerous to use in "api-fast" functions.
Solution: Remove wrappers that don't restore the previous state.
Always use TRY_WRAP.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
- API functions using `try_start` directly, do not surface the
underlying error message, and instead show generic messages.
- Error-handling code is duplicated in the API impl.
- Failure modes are not tested.
Solution:
- Use `TRY_WRAP`.
- Add tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the api_info() output:
:new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val')
...
{'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1}
The `ArrayOf(Integer, 2)` return type didn't break clients when we added
it, which is evidence that clients don't use the `return_type` field,
thus renaming Dictionary => Dict in api_info() is not (in practice)
a breaking change.
|
| |
|
|
|
|
|
|
| |
- Tags are now created with `[tag]()`
- References are now created with `[tag]`
- Code spans are no longer wrapped
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.
Solution:
Re-implement the flow using Lua, LPEG and treesitter.
- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
- LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
- LPEG for C parsing (see `scripts/cdoc_parser.lua`)
- Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
- Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
- `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
|
|
|
|
|
|
|
|
|
| |
As only a few API functions make use of explicit freeing of the return
value, make it opt-in instead. The arena is always present under the
hood, so `Arena *arena` arg now doesn't mean anything other than getting
access to this arena. Also it is in principle possible to return an
allocated value while still using the arena as scratch space for other
stuff (unlikely, but there no reason to not allow it).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note: this contains two _temporary_ changes which can be reverted
once the Arena vs no-Arena distinction in API wrappers has been removed.
Both nlua_push_Object and object_to_vim_take_luaref() has been changed
to take the object argument as a pointer. This is not going to be
necessary once these are only used with arena (or not at all) allocated
Objects.
The object_to_vim() variant which leaves luaref untouched might need to
stay for a little longer.
|
|
|
|
|
|
| |
Remove `export` pramgas from defs headers as it causes IWYU to believe
that the definitions from the defs headers comes from main header, which
is not what we really want.
|
| |
|
| |
|
|
|
|
|
| |
Since the parent commit, object_to_vim() can't fail, so callers don't
need to check its result.
|
|
|
|
|
|
| |
FUNC_ATTR_* should only be used in .c files with generated headers.
Defining FUNC_ATTR_* as empty in headers causes misuses of them to be
silently ignored. Instead don't define them by default, and only define
them as empty after a .c file has included its generated header.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
We already have an extensive suite of static analysis tools we use,
which causes a fair bit of redundancy as we get duplicate warnings. PVS
is also prone to give false warnings which creates a lot of work to
identify and disable.
|
| |
|
|
|
|
|
| |
Initially this is just for geting rid of boilerplate,
but eventually the types could get exposed as metadata
|
| |
|
|
|
|
|
|
|
| |
Enforce consistent terminology (defined in
`gen_help_html.lua:spell_dict`) for common misspellings.
This does not spellcheck English in general (perhaps a future TODO,
though it may be noisy).
|
|
|
|
| |
Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Vim9: no line break allowed in a for loop.
Solution: Skip line breaks in for command.
https://github.com/vim/vim/commit/b7a78f7a6713f07d2fcad0b27dea22925c7b1cdf
Omit *_break_count and skip_for_lines(): Vim9 script only.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Vim9: script cannot use line continuation like in a :def function.
Solution: Pass the getline function pointer to the eval() functions. Use it
for addition and multiplication operators.
https://github.com/vim/vim/commit/5409f5d8c95007216ae1190565a7a8ee9ebd7100
Omit source_nextline() and eval_next_non_blank(): Vim9 script only.
N/A patches for version.c:
vim-patch:8.2.1048: build failure without the eval feature
Problem: Build failure without the eval feature.
Solution: Add dummy typedef.
https://github.com/vim/vim/commit/9d40c63c7dc8c3eb3886c58dcd334bc7f37eceba
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
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vim-patch:8.2.0695: Vim9: cannot define a function inside a function
Problem: Vim9: cannot define a function inside a function.
Solution: Initial support for :def inside :def.
https://github.com/vim/vim/commit/04b12697838b232b8b17c553ccc74cf1f1bdb81c
vim-patch:8.2.0725: Vim9: cannot call a function declared later in Vim9 script
Problem: Vim9: cannot call a function declared later in Vim9 script.
Solution: Make two passes through the script file.
https://github.com/vim/vim/commit/09689a02840be40fa7bb10b1921fb5bc5b2908f1
vim-patch:8.2.0734: Vim9: leaking memory when using :finish
Problem: Vim9: leaking memory when using :finish.
Solution: Do not check for next line in third pass.
https://github.com/vim/vim/commit/04816717dfea6e2469ff4c9d40f68b59aaf03724
vim-patch:8.2.0753: Vim9: expressions are evaluated in the discovery phase
Problem: Vim9: expressions are evaluated in the discovery phase.
Solution: Bail out if an expression is not a constant. Require a type for
declared constants.
https://github.com/vim/vim/commit/32e351179eacfc84f64cd5029e221582d400bb38
vim-patch:8.2.0818: Vim9: using a discovery phase doesn't work well
Problem: Vim9: using a discovery phase doesn't work well.
Solution: Remove the discovery phase, instead compile a function only when
it is used. Add :defcompile to compile def functions earlier.
https://github.com/vim/vim/commit/822ba24743af9ee1b5e7f656a7a61a38f3638bca
vim-patch:8.2.0819: compiler warning for unused variable
Problem: Compiler warning for unused variable.
Solution: Remove the variable.
https://github.com/vim/vim/commit/f40e51a880a95f94dbbbecc9476559506c2cc345
vim-patch:8.2.0822: Vim9: code left over from discovery phase
Problem: Vim9: code left over from discovery phase.
Solution: Remove the dead code.
https://github.com/vim/vim/commit/2eec37926db6d31beb36f162ac00357a30c093c8
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
|
|
|
|
|
|
| |
Problem:
The signature of nvim_exec() is not extensible per ":help api-contract".
Solution:
Introduce nvim_exec2() and deprecate nvim_exec().
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Allow Include What You Use to remove unnecessary includes and only
include what is necessary. This helps with reducing compilation times
and makes it easier to visualise which dependencies are actually
required.
Work on https://github.com/neovim/neovim/issues/549, but doesn't close
it since this only works fully for .c files and not headers.
|
|
|
|
|
|
|
|
| |
Enable and fix bugprone-misplaced-widening-cast warning.
Fix some modernize-macro-to-enum and readability-else-after-return
warnings, but don't enable them. While the warnings can be useful, they
are in general too noisy to enable.
|
|
|
|
|
|
|
|
|
| |
(#20214)
Problem: The funcexe_T struct members are not named consistently.
Solution: Prefix "fe_" to all the members.
https://github.com/vim/vim/commit/851f86b951cdd67ad9cf3149e46169d1375c8d82
Omit fe_check_type: always NULL in legacy Vim script.
|
|
|
|
| |
Work on https://github.com/neovim/neovim/issues/459
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`!did_throw` doesn't exactly imply `!current_exception`, as `did_throw = false`
is sometimes used to defer exception handling for later (without forgetting the
exception). E.g: uncaught exception handling in `do_cmdline()` may be deferred
to a different call (e.g: when `try_level > 0`).
In #7881, `current_exception = NULL` in `do_cmdline()` is used as an analogue of
`did_throw = false`, but also causes the pending exception to be lost, which
also leaks as `discard_exception()` wasn't used.
It may be possible to fix this by saving/restoring `current_exception`, but
handling all of `did_throw`'s edge cases seems messier. Maybe not worth
diverging over.
This fix also uncovers a `man_spec.lua` bug on Windows: exceptions are thrown
due to Windows missing `man`, but they're lost; skip these tests if `man` isn't
executable.
|
|
|
|
| |
This matches the code in execute_common(), preventing messages after the
API call from being printed at the wrong column.
|
|
|
|
| |
Mostly avoids including eval.h, ex_cmds2.h and ex_docmd.h in other
headers.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The size of long varies depending on architecture, in contrast to the
MAXLNUM constant which sets the maximum allowable number of lines to
2^32-1. This discrepancy may lead to hard to detect bugs, for example
https://github.com/neovim/neovim/issues/18454. Setting linenr_T to a
fix maximum size of 2^32-1 will prevent this type of errors in the
future.
Also change the variables `amount` and `amount_after` to be linenr_T
since they're referring to "the line number difference" between two
texts.
|
|
|
|
| |
Closes #18876.
|
|
|
|
| |
Adds a Lua-only `preview` flag to user commands which allows the command to be incrementally previewed like `:substitute` when 'inccommand' is set.
|
|
|
|
| |
Closes #18632
|
| |
|
|
|
|
| |
Work on https://github.com/neovim/neovim/issues/459
|
|
|
|
| |
Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
|
|
|
|
| |
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.
|
|
|
|
| |
Work on https://github.com/neovim/neovim/issues/459
|
|
|
|
|
|
|
|
| |
It seems range and count can be used together in commands. This PR fixes
the behavior of `nvim_parse_cmd` for those cases by removing the mutual
exclusivity of "range" and "count". It also removes range line number
validation for `nvim_parse_cmd` as it's not its job to validate the
command.
|
|\
| |
| | |
refactor: upgrade uncrustify configuration to version 0.75
|
| | |
|