feat: implement dummy workspace/executeCommand#344
feat: implement dummy workspace/executeCommand#344Myriad-Dreamin wants to merge 2 commits intoclice-io:mainfrom
workspace/executeCommand#344Conversation
📝 WalkthroughWalkthroughAdds 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
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 unusedTextDocumentParamsstruct.The
TextDocumentParamsstruct 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
📒 Files selected for processing (5)
include/Protocol/Basic.hinclude/Protocol/Feature/ExecuteCommand.hinclude/Protocol/TextDocument.hinclude/Server/Server.hsrc/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
anytype 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
ExecuteCommandParamsstructure correctly implements the LSP protocol definition with a command string and an optional arguments array.
| register_callback<&Server::on_execute_command>("workspace/executeCommand"); | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Search for executeCommandProvider or ExecuteCommandOptions registration
rg -n -A3 -B3 'executeCommandProvider|ExecuteCommandOptions' --type=cppRepository: 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 -30Repository: clice-io/clice
Length of output: 2018
🏁 Script executed:
# Get the full on_initialize function implementation
sed -n '5,103p' src/Server/Lifecycle.cppRepository: 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.
This PR focuses on adding protocol definitions about
workspace/executeCommand. clice may add specific custom commands in future.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.