wrapSqlVB sortLength cutEachLine

This commit is contained in:
Mike Phares 2021-06-07 17:48:09 -07:00
parent 63fe43adf0
commit 9efe4e506b
3 changed files with 22 additions and 18 deletions

View File

@ -16,34 +16,34 @@
"onCommand:helper.addCSharpComment",
"onCommand:helper.addVBComment",
"onCommand:helper.convertToRegularExpression",
"onCommand:helper.cutEachLine",
"onCommand:helper.expandSql",
"onCommand:helper.listToListFamily",
"onCommand:helper.listToListWrappedComma",
"onCommand:helper.prettySql",
"onCommand:helper.removeComment",
"onCommand:helper.sortLength",
"onCommand:helper.sortNormal",
"onCommand:helper.unwrapSql",
"onCommand:helper.wrapSqlCSharp",
"onCommand:helper.wrapSqlVB",
"onCommand:helper.sortLength",
"onCommand:helper.cutEachLine"
"onCommand:helper.wrapSqlVB"
],
"contributes": {
"commands": [
{ "command": "helper.addCSharpComment", "title": "Add C# Comment" },
{ "command": "helper.addVBComment", "title": "Add VB Comment" },
{ "command": "helper.convertToRegularExpression", "title": "Convert to Regular Expression" },
{ "command": "helper.cutEachLine", "title": "Cut each line after |||" },
{ "command": "helper.expandSql", "title": "Expand Sql" },
{ "command": "helper.listToListFamily", "title": "List to list family (Kristy, Mike ...)" },
{ "command": "helper.listToListWrappedComma", "title": "List to list wrapped comma" },
{ "command": "helper.prettySql", "title": "Pretty Sql" },
{ "command": "helper.removeComment", "title": "Remove comment" },
{ "command": "helper.sortLength", "title": "Sort by Length" },
{ "command": "helper.sortNormal", "title": "My Sort lines (ascending, case sensitive)" },
{ "command": "helper.unwrapSql", "title": "Un-wrap Sql" },
{ "command": "helper.wrapSqlCSharp", "title": "Wrap Sql for C#" },
{ "command": "helper.wrapSqlVB", "title": "Wrap Sql for VB" },
{ "command": "helper.sortLength", "title": "Sort by Length" },
{ "command": "helper.cutEachLine", "title": "Cut each line after |||" }
{ "command": "helper.wrapSqlVB", "title": "Wrap Sql for VB" }
],
"keybindings": [
{

View File

@ -28,17 +28,17 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('helper.addCSharpComment', helper.addCSharpComment),
vscode.commands.registerCommand('helper.addVBComment', helper.addVBComment),
vscode.commands.registerCommand('helper.convertToRegularExpression', helper.convertToRegularExpression),
vscode.commands.registerCommand('helper.cutEachLine', helper.cutEachLine),
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.sortLength', helper.sortLength),
vscode.commands.registerCommand('helper.sortNormal', helper.sortNormal),
vscode.commands.registerCommand('helper.unwrapSql', helper.unwrapSql),
vscode.commands.registerCommand('helper.wrapSqlCSharp', helper.wrapSqlCSharp),
vscode.commands.registerCommand('helper.wrapSqlVB', helper.wrapSqlVB),
vscode.commands.registerCommand('helper.sortLength', helper.sortLength),
vscode.commands.registerCommand('helper.cutEachLine', helper.cutEachLine)
vscode.commands.registerCommand('helper.wrapSqlVB', helper.wrapSqlVB)
];
commands.forEach(command => context.subscriptions.push(command));

View File

@ -8,17 +8,18 @@ enum LinesAction {
addCSharpComment,
addVBComment,
convertToRegularExpression,
cutEachLine,
expandSql,
listToListFamily,
listToListWrappedComma,
prettySql,
pdsfToFixedWidth,
removeComment,
sortLength,
sortNormal,
unwrapSql,
wrapSqlCSharp,
wrapSqlVB,
sortLength,
cutEachLine
wrapSqlVB
}
function removeBlanks(lines: string[]): void {
@ -61,6 +62,8 @@ function convertToRegularExpressionLogic(lines: string[]): string[] {
split(')').join('\\)').
split('[').join('\\[').
split(']').join('\\]').
split('{').join('\\{').
split('}').join('\\}').
split('.').join('\\.').
split('*').join('\\*').
split('+').join('\\+').
@ -111,7 +114,7 @@ function expandSqlLogic(lines: string[]): void {
function listToListFamilyLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = "Kristy" + lines[i].trim() + "Mike" + lines[i].trim() + "Jason" + lines[i].trim() + "Mackenzie" + lines[i].trim() + "Logan" + lines[i].trim() + "Lilly" + lines[i].trim() + "Chelsea" + lines[i].trim() + "Pipper" + lines[i].trim();
lines[i] = "Kristy" + lines[i].trim() + "Mike" + lines[i].trim() + "Jason" + lines[i].trim() + "Mackenzie" + lines[i].trim() + "Logan" + lines[i].trim() + "Lilly" + lines[i].trim() + "Chelsea" + lines[i].trim() + "Piper" + lines[i].trim();
}
}
@ -258,17 +261,17 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
case LinesAction.addCSharpComment: { addCSharpCommentLogic(lines); break; }
case LinesAction.addVBComment: { addVBCommentLogic(lines); break; }
case LinesAction.convertToRegularExpression: { lines = convertToRegularExpressionLogic(lines); break; }
case LinesAction.cutEachLine: { cutEachLineLogic(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.sortLength: { sortLengthLogic(lines); break; }
case LinesAction.sortNormal: { sortNormalLogic(lines); break; }
case LinesAction.unwrapSql: { unwrapSqlLogic(lines); break; }
case LinesAction.wrapSqlCSharp: { wrapSqlCSharpLogic(lines); break; }
case LinesAction.wrapSqlVB: { wrapSqlVBLogic(lines); break; }
case LinesAction.sortLength: { sortLengthLogic(lines); break; }
case LinesAction.cutEachLine: { cutEachLineLogic(lines); break; }
default: { throw new Error(); }
}
return returnLines(textEditor, startLine, endLine, lines);
@ -277,14 +280,15 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
export const addCSharpComment = () => linesFunction(LinesAction.addCSharpComment);
export const addVBComment = () => linesFunction(LinesAction.addVBComment);
export const convertToRegularExpression = () => linesFunction(LinesAction.convertToRegularExpression);
export const cutEachLine = () => linesFunction(LinesAction.cutEachLine);
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 pdsfToFixedWidth = () => linesFunction(LinesAction.pdsfToFixedWidth);
export const removeComment = () => linesFunction(LinesAction.removeComment);
export const sortLength = () => linesFunction(LinesAction.sortLength);
export const sortNormal = () => linesFunction(LinesAction.sortNormal);
export const unwrapSql = () => linesFunction(LinesAction.unwrapSql);
export const wrapSqlCSharp = () => linesFunction(LinesAction.wrapSqlCSharp);
export const wrapSqlVB = () => linesFunction(LinesAction.wrapSqlVB);
export const sortLength = () => linesFunction(LinesAction.sortLength);
export const cutEachLine = () => linesFunction(LinesAction.cutEachLine);
export const wrapSqlVB = () => linesFunction(LinesAction.wrapSqlVB);