feat: reopen diagram automatically on workspace/solution open#11
Open
DisciplinedSoftware wants to merge 5 commits intoOlegIGalkin:mainfrom
Open
feat: reopen diagram automatically on workspace/solution open#11DisciplinedSoftware wants to merge 5 commits intoOlegIGalkin:mainfrom
DisciplinedSoftware wants to merge 5 commits intoOlegIGalkin:mainfrom
Conversation
When the extension activates (on workspace open or Developer: Reload Window), check if the diagram panel was open before the reload using workspaceState persistence. If it was, reopen it automatically. - Add 'onStartupFinished' activation event so extension activates on startup, not just when commands are invoked - Store 'panelWasOpen' flag in workspaceState when panel is created - Clear flag when panel is disposed (user explicitly closed it) - On activate, reopen panel if flag is set Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous approach sent 'importMindMapData' immediately after reading the file, but MindElixir.js may not have loaded yet (mind === null), causing the data to be silently dropped. Now the webview posts 'webviewReady' at the end of initMindMap() once 'mind' is fully initialized. The extension responds by reading and sending the saved file content, guaranteeing importData() can run. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous webviewReady handshake could fail if DOMContentLoaded had already fired before the ES module's listener was registered (async module imports can delay script execution past the event). New approach: - Extension sends importMindMapData eagerly (as before), as VS Code queues messages for webviews that haven't loaded yet - Webview stores any importMindMapData that arrives before mind is initialized in pendingImportData - initMindMap() flushes pendingImportData at the end, once mind is fully ready -- guaranteeing the data is applied regardless of which side finishes first Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dev webpack config had 'clean: true' but no CopyWebpackPlugin, so every dev build wiped out/MindElixir/MindElixir.js. The webview imports this file via ES module; without it the entire module script fails silently -- blank canvas and non-functional buttons. Mirrors the same fix already applied on feature/fix-keyboard-after-click-without-focus. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a solution that has associated mind map data is opened, automatically show the Code Mind Map tool window (creating it if needed). Previously HandleSolutionOpened() only loaded data into the window if it was already visible; the window itself was never shown automatically. This mirrors the VS Code behavior where the panel reopens on workspace open. The actual diagram data is loaded by MindMapBrowser_NavigationCompleted once WebView2 finishes initializing, so timing is not an issue. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the issue where the diagram closes on window reload (VS Code) or is not shown when reopening a solution (Visual Studio) and does not reopen.
VS Code changes
Auto-reopen panel (
package.json,extension.ts):onStartupFinishedactivation event so the extension activates on startupworkspaceState(panelWasOpenkey)Diagram data loads correctly after reopen (
extension.ts):importMindMapDatamessage arrives before MindElixir.js finishes loading; the oldif (mind)guard silently dropped itpendingImportDatabuffer in the webview: if the message arrives beforemindis initialized it is stored, then flushed at the end ofinitMindMap()Dev build fix (
webpack.dev.config.js):CopyWebpackPlugin(already present in the production config) soout/MindElixir/MindElixir.jsis not wiped on every dev build — missing this file caused the entire webview module script to fail silentlyVisual Studio changes
Auto-show window on solution open (
CodeMindMapPackage.cs):HandleSolutionOpened()finds that the solution has existing mind map data, it now callsShowToolWindowAsyncto ensure the Code Mind Map window is visible