diff --git a/source/components/file-tree-panel/file-tree-panel.ts b/source/components/file-tree-panel/file-tree-panel.ts index 6d60e04..870c114 100644 --- a/source/components/file-tree-panel/file-tree-panel.ts +++ b/source/components/file-tree-panel/file-tree-panel.ts @@ -118,6 +118,20 @@ class FileTreePanel extends HTMLElement { if ( editorTag ) { const containers = Array.from( document.querySelectorAll( 'tab-container' ) ); + + for ( const tc of containers ) + { + const tabs = ( tc as any ).tabs as Array<{ id: string; element: HTMLElement }>; + for ( const tab of tabs ) + { + if ( ( tab.element as any ).currentPath === path ) + { + ( tc as any ).activateTab( tab.id ); + return; + } + } + } + let found: { panel: HTMLElement; tc: any; tabId: string } | null = null; for ( const tc of containers ) @@ -125,7 +139,7 @@ class FileTreePanel extends HTMLElement { const tabs = ( tc as any ).tabs as Array<{ id: string; element: HTMLElement; dirty: boolean }>; for ( const tab of tabs ) { - if ( tab.element.tagName.toLowerCase() === editorTag && !tab.dirty ) + if ( tab.element.tagName.toLowerCase() === editorTag && !tab.dirty && !( tab.element as any )._pinned ) { found = { panel: tab.element, tc, tabId: tab.id }; break;