Skip to content

Commit 9aba21b

Browse files
committed
fixing
1 parent 0479e05 commit 9aba21b

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { ILanguageConfigurationService } from 'vs/editor/common/languages/langua
2626
import { ILanguageFeatureDebounceService } from 'vs/editor/common/services/languageFeatureDebounce';
2727
import * as dom from 'vs/base/browser/dom';
2828
import { StickyRange } from 'vs/editor/contrib/stickyScroll/browser/stickyScrollElement';
29+
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
2930

3031
interface CustomMouseEvent {
3132
detail: string;
@@ -76,7 +77,8 @@ export class StickyScrollController extends Disposable implements IEditorContrib
7677
@IInstantiationService private readonly _instaService: IInstantiationService,
7778
@ILanguageConfigurationService _languageConfigurationService: ILanguageConfigurationService,
7879
@ILanguageFeatureDebounceService _languageFeatureDebounceService: ILanguageFeatureDebounceService,
79-
@IContextKeyService private readonly _contextKeyService: IContextKeyService
80+
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
81+
@ICodeEditorService private readonly _codeEditorService: ICodeEditorService
8082
) {
8183
super();
8284
this._stickyScrollWidget = new StickyScrollWidget(this._editor);
@@ -297,15 +299,32 @@ export class StickyScrollController extends Disposable implements IEditorContrib
297299
});
298300
}
299301

302+
private _removeStickyWidget(): void {
303+
this._editor.removeOverlayWidget(this._stickyScrollWidget);
304+
this._sessionStore.clear();
305+
this._enabled = false;
306+
}
307+
300308
private _readConfiguration() {
301309
const options = this._editor.getOption(EditorOption.stickyScroll);
302310

303311
if (options.enabled === false) {
304-
this._editor.removeOverlayWidget(this._stickyScrollWidget);
305-
this._sessionStore.clear();
306-
this._enabled = false;
312+
this._removeStickyWidget();
307313
return;
308314
} else if (options.enabled && !this._enabled) {
315+
// Do not render the sticky scroll if the editor is the left side of an inline diff editor
316+
let isLeftSideOfInlineDiffEditor = false;
317+
if (this._editor.getOption(EditorOption.inDiffEditor)) {
318+
for (const diffEditor of this._codeEditorService.listDiffEditors()) {
319+
if (diffEditor.getOriginalEditor() === this._editor && !diffEditor.renderSideBySide) {
320+
isLeftSideOfInlineDiffEditor = true;
321+
}
322+
}
323+
}
324+
if (isLeftSideOfInlineDiffEditor) {
325+
this._removeStickyWidget();
326+
return;
327+
}
309328
// When sticky scroll was just enabled, add the listeners on the sticky scroll
310329
this._editor.addOverlayWidget(this._stickyScrollWidget);
311330
this._sessionStore.add(this._editor.onDidScrollChange(() => this._renderStickyScroll()));

0 commit comments

Comments
 (0)