Show git gutter indicators in both panes when using Split Editor In Group

Fixes #211257
This commit is contained in:
Alex Ross
2024-04-25 12:53:14 +02:00
parent d4a41934a6
commit e8b2166ef3
3 changed files with 21 additions and 4 deletions
@@ -32,6 +32,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { isEqual } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { IBoundarySashes } from 'vs/base/browser/ui/sash/sash';
import { coalesce } from 'vs/base/common/arrays';
interface ISideBySideEditorViewState {
primary: object;
@@ -455,6 +456,10 @@ export class SideBySideEditor extends AbstractEditorWithViewState<ISideBySideEdi
return this.getLastFocusedEditorPane()?.getControl();
}
getControls(): IEditorControl[] {
return coalesce([this.primaryEditorPane?.getControl(), this.secondaryEditorPane?.getControl()]);
}
getPrimaryEditorPane(): IEditorPane | undefined {
return this.primaryEditorPane;
}
+10
View File
@@ -167,6 +167,16 @@ export interface IEditorPane extends IComposite {
*/
getControl(): IEditorControl | undefined;
/**
* Returns the underlying controls of this editor. Callers need to cast
* the control to a specific instance as needed, e.g. by using the
* `isCodeEditor` helper method to access the text code editor.
*
* Use the `onDidChangeControl` event to track whenever the control
* changes.
*/
getControls?(): IEditorControl[];
/**
* Returns the current view state of the editor if any.
*
@@ -5,7 +5,7 @@
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IResourceEditorInput, IEditorOptions, EditorActivation, IResourceEditorInputIdentifier, ITextResourceEditorInput } from 'vs/platform/editor/common/editor';
import { SideBySideEditor, IEditorPane, GroupIdentifier, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, EditorInputWithOptions, isEditorInputWithOptions, IEditorIdentifier, IEditorCloseEvent, ITextDiffEditorPane, IRevertOptions, SaveReason, EditorsOrder, IWorkbenchEditorConfiguration, EditorResourceAccessor, IVisibleEditorPane, EditorInputCapabilities, isResourceDiffEditorInput, IUntypedEditorInput, isResourceEditorInput, isEditorInput, isEditorInputWithOptionsAndGroup, IFindEditorOptions, isResourceMergeEditorInput, IEditorWillOpenEvent } from 'vs/workbench/common/editor';
import { SideBySideEditor, IEditorPane, GroupIdentifier, IUntitledTextResourceEditorInput, IResourceDiffEditorInput, EditorInputWithOptions, isEditorInputWithOptions, IEditorIdentifier, IEditorCloseEvent, ITextDiffEditorPane, IRevertOptions, SaveReason, EditorsOrder, IWorkbenchEditorConfiguration, EditorResourceAccessor, IVisibleEditorPane, EditorInputCapabilities, isResourceDiffEditorInput, IUntypedEditorInput, isResourceEditorInput, isEditorInput, isEditorInputWithOptionsAndGroup, IFindEditorOptions, isResourceMergeEditorInput, IEditorWillOpenEvent, IEditorControl } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput';
import { ResourceMap, ResourceSet } from 'vs/base/common/map';
@@ -491,9 +491,11 @@ export class EditorService extends Disposable implements EditorServiceImpl {
get visibleTextEditorControls(): Array<ICodeEditor | IDiffEditor> {
const visibleTextEditorControls: Array<ICodeEditor | IDiffEditor> = [];
for (const visibleEditorPane of this.visibleEditorPanes) {
const control = visibleEditorPane.getControl();
if (isCodeEditor(control) || isDiffEditor(control)) {
visibleTextEditorControls.push(control);
const controls: (IEditorControl | undefined)[] = visibleEditorPane.getControls ? visibleEditorPane.getControls() : [visibleEditorPane.getControl()];
for (const control of controls) {
if (isCodeEditor(control) || isDiffEditor(control)) {
visibleTextEditorControls.push(control);
}
}
}