Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
feat: show all active text editors
Browse files Browse the repository at this point in the history
  • Loading branch information
monstajoe2002 committed Dec 12, 2023
1 parent 0e81b87 commit 89bb19d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/providers/active-editors-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,23 @@ export default class ActiveEditorsProvider
getChildren(
element?: ActiveEditorsTreeItem | undefined
): vscode.ProviderResult<ActiveEditorsTreeItem[]> {
try {
const activeEditors = vscode.window.visibleTextEditors;
this.refresh();
return activeEditors.map((editor) => {
return new ActiveEditorsTreeItem(
editor.document!.fileName,
vscode.TreeItemCollapsibleState.None
);
});
} catch (err) {
return [];
}
const openDocuments = vscode.workspace.textDocuments;
const activeEditors: ActiveEditorsTreeItem[] = [];
this.refresh();
openDocuments.forEach((editor) => {
if (editor.fileName.endsWith(".git")) {
return null;
}
const activeEditor = new ActiveEditorsTreeItem(
"\\" +
editor.fileName.substring(
editor.fileName.indexOf("app\\") + "app\\".length
),
vscode.TreeItemCollapsibleState.None
);
activeEditors.push(activeEditor);
});
return activeEditors;
}
closeEditor(element: ActiveEditorsTreeItem) {
vscode.window.visibleTextEditors.map((editor) => {
Expand Down

0 comments on commit 89bb19d

Please sign in to comment.