Skip to content

feat: load clice server plugins#345

Draft
Myriad-Dreamin wants to merge 15 commits intoclice-io:mainfrom
Myriad-Dreamin:server-plugin
Draft

feat: load clice server plugins#345
Myriad-Dreamin wants to merge 15 commits intoclice-io:mainfrom
Myriad-Dreamin:server-plugin

Conversation

@Myriad-Dreamin
Copy link
Copy Markdown
Contributor

@Myriad-Dreamin Myriad-Dreamin commented Jan 10, 2026

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 clice as 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_info to 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:

extern "C" ::clice::PluginInfo LLVM_ATTRIBUTE_WEAK
clice_get_server_plugin_info() {
  return {
    CLICE_PLUGIN_API_VERSION, "MyPlugin", "v0.1", CLICE_PLUGIN_DEF_HASH,
    [](ServerPluginBuilder builder) {  ... }
  };
}

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 clice starts, it will load all plugins specified in the command line. You can specify the plugin path through the --plugin-path option.

$ clice --plugin-path /path/to/my-plugin.so

Getting content of CLICE_PLUGIN_DEF_HASH

There are two values to return in the clice_get_server_plugin_info function.

  • CLICE_PLUGIN_API_VERSION is used to ensure compability of the clice_get_server_plugin_info function between the plugin and the server.
  • CLICE_PLUGIN_DEF_HASH is 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:

$ git clone https://github.com/clice-io/clice.git
$ cd clice
$ git checkout `clice --version --git-describe`
$ python scripts/plugin-def.py content

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 10, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Myriad-Dreamin Myriad-Dreamin changed the title Server plugin feat: add minimal support to clice server plugins Jan 10, 2026
@Myriad-Dreamin Myriad-Dreamin changed the title feat: add minimal support to clice server plugins feat: add support to load clice server plugins Jan 10, 2026
@Myriad-Dreamin Myriad-Dreamin changed the title feat: add support to load clice server plugins feat: load clice server plugins Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant