Skip to content

Added files.simpleDialog.currentDirectory option #225565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/files/browser/files.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ configurationRegistry.registerConfiguration({
'description': nls.localize('fileDialogDefaultPath', "Default path for file dialogs, overriding user's home path. Only used in the absence of a context-specific path, such as most recently opened file or folder."),
'scope': ConfigurationScope.MACHINE
},
'files.dialog.useParentPathForOpenFolder': {
'type': 'boolean',
'description': nls.localize('files.dialog.useParentPathForOpenFolder', "Determines whether the open folder dialog should start in the parent or current folder of the most recently active file or folder."),
'default': 'true'
},
'files.simpleDialog.enable': {
'type': 'boolean',
'description': nls.localize('files.simpleDialog.enable', "Enables the simple file dialog for opening and saving files and folders. The simple file dialog replaces the system file dialog when enabled."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
return this.preferredHome(schemeFilter);
}

const startParent = this.configurationService.getValue<boolean>('files.dialog.useParentPathForOpenFolder') !== false;
if (!startParent) {
try {
return (await this.fileService.stat(candidate)).isDirectory ? candidate : resources.dirname(candidate);
} catch {
// fall back to parent.
}
}
return resources.dirname(candidate);
}

Expand Down