Skip to content

fix: show resolved path in setup wizard's config location picker - #855

Open
kishore280 wants to merge 4 commits into
Nano-Collective:mainfrom
kishore280:fix/852-location-picker-show-path
Open

fix: show resolved path in setup wizard's config location picker#855
kishore280 wants to merge 4 commits into
Nano-Collective:mainfrom
kishore280:fix/852-location-picker-show-path

Conversation

@kishore280

Copy link
Copy Markdown

Fixes #852.

The location picker offered "Global user config" vs "Current project
directory" as bare labels, no path shown either way. No way to know
which directory you were about to write into before confirming.

Now shows the resolved path next to both options, home-relativized
with ~, truncated on narrow terminals using the same
PATH_LENGTH_NARROW_TERMINAL/PATH_LENGTH_NORMAL_TERMINAL constants
status.tsx already uses for this.

Ran: test:ava on location-step.spec.tsx (16 pass, 1 new), test:types, test:lint.

@kishore280

Copy link
Copy Markdown
Author

@akramcodez kept this minimal on purpose. Just added the resolved file path next to each option in the location picker so you can see where it's about to write before confirming, e.g.:

> Global user config  (~\AppData\Roaming\nanocoder)
  Current project directory  (...\Microsoft VS Code Insiders)

Didn't touch the UI beyond that — if no provider's configured, the chat panel still just sits stuck on "Loading models..." with no real feedback. Left that out of scope here, happy to pick it up separately if any UI changes are planned down the line.

@will-lamerton

Copy link
Copy Markdown
Member

Hey @kishore280 - thanks for this, the direction is right and the changeset/scope are clean. Two things I'd like fixed before merge:

  1. homeRelative uses an unanchored prefix check, so a sibling home directory gets mangled: with home /Users/will, the path /Users/willy/projects/app renders as ~y/projects/app. Needs a separator boundary, i.e. resolved === home || resolved.startsWith(home + sep).

  2. The truncation budget doesn't account for the label prefix, and it double-truncates. "Current project directory (" is already 28 chars, and StyledSelectInput renders items with wrap="truncate-end" while truncatePath keeps the end of the path. So on an 80-col terminal a deeper path comes out as Current project directory (...tHub/some-org/some-really-long-monorepo-name/pa, cutting off the leaf directory, which is the thing the issue asked to see. Deriving the budget from actualWidth - label.length would fix it, or render the path on its own dim second line via a custom itemComponent.

Smaller points:

  • dirname(join(projectDir, configFileName)) is just projectDir, same for the global one, so the dirname/join round-trip can go.
  • app-container.tsx:58 already does home-relativization with configPath.replace(homedir, '~'). Worth pulling one shared helper into source/utils/ so the boundary fix lives in one place.
  • The new test's /Current project directory.*project/ matches almost anything with "project" in it. Asserting the concrete expected string would be stronger, and exporting homeRelative (with an injectable home, like daemon/install.ts does) would let you cover the case in point 1.
  • The double space before ( doesn't align anything since the two label stems are 18 vs 25 chars.

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.

Setup wizard writes config to cwd, not a fixed location — breaks VS Code extension connection

2 participants