[VSCode] Add `/fix` "Source" code action

Problem to solve

As part of the implementation for [VS Code] Add /fix to code actions (gitlab-org/editor-extensions&127 - closed) we need to be able to trigger the new command from the "Source" code actions.

Unlike the "Quick Fix" code actions, which will be added here, the "Source" code actions are available even when there is no diagnostic error.

This will allow the user to trigger fixes on code which is valid, but may have other errors, such as logic errors. This also maintains parity with the Jetbrains plugin.

Proposed solution

Add to our Code Action Provider introduced in [VSCode] Add `/fix` Quick Fix code action (#1855 - closed)

Add new Source code action. Integrate it with the new COMMAND_START_QUICK_CHAT_WITH_CONTEXT command.

Allow triggering from any code that does not contain an existing "quick fix" diagnostic action.

Determine the selection range. Unlike existing quick_chat (which will not open without a user selection) we will support selections or no selections, to maintain parity with the Jetbrains implementation.

  • if the user has a selection, use that
  • if not, we use the entire document as selection
Edited by Elwyn Benson