mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
perf - 20% less time spend computing pinned state when many tabs are opened
This commit is contained in:
@@ -917,6 +917,7 @@ export interface IEditorGroup {
|
||||
getEditors(mru?: boolean): IEditorInput[];
|
||||
isActive(editor: IEditorInput): boolean;
|
||||
isPreview(editor: IEditorInput): boolean;
|
||||
isPinned(index: number): boolean;
|
||||
isPinned(editor: IEditorInput): boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -482,9 +482,20 @@ export class EditorGroup implements IEditorGroup {
|
||||
this.closeEditor(oldPreview);
|
||||
}
|
||||
|
||||
public isPinned(editor: EditorInput): boolean {
|
||||
const index = this.indexOf(editor);
|
||||
if (index === -1) {
|
||||
public isPinned(editor: EditorInput): boolean;
|
||||
public isPinned(index: number): boolean;
|
||||
public isPinned(arg1: EditorInput | number): boolean {
|
||||
let editor: EditorInput;
|
||||
let index: number;
|
||||
if (typeof arg1 === 'number') {
|
||||
editor = this.editors[arg1];
|
||||
index = arg1;
|
||||
} else {
|
||||
editor = arg1;
|
||||
index = this.indexOf(editor);
|
||||
}
|
||||
|
||||
if (index === -1 || !editor) {
|
||||
return false; // editor not found
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user