From c32184bea05a7296a614980c1d770a1157120fd0 Mon Sep 17 00:00:00 2001 From: Tami Takamiya Date: Wed, 6 Mar 2024 08:40:01 -0500 Subject: [PATCH] Send IGNORED feedback if feedback was pending (#1116) * Send IGNORED feedback if feedback was pending * Change the order of test execution * update comment --- src/features/lightspeed/inlineSuggestions.ts | 4 ++++ test/testScripts/lightspeed/testLightspeed.test.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/features/lightspeed/inlineSuggestions.ts b/src/features/lightspeed/inlineSuggestions.ts index d032530f8..bbf3ab581 100644 --- a/src/features/lightspeed/inlineSuggestions.ts +++ b/src/features/lightspeed/inlineSuggestions.ts @@ -344,6 +344,10 @@ async function requestSuggestion( ); const suggestionId = uuidv4(); try { + // If there is a suggestion, whose feedback is pending, send a feedback with IGNORED action + // before making a new request + await ignorePendingSuggestion(); + const activityId = retrieveActivityIdFromTracker( documentInfo, inlinePosition diff --git a/test/testScripts/lightspeed/testLightspeed.test.ts b/test/testScripts/lightspeed/testLightspeed.test.ts index 25743b667..96bada0f8 100644 --- a/test/testScripts/lightspeed/testLightspeed.test.ts +++ b/test/testScripts/lightspeed/testLightspeed.test.ts @@ -17,6 +17,7 @@ import { lightSpeedManager } from "../../../src/extension"; import { testInlineSuggestionByAnotherProvider, testInlineSuggestionProviderCoExistence, + testIgnorePendingSuggestion, } from "./e2eInlineSuggestion.test"; import { UserAction } from "../../../src/definitions/lightspeed"; import { FeedbackRequestParams } from "../../../src/interfaces/lightspeed"; @@ -272,6 +273,10 @@ export function testLightspeed(): void { }); }); + describe("Test ignore pending suggestions", () => { + testIgnorePendingSuggestion(); + }); + describe("Test inline suggestion by another provider", () => { testInlineSuggestionByAnotherProvider(); testInlineSuggestionProviderCoExistence();