feat: Interrupt running command when LS notifies to do so

Description

Companion MR to gitlab-org/editor-extensions/gitlab-lsp!3123 (merged). This implements the IDE extension side of command cancellation for Duo Workflow commands running in the integrated terminal.

Problem

When a user interrupts a running Duo Workflow command, the LSP sends a $/gitlab/cancelRunningCommand notification, but the IDE extension wasn't handling it. The command continued running in the terminal with no way to stop it or retrieve partial output.

Solution

  • Added handler for $/gitlab/cancelRunningCommand notification in TerminalManager
  • When cancellation is requested:
    • Sends Ctrl+C (\x03) to the terminal to interrupt the running process
    • Immediately resolves the pending $/gitlab/runCommand request with partial output collected so far

References gitlab-org/editor-extensions/gitlab-lsp#2022 (closed)

How has this been tested?

  1. Link this MR and gitlab-org/editor-extensions/gitlab-lsp!3123 (merged)
  2. Ask chat to run a long-running command, e.g. "Run npm run test:unit"
  3. Approve the command, then click the stop button
  4. The terminal process is interrupted with Ctrl+C and partial output is returned to the LSP

What CHANGELOG entry will this MR create?

  • feature: New feature - a user-facing change which adds functionality - included in changelog
  • fix: Bug fix fixes - a user-facing issue in production - 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
Loading