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 {
292292
293293 this . _sessionStore . clear ( ) ;
294294
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+ } ;
299302 this . _sessionStore . add ( toDisposable ( ( ) => wholeRangeDecoration . clear ( ) ) ) ;
303+ this . _sessionStore . add ( this . _activeSession . wholeRange . onDidChange ( updateWholeRangeDecoration ) ) ;
304+ updateWholeRangeDecoration ( ) ;
300305
301306 this . _zone . value . widget . updateSlashCommands ( this . _activeSession . session . slashCommands ?? [ ] ) ;
302307 this . _zone . value . widget . placeholder = this . _getPlaceholderText ( ) ;
Original file line number Diff line number Diff line change @@ -66,20 +66,20 @@ class SessionWholeRange {
6666
6767 private static readonly _options = { description : 'inlineChat/session/wholeRange' } ;
6868
69- private readonly _store = new DisposableStore ( ) ;
69+ private readonly _onDidChange = new Emitter < this> ( ) ;
70+ readonly onDidChange : Event < this> = this . _onDidChange . event ;
71+
7072 private readonly _decorationIds : string [ ] = [ ] ;
7173
7274 constructor ( private readonly _textModel : ITextModel , wholeRange : IRange ) {
7375 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- } ) ) ;
7976 }
8077
8178 dispose ( ) {
82- this . _store . dispose ( ) ;
79+ this . _onDidChange . dispose ( ) ;
80+ if ( ! this . _textModel . isDisposed ( ) ) {
81+ this . _textModel . deltaDecorations ( this . _decorationIds , [ ] ) ;
82+ }
8383 }
8484
8585 trackEdits ( edits : ISingleEditOperation [ ] ) : void {
@@ -88,6 +88,7 @@ class SessionWholeRange {
8888 newDeco . push ( { range : edit . range , options : SessionWholeRange . _options } ) ;
8989 }
9090 this . _decorationIds . push ( ...this . _textModel . deltaDecorations ( [ ] , newDeco ) ) ;
91+ this . _onDidChange . fire ( this ) ;
9192 }
9293
9394 get value ( ) : Range {
You can’t perform that action at this time.
0 commit comments