VS Code incorrectly renders Duo code blocks, breaking 'Insert at Cursor' functionality
Checklist
-
I'm using the latest version of the extension (see the latest version in the right column of this page) - Extension version: Latest as of May 2025
-
I'm using the latest VS Code version (find the latest version here) - VS Code version: Latest as of May 2025
-
I'm using a supported version of GitLab (see README for the supported version) - GitLab version: Latest on gitlab.com
Summary
VS Code extension incorrectly renders code blocks within Duo chat responses, causing improper formatting and breaking the "Insert at Cursor" functionality. This issue disrupts normal development workflows as users cannot directly use the generated code.
Steps to reproduce
- Open VS Code with the GitLab extension
- Use GitLab Duo to generate code (especially code containing HTML tags or nested code blocks)
- Observe the rendering in VS Code
- Try to use "Insert at Cursor" functionality with the rendered code
What is the current bug behavior?
- Code blocks inside another code block are not rendered correctly in VS Code
- After VS Code fails to render the code correctly, all further code is greyed out
- When using "Insert at Cursor", the code includes special characters for HTML tags and other formatting, making it unusable
- Users are forced to switch context to GitLab UI to copy the correctly rendered code
What is the expected correct behavior?
- Code blocks should render correctly in VS Code, similar to how they appear in the GitLab UI
- "Insert at Cursor" functionality should insert clean, usable code without special characters or formatting issues
- Users should be able to use Duo-generated code directly from VS Code without having to switch context
Relevant logs and/or screenshots
A screenshot was provided showing the difference between the rendering in VS Code (incorrect) and GitLab UI (correct).
I reproduced it in gitlab.com
with latest VScode version and extension- screenshot below:
Possible fixes
This is similar to:
The issue was previously fixed around v17.5 of GitLab but has regressed.
Edited by ŁUKASZ KORBASIEWICZ