aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/defs.h
Commit message (Collapse)AuthorAge
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* refactor: replace manual header guards with #pragma oncedundargoc2023-11-12
| | | | | It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard.
* refactor(api): use typed keysetsbfredl2023-08-07
| | | | | Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata
* test: spellcheck :help (vimdoc) files #24109Justin M. Keyes2023-06-22
| | | | | | | 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).
* refactor(api): make typed dicts appear as types in the source codebfredl2023-04-07
| | | | | | | | | | | | | | | | | | | | | problem: can we have Serde? solution: we have Serde at home This by itself is just a change of notation, that could be quickly merged to avoid messy merge conflicts, but upcoming changes are planned: - keysets no longer need to be defined in one single file. `keysets.h` is just the initial automatic conversion of the previous `keysets.lua`. keysets just used in a single api/{scope}.h can be moved to that file, later on. - Typed dicts will have more specific types than Object. this will enable most of the existing manual typechecking boilerplate to be eliminated. We will need some annotation for missing value, i e a boolean will need to be represented as a TriState (none/false/true) in some cases. - Eventually: optional parameters in form of a `Dict opts` final parameter will get added in some form to metadata. this will require a discussion/desicion about type forward compatibility.
* fix(ui-ext): log and clear error in ui_comp_event (#21147)Andrew Willette2022-11-30
| | | | | | | | | | | | | * fix: log and clear error in ui_comp_event * fix: handling error in each map_foreach_value iteration * fix: handling error decl in for_each loop * fix: updating initerr to const, removing initerr free-ing * fix: using ERROR_SET for error check * fix: wrapping ERROR_INIT in parens to allow for including inside macro
* refactor: clang-tidy fixes to silence clangd warning (#20683)dundargoc2022-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | * refactor: readability-uppercase-literal-suffix * refactor: readability-named-parameter * refactor: bugprone-suspicious-string-compare * refactor: google-readability-casting * refactor: readability-redundant-control-flow * refactor: bugprone-too-small-loop-variable * refactor: readability-non-const-parameter * refactor: readability-avoid-const-params-in-decls * refactor: google-readability-todo * refactor: readability-inconsistent-declaration-parameter-name * refactor: bugprone-suspicious-missing-comma * refactor: remove noisy or slow warnings
* refactor: move klib out of src/nvim/ #20341dundargoc2022-09-25
| | | | It's confusing to mix vendored dependencies with neovim source code. A clean separation is simpler to keep track of and simpler to document.
* perf(ui): unpack grid_line (screen contents) directlybfredl2022-07-19
|
* perf(ui): reduce allocation overhead when encoding "redraw" eventsbfredl2022-06-20
| | | | | | | | | | | | | | | | | Note for external UIs: Nvim can now emit multiple "redraw" event batches before a final "flush" event is received. To retain existing behavior, clients should make sure to update visible state at an explicit "flush" event, not just the end of a "redraw" batch of event. * Get rid of copy_object() blizzard in the auto-generated ui_event layer * Special case "grid_line" by encoding screen state directly to msgpack events with no intermediate API events. * Get rid of the arcane notion of referring to the screen as the "shell" * Array and Dictionary are kvec_t:s, so define them as such. * Allow kvec_t:s, such as Arrays and Dictionaries, to be allocated with a predetermined size within an arena. * Eliminate redundant capacity checking when filling such kvec_t:s with values.
* refactor: uncrustify #16090dundargoc2021-10-29
|
* refactor: format header files with uncrustify #15877dundargoc2021-10-09
| | | | | | * refactor: format header files with uncrustify * fixup(justin): skip formatting of terminfo_defs.h * fixup: force winsock2 to be included first * fixup: simplify disable/enable directive to "uncrustify:off/on"
* refactor(api): handle option dicts properlyBjörn Linse2021-10-03
| | | | | | | Do not copy a lot of lua strings (dict keys) to just strequal() them Just compare them directly to a dedicated hash function. feat(generators): HASHY McHASHFACE
* api: allow nvim_buf_attach from lua using callbacksBjörn Linse2019-06-04
|
* RPC: eliminate NO_RESPONSEJustin M. Keyes2019-04-12
| | | | | | | | | | Using a sentinel value in the response-id is ambiguous because the msgpack-rpc spec allows all values (including zero/max). And clients control the id, so we can't be sure they won't use the sentinel value. Instead of a sentinel value, check the message type explicitly. ref #8850
* multigrid: reorganize types and global varaiblesBjörn Linse2018-12-31
|
* build/MSVC: fix "C4028: formal parameter different from declaration"Justin M. Keyes2018-03-18
|
* Merge branch 'master' into luaviml'/luaZyX2017-05-08
|\
| * api/internal: Remove `set` field from Error type.Justin M. Keyes2017-04-23
| |
| * api: Do not truncate errors <1 MB. #6237Sander Bosma2017-04-23
| | | | | | | | Closes #5984
* | api: Use a form of `1 << 63` for INTERNAL_CALL_MASKZyX2017-03-27
| |
* | api: Allow kObjectTypeNil to be zero without breaking compatibilityZyX2017-03-27
| |
* | api: Reserve more numbers for internal callsZyX2017-03-27
| | | | | | | | | | | | Reasoning; currently INTERNAL_CALL is mostly used to determine whether it is needed to deal with NL-used-as-NUL problem. This code is useful for nvim_… API calls done from VimL, but not for API calls done from lua, yet lua needs to supply something as channel_id.
* | executor/converter: Make nlua_pop_Object not recursiveZyX2017-03-27
|/
* object_to_vim: Fix buffer/window/tabpage conversion on BE systemsJames McCoy2016-11-02
| | | | | | | | | | | Since data.integer is a different (larger) integer type than data.{buffer,window,tabpage}, we cannot abuse the union by using data.integer to access the value for all 4 types. Instead, remove the {buffer,window,tabpage} members and always use the integer member. In order to accomodate this, perform distinct validation and coercion between the Integer type and Buffer/Window/Tabpage types in object_to_vim, msgpack_rpc helpers, and gendispatch.lua.
* api: call multiple methods atomically (useful in async contexts)Björn Linse2016-10-22
| | | | remove unused response_id parameter of handle_nvim_... helpers
* api: When calling get/set_lines from vimL, don't convert between "\n" and "\0".Björn Linse2016-08-31
|
* api: unify buffer numbers and window ids with handlesBjörn Linse2016-08-31
| | | | also allow handle==0 meaning curbuf/curwin/curtab
* msgpack_rpc: Also make msgpack_from_*/msgpack_to_* functions not recurZyX2016-06-24
| | | | | | This removes some stack overflows in new test regarding deeply nested variables. Now in place of crashing vim_to_object/msgpack_rpc_from_object/etc it crashes clear_tv with stack overflow.
* *: Fix new linter errorsZyX2016-06-11
|
* api: Add warnings about the returned value to \*del_var functionsZyX2016-04-18
|
* msgpack: Allow notifications to execute commands.Scott Prager2015-04-13
| | | | | | | | | | Consider: `let vim = rpcstart('nvim', ['--embed'])` Allows `rpcnotify(vim, ...)` to work like an asynchronous `rpcrequest(nvim, ...)`. Helped-by: Michael Reed <m.reed@mykolab.com> Helped-by: Justin M. Keyes <>
* api/msgpack-rpc: Improve error infrastructureThiago de Arruda2014-09-18
| | | | | | | | | | | | | | | | - Add error type information to `Error` - Rename `set_api_error` to `api_set_error` for consistency with other api_* functions/macros. - Refactor the api_set_error macro to accept formatted strings and error types - Improve error messages - Wrap error messages with gettext macro - Refactor msgpack-rpc serialization to transform Error instances into [type, message] arrays - Add error type information to API metadata - Normalize nvim->client and client->nvim error handling(change channel_send_call to accept an Error pointer instead of the `errored` boolean pointer) - Use macro to initialize Error structures
* api metadata: Allow typed container information in api functionsThiago de Arruda2014-09-12
| | | | | | | | Adapt gendeclarations.lua/msgpack-gen.lua to allow the `ArrayOf(...)` and `DictionaryOf(...)` types in function headers. These are simple macros that expand to Array and Dictionary respectively, but the information is kept in the metadata object, which is useful for building clients in statically typed languages.
* api/msgpack-rpc: Refactor metadata object constructionThiago de Arruda2014-09-12
| | | | | | | | | Instead of building all metadata from msgpack-gen.lua, we now merge the generated part with manual information(such as types and features). The metadata is accessible through the api method `vim_get_api_info`. This was done to simplify the generator while also increasing flexibility(by being able to add more metadata)
* api: initialize capacity in the array_dict_macroThiago de Arruda2014-09-12
|
* api/msgpack-rpc: Remove Position type, using arrays instead.Thiago de Arruda2014-09-12
|
* api/msgpack-rpc: Parse type information from api/private/defs.hThiago de Arruda2014-09-12
| | | | | | | Enhance msgpack-gen.lua to extract custom api type codes from the ObjectType enum in api/private/defs.h. The type information is made available from the api metadata and clients can use to correctly serialize/deserialize these types using msgpack EXT type.
* api/msgpack-rpc: Remove specialized array typesThiago de Arruda2014-09-12
| | | | | | | | | | | | | | | | | Specialized array types(BufferArray, WindowArray, etc) were added to the API for two main reasons: - msgpack used to lack a way of serializing appliaction-specific types and there was no obvious way of making an API function accept/return arrays of custom objects such as buffers(which are represented as integers, so clients didn't have a way to distinguish from normal numbers) - Let clients in statically-typed languages that support generics have a better typed API With msgpack 2.0 EXT type the first item is no longer a factor and this commit starts by removing the specialized array types. The second item will be addressed in the future by making the API metadata return extra useful information for statically-typed languages.
* channel/msgpack_rpc: Refactor API dispatchingThiago de Arruda2014-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is how API dispatching worked before this commit: - The generated `msgpack_rpc_dispatch` function receives a the `msgpack_packer` argument. - The response is incrementally built while validating/calling the API. - Return values/errors are also packed into the `msgpack_packer` while the final response is being calculated. Now the `msgpack_packer` argument is no longer provided, and the `msgpack_rpc_dispatch` function returns `Object`/`Error` values to `msgpack_rpc_call`, which will use those values to build the response in a single pass. This was done because the new `channel_send_call` function created the possibility of having recursive API invocations, and this wasn't possible when sharing a single `msgpack_sbuffer` across call frames(it was shared implicitly through the `msgpack_packer` instance). Since we only start to build the response when the necessary information has been computed, it's now safe to share a single `msgpack_sbuffer` instance across all channels and API invocations. Some other changes also had to be performed: - Handling of the metadata discover was moved to `msgpack_rpc_call` - Expose more types as subtypes of `Object`, this was required to forward the return value from `msgpack_rpc_dispatch` to `msgpack_rpc_call` - Added more helper macros for casting API types to `Object` any
* api: Enable usage of Arrays and Dictionaries as [k]vectorsThiago de Arruda2014-06-18
| | | | | - Rename a/n/m to items/size/capactity in kvec.h - Add capactity field to Arrays/Dictionaries
* Initialize Object, PositionJustin M. Keyes2014-05-31
| | | | | fix #778 thanks @genisaguilar
* Build: Add more files to clint-files.txt and fix errorsThiago de Arruda2014-05-26
|
* API: Refactor: Duplicate/free string arguments coming from msgpackThiago de Arruda2014-05-26
| | | | | | | | | When receiving strings *from* msgpack, we don't need to duplicate/free since the data only lives in the msgpack parse buffer until the end of the call. But in order to reuse `msgpack_rpc_free_object` when sending event data(which is sent *to* msgpack), Strings must be freed, which means they must also be allocated separately.
* API: Refactor: Use macro for initializing all arraysThiago de Arruda2014-05-23
|
* API: Refactor: Return handles instead of indexesThiago de Arruda2014-05-23
| | | | | | | - Define specialized arrays for each remote object type - Implement msgpack_rpc functions for dealing with the new types - Refactor all functions dealing with buffers, windows and tabpages to return/accept handles instead of list indexes.
* API: Refactor: Change the integer type of remote objects to uint64_tThiago de Arruda2014-05-23
|
* API: Refactor: Add macro infrastructure for typed arraysThiago de Arruda2014-05-23
| | | | | - Add macros supporting typed arrays in the remote API - Refactor StringArray-related functions on top of the new macros
* API: Refactor: Generalize buffer, window and tabpage types/functionsThiago de Arruda2014-05-23
| | | | | - Extract remote types definitions into a macro - Extract msgpack_rpc helper functions for remote types into a macro
* API: Refactor: Move non-public files to private subdirectoryThiago de Arruda2014-05-23