Skip to content

fix(chat): styling of in-progress code blocks

Tomas Vik requested to merge tv/2024-07/fix-in-progress-chat-highlighting into main

Description

The gitlab-ui Chat component overrode styles for the chat messages, breaking the colors of in-progress code blocks.

before after
Screenshot_2024-07-29_at_13.05.02 Screenshot_2024-07-29_at_13.04.32

Related Issues

Fixed as a part of gitlab-org/editor-extensions/gitlab-visual-studio-extension#138 (moved)

How has this been tested?

You can write a prompt that generates a code block (e.g. how to restructure objects in JS?) and see the code blocks having better color (see screenshots above)

If you want to inspect the code with development tools (OPTION+I in development host), you want to apply this snippet that prevents the final GitLab-rendered message from overriding the in-progress version of the message

diff --git a/src/common/chat/gitlab_chat_api.ts b/src/common/chat/gitlab_chat_api.ts
index a465daf6..1910a43a 100644
--- a/src/common/chat/gitlab_chat_api.ts
+++ b/src/common/chat/gitlab_chat_api.ts
@@ -222,9 +222,9 @@ export class GitLabChatApi {
       }
       await messageCallback(msg);
     });
-    channel.on('fullMessage', async message => {
+    channel.on('fullMessage', async () => {
       fullMessageReceived = true;
-      await messageCallback(message);
+      // await messageCallback(message);
 
       if (subscriptionId) {
         cable.disconnect();

(pbpaste | git apply)

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

Merge request reports

Loading