Skip to content

Fix VS Code lineage node opening for paths with @#2

Merged
nickmuoh merged 2 commits intomainfrom
copilot/fix-lineage-panel-path-handling
Apr 29, 2026
Merged

Fix VS Code lineage node opening for paths with @#2
nickmuoh merged 2 commits intomainfrom
copilot/fix-lineage-panel-path-handling

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 29, 2026

The lineage panel file-open flow mixed filesystem paths and URI strings, causing files with special characters like @ in their path to fail silently. URI.file(path).toString() encodes @ as %40, and Uri.parse() on the extension side did not correctly reconstruct the filesystem path.

Changes

vscode/bus/src/callbacks.ts

  • Renamed openFile payload field uri → filePath to reflect the actual type (plain filesystem path, not a URI string)

vscode/react/src/pages/lineage.tsx

  • handleClickModel: send model.full_path directly as filePath instead of round-tripping through URI.file(...).toString()
  • fetchFirstTimeModelIfNotSet: compare filesystem paths directly instead of wrapping in URI.file().path (no-op on Linux, but misleading)
  • handleChangeFocusedFile: drop URI.parse() — extension now sends fsPath so direct string comparison is correct
  • Remove unused vscode-uri import

vscode/extension/src/webviews/lineagePanel.ts

  • openFile: Uri.parse(payload.uri)Uri.file(payload.filePath) so special characters are treated as literal path bytes, not percent-encoded URI components
  • changeFocusOnFile: send editor.document.uri.fsPath instead of .toString() to keep the path unencoded end-to-end

vscode/extension/src/commands/tableDiff.ts

  • Align openFile handler with the shared type change (filePath / Uri.file)

Test Plan

Manually verified via code inspection that the round-trip URI.file(path).toString()Uri.parse() is eliminated and replaced with a direct Uri.file(fsPath) call throughout both sides of the RPC contract.

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO
Original prompt

Create a pull request in repository nickmuoh/sqlmesh with a minimal, targeted fix for the VS Code lineage panel file-open flow.

Required changes:

  1. In vscode/react/src/pages/lineage.tsx

    • Send model.full_path as a plain filesystem path in openFile.
    • Treat get_active_file consistently as a filesystem path, not a URI.
  2. In vscode/extension/src/webviews/lineagePanel.ts

    • Open clicked files with Uri.file(...) instead of Uri.parse(...).
    • Rename the RPC payload field from fileUri to filePath only if needed by the paired client change.

Goal:

  • Fix cases where clicking a model in the VS Code lineage graph fails to open the file when the path contains special characters such as @.
  • Keep the change narrowly scoped to lineage panel path handling.

Suggested PR description content:

Issue

  • Clicking a model in the VS Code lineage graph could fail to open the file when the path contained special characters such as @. The lineage flow was mixing filesystem paths and URI strings, which caused encoded paths like %40Domain to be handled incorrectly in this case.

Solution

  • This change keeps the fix narrowly scoped to the lineage panel flow. The webview now sends the model’s local filesystem path directly, and the extension opens the file using Uri.file(...) instead of reparsing an encoded URI string. This avoids incorrect handling of special characters in local paths.

Scope

  • Minimal, targeted update limited to the VS Code lineage file-open path handling.

Suggested implementation guidance:

  • Verify the existing RPC contract between the React webview and the VS Code extension, and update both sides consistently.
  • Avoid unrelated refactors.
  • Preserve existing behavior for normal paths while fixing special-character handling.
  • Update any affected types if necessary.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix lineage panel file-open flow for special characters Fix VS Code lineage node opening for paths with @ Apr 29, 2026
Copilot AI requested a review from nickmuoh April 29, 2026 00:07
@nickmuoh nickmuoh marked this pull request as ready for review April 29, 2026 00:40
@nickmuoh nickmuoh merged commit c769d20 into main Apr 29, 2026
21 checks passed
@nickmuoh nickmuoh deleted the copilot/fix-lineage-panel-path-handling branch April 29, 2026 00:41
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.

2 participants