This patch adds a simple API allowing LSP plugins to take control of certain Geany built-in features and disabling their implementation in Geany. Currently, autocompletion, calltips, and going to definition/declaration is supported.

Plugins should define the Lsp struct, fill the pointers to the functions implementing the features they override, and register themselves using the lsp_register() call. Similarly, they should unregister themselves using lsp_unregister() when they don't want to provide the Lsp features any more, or, latest, when the plugin gets unloaded.

Each of the currently supported features is implemented using two functions - one checking whether Lsp plugin will override Geany's behavior of this feature, and the other function implementing the feature. For instance for autocompletion:

The Lsp struct is padded with an array large enough to allow additions of many more functions to the struct and allowing binary compatibility with older LSP plugin versions not implementing all the functions. It's just mandatory that all plugins zero-initialize the allocated Lsp struct (either by creating it on the heap or by allocating it using g_new0() or similar function). NULL pointers in this struct are handled gracefully.

The current implementation supports only a single LSP plugin. However, if in the future arises the need for more LSP plugins running in parallel (e.g. a specialized LSP plugin for certain language together with the current "generic" LSP plugin), the implementation could be extended to support a list of Lsp structs and trying to call the functions defined by them one by one. The current interface should already be sufficient to support such an implementation.


You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/3571

Commit Summary

File Changes

(7 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3571@github.com>