Skip to content

Commit 374e02f

Browse files
committed
sticky scroll disabled in the left hand side of the diff editor
1 parent 9aba21b commit 374e02f

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
12971297
result.readOnly = !this._options.originalEditable;
12981298
result.dropIntoEditor = { enabled: !result.readOnly };
12991299
result.extraEditorClassName = 'original-in-monaco-diff-editor';
1300+
result.stickyScroll = { enabled: false };
13001301
return {
13011302
...result,
13021303
dimension: {

src/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
291291
result.readOnly = !options.originalEditable;
292292
result.dropIntoEditor = { enabled: !result.readOnly };
293293
result.extraEditorClassName = 'original-in-monaco-diff-editor';
294+
result.stickyScroll = { enabled: false };
294295
return result;
295296
}
296297

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

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ 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';
3029

3130
interface CustomMouseEvent {
3231
detail: string;
@@ -77,8 +76,7 @@ export class StickyScrollController extends Disposable implements IEditorContrib
7776
@IInstantiationService private readonly _instaService: IInstantiationService,
7877
@ILanguageConfigurationService _languageConfigurationService: ILanguageConfigurationService,
7978
@ILanguageFeatureDebounceService _languageFeatureDebounceService: ILanguageFeatureDebounceService,
80-
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
81-
@ICodeEditorService private readonly _codeEditorService: ICodeEditorService
79+
@IContextKeyService private readonly _contextKeyService: IContextKeyService
8280
) {
8381
super();
8482
this._stickyScrollWidget = new StickyScrollWidget(this._editor);
@@ -299,32 +297,15 @@ export class StickyScrollController extends Disposable implements IEditorContrib
299297
});
300298
}
301299

302-
private _removeStickyWidget(): void {
303-
this._editor.removeOverlayWidget(this._stickyScrollWidget);
304-
this._sessionStore.clear();
305-
this._enabled = false;
306-
}
307-
308300
private _readConfiguration() {
309301
const options = this._editor.getOption(EditorOption.stickyScroll);
310302

311303
if (options.enabled === false) {
312-
this._removeStickyWidget();
304+
this._editor.removeOverlayWidget(this._stickyScrollWidget);
305+
this._sessionStore.clear();
306+
this._enabled = false;
313307
return;
314308
} 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-
}
328309
// When sticky scroll was just enabled, add the listeners on the sticky scroll
329310
this._editor.addOverlayWidget(this._stickyScrollWidget);
330311
this._sessionStore.add(this._editor.onDidScrollChange(() => this._renderStickyScroll()));

0 commit comments

Comments
 (0)