@@ -20,12 +20,7 @@ import { AmazonQInlineCompletionItemProvider, InlineCompletionManager } from '..
2020import { RecommendationService } from '../../../../../src/app/inline/recommendationService'
2121import { SessionManager } from '../../../../../src/app/inline/sessionManager'
2222import { createMockDocument , createMockTextEditor , getTestWindow , installFakeClock } from 'aws-core-vscode/test'
23- import {
24- noInlineSuggestionsMsg ,
25- ReferenceHoverProvider ,
26- ReferenceInlineProvider ,
27- ReferenceLogViewProvider ,
28- } from 'aws-core-vscode/codewhisperer'
23+ import { noInlineSuggestionsMsg , ReferenceHoverProvider , ReferenceLogViewProvider } from 'aws-core-vscode/codewhisperer'
2924import { InlineGeneratingMessage } from '../../../../../src/app/inline/inlineGeneratingMessage'
3025import { LineTracker } from '../../../../../src/app/inline/stateTracker/lineTracker'
3126import { InlineTutorialAnnotation } from '../../../../../src/app/inline/tutorials/inlineTutorialAnnotation'
@@ -230,46 +225,6 @@ describe('InlineCompletionManager', () => {
230225 assert ( registerProviderStub . calledTwice ) // Once in constructor, once after rejection
231226 } )
232227 } )
233-
234- describe ( 'previous command' , ( ) => {
235- it ( 'should register and handle previous command correctly' , async ( ) => {
236- const prevCommandCall = registerCommandStub
237- . getCalls ( )
238- . find ( ( call ) => call . args [ 0 ] === 'editor.action.inlineSuggest.showPrevious' )
239-
240- assert ( prevCommandCall , 'Previous command should be registered' )
241-
242- if ( prevCommandCall ) {
243- const handler = prevCommandCall . args [ 1 ]
244- await handler ( )
245-
246- assert ( executeCommandStub . calledWith ( 'editor.action.inlineSuggest.hide' ) )
247- assert ( disposableStub . calledOnce )
248- assert ( registerProviderStub . calledTwice )
249- assert ( executeCommandStub . calledWith ( 'editor.action.inlineSuggest.trigger' ) )
250- }
251- } )
252- } )
253-
254- describe ( 'next command' , ( ) => {
255- it ( 'should register and handle next command correctly' , async ( ) => {
256- const nextCommandCall = registerCommandStub
257- . getCalls ( )
258- . find ( ( call ) => call . args [ 0 ] === 'editor.action.inlineSuggest.showNext' )
259-
260- assert ( nextCommandCall , 'Next command should be registered' )
261-
262- if ( nextCommandCall ) {
263- const handler = nextCommandCall . args [ 1 ]
264- await handler ( )
265-
266- assert ( executeCommandStub . calledWith ( 'editor.action.inlineSuggest.hide' ) )
267- assert ( disposableStub . calledOnce )
268- assert ( registerProviderStub . calledTwice )
269- assert ( executeCommandStub . calledWith ( 'editor.action.inlineSuggest.trigger' ) )
270- }
271- } )
272- } )
273228 } )
274229
275230 describe ( 'AmazonQInlineCompletionItemProvider' , ( ) => {
@@ -278,15 +233,13 @@ describe('InlineCompletionManager', () => {
278233 let provider : AmazonQInlineCompletionItemProvider
279234 let getAllRecommendationsStub : sinon . SinonStub
280235 let recommendationService : RecommendationService
281- let setInlineReferenceStub : sinon . SinonStub
282236 let inlineTutorialAnnotation : InlineTutorialAnnotation
283237
284238 beforeEach ( ( ) => {
285239 const lineTracker = new LineTracker ( )
286240 const activeStateController = new InlineGeneratingMessage ( lineTracker )
287241 inlineTutorialAnnotation = new InlineTutorialAnnotation ( lineTracker , mockSessionManager )
288242 recommendationService = new RecommendationService ( mockSessionManager , activeStateController )
289- setInlineReferenceStub = sandbox . stub ( ReferenceInlineProvider . instance , 'setInlineReference' )
290243
291244 mockSessionManager = {
292245 getActiveSession : getActiveSessionStub ,
@@ -320,48 +273,21 @@ describe('InlineCompletionManager', () => {
320273 assert ( getAllRecommendationsStub . calledOnce )
321274 assert . deepStrictEqual ( items , mockSuggestions )
322275 } ) ,
323- it ( 'should not call recommendation service for existing sessions' , async ( ) => {
324- provider = new AmazonQInlineCompletionItemProvider (
325- languageClient ,
326- recommendationService ,
327- mockSessionManager ,
328- inlineTutorialAnnotation ,
329- false
330- )
331- const items = await provider . provideInlineCompletionItems (
332- mockDocument ,
333- mockPosition ,
334- mockContext ,
335- mockToken
336- )
337- assert ( getAllRecommendationsStub . notCalled )
338- assert . deepStrictEqual ( items , mockSuggestions )
339- } ) ,
340276 it ( 'should handle reference if there is any' , async ( ) => {
341277 provider = new AmazonQInlineCompletionItemProvider (
342278 languageClient ,
343279 recommendationService ,
344280 mockSessionManager ,
345- inlineTutorialAnnotation ,
346- false
281+ inlineTutorialAnnotation
347282 )
348283 await provider . provideInlineCompletionItems ( mockDocument , mockPosition , mockContext , mockToken )
349- assert ( setInlineReferenceStub . calledOnce )
350- assert (
351- setInlineReferenceStub . calledWithExactly (
352- mockPosition . line ,
353- mockSuggestions [ 0 ] . insertText ,
354- fakeReferences
355- )
356- )
357284 } ) ,
358285 it ( 'should add a range to the completion item when missing' , async function ( ) {
359286 provider = new AmazonQInlineCompletionItemProvider (
360287 languageClient ,
361288 recommendationService ,
362289 mockSessionManager ,
363- inlineTutorialAnnotation ,
364- true
290+ inlineTutorialAnnotation
365291 )
366292 getActiveRecommendationStub . returns ( [
367293 {
@@ -391,8 +317,7 @@ describe('InlineCompletionManager', () => {
391317 languageClient ,
392318 recommendationService ,
393319 mockSessionManager ,
394- inlineTutorialAnnotation ,
395- true
320+ inlineTutorialAnnotation
396321 )
397322 const expectedText = 'this is my text'
398323 getActiveRecommendationStub . returns ( [
@@ -415,8 +340,7 @@ describe('InlineCompletionManager', () => {
415340 languageClient ,
416341 recommendationService ,
417342 mockSessionManager ,
418- inlineTutorialAnnotation ,
419- true
343+ inlineTutorialAnnotation
420344 )
421345 getActiveRecommendationStub . returns ( [ ] )
422346 const messageShown = new Promise ( ( resolve ) =>
@@ -449,8 +373,7 @@ describe('InlineCompletionManager', () => {
449373 languageClient ,
450374 recommendationService ,
451375 mockSessionManager ,
452- inlineTutorialAnnotation ,
453- false
376+ inlineTutorialAnnotation
454377 )
455378 const p1 = provider . provideInlineCompletionItems ( mockDocument , mockPosition , mockContext , mockToken )
456379 const p2 = provider . provideInlineCompletionItems ( mockDocument , mockPosition , mockContext , mockToken )
0 commit comments