feat: add /fix with duo quick chat "source" code action

Description

Adds a "Fix with GitLab Duo" code action to the "Source actions' category.

We recently added a "Quick Fix" code action in [VSCode] Add `/fix` Quick Fix code action (#1855 - closed) and this MR adds the "Source" code action to cover different scenarios.

In VSCode, a "Quick Fix" code action is associated with specific diagnostic issue(s), whereas a "Source" code action relates to the entire file. So this new code action allows the user to easily trigger "Fix with GitLab Duo" on the entire file, rather than from a specific diagnostic. The whole file contents will be sent as the code to fix.

Related Issues

Resolves #1863 (closed)

How has this been tested?

  • Enable the gitlab.featureFLags.fixWithDuoQuickChatCodeActions local feature flag
  • Ensure Duo, Duo Quick Chat are available (check GitLab Diagnostics command if you're unsure)
Verify code action is not available when file has no diagnostics
  • Open a file with no errors
  • Right click anywhere in the file
  • Click Source Action...
  • Verify there is no fix with gitlab duo action
Verify code action IS available when file has diagnostics
  • Open a file with errors, or make some errors
  • Right click anywhere in the file
  • Click Source Action...
  • Verify there is a Fix with GitLab Duo action
  • Click the action and verify quick-chat is opened and Duo shows an appropriate answer
  • If src/browser or src/common has been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE.
  • Consider an end-to-end test for significant new features that aren't covered by integration tests.

Screenshots (if appropriate)

header header
image File has no errors, code action unavailable
image File has errors, code action available in source
image Running the code action opens quick-chat and shows suggestion

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

Closes #1863 (closed)

Edited by Elwyn Benson

Merge request reports

Loading
Loading