@@ -46,6 +46,7 @@ import { SuggestItemInfo } from './suggestWidgetAdapter.js';
46
46
import { TextModelEditReason , EditReasons } from '../../../../common/textModelEditReason.js' ;
47
47
import { ICodeEditorService } from '../../../../browser/services/codeEditorService.js' ;
48
48
import { InlineCompletionViewData , InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js' ;
49
+ import { IInlineCompletionsService } from '../../../../browser/services/inlineCompletionsService.js' ;
49
50
50
51
export class InlineCompletionsModel extends Disposable {
51
52
private readonly _source ;
@@ -90,6 +91,7 @@ export class InlineCompletionsModel extends Disposable {
90
91
@IAccessibilityService private readonly _accessibilityService : IAccessibilityService ,
91
92
@ILanguageFeaturesService private readonly _languageFeaturesService : ILanguageFeaturesService ,
92
93
@ICodeEditorService private readonly _codeEditorService : ICodeEditorService ,
94
+ @IInlineCompletionsService inlineCompletionsService : IInlineCompletionsService
93
95
) {
94
96
super ( ) ;
95
97
this . primaryPosition = derived ( this , reader => this . _positions . read ( reader ) [ 0 ] ?? new Position ( 1 , 1 ) ) ;
@@ -111,6 +113,11 @@ export class InlineCompletionsModel extends Disposable {
111
113
this . _inlineEditsEnabled = this . _editorObs . getOption ( EditorOption . inlineSuggest ) . map ( v => ! ! v . edits . enabled ) ;
112
114
this . _inlineEditsShowCollapsedEnabled = this . _editorObs . getOption ( EditorOption . inlineSuggest ) . map ( s => s . edits . showCollapsed ) ;
113
115
this . _triggerCommandOnProviderChange = this . _editorObs . getOption ( EditorOption . inlineSuggest ) . map ( s => s . experimental . triggerCommandOnProviderChange ) ;
116
+ this . _register ( inlineCompletionsService . onDidChangeIsSnoozing ( ( isSnoozing ) => {
117
+ if ( isSnoozing ) {
118
+ this . stop ( ) ;
119
+ }
120
+ } ) ) ;
114
121
115
122
this . _lastShownInlineCompletionInfo = undefined ;
116
123
this . _lastAcceptedInlineCompletionInfo = undefined ;
@@ -183,7 +190,8 @@ export class InlineCompletionsModel extends Disposable {
183
190
this . _onlyRequestInlineEditsSignal . read ( reader ) ;
184
191
this . _forceUpdateExplicitlySignal . read ( reader ) ;
185
192
this . _fetchSpecificProviderSignal . read ( reader ) ;
186
- const shouldUpdate = ( this . _enabled . read ( reader ) && this . _selectedSuggestItem . read ( reader ) ) || this . _isActive . read ( reader ) ;
193
+ const shouldUpdate = ( ( this . _enabled . read ( reader ) && this . _selectedSuggestItem . read ( reader ) ) || this . _isActive . read ( reader ) )
194
+ && ( ! inlineCompletionsService . isSnoozing ( ) || changeSummary . inlineCompletionTriggerKind === InlineCompletionTriggerKind . Explicit ) ;
187
195
if ( ! shouldUpdate ) {
188
196
this . _source . cancelUpdate ( ) ;
189
197
return undefined ;
0 commit comments