feat: load clice server plugins#345
Draft
Myriad-Dreamin wants to merge 15 commits intoclice-io:mainfrom
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
494ab19 to
09acba6
Compare
3db850d to
e9340ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support to customize clice through server plugins. You can implement a clice server plugin to extend clice's functionality.
Use case
When you use
cliceas LSP backend of LLM agents, e.g. claude code, you can add plugin to provide some extra features.Writing a plugin
When a plugin is loaded by the server, it will call
clice_get_server_plugin_infoto obtain information about this plugin and about how to register its customization points.This function needs to be implemented by the plugin, see the example below:
Compiling a plugin
The plugin must be compiled with the same dependencies and compiler options as clice, otherwise it will cause undefined behavior.
Loading plugins
For security reasons, clice does not allow loading plugins through configuration files, but must specify the plugin path through command line options.
When
clicestarts, it will load all plugins specified in the command line. You can specify the plugin path through the--plugin-pathoption.Getting content of
CLICE_PLUGIN_DEF_HASHThere are two values to return in the
clice_get_server_plugin_infofunction.CLICE_PLUGIN_API_VERSIONis used to ensure compability of theclice_get_server_plugin_infofunction between the plugin and the server.CLICE_PLUGIN_DEF_HASHis used to ensure the consistency of the C++ declarations between the plugin and the server.To debug the content of
CLICE_PLUGIN_DEF_HASH, you can run following command: