Skip to content

[Repo Assist] Fix FSharp.workspacePath resolution in multi-folder workspaces#2154

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-workspace-path-multifolder-1976-20260316-349e86cd00910470
Draft

[Repo Assist] Fix FSharp.workspacePath resolution in multi-folder workspaces#2154
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-workspace-path-multifolder-1976-20260316-349e86cd00910470

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #1976


Root Cause

When a user sets FSharp.workspacePath to a relative path (e.g. "backend/App.sln") in a multi-folder VS Code workspace, Ionide resolved the path exclusively against workspace.rootPath — which is always the first workspace folder. If the F# project lives in a folder that isn't first in the list, the resolved path does not exist, Ionide silently ignores the setting, and no solution/directory is loaded.

Additionally, workspace.rootPath.Value would crash with a null-reference exception when no workspace folder is open at all.

Minimal repro: workspace with folders ["client", "dotnet"] and FSharp.workspacePath = "dotnet/App.sln" → resolved as (client-path)/dotnet/App.sln (wrong folder) → path does not exist → ignored.

Fix

  • Rename parseparseWithBase to accept an explicit base path rather than implicitly reading workspace.rootPath.Value.
  • Add candidateBasePaths() which returns rootPath :: workspaceFolders (deduped) — all possible base paths in the workspace.
  • In parseAndValidate, try each candidate path in order, returning the first one that physically exists on disk. If none exist, warn and return None (same as before).

Behaviour Changes

Scenario Before After
Single-folder, relative path ✅ Works ✅ Works (unchanged)
Multi-folder, path in first folder ✅ Works ✅ Works (unchanged)
Multi-folder, path in non-first folder ❌ Silently ignored ✅ Resolved correctly
Absolute path ✅ Works ✅ Works (unchanged)
No workspace open (rootPath = None) 💥 Exception ✅ Falls back to workspaceFolders

Trade-offs

  • Tries multiple paths instead of one — negligible overhead (a few stat syscalls at startup/configuration-change time only).
  • If two workspace folders both contain a relative path like "src/App.sln", the one in rootPath/first folder wins (consistent with existing priority ordering).

Test Status

Fable compilation: ✅ No errors (dotnet fable src --noCache — 0 error FSHARP lines, only pre-existing deprecation warnings unrelated to this change).

No existing automated test suite covers this integration path (workspace configuration resolution uses VS Code's live API, not unit-testable in isolation).

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

When a user configures FSharp.workspacePath with a relative path in a
multi-folder workspace, Ionide was resolving it against workspace.rootPath
(the first workspace folder). If the F# project lives in a different folder,
the resolved path would not exist and the setting would be silently ignored.

Fix: collect all workspace folder paths as candidates and try each one in
order until we find an existing path. Falls back to rootPath-only behaviour
for single-folder workspaces (no behaviour change).

Closes #1976

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not Recognizing F# Project Inside Workspace With Flutter

0 participants