-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
Workspace folder picker command (for #32936) #34648
Conversation
good point about the return type and identity, that is addressed in this change. I rethought about having real API for this because I somewhat assume that this is a corner case where people might need it. If we want to go away from introducing more commands, I can also restore the proper API again and call into the command. |
Fair enough, I let @dbaeumer decide if a command is OK for him |
Oh, the test actually doesn't pass: https://travis-ci.org/Microsoft/vscode/jobs/277395186#L4159 |
I always prefer explicit API over commands. The reason is:
But that might be me :-) |
@jrieken @dbaeumer fair enough, I provide this API now (while still using the command internally): /**
* Shows a selection list of [workspace folders](#workspace.workspaceFolders) to pick from.
* Returns `undefined` if no folder is open.
*
* @param options Configures the behavior of the workspace folder list.
* @return A promise that resolves to the workspace folder or `undefined`.
*/
export function showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions): Thenable<WorkspaceFolder | undefined>;
/**
* Options to configure the behaviour of the [workspace folder](#WorkspaceFolder) pick UI.
*/
export interface WorkspaceFolderPickOptions {
/**
* An optional string to show as place holder in the input box to guide the user what to pick on.
*/
placeHolder?: string;
/**
* Set to `true` to keep the picker open when focus moves to another part of the editor or to another window.
*/
ignoreFocusOut?: boolean;
} |
/** | ||
* Options to configure the behaviour of the [workspace folder](#WorkspaceFolder) pick UI. | ||
*/ | ||
export interface WorkspaceFolderPickOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't define types inside a namespace but globally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrieken isn't that globally? It is outside the window
namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry. Didn't see that closing-curly
fixes #32936
Introduces a simple new command
vscode.pickWorkspace
to pick aWorkspaceFolder
via quick pick.