diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index f099642e29460..40ac1f7bbf217 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -2332,11 +2332,12 @@ export class DidChangeDecorationsEmitter extends Disposable { this._deferredCnt--; if (this._deferredCnt === 0) { if (this._shouldFire) { + const affectedTextLines = new Set(this._affectedInjectedTextLines); this.handleBeforeFire(this._affectedInjectedTextLines); - const event: IModelDecorationsChangedEvent = { affectsMinimap: this._affectsMinimap, - affectsOverviewRuler: this._affectsOverviewRuler + affectsOverviewRuler: this._affectsOverviewRuler, + linesAffected: affectedTextLines, }; this._shouldFire = false; this._affectsMinimap = false; diff --git a/src/vs/editor/common/textModelEvents.ts b/src/vs/editor/common/textModelEvents.ts index aefa7dca03ba5..9c5abde3a67e1 100644 --- a/src/vs/editor/common/textModelEvents.ts +++ b/src/vs/editor/common/textModelEvents.ts @@ -80,6 +80,7 @@ export interface IModelContentChangedEvent { export interface IModelDecorationsChangedEvent { readonly affectsMinimap: boolean; readonly affectsOverviewRuler: boolean; + readonly linesAffected?: Set | null; } /** diff --git a/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts b/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts index 3efb9d5738f3a..e8f1d49187736 100644 --- a/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts +++ b/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts @@ -65,6 +65,22 @@ export class StickyScrollController extends Disposable implements IEditorContrib if (lineNumberOption.renderType === RenderLineNumbersType.Relative) { this._sessionStore.add(this._editor.onDidChangeCursorPosition(() => this.renderStickyScroll())); } + const inlayHintsOptions = this._editor.getOption(EditorOption.inlayHints); + if (inlayHintsOptions.enabled === 'offUnlessPressed' || inlayHintsOptions.enabled === 'onUnlessPressed') { + this._editor.onDidChangeModelDecorations((e) => { + const firstLine = this._widgetState.lineNumbers[0]; + const lastLine = this._widgetState.lineNumbers[this._widgetState.lineNumbers.length - 1]; + if (!e.linesAffected || !firstLine || !lastLine) { + return; + } + for (const line of e.linesAffected) { + if (line >= firstLine && line <= lastLine) { + this.renderStickyScroll(); + return; + } + } + }); + } } } diff --git a/src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts b/src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts index 6489adceee126..47008f6fe69f8 100644 --- a/src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts +++ b/src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts @@ -59,8 +59,8 @@ export class StickyLineCandidateProvider extends Disposable { } private readConfiguration() { - const options = this._editor.getOption(EditorOption.stickyScroll); - if (options.enabled === false) { + const stickyScrollOptions = this._editor.getOption(EditorOption.stickyScroll); + if (stickyScrollOptions.enabled === false) { this._sessionStore.clear(); return; } else { diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 7bd8af19e51d7..a284d49ce0efb 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2695,6 +2695,7 @@ declare namespace monaco.editor { export interface IModelDecorationsChangedEvent { readonly affectsMinimap: boolean; readonly affectsOverviewRuler: boolean; + readonly linesAffected?: Set | null; } export interface IModelOptionsChangedEvent {