Problem
A fresh browser.cpp extension tab currently displays an unsaved file tab containing a Hello World program. Although toolbar compilation is already gated on workspace sources, the visible sample makes the editor appear ready to compile and run before the user has selected a workspace.
Decision
Open means Open Folder. It remains a workspace directory picker, not a standalone file picker.
A fresh tab and a user-selected Start new project state will have no open tabs, no active file, no filename, and an empty editor. Reopening a prior workspace is the only case that restores previously open tabs.
After a folder is chosen through Open, browser.cpp will show the Explorer and workspace terminal context but will not auto-open README.md or any other file. The user opens an existing file by selecting it in Explorer.
For New File with no workspace, browser.cpp will first request a workspace folder, then use the existing inline Explorer filename input to collect and validate a workspace-relative name. Once the folder has been selected, cancelling the filename input keeps that folder open; cancelling the directory picker leaves the existing empty state unchanged.
Implementation plan
-
Make the empty editor a first-class state in src/ui/editor.js, src/ui/toolbar.js, and src/ui/app.js.
- Initialize Monaco with an empty value so Hello World never flashes during boot.
- Revise
resetToNewProject() to clear open tabs, active path, editor content, diagnostics, status filename, file handle, workspace/sidebar state, terminal workspace state, and transient build state together.
- Do not create
untitled:default for a fresh or Start new project state.
-
Preserve and clarify session restoration in src/ui/session-persistence.mjs.
- First launch, a declined/failed session reload, and Start new project must all reach the identical no-file state.
- A successfully reloaded workspace restores its saved tabs exactly as today, including a valid zero-open-tab session.
- Update obsolete comments that describe a default
main.cpp / DEFAULT_SOURCE tab, and keep abandoned workspaces from being re-persisted.
-
Make folder-first file flows explicit in src/ui/toolbar.js and src/ui/filesystem.js.
- Open invokes the existing directory picker and renders the selected workspace without auto-opening
README.md or another initial file.
- New File with no workspace invokes the directory picker before the inline filename control; the submitted name continues through existing workspace-path validation and creates/opens one real workspace tab.
- Preserve cancellation behavior: directory-picker cancellation changes nothing; filename cancellation after a successful folder selection leaves the chosen folder open and creates no tab.
-
Audit compile/run affordances for an empty state.
- Toolbar buttons and shortcuts must remain unavailable with no real workspace source.
- Terminal
g++ without explicit source paths must fail clearly when there is no active real document/workspace source; it must never compile an implicit default or empty buffer.
-
Extend E2E coverage and register any new suite in the explicit test:e2e command in package.json.
- Fresh startup and Start new project after declining reload: no tabs, no active path, blank editor/status, no Hello World, and disabled compile/run controls.
- Restored workspace sessions: saved tabs restore; zero-open-tab sessions remain empty.
- Open Folder: selection renders Explorer but opens no file, including when root
README.md exists; cancellation preserves state.
- New File: no-workspace folder-first flow, filename validation/submission, and both cancellation cases.
- Toolbar, shortcut, and terminal compile behavior with no active real source.
Acceptance criteria
- A fresh extension tab shows no open file or Hello World content.
- Start new project has the same no-file state.
- Reopening a prior folder restores its saved tabs; a restored workspace may legitimately have zero open tabs.
- Open Folder asks for a workspace and does not auto-open a file.
- New File asks for a workspace when needed, then for a valid workspace-relative name, and opens only the created file.
- Empty-state compile/run paths cannot compile an implicit default buffer.
Verification
npm run lint
npm run build
npm run test:e2e
Problem
A fresh browser.cpp extension tab currently displays an
unsaved filetab containing a Hello World program. Although toolbar compilation is already gated on workspace sources, the visible sample makes the editor appear ready to compile and run before the user has selected a workspace.Decision
Openmeans Open Folder. It remains a workspace directory picker, not a standalone file picker.A fresh tab and a user-selected Start new project state will have no open tabs, no active file, no filename, and an empty editor. Reopening a prior workspace is the only case that restores previously open tabs.
After a folder is chosen through Open, browser.cpp will show the Explorer and workspace terminal context but will not auto-open
README.mdor any other file. The user opens an existing file by selecting it in Explorer.For New File with no workspace, browser.cpp will first request a workspace folder, then use the existing inline Explorer filename input to collect and validate a workspace-relative name. Once the folder has been selected, cancelling the filename input keeps that folder open; cancelling the directory picker leaves the existing empty state unchanged.
Implementation plan
Make the empty editor a first-class state in
src/ui/editor.js,src/ui/toolbar.js, andsrc/ui/app.js.resetToNewProject()to clear open tabs, active path, editor content, diagnostics, status filename, file handle, workspace/sidebar state, terminal workspace state, and transient build state together.untitled:defaultfor a fresh or Start new project state.Preserve and clarify session restoration in
src/ui/session-persistence.mjs.main.cpp/DEFAULT_SOURCEtab, and keep abandoned workspaces from being re-persisted.Make folder-first file flows explicit in
src/ui/toolbar.jsandsrc/ui/filesystem.js.README.mdor another initial file.Audit compile/run affordances for an empty state.
g++without explicit source paths must fail clearly when there is no active real document/workspace source; it must never compile an implicit default or empty buffer.Extend E2E coverage and register any new suite in the explicit
test:e2ecommand inpackage.json.README.mdexists; cancellation preserves state.Acceptance criteria
Verification
npm run lintnpm run buildnpm run test:e2e