Skip to content

[Repo Assist] Fix: show relative paths in 'Add project to solution' picker#2141

Draft
github-actions[bot] wants to merge 2 commits into
mainfrom
repo-assist/improve-add-project-relative-paths-760235d7a4f65f13
Draft

[Repo Assist] Fix: show relative paths in 'Add project to solution' picker#2141
github-actions[bot] wants to merge 2 commits into
mainfrom
repo-assist/improve-add-project-relative-paths-760235d7a4f65f13

Conversation

@github-actions

@github-actions github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

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

Summary

Closes #1965

When using Add project to solution from the F# Solution Explorer context menu, the quick-pick list shows full absolute paths for all discoverable projects. On large monorepos or deeply-nested solutions this makes it impossible to distinguish which project is which at a glance.

Root Cause

fsharp.explorer.solution.addProject calls Project.getAll() (which returns full absolute paths), converts them to a plain ResizeArray(string), and passes that directly to window.showQuickPick. VS Code displays these strings verbatim as the quick-pick labels.

Fix

Replace the plain string list with QuickPickItem objects where:

  • label = workspace-relative path (e.g. src/MyLib/MyLib.fsproj instead of /home/user/repos/MyApp/src/MyLib/MyLib.fsproj)
  • description = full absolute path (still shown as secondary text, and used as the argument to dotnet sln add)

The stripping logic normalises path separators and strips the workspace root prefix. If a project lives outside the workspace root (unusual but possible), the full path is shown unchanged.

Trade-offs

  • No behaviour change for usersdotnet sln add still receives the full absolute path via proj.description.
  • One-project workspaces — still shows relative path, which is shorter and equally unambiguous.
  • Cross-platform — backslash/forward-slash normalisation is handled before comparison.

Test Status

⚠️ Infrastructure limitation: yarn install is unavailable in this environment due to network restrictions, so a full Fable build cannot be run.

The change is type-correct: createEmpty(QuickPickItem) / .label / .description follow the same pattern used in the template-picker code (lines 857–860 of SolutionExplorer.fs). The U2.Case1 wrapper for ResizeArray(QuickPickItem) mirrors line 867.

Generated by Repo Assist

To install this agentic workflow, run

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

…1965)

Replace raw full paths in the QuickPick for fsharp.explorer.solution.addProject
with workspace-relative paths. The full path is preserved as the description so
the dotnet sln add command still receives it correctly.

- Strip workspace root prefix from each project path before display
- Store full path in QuickPickItem.description for reliable dotnet sln add
- Fall back to full path if project is outside the workspace root

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.

[UX - Add project to sln] eliminate longest common prefix of all fsproj in the list

0 participants