Add validation for new file names for sql projects (#21601)

* Add validation for new file names for sql projects

* Addres comments and add validation for new project dialog

* Address comments

* Address comments on test

* Fix tests

* Remove extra error messages and rename file

* Address comments

* Fix tests

* Add test file back
This commit is contained in:
Sakshi Sharma
2023-02-02 07:25:26 -08:00
committed by GitHub
parent 1071c6dfff
commit 972312b3f5
12 changed files with 438 additions and 29 deletions

View File

@@ -9,6 +9,7 @@ import * as constants from '../common/constants';
import { directoryExist, showInfoMessageWithLearnMoreLink } from '../common/utils';
import { defaultProjectSaveLocation } from '../common/projectLocationHelper';
import { WorkspaceService } from '../services/workspaceService';
import { isValidBasename, isValidBasenameErrorMessage } from '../common/pathUtilsHelper';
/**
* Create flow for a New Project using only VS Code-native APIs such as QuickPick
@@ -39,7 +40,7 @@ export async function createNewProjectWithQuickpick(workspaceService: WorkspaceS
{
title: constants.EnterProjectName,
validateInput: (value) => {
return value ? undefined : constants.NameCannotBeEmpty;
return isValidBasename(value) ? undefined : isValidBasenameErrorMessage(value);
},
ignoreFocusOut: true
});