fix: resolve editor paths from repo root#347
Conversation
Greptile SummaryThis PR fixes the
Confidence Score: 5/5This is a focused, well-scoped bug fix with correct logic and no regressions introduced. The input-kind guard in App.tsx correctly limits repo-root resolution to the three VCS-backed input kinds where sourceLabel is always an absolute repo root path; the cwd fallback is preserved for all other input types. The resolve call in the helper handles already-absolute paths safely. No edge cases or data-flow issues were found. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant App as App.tsx
participant OE as openInEditor.ts
participant FS as filesystem
App->>App: User presses 'e'
App->>App: Determine basePath
note over App: sourceLabel if vcs/show/stash-show, else undefined
App->>OE: "openSelectedFileInEditor({ basePath, file, … })"
OE->>OE: resolveEditableFilePath(file.path, basePath)
note over OE: resolve(basePath ?? cwd, file.path)
OE->>FS: existsSync(absolutePath)
alt file exists
OE->>OE: buildEditorCommand(editor, absolutePath, line)
OE->>OE: Bun.spawnSync([editor, …args])
else file not found
OE-->>App: Cannot edit …: file does not exist on disk.
end
Reviews (1): Last reviewed commit: "fix: resolve editor paths from repo root" | Re-trigger Greptile |
a38640f to
bf35853
Compare
|
Makes sense, thanks for the follow up! |
@benvinegar - there is a bug when launching the editor from a place that is not the repo root.
This PR should fix it.