Skip to content

showOpenDialog ignores defaultUri and opens on “Recent” / user working directory instead #16834

@ayatarek831

Description

@ayatarek831

Bug description:
When a VS Code extension is executed in Theia (via @theia/plugin-ext), calling [vscode.window.showOpenDialog({ defaultUri })] does not open the dialog in the provided [defaultUri].

Instead, the Theia file dialog opens on a “Recent” view or falls back to another directory, even though the extension passes a valid URI.

Expected behavior:
The open dialog should start in the folder specified by [options.defaultUri]
(or its parent when [defaultUri] points to a file / non-existing file).

Actual behavior: The dialog does not navigate to [defaultUri] and starts in a “Recent” tab / different folder.
Run Theia with plugin-ext enabled.

Steps to Reproduce
Execute an extension command that calls:
[vscode.window.showOpenDialog({ defaultUri: vscode.Uri.file('/home/dir1/dir2/'), canSelectFiles: true, canSelectFolders: false })]
Observe the open dialog starting in “Recent” / unexpected directory rather than [dir2]

This bug is also found in showSaveDialog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions