File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
src/vs/workbench/contrib/inlineChat/browser Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -292,11 +292,16 @@ export class InlineChatController implements IEditorContribution {
292
292
293
293
this . _sessionStore . clear ( ) ;
294
294
295
- const wholeRangeDecoration = this . _editor . createDecorationsCollection ( [ {
296
- range : this . _activeSession . wholeRange . value ,
297
- options : InlineChatController . _decoBlock
298
- } ] ) ;
295
+ const wholeRangeDecoration = this . _editor . createDecorationsCollection ( ) ;
296
+ const updateWholeRangeDecoration = ( ) => {
297
+ wholeRangeDecoration . set ( [ {
298
+ range : this . _activeSession ! . wholeRange . value ,
299
+ options : InlineChatController . _decoBlock
300
+ } ] ) ;
301
+ } ;
299
302
this . _sessionStore . add ( toDisposable ( ( ) => wholeRangeDecoration . clear ( ) ) ) ;
303
+ this . _sessionStore . add ( this . _activeSession . wholeRange . onDidChange ( updateWholeRangeDecoration ) ) ;
304
+ updateWholeRangeDecoration ( ) ;
300
305
301
306
this . _zone . value . widget . updateSlashCommands ( this . _activeSession . session . slashCommands ?? [ ] ) ;
302
307
this . _zone . value . widget . placeholder = this . _getPlaceholderText ( ) ;
Original file line number Diff line number Diff line change @@ -66,20 +66,20 @@ class SessionWholeRange {
66
66
67
67
private static readonly _options = { description : 'inlineChat/session/wholeRange' } ;
68
68
69
- private readonly _store = new DisposableStore ( ) ;
69
+ private readonly _onDidChange = new Emitter < this> ( ) ;
70
+ readonly onDidChange : Event < this> = this . _onDidChange . event ;
71
+
70
72
private readonly _decorationIds : string [ ] = [ ] ;
71
73
72
74
constructor ( private readonly _textModel : ITextModel , wholeRange : IRange ) {
73
75
this . _decorationIds = _textModel . deltaDecorations ( [ ] , [ { range : wholeRange , options : SessionWholeRange . _options } ] ) ;
74
- this . _store . add ( toDisposable ( ( ) => {
75
- if ( ! _textModel . isDisposed ( ) ) {
76
- _textModel . deltaDecorations ( this . _decorationIds , [ ] ) ;
77
- }
78
- } ) ) ;
79
76
}
80
77
81
78
dispose ( ) {
82
- this . _store . dispose ( ) ;
79
+ this . _onDidChange . dispose ( ) ;
80
+ if ( ! this . _textModel . isDisposed ( ) ) {
81
+ this . _textModel . deltaDecorations ( this . _decorationIds , [ ] ) ;
82
+ }
83
83
}
84
84
85
85
trackEdits ( edits : ISingleEditOperation [ ] ) : void {
@@ -88,6 +88,7 @@ class SessionWholeRange {
88
88
newDeco . push ( { range : edit . range , options : SessionWholeRange . _options } ) ;
89
89
}
90
90
this . _decorationIds . push ( ...this . _textModel . deltaDecorations ( [ ] , newDeco ) ) ;
91
+ this . _onDidChange . fire ( this ) ;
91
92
}
92
93
93
94
get value ( ) : Range {
You can’t perform that action at this time.
0 commit comments