mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 01:25:38 -05:00
Hygiene linting for extensions + new rule (#7843)
* linting for extensions + new rule * Remove unneeded array * Fix spelling mistake * Fix bad merge
This commit is contained in:
@@ -18,7 +18,7 @@ export class CancelableStream extends Transform {
|
||||
|
||||
public _transform(chunk: any, encoding: string, callback: Function): void {
|
||||
if (this.cancelationToken && this.cancelationToken.token.isCancellationRequested) {
|
||||
callback(new Error(localize('streamCanceled', 'Stream operation canceled by the user')));
|
||||
callback(new Error(localize('streamCanceled', "Stream operation canceled by the user")));
|
||||
} else {
|
||||
this.push(chunk);
|
||||
callback();
|
||||
|
||||
@@ -140,7 +140,7 @@ export abstract class ProgressCommand extends Command {
|
||||
const tokenSource = new vscode.CancellationTokenSource();
|
||||
const statusBarItem = this.apiWrapper.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
disposables.push(vscode.Disposable.from(statusBarItem));
|
||||
statusBarItem.text = localize('progress', '$(sync~spin) {0}...', label);
|
||||
statusBarItem.text = localize('progress', "$(sync~spin) {0}...", label);
|
||||
if (isCancelable) {
|
||||
const cancelCommandId = `cancelProgress${ProgressCommand.progressId++}`;
|
||||
disposables.push(this.apiWrapper.registerCommand(cancelCommandId, async () => {
|
||||
@@ -148,7 +148,7 @@ export abstract class ProgressCommand extends Command {
|
||||
tokenSource.cancel();
|
||||
}
|
||||
}));
|
||||
statusBarItem.tooltip = localize('cancelTooltip', 'Cancel');
|
||||
statusBarItem.tooltip = localize('cancelTooltip', "Cancel");
|
||||
statusBarItem.command = cancelCommandId;
|
||||
}
|
||||
statusBarItem.show();
|
||||
@@ -170,7 +170,7 @@ export abstract class ProgressCommand extends Command {
|
||||
private async confirmCancel(): Promise<boolean> {
|
||||
return await this.prompter.promptSingle<boolean>(<IQuestion>{
|
||||
type: QuestionTypes.confirm,
|
||||
message: localize('cancel', 'Cancel operation?'),
|
||||
message: localize('cancel', "Cancel operation?"),
|
||||
default: true
|
||||
});
|
||||
}
|
||||
@@ -179,7 +179,7 @@ export abstract class ProgressCommand extends Command {
|
||||
export function registerSearchServerCommand(appContext: AppContext): void {
|
||||
appContext.apiWrapper.registerCommand('mssql.searchServers', () => {
|
||||
vscode.window.showInputBox({
|
||||
placeHolder: localize('mssql.searchServers', 'Search Server Names')
|
||||
placeHolder: localize('mssql.searchServers', "Search Server Names")
|
||||
}).then((stringSearch) => {
|
||||
if (stringSearch) {
|
||||
vscode.commands.executeCommand('registeredServers.searchServer', (stringSearch));
|
||||
|
||||
@@ -84,15 +84,15 @@ export class SqlClusterConnection {
|
||||
|
||||
private validate(connectionInfo: azdata.ConnectionInfo): void {
|
||||
if (!connectionInfo) {
|
||||
throw new Error(localize('connectionInfoUndefined', 'ConnectionInfo is undefined.'));
|
||||
throw new Error(localize('connectionInfoUndefined', "ConnectionInfo is undefined."));
|
||||
}
|
||||
if (!connectionInfo.options) {
|
||||
throw new Error(localize('connectionInfoOptionsUndefined', 'ConnectionInfo.options is undefined.'));
|
||||
throw new Error(localize('connectionInfoOptionsUndefined', "ConnectionInfo.options is undefined."));
|
||||
}
|
||||
let missingProperties: string[] = this.getMissingProperties(connectionInfo);
|
||||
if (missingProperties && missingProperties.length > 0) {
|
||||
throw new Error(localize('connectionInfoOptionsMissingProperties',
|
||||
'Some missing properties in connectionInfo.options: {0}',
|
||||
"Some missing properties in connectionInfo.options: {0}",
|
||||
missingProperties.join(', ')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ export class UploadFilesCommand extends ProgressCommand {
|
||||
canSelectFiles: true,
|
||||
canSelectFolders: false,
|
||||
canSelectMany: true,
|
||||
openLabel: localize('lblUploadFiles', 'Upload'),
|
||||
openLabel: localize('lblUploadFiles', "Upload"),
|
||||
filters: filter
|
||||
};
|
||||
let fileUris: vscode.Uri[] = await this.apiWrapper.showOpenDialog(options);
|
||||
@@ -86,8 +86,8 @@ export class UploadFilesCommand extends ProgressCommand {
|
||||
let files: IFile[] = await Promise.all(fileUris.map(uri => uri.fsPath).map(this.mapPathsToFiles()));
|
||||
await this.executeWithProgress(
|
||||
(cancelToken: vscode.CancellationTokenSource) => this.writeFiles(files, folderNode, cancelToken),
|
||||
localize('uploading', 'Uploading files to HDFS'), true,
|
||||
() => this.apiWrapper.showInformationMessage(localize('uploadCanceled', 'Upload operation was canceled')));
|
||||
localize('uploading', "Uploading files to HDFS"), true,
|
||||
() => this.apiWrapper.showInformationMessage(localize('uploadCanceled', "Upload operation was canceled")));
|
||||
if (context.type === constants.ObjectExplorerService) {
|
||||
let objectExplorerNode = await azdata.objectexplorer.getNode(context.explorerContext.connectionProfile.id, folderNode.getNodeInfo().nodePath);
|
||||
await objectExplorerNode.refresh();
|
||||
@@ -96,7 +96,7 @@ export class UploadFilesCommand extends ProgressCommand {
|
||||
}
|
||||
} catch (err) {
|
||||
this.apiWrapper.showErrorMessage(
|
||||
localize('uploadError', 'Error uploading files: {0}', utils.getErrorMessage(err, true)));
|
||||
localize('uploadError', "Error uploading files: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +152,8 @@ export class MkDirCommand extends ProgressCommand {
|
||||
if (fileName && fileName.length > 0) {
|
||||
await this.executeWithProgress(
|
||||
async (cancelToken: vscode.CancellationTokenSource) => this.mkDir(fileName, folderNode, cancelToken),
|
||||
localize('makingDir', 'Creating directory'), true,
|
||||
() => this.apiWrapper.showInformationMessage(localize('mkdirCanceled', 'Operation was canceled')));
|
||||
localize('makingDir', "Creating directory"), true,
|
||||
() => this.apiWrapper.showInformationMessage(localize('mkdirCanceled', "Operation was canceled")));
|
||||
if (context.type === constants.ObjectExplorerService) {
|
||||
let objectExplorerNode = await azdata.objectexplorer.getNode(context.explorerContext.connectionProfile.id, folderNode.getNodeInfo().nodePath);
|
||||
await objectExplorerNode.refresh();
|
||||
@@ -162,7 +162,7 @@ export class MkDirCommand extends ProgressCommand {
|
||||
}
|
||||
} catch (err) {
|
||||
this.apiWrapper.showErrorMessage(
|
||||
localize('mkDirError', 'Error on making directory: {0}', utils.getErrorMessage(err, true)));
|
||||
localize('mkDirError', "Error on making directory: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export class MkDirCommand extends ProgressCommand {
|
||||
return await this.prompter.promptSingle(<IQuestion>{
|
||||
type: QuestionTypes.input,
|
||||
name: 'enterDirName',
|
||||
message: localize('enterDirName', 'Enter directory name'),
|
||||
message: localize('enterDirName', "Enter directory name"),
|
||||
default: ''
|
||||
}).then(confirmed => <string>confirmed);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ export class DeleteFilesCommand extends Command {
|
||||
}
|
||||
} catch (err) {
|
||||
this.apiWrapper.showErrorMessage(
|
||||
localize('deleteError', 'Error on deleting files: {0}', utils.getErrorMessage(err, true)));
|
||||
localize('deleteError', "Error on deleting files: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ export class DeleteFilesCommand extends Command {
|
||||
|
||||
private async deleteFolder(node: FolderNode): Promise<void> {
|
||||
if (node) {
|
||||
let confirmed = await this.confirmDelete(localize('msgDeleteFolder', 'Are you sure you want to delete this folder and its contents?'));
|
||||
let confirmed = await this.confirmDelete(localize('msgDeleteFolder', "Are you sure you want to delete this folder and its contents?"));
|
||||
if (confirmed) {
|
||||
// TODO prompt for recursive delete if non-empty?
|
||||
await node.delete(true);
|
||||
@@ -244,7 +244,7 @@ export class DeleteFilesCommand extends Command {
|
||||
|
||||
private async deleteFile(node: FileNode): Promise<void> {
|
||||
if (node) {
|
||||
let confirmed = await this.confirmDelete(localize('msgDeleteFile', 'Are you sure you want to delete this file?'));
|
||||
let confirmed = await this.confirmDelete(localize('msgDeleteFile', "Are you sure you want to delete this file?"));
|
||||
if (confirmed) {
|
||||
await node.delete();
|
||||
}
|
||||
@@ -273,15 +273,15 @@ export class SaveFileCommand extends ProgressCommand {
|
||||
if (fileUri) {
|
||||
await this.executeWithProgress(
|
||||
(cancelToken: vscode.CancellationTokenSource) => this.doSaveAndOpen(fileUri, fileNode, cancelToken),
|
||||
localize('saving', 'Saving HDFS Files'), true,
|
||||
() => this.apiWrapper.showInformationMessage(localize('saveCanceled', 'Save operation was canceled')));
|
||||
localize('saving', "Saving HDFS Files"), true,
|
||||
() => this.apiWrapper.showInformationMessage(localize('saveCanceled', "Save operation was canceled")));
|
||||
}
|
||||
} else {
|
||||
this.apiWrapper.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
this.apiWrapper.showErrorMessage(
|
||||
localize('saveError', 'Error on saving file: {0}', utils.getErrorMessage(err, true)));
|
||||
localize('saveError', "Error on saving file: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,14 +324,14 @@ export class PreviewFileCommand extends ProgressCommand {
|
||||
await this.showNotebookDocument(fileName, connectionProfile, contents);
|
||||
}
|
||||
},
|
||||
localize('previewing', 'Generating preview'),
|
||||
localize('previewing', "Generating preview"),
|
||||
false);
|
||||
} else {
|
||||
this.apiWrapper.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
this.apiWrapper.showErrorMessage(
|
||||
localize('previewError', 'Error on previewing file: {0}', utils.getErrorMessage(err, true)));
|
||||
localize('previewError', "Error on previewing file: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ export class CopyPathCommand extends Command {
|
||||
}
|
||||
} catch (err) {
|
||||
this.apiWrapper.showErrorMessage(
|
||||
localize('copyPathError', 'Error on copying path: {0}', utils.getErrorMessage(err, true)));
|
||||
localize('copyPathError', "Error on copying path: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ export class FolderNode extends HdfsFileSourceNode {
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
this.children = [ErrorNode.create(localize('errorExpanding', 'Error: {0}', utils.getErrorMessage(error)), this, error.statusCode)];
|
||||
this.children = [ErrorNode.create(localize('errorExpanding', "Error: {0}", utils.getErrorMessage(error)), this, error.statusCode)];
|
||||
}
|
||||
}
|
||||
return this.children;
|
||||
@@ -242,7 +242,7 @@ export class ConnectionNode extends FolderNode {
|
||||
}
|
||||
|
||||
public async delete(): Promise<void> {
|
||||
throw new Error(localize('errDeleteConnectionNode', 'Cannot delete a connection. Only subfolders and files can be deleted.'));
|
||||
throw new Error(localize('errDeleteConnectionNode', "Cannot delete a connection. Only subfolders and files can be deleted."));
|
||||
}
|
||||
|
||||
async getTreeItem(): Promise<vscode.TreeItem> {
|
||||
|
||||
Reference in New Issue
Block a user