Skip to content

feat: implement dummy workspace/executeCommand#344

Draft
Myriad-Dreamin wants to merge 2 commits intoclice-io:mainfrom
Myriad-Dreamin:dummy-exec-command
Draft

feat: implement dummy workspace/executeCommand#344
Myriad-Dreamin wants to merge 2 commits intoclice-io:mainfrom
Myriad-Dreamin:dummy-exec-command

Conversation

@Myriad-Dreamin
Copy link
Contributor

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

This PR focuses on adding protocol definitions about workspace/executeCommand. clice may add specific custom commands in future.

Summary by CodeRabbit

  • New Features
    • Added workspace command execution support to the language server, enabling clients to invoke custom commands with flexible parameter handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2026

📝 Walkthrough

Walkthrough

Adds LSP workspace/executeCommand support by introducing a JSON value type alias in the protocol, defining ExecuteCommandParams and TextDocumentParams structures, and implementing a server handler for command execution requests.

Changes

Cohort / File(s) Summary
Protocol JSON Support
include/Protocol/Basic.h
Added LLVM JSON support via #include <llvm/Support/JSON.h> and public type alias using any = llvm::json::Value; in clice::proto namespace.
Execute Command Feature Definition
include/Protocol/Feature/ExecuteCommand.h
New header defining two protocol structures: ExecuteCommandParams (command string, arguments array) and TextDocumentParams (textDocument identifier).
Protocol Integration
include/Protocol/TextDocument.h
Added include for the new ExecuteCommand feature header.
Server Handler Declaration
include/Server/Server.h
Added private member function declaration on_execute_command(proto::ExecuteCommandParams).
Server Handler Implementation
src/Server/Server.cpp
Registered workspace/executeCommand handler in constructor and implemented on_execute_command() handler returning empty JSON value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop and command! 💫
JSON hops through the protocol's door,
ExecuteCommand takes its place,
The server listens, ready to soar.
New handlers bloom in the code—
Thump-thump goes the LSP rabbit's abode! 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: implementing a dummy workspace/executeCommand handler with protocol definitions and JSON support for arbitrary values.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 marked this pull request as ready for review January 10, 2026 15:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @src/Server/Server.cpp:
- Around line 105-106: The initialize response currently omits the
executeCommandProvider capability; update the Server::on_initialize
implementation to populate InitializeResult.capabilities.executeCommandProvider
with the list of commands the server supports (the same commands registered with
register_callback<&Server::on_execute_command>), e.g. set
executeCommandProvider.commands to that command list (and set workDoneProgress
as appropriate), and remove the FIXME in the protocol header so clients can
discover supported commands.
🧹 Nitpick comments (1)
include/Protocol/Feature/ExecuteCommand.h (1)

12-15: Remove unused TextDocumentParams struct.

The TextDocumentParams struct is defined in this header but is not used anywhere in the codebase. It can be safely removed.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53689f2 and feaee0e.

📒 Files selected for processing (5)
  • include/Protocol/Basic.h
  • include/Protocol/Feature/ExecuteCommand.h
  • include/Protocol/TextDocument.h
  • include/Server/Server.h
  • src/Server/Server.cpp
🧰 Additional context used
🧬 Code graph analysis (2)
include/Protocol/Feature/ExecuteCommand.h (2)
include/Protocol/Basic.h (1)
  • clice (11-139)
include/Protocol/TextDocument.h (1)
  • clice (27-202)
include/Server/Server.h (1)
src/Server/Server.cpp (2)
  • on_execute_command (189-191)
  • on_execute_command (189-189)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: clice / publish-clice (macos-15, clice.tar.gz, clice-arm64-macos-darwin.tar.gz, clice-symbol.tar.gz, clic...
🔇 Additional comments (7)
include/Protocol/TextDocument.h (1)

14-14: LGTM!

The include is correctly placed in alphabetical order alongside other feature headers.

include/Server/Server.h (1)

195-196: LGTM!

The handler declaration follows the same pattern as other command handlers and is properly positioned within the private interface.

include/Protocol/Basic.h (2)

9-10: LGTM!

The include is properly added to support the JSON value type.


20-21: LGTM!

The any type alias provides a clean abstraction for arbitrary JSON values, consistent with the naming convention used for other protocol type aliases.

src/Server/Server.cpp (1)

189-191: LGTM!

The dummy implementation correctly returns an empty JSON value. Since no commands are currently supported, this no-op behavior is appropriate.

include/Protocol/Feature/ExecuteCommand.h (2)

1-4: LGTM!

The include guard and dependency on Basic.h are correctly set up.


7-10: LGTM!

The ExecuteCommandParams structure correctly implements the LSP protocol definition with a command string and an optional arguments array.

Comment on lines +105 to +106
register_callback<&Server::on_execute_command>("workspace/executeCommand");

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Search for executeCommandProvider or ExecuteCommandOptions registration
rg -n -A3 -B3 'executeCommandProvider|ExecuteCommandOptions' --type=cpp

Repository: clice-io/clice

Length of output: 564


🏁 Script executed:

# Also search for the initialize handler and response building
rg -n -A10 'initialize|on_initialize' --type=cpp src/Server/

Repository: clice-io/clice

Length of output: 3132


🏁 Script executed:

# Search for where capabilities are set or advertised
rg -n 'capabilities|Capabilities' --type=cpp src/Server/ | head -30

Repository: clice-io/clice

Length of output: 2018


🏁 Script executed:

# Get the full on_initialize function implementation
sed -n '5,103p' src/Server/Lifecycle.cpp

Repository: clice-io/clice

Length of output: 3522


The command handler is registered correctly, but executeCommandProvider capability is not advertised in the initialize response.

The handler registration at line 105 is correct. However, the on_initialize response in src/Server/Lifecycle.cpp does not set the executeCommandProvider capability, which clients rely on to discover supported commands. Per LSP specification, servers must advertise this capability for clients to know what commands are available. This is currently marked as FIXME in the protocol header file and should be implemented.

🤖 Prompt for AI Agents
In @src/Server/Server.cpp around lines 105 - 106, The initialize response
currently omits the executeCommandProvider capability; update the
Server::on_initialize implementation to populate
InitializeResult.capabilities.executeCommandProvider with the list of commands
the server supports (the same commands registered with
register_callback<&Server::on_execute_command>), e.g. set
executeCommandProvider.commands to that command list (and set workDoneProgress
as appropriate), and remove the FIXME in the protocol header so clients can
discover supported commands.

@Myriad-Dreamin Myriad-Dreamin marked this pull request as draft January 10, 2026 18:26
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