feat: implement inserting code snippets
Description
This MR adds insert code block functionality to GitLab Duo Chat in vscode extension.
It relies on the existing functionality DuoChat component provides, and patches the render_gfm
implementation to support inserting code snippets even if GitLab instance is outdated and does not return insert-code-block
custom elements as part of the duo response.
Related Issues
Resolves #1422 (closed)
How has this been tested?
- Open a duo chat without opening any editors
- Ask duo to generate some code.
- Hover on the code block, locate insert code snippet button and press it
- Check that the notification shows that there are no active editors
- Open a code editor
- Press the insert code snippet button again. Check that the code is inserted at the cursor. That should also work with the selection, in this case the selection will be replaced with the code snippet.
Screenshots (if appropriate)
What CHANGELOG entry will this MR create?
-
fix:
Bug fix fixes - a user-facing issue in production - included in changelog -
feature:
New feature - a user-facing change which adds functionality - included in changelog -
BREAKING CHANGE:
(fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog -
None - other non-user-facing changes
Edited by Andrei Zubov