listToListWrappedComma

This commit is contained in:
2020-02-26 12:01:45 -07:00
parent 615bbd23a7
commit b45f007134
5 changed files with 17 additions and 1 deletions

View File

@ -30,6 +30,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('helper.convertToRegularExpression', helper.convertToRegularExpression),
vscode.commands.registerCommand('helper.expandSql', helper.expandSql),
vscode.commands.registerCommand('helper.listToListFamily', helper.listToListFamily),
vscode.commands.registerCommand('helper.listToListWrappedComma', helper.listToListWrappedComma),
vscode.commands.registerCommand('helper.prettySql', helper.prettySql),
vscode.commands.registerCommand('helper.removeComment', helper.removeComment),
vscode.commands.registerCommand('helper.sortNormal', helper.sortNormal),

View File

@ -10,6 +10,7 @@ enum LinesAction {
convertToRegularExpression,
expandSql,
listToListFamily,
listToListWrappedComma,
prettySql,
removeComment,
sortNormal,
@ -112,6 +113,12 @@ function listToListFamilyLogic(lines: string[]): void {
}
}
function listToListWrappedCommaLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = "'" + lines[i].trim() + "',";
}
}
function prettySqlLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = ' ' + lines[i];
@ -231,6 +238,7 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
case LinesAction.convertToRegularExpression: { lines = convertToRegularExpressionLogic(lines); break; }
case LinesAction.expandSql: { expandSqlLogic(lines); break; }
case LinesAction.listToListFamily: { listToListFamilyLogic(lines); break; }
case LinesAction.listToListWrappedComma: { listToListWrappedCommaLogic(lines); break; }
case LinesAction.prettySql: { prettySqlLogic(lines); break; }
case LinesAction.removeComment: { removeCommentLogic(lines); break; }
case LinesAction.sortNormal: { sortNormalLogic(lines); break; }
@ -247,6 +255,7 @@ export const addVBComment = () => linesFunction(LinesAction.addVBComment);
export const convertToRegularExpression = () => linesFunction(LinesAction.convertToRegularExpression);
export const expandSql = () => linesFunction(LinesAction.expandSql);
export const listToListFamily = () => linesFunction(LinesAction.listToListFamily);
export const listToListWrappedComma = () => linesFunction(LinesAction.listToListWrappedComma);
export const prettySql = () => linesFunction(LinesAction.prettySql);
export const removeComment = () => linesFunction(LinesAction.removeComment);
export const sortNormal = () => linesFunction(LinesAction.sortNormal);