Skip to content

bug(vscode): openFile accepts zero line and column values #5710

Description

@tt-a1i

What happened?

The VS Code companion webview openFile handler parses paths like src/app.ts:123:45 and converts the line/column to VS Code zero-based positions by subtracting 1.

That means inputs such as src/app.ts:0 or src/app.ts:1:0 produce negative vscode.Position values (-1 or -1 column). In the real VS Code API this can make the open-file request fail instead of opening the document.

Expected behavior

Zero line/column values from a webview open request should not produce negative editor positions. The handler should normalize them to the start of the file/line or otherwise ignore the invalid location while still opening the file.

Notes

Relevant code:

  • packages/vscode-ide-companion/src/webview/handlers/FileMessageHandler.ts
  • packages/vscode-ide-companion/src/webview/handlers/FileMessageHandler.test.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    category/integrationExternal integrationscategory/uiUser interface and displaypriority/P2Medium - Moderately impactful, noticeable problemscope/vscodeVSCode extension specifictype/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions