refactor: prepare extension for single-file mode support#527
Merged
Conversation
- 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>
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
ensureFlixExistsagainst undefinedworkspaceFolders(default to[]) so it no longer crashes when no folder is openStartEngineInputtypes:[string]tuples →string[]arrays; make unusedworkspaceFoldersfield optionalactivationEvents: ["onLanguage:flix"]topackage.jsonisProjectMode()helper for single-file vs project mode detectionContext
This is preparatory refactoring for single-file mode support (opening a standalone
.flixfile without a workspace folder). All changes preserve existing behavior in folder mode — the glob patterns produce the same values,ensureFlixExistsfollows the same resolution order, and all commands remain visible when a workspace folder is open.Test plan
npm test).flixfile — extension no longer crashes at module-load time🤖 Generated with Claude Code