Auto increment new db project name (#11882)

* auto increment db proj name

* auto increment on import project from db

* adding separate message if workspace setting is invalid

* updating based on feedback

* adding do not ask again functionality

* moving constants

* making newprojecttool only top level functions

* adding tests

* updating to address merge conflicts

* fixing tests

* fixing tests
This commit is contained in:
anjalia
2020-08-26 12:14:51 -07:00
committed by GitHub
parent a3121c0b2d
commit f7279cb1f5
7 changed files with 210 additions and 7 deletions

View File

@@ -11,9 +11,10 @@ import * as path from 'path';
import * as utils from '../common/utils';
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
import * as templates from '../templates/templates';
import * as newProjectTool from '../tools/newProjectTool';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import { promises as fs } from 'fs';
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
import { Project, DatabaseReferenceLocation, SystemDatabase, TargetPlatform, ProjectEntry, reservedProjectFolders, SqlProjectReferenceProjectEntry } from '../models/project';
@@ -661,6 +662,8 @@ export class ProjectsController {
model.extractTarget = await this.getExtractTarget();
model.version = '1.0.0.0';
newProjectTool.updateSaveLocationSetting();
const newProjFilePath = await this.createNewProject(model.projName, vscode.Uri.file(newProjFolderUri), true);
model.filePath = path.dirname(newProjFilePath);
@@ -739,7 +742,7 @@ export class ProjectsController {
private async getProjectName(dbName: string): Promise<string> {
let projName = await vscode.window.showInputBox({
prompt: constants.newDatabaseProjectName,
value: `DatabaseProject${dbName}`
value: newProjectTool.defaultProjectNameFromDb(dbName)
});
projName = projName?.trim();
@@ -797,7 +800,7 @@ export class ProjectsController {
canSelectFolders: true,
canSelectMany: false,
openLabel: constants.selectString,
defaultUri: vscode.workspace.workspaceFolders ? (vscode.workspace.workspaceFolders as vscode.WorkspaceFolder[])[0].uri : undefined
defaultUri: newProjectTool.defaultProjectSaveLocation()
});
if (selectionResult) {