aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
Commit message (Collapse)AuthorAge
* msgpack-rpc: Improve logging of msgpack-rpc messagesThiago de Arruda2014-10-23
| | | | | | | | | | - Expose more logging control from the log.c module(get log stream and omit newlines) - Remove logging from the generated functions in msgpack-gen.lua - Refactor channel.c/helpers.c to log every msgpack-rpc payload using msgpack_object_print(a helper function from msgpack.h) - Remove the api_stringify function, it was only useful for logging msgpack-rpc which is now handled by msgpack_object_print.
* debug: Improve debugging of msgpack-rpc requestsThiago de Arruda2014-10-22
| | | | | | - Add the api_stringify function to display API objects - Use api_stringify to display request arguments and return values in DLOG statements.
* api: Add FUNC_ATTR_DEFERRED attribute to a number of functionsThiago de Arruda2014-10-21
| | | | | Any function that can directly mutate the screen or execute vimscript had the attribute applied.
* msgpack-rpc: Create subdirectory for msgpack-rpc modulesThiago de Arruda2014-10-21
| | | | | Create the msgpack_rpc subdirectory and move all modules that deal with msgpack-rpc to it. Also merge msgpack_rpc.c into msgpack_rpc/helpers.c
* Use line-specific method names where possible to remove ambiguity and ↵Paul Jolly2014-10-01
| | | | possibility of future clashes
* FOR_ALL_WINDOWS_IN_TAB and local variables in FOR_ALL_TAB_WINDOWSWayne Rowcliffe2014-09-22
|
* 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: Implement `vim_report_error` functionThiago de Arruda2014-09-12
| | | | | This function is used to report errors caused by remote functions called by channel_send_call
* api: initialize capacity in the array_dict_macroThiago de Arruda2014-09-12
|
* provider: Major refactorThiago de Arruda2014-09-12
| | | | | | | | | | | | | | | | | - Providers for features are now registered as a unit. For example, instead of calling `register_provider("clipboard_get")` and `register_provider("clipboard_set")`, clients call `register_provider("clipboard")` and nvim will assume it implements all methods of the "clipboard" feature - Bootstrapping code was removed. With the `api_spawn` function exposed to vimscript, it's no longer necessary and will be handled by plugins distributed with nvim. - Now the `has` function will return true if there's a live channel that has registered as a provider for the feature. - 'initpython'/'initclipboard' options were removed - A new API function was exposed: `vim_discover_features` which returns an object with information about pluggable features such as 'python' or 'clipboard'
* api/msgpack-rpc: Refactor msgpack_rpc_helpers.{c,h}Thiago de Arruda2014-09-12
| | | | | | - Move helpers that are specific to API types to api/private/helpers.{c,h} - Include headers with generated declarations - Delete unused macros
* 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.
* coverity/62620: fix uninitialized scalar variablePaul Burlumi2014-08-24
|
* Add API vim_replace_termcodesRui Abreu Ferreira2014-08-07
| | | | - Add API function to call replace_termcodes
* Refactor vim_feedkeys and f_feedkeysRui Abreu Ferreira2014-08-07
| | | | | | | | - To clean up the mix between feedkeys and replace_termcodes the vim_feedkeys API function now does the same thing as the vimscript feedkeys() function - The original f_feedkeys() function now calls the vim_feedkeys() function from the API
* Add helper cstr_as_string()Rui Abreu Ferreira2014-08-07
| | | | - Add nocopy helper alternative to cstr_to_string
* Return bool from find_win_for_buf #1023Wayne Rowcliffe2014-08-07
|
* api: make buffer_{get,set}_slice automatically assume `include_end`Thiago de Arruda2014-07-17
| | | | | This is for compatibility with python-vim interface: When passing an end index with a value higher than the last index, assume the `include_end` flag
* provider: New module used to expose extension points for core servicesThiago de Arruda2014-07-17
| | | | | | | | | | | | | | | | | Introducing the concept of providers: co-processes that talk with the editor through the remote API and provide implementation for one or more core services. The `provider_register` function and it's API wrapper can be used by channels that want to self-register as a service provider. Some old builtin vim features will be re-implemented as providers. The `provider_has_feature` function is used to check if a provider implementing a certain feature is available(It will be called by the `has` vimscript function to check for features in a vim-compatible way) This implements the provider module without exposing any extension points, which will be done in future commits.
* api: Refactor write_msg to use separate out/err buffersThiago de Arruda2014-07-17
|
* Use strict function prototypes #945Pavel Platto2014-07-14
| | | | | | | | | | | | | | | | | | | `-Wstrict-prototypes` warn if a function is declared or defined without specifying the argument types. This warning disallow function prototypes with empty parameter list. In C, a function declared with an empty parameter list accepts an arbitrary number of arguments when being called. This is for historic reasons; originally, C functions didn't have prototypes, as C evolved from B, a typeless language. When prototypes were added, the original typeless declarations were left in the language for backwards compatibility. Instead we should provide `void` in argument list to state that function doesn't have arguments. Also this warning disallow declaring type of the parameters after the parentheses because Neovim header generator produce no declarations for old-stlyle prototypes: it expects to find `{` after prototype.
* Remove stdbool.h from files which don't need itPavel Platto2014-07-11
| | | | | | | Done by manual inspection of the output of this script: grep -r -l -w "bool\|true\|false" * | grep 'c$\|h$' > has_bool grep -r -l "stdbool.h" * | grep 'c$\|h$' > has_include grep -F -x -v -f has_bool has_include
* Include stdbool.h in some files which use itPavel Platto2014-07-11
| | | | | | | Done by manual inspection of the output of this script: grep -r -l -w "bool\|true\|false" * | grep 'c$\|h$' > has_bool grep -r -l "stdbool.h" * | grep 'c$\|h$' > has_include grep -F -x -v -f has_include has_bool
* move errno.h include out of vim.hBrandon Coleman2014-07-09
|
* move assert.h include out of vim.hBrandon Coleman2014-07-09
|
* move ascii.h include out of vim.hBrandon Coleman2014-07-09
|
* Add vim_feedkeys API functionRui Abreu Ferreira2014-07-07
| | | | | | | | | | | - New API function to push data to the typeahead buffer - this should equivalent to the vimscript feedkeys() function - In Vim there was a --remote-send command to insert input into a Vim server instance. Besides accepting key sequences it also translated special keys such as <CR> or <Leader>, backslash notation is ignored. This commit backports the original Vim handler for --remote-send as a bool option for vim_feedkeys() - vim-patch:0
* 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
* channel: Implement the 'channel_send_call' functionThiago de Arruda2014-06-24
| | | | | | | | This function is used to send RPC calls to clients. In contrast to `channel_send_event`, this function will block until the client sends a response(But it will continue processing requests from that client). The RPC call stack has a maximum depth of 20.
* channel/msgpack_rpc: Refactor msgpack_rpc_notification/serialize_eventThiago de Arruda2014-06-24
| | | | | | | | | | - Generalize some argument names(event type -> event name, event data -> event arg) - Rename serialize_event to serialize_message - Rename msgpack_rpc_notification to msgpack_rpc_message - Extract the message type out of msgpack_rpc_message - Add 'id' parameter to msgpack_rpc_message/serialize_message to create messages that are not notifications
* api: Add helper macros for dealing with API type castsThiago de Arruda2014-06-18
|
* 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
* api: Rename find_{buffer,window,tabpage}Thiago de Arruda2014-06-18
| | | | | They were renamed to find_{buffer,window,tabpage}_by_handle to avoid conflicts with existing functions of the same name.
* Prevent null-pointer deference during vim_eval #785Andrew Chin2014-06-10
| | | | | If the eval_expr call in vim_eval returns NULL, a null-pointer deference would happen a few frames down, in vim_to_object_rec
* api: unify string conversions, simplify interopNicolas Hillegeer2014-06-08
| | | | | | | | | | | | | - The data member of String's can now be passed directly to functions expecting C strings, as we now guarantee that they are NUL-terminated. This obviates the need to use xstrndup and free, simplifying code and enhancing performance. - Use xmemdupz instead of xstrndup for converting String's into C strings. It's faster because it doesn't calculate strlen(string.data) (which is unnecesary as that information is already provided in string.size anyway). - Use cstr_to_string to convert from C strings to String, it is both shorter and faster than the usual strlen/xstrndup combo, which calls strlen twice. cstr_to_string internally calls strlen and then xmemdupz.
* api: also NUL-terminate Strings made from cstrsNicolas Hillegeer2014-06-08
| | | | | | I believe we can now mostly assume that all encountered String's data members are safe to pass into functions that accept C strings. That should simplify interop with C string code.
* api: remove some redundant string copiesNicolas Hillegeer2014-06-08
| | | | | Now that incoming Pascal strings are NULL-terminated by default, we can skip some spurious copies.
* text: remove useless arg from mb_string2cellsNicolas Hillegeer2014-06-08
| | | | | | | | | | | | | | | | | | mb_string2cells was always called like mb_string2cells(..., -1) so that was the only codepath that was tested. @tarruda was the first to try to input an actual length, after which valgrind detected that funny business was going on. It's not even possible to do the right thing with the current text codec infrastructure: they all assume to be working with C strings. Meaning that if there is no NUL-terminator, they will happily keep on reading past the end of Pascal strings. Ergo, passing the length parameter is moot. The condition in the for-loop was wrong as well (but that's no longer relevant). Also change the return value to size_t, by analogy with strlen. ref: https://github.com/neovim/neovim/commit/677d30d7966dd2766bbf20665791c568dacc427a
* Add automatic generation of headersZyX2014-06-02
| | | | | | | | | | | | | | | | | - The 'stripdecls.py' script replaces declarations in all headers by includes to generated headers. `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'` was used for this. - Add and integrate gendeclarations.lua into the build system to generate the required includes. - Add -Wno-unused-function - Made a bunch of old-style definitions ANSI This adds a requirement: all type and structure definitions must be present before INCLUDE_GENERATED_DECLARATIONS-protected include. Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is the only exception.
* Move documentation from function declarations to definitionsZyX2014-06-02
| | | | Uses a perl script to move it (scripts/movedocs.pl)
* Initialize Object, PositionJustin M. Keyes2014-05-31
| | | | | fix #778 thanks @genisaguilar
* Refactor: Redefine `Map(T)` as a more generic `Map(T, U)` macroThiago de Arruda2014-05-30
| | | | | To replace `Map(T)`, a new macro `PMap(T)` was defined as `Map(T, ptr_t)` for writing maps that store pointers with less boilerplate
* Extract cursor.h from misc{1,2}.h and memline.hHinidu2014-05-28
|
* API: Events: Add functions for {un}subscribing to broadcasted eventsThiago de Arruda2014-05-28
|
* API: Bugfix: Remove possible double-free in buffer_get_lineThiago de Arruda2014-05-28
|
* API: Bugfix: Remove memory leak from buffer_get_lineThiago de Arruda2014-05-26
|