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.
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
GetTabFilePathinMainWindow.Tabs.csonly understands one tab shape:A query tab holds a
QuerySessionControl, which since #459 has a perfectly goodSourceFilePathof its own. It just never gets asked. SoSaveOpenPlansrecords nothing for query tabs andRestoreOpenPlanshas nothing to restore.Two things fall out of the same fix
Teaching
GetTabFilePathaboutQuerySessionControlalso un-hides Copy Path on the tab context menu, which is currently gated onGetTabFilePath(tab) != nulland so has never appeared on a query tab.RestoreOpenPlansthen needs to route by extension —.sqltoLoadSqlFile, everything else toLoadPlanFile— since both now land in the same saved list. Worth renaming the setting offOpenPlansif 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.