TabbyML / tabby

Self-hosted AI coding assistant
https://tabby.tabbyml.com/
Other
21.05k stars 955 forks source link

[VSCode] Combine all the chat streaming edit steps as one undo-redo step #2830

Closed wsxiaoys closed 2 weeks ago

wsxiaoys commented 1 month ago

Please describe the feature you want As the chat editing is applied multi times as streaming, it requires a lot of ctrl+z for user to undo it.


Please reply with a 👍 if you want this feature.

Sma1lboy commented 1 month ago

I'll take this one if nobody else is doing it. I'll update the PR ASAP :^)

icycodes commented 1 month ago

Please see https://github.com/TabbyML/tabby/blob/main/clients/tabby-agent/src/lsp/protocol.ts#L379 for the current implementation. The current implementation uses the LSP method workspace/applyEdit multiple times to make the edit, which does not have the undo-redo parameters. In VSCode, there is an interface supporting setting an undo-redo stop programmatically.

My suggested approach

  1. Extend the current workspace/applyEdit to add relevant parameters. Alternatively, add a new server-to-client method tabby/workspace/applyEdit to be used primarily.
  2. Implement setting undo-redo stop on the server-side using new parameters.
  3. Add a middleware to process the extended workspace/applyEdit or add new support for tabby/workspace/applyEdit.
wsxiaoys commented 2 weeks ago

released in 1.10