Skip to content

refactor: prepare extension for single-file mode support#527

Merged
magnus-madsen merged 1 commit into
masterfrom
feat/single-file-mode-prep
Mar 22, 2026
Merged

refactor: prepare extension for single-file mode support#527
magnus-madsen merged 1 commit into
masterfrom
feat/single-file-mode-prep

Conversation

@magnus-madsen
Copy link
Copy Markdown
Member

@magnus-madsen magnus-madsen commented Mar 22, 2026

Summary

  • Guard ensureFlixExists against undefined workspaceFolders (default to []) so it no longer crashes when no folder is open
  • Fix StartEngineInput types: [string] tuples → string[] arrays; make unused workspaceFolders field optional
  • Defer glob pattern creation from module-level constants to functions, so module-load no longer crashes in single-file mode
  • Add explicit activationEvents: ["onLanguage:flix"] to package.json
  • Add isProjectMode() helper for single-file vs project mode detection
  • Hide project-only commands (init, build-jar, build-fatjar, build-pkg, doc, outdated, showAst) from command palette when no folder is open

Context

This is preparatory refactoring for single-file mode support (opening a standalone .flix file without a workspace folder). All changes preserve existing behavior in folder mode — the glob patterns produce the same values, ensureFlixExists follows the same resolution order, and all commands remain visible when a workspace folder is open.

Test plan

  • Verify all existing integration tests pass (npm test)
  • Open a Flix project folder — all features and commands work as before
  • Open a standalone .flix file — extension no longer crashes at module-load time

🤖 Generated with Claude Code

- Guard `ensureFlixExists` against undefined `workspaceFolders` (default to [])
- Fix `StartEngineInput` types: `[string]` tuples → `string[]` arrays,
  make unused `workspaceFolders` field optional
- Defer glob pattern creation from module-level constants to functions,
  so module-load no longer crashes when no workspace folder is open
- Add explicit `activationEvents: ["onLanguage:flix"]` to package.json
- Add `isProjectMode()` helper for single-file vs project mode detection
- Hide project-only commands (init, build-jar, build-fatjar, build-pkg,
  doc, outdated, showAst) from command palette when no folder is open

No behavior change in folder mode — all refactorings preserve existing
semantics. These changes unblock single-file mode support in a follow-up.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@magnus-madsen magnus-madsen merged commit 80bf1d7 into master Mar 22, 2026
9 checks passed
@magnus-madsen magnus-madsen deleted the feat/single-file-mode-prep branch March 22, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant