Skip to content

Restore query tabs on restart, and let Copy Path see them #463

Description

@erikdarlingdata

Reported by @joshdbe in #458.

Plan tabs come back when the app restarts. Query tabs do not, even when the query was opened from a file and its path is known.

Cause

GetTabFilePath in MainWindow.Tabs.cs only understands one tab shape:

if (tab.Content is DockPanel dp)
{
    foreach (var child in dp.Children)
        if (child is PlanViewerControl v)
            return v.SourceFilePath;
}
return null;

A query tab holds a QuerySessionControl, which since #459 has a perfectly good SourceFilePath of its own. It just never gets asked. So SaveOpenPlans records nothing for query tabs and RestoreOpenPlans has nothing to restore.

Two things fall out of the same fix

Teaching GetTabFilePath about QuerySessionControl also un-hides Copy Path on the tab context menu, which is currently gated on GetTabFilePath(tab) != null and so has never appeared on a query tab.

RestoreOpenPlans then needs to route by extension — .sql to LoadSqlFile, everything else to LoadPlanFile — since both now land in the same saved list. Worth renaming the setting off OpenPlans if it is going to hold both.

Scope

This restores query tabs that came from a file. A scratch tab that was never saved has no path and still will not come back; persisting unsaved buffers is a bigger feature and belongs with the dirty-tracking work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions