mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 09:35:38 -05:00
use default folder or open folder as initial location in new project dialog (#20416)
* use default folder or open folder in new project dialog * simplify
This commit is contained in:
@@ -193,6 +193,11 @@ export class NewProjectDialog extends DialogBase {
|
||||
width: constants.DefaultInputWidth
|
||||
}).component();
|
||||
|
||||
// use the default save location if it's there
|
||||
// otherwise, if there's an open folder, set the initial location to that. If there are multiple folders in the workspace, default to the first one
|
||||
const defaultSaveLocation = defaultProjectSaveLocation();
|
||||
locationTextBox.value = defaultSaveLocation?.fsPath ?? vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
||||
|
||||
this.register(locationTextBox.onTextChanged(() => {
|
||||
this.model.location = locationTextBox.value!;
|
||||
return locationTextBox.updateProperty('title', locationTextBox.value);
|
||||
@@ -209,7 +214,7 @@ export class NewProjectDialog extends DialogBase {
|
||||
canSelectFiles: false,
|
||||
canSelectFolders: true,
|
||||
canSelectMany: false,
|
||||
defaultUri: defaultProjectSaveLocation()
|
||||
defaultUri: locationTextBox.value ? vscode.Uri.file(locationTextBox.value) : undefined
|
||||
});
|
||||
if (!folderUris || folderUris.length === 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user