[SQL-bindings] remove watcher for files (#20250)

* remove watcher for files

* nit
This commit is contained in:
Vasu Bhog
2022-08-05 16:18:03 -07:00
committed by GitHub
parent 9dee889808
commit 4ebe4c4547
4 changed files with 3 additions and 82 deletions

View File

@@ -25,11 +25,6 @@ export interface ILocalSettingsJson {
ConnectionStrings?: { [key: string]: string };
}
export interface IFileFunctionObject {
filePromise: Promise<string>;
watcherDisposable: vscode.Disposable;
}
/**
* copied and modified from vscode-azurefunctions extension
* https://github.com/microsoft/vscode-azurefunctions/blob/main/src/funcConfig/local.settings.ts
@@ -198,42 +193,6 @@ export async function getSettingsFile(projectFolder: string): Promise<string | u
return path.join(projectFolder, 'local.settings.json');
}
/**
* New azure function file watcher and watcher disposable to be used to watch for changes to the azure function project
* @param projectFolder is the parent directory to the project file
* @returns the function file path once created and the watcher disposable
*/
export function waitForNewFunctionFile(projectFolder: string): IFileFunctionObject {
const watcher = vscode.workspace.createFileSystemWatcher((
new vscode.RelativePattern(projectFolder, '**/*.cs')), false, true, true);
const filePromise = new Promise<string>((resolve, _) => {
watcher.onDidCreate((e) => {
resolve(e.fsPath);
});
});
return {
filePromise,
watcherDisposable: watcher
};
}
/**
* Retrieves the new host project file once it has created and the watcher disposable
* @returns the host file path once created and the watcher disposable
*/
export function waitForNewHostFile(): IFileFunctionObject {
const watcher = vscode.workspace.createFileSystemWatcher('**/host.json', false, true, true);
const filePromise = new Promise<string>((resolve, _) => {
watcher.onDidCreate((e) => {
resolve(e.fsPath);
});
});
return {
filePromise,
watcherDisposable: watcher
};
}
/**
* Adds the required nuget package to the project
* @param selectedProjectFile is the users selected project file path

View File

@@ -83,20 +83,6 @@ export function generateQuotedFullName(schema: string, objectName: string): stri
return `[${escapeClosingBrackets(schema)}].[${escapeClosingBrackets(objectName)}]`;
}
/**
* Returns a promise that will reject after the specified timeout
* @param errorMessage error message to be returned in the rejection
* @param ms timeout in milliseconds. Default is 10 seconds
* @returns a promise that rejects after the specified timeout
*/
export function timeoutPromise(errorMessage: string, ms: number = 10000): Promise<string> {
return new Promise((_, reject) => {
setTimeout(() => {
reject(new TimeoutError(errorMessage));
}, ms);
});
}
/**
* Gets a unique file name
* Increment the file name by adding 1 to function name if the file already exists