Closed odisseus closed 2 months ago
Here's some pointers to get started:
new CodeActionProvider()
(I know...)You need to do a design to reuse the logic in FIxupCodeAction.
Your main choice is at what level to make that reuse happen. Trace back through Agent and vscode-shim.ts to see how much of VSCode code actions API is wired up, how much of diagnostics are wired up, etc.
If the wiring is in place, do whatever last bit of plumbing to connect it end-to-end with invoking a JetBrains action and triggering a JetBrains edit.
If the wiring is not in place, you have basically two choices:
Either of these choices can work and have different tradeoffs. The first approach can be high leverage and not disturb the TypeScript implementation used by VSCode... if the VSCode shim API fidelity is good, it will "just work."
The second approach is more design work but the results are better because you can fit your API abstraction level to the task at hand.
For example, Edits basically uses the second approach (there's high-level Agent protocol like editTask/accept
etc. and it calls a FixupControlApplicator object) but it is not a completely black and white choice (at one level of abstraction down, the FixupControlApplicator causes text edits and of course they use the VSCode API --> shims --> Agent --> Kotlin route.)
Hope this helps.
- Add an agent ClientCapability like "I support code action providers" and extend Agent, vscode-shim, Kotlin side to support VSCode code action provider API and pass diagnostics.
I agree and think that adding general CodeActionProvider support to the agent has my preference here. I'm available to pair on this @odisseus if that's helpful?
I'm not so convinced about the general support for CodeActionProvider. I see that the CodeAction can contain not just a source edit, but also an arbitrary VS Code command. In IntelliJ, we may or may not have equivalent commands. Is this field actually used anywhere in Cody?
Partially implements https://github.com/sourcegraph/jetbrains/issues/117.
Test plan