Skip to content

chore: Add WebView Duo chat commands

Description

Allows to run Duo chat-related commands from the editor Context Menu or Command Palette.

  • First commit renamed methods for registering messages to be consistent with LSP naming. This is done as in the next commit we add sendNotification method to the registry so it is somewhat consistent.
  • Second commit registers notifier function in the message registry (similarly to the LS implementation we pass notifier fn that wraps client calls instead of passing client instance). It also adds sendNotification method that will call notifier send notification to the LS.
  • Last commit adds new functionality, specifically when command is run, sends the notification to the LS Duo Chat webview with correct parameters.

Related Issues

Closes #1677 (closed)

How has this been tested?

  1. Link this MR with the LS counterpart MR
npm run watch -- --editor=vscode --packages @gitlab-org/webview-duo-chat-v2 @webview/duo-chat-v2
  1. Enable the feature flag in the extension settings.json: "gitlab.featureFlags.languageServerWebviews": true
  2. Run the extension and open the Duo chat
  3. The Chat Webview should load successfully (the styling is a bit off but its ok, it'll be fixed in the next iterations)
  4. Open some file, select content in, open Duo-chat related Context Menu and run chat commands. (explain, fix, generate test and refactor - except Open QuickChat)
  5. Test all commands and make sure that chat responds as expected and response has context about the editor selection (if provided)
  6. Open command palette and run "Start a new conversation". The chat should start new conversation

2024-12-18_23-06-12.mp4

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 Olena Horal-Koretska

Merge request reports

Loading