summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/context.c
AgeCommit message (Collapse)AuthorFiles
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2024-12-23refactor: iwyu #31637Justin M. Keyes1
Result of `make iwyu` (after some "fixups").
2024-09-23refactor(api)!: rename Dictionary => DictJustin M. Keyes1
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.
2024-06-11refactor(shada): use msgpack_sbuffer lessbfredl1
Work towards getting rid of libmsgpack depedency eventually. msgpack_sbuffer is just a string buffer, we can use our own String type.
2024-02-15refactor(eval): use arena when converting typvals to Objectbfredl1
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.
2024-01-11refactor(IWYU): fix headersdundargoc1
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.
2023-12-09refactor(options): reduce `findoption()` usageFamiu Haque1
Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over. Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
2023-12-07refactor(options): split `get_option_value()` into smaller functionsFamiu Haque1
Problem: Currently, `get_option_value()` returns 3 separate things: The actual value of the option, whether the option is hidden, and the option flags. This makes the function difficult to refactor, modify or otherwise reason about. Solution: Split `get_option_value()` into 3 functions, each with a single purpose. This also affects `get_option_value_for()`.
2023-12-07refactor: object_to_vim() cannot failJustin M. Keyes1
Since the parent commit, object_to_vim() can't fail, so callers don't need to check its result.
2023-11-30build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq1
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.
2023-11-27refactor: fix includes for api/autocmd.hdundargoc1
2023-11-27build(IWYU): fix includes for func_attr.hdundargoc1
2023-11-16refactor: iwyu (#26062)zeertzjq1
2023-11-12build: remove PVSdundargoc1
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.
2023-11-11fix(context): don't leak memory on multiple invalid objects (#25979)zeertzjq1
2023-11-11fix(context): don't crash on invalid arg to nvim_get_context (#25977)zeertzjq1
Note: The crash happens in the second test case when using uninitialized memory, and therefore doesn't happen with ASAN.
2023-11-10refactor: change some xstrndup() and xstrnsave() to xmemdupz() (#25959)zeertzjq1
When the given length is exactly the number of bytes to copy, xmemdupz() makes the intention clearer.
2023-09-30build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq1
2023-08-07refactor(api): use typed keysetsbfredl1
Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata
2023-06-07refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)Famiu Haque1
Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options.
2023-03-25feat(api): nvim_exec2(), deprecate nvim_exec() #19032Evgeni Chasnovski1
Problem: The signature of nvim_exec() is not extensible per ":help api-contract". Solution: Introduce nvim_exec2() and deprecate nvim_exec().
2023-01-15refactor: fix IWYU mapping file and use IWYU (#21802)dundargoc1
Also add the EXITFREE definition to main_lib rather than the nvim target, as the header generation needs the EXITFREE flag to work properly.
2022-11-28refactor: replace char_u with chardundargoc1
Work on https://github.com/neovim/neovim/issues/459
2022-11-26refactor: replace char_u with charDundar Göc1
Work on https://github.com/neovim/neovim/issues/459
2022-11-15build: allow IWYU to fix includes for all .c filesdundargoc1
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.
2022-11-07vim-patch:8.2.3751: cannot assign a lambda to an option that takes a functionzeertzjq1
Problem: Cannot assign a lambda to an option that takes a function. Solution: Automatically convert the lambda to a string. (Yegappan Lakshmanan, closes vim/vim#9286) https://github.com/vim/vim/commit/6409553b6e3b4de4e1d72b8ee5445595214581ff Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2022-08-24refactor(api): provide a temporary copy solution for nvim_call_atomicbfredl1
Make the copy_object() family accept an optional arena. More than half of the callsites should be refactored to use an arena later anyway.
2022-08-12vim-patch:8.1.1689: profiling code is spread outzeertzjq1
Problem: Profiling code is spread out. Solution: Move more profiling code to profiler.c. (Yegappan Lakshmanan, closes vim/vim#4668) https://github.com/vim/vim/commit/660a10ad41c14363326f83451c3c425201923119
2022-05-11refactor: replace char_u variables and functions with charDundar Goc1
Work on https://github.com/neovim/neovim/issues/459
2022-05-09refactor: replace char_u variables and functions with charDundar Goc1
Work on https://github.com/neovim/neovim/issues/459
2022-04-13refactor: add pure attribute to pure functionsDundar Göc1
This will allow compilers that support the pure attribute to make further optimizations to functions.
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.
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-29refactor(api): break out Vim script functions to its own fileBjörn Linse1
2021-10-29refactor(api): break out vim_to_object/object_to_vim to own fileBjörn Linse1
2021-09-19refactor: format with uncrustify #15722dundargoc1
2021-02-07option: use char* for get_option_value() paramJan Edmund Lazo1
'name' param is casted to char_u* within get_option_value(). Most calls to get_option_value() cast arg to 'name' from char to char_u. Remove these pointless type casts.
2019-12-02API: deprecate nvim_command_outputJustin M. Keyes1
2019-09-14Context: rename "buflist" => "bufs"Justin M. Keyes1
Given the other type names "jumps", "vars", etc., the name "buflist" is somewhat unintuitive.
2019-07-27API: Context: save/restoreAbdelhakeem1
2019-07-27API: ContextJustin M. Keyes1