Open marrej opened 10 months ago
Will this PR merge in the future?
happy to update the PR to the latest version if @jrieken will agree to have it enabled. Although lets note that this is not the clean way how this should be done. Rather the functionality should be exposed via a dedicated API and best have the Inline diff totally separated (as a whole new Core Component).
That being said, the dedicated API could be added easily, with the provider being registered automatically for extensionHost (While allowing only the mentioned command to be called) as intermediate step, allowing then to switch the functionality in the background of the API to a separate inline Diff with edit panel.
(Happy to add that in if agreed :))
Utilizing the Inline chat as means for showing edits.
TLDR; The Inline chat could be cheaply extended to provide In editor edits. (PR https://github.com/microsoft/vscode/pull/190258 )
Intro
At the moment the experimental inline chat, provides very interesting way how to display edits that are restricted to a single file (TextEdits). And assuming that this API is something that the extension authors are interested in (e.g. see https://github.com/microsoft/vscode/issues/85682 ) might provide a great addition to the extension author toolbelt.
The main benefits being (compared to Refactor Preview), that for small edits/single file edits:
At the same time, I realise that the Inline chat purpose is to Chat, but at the moment it seems that the edit preview logic is fused with the internals of the chat and can not be easily extracted.
Proposal
Extend the existing
inlineChat.start
(or introduce a new command e.g.inlineChat.showEdit
) which would allow to take inedits: vscode.TextEdit[]
(or vscode.WorkspaceEdit, and add additional checks in the inlineChat). The edits would be added to the options (which are passed to theInlineChatController
), and would modify the state flow a bit. AfterINIT_UI
, break the_nextState
and Attach the edit as a new response, then continue the_nextState
withAPPLY_EDIT
If edits are provided in the options, then hide parts of the toolbar (the conversational pieces), and keep only the actions.Done in PR https://github.com/microsoft/vscode/pull/190258
Additional nice to have
VS Code version: 1.81.1 OS version: ChromeOS 114.0.5735.239