listToListWrappedComma

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

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
type-script-helper-1.1.6.vsix
type-script-helper-1.1.7.vsix
type-script-helper-1.1.8.vsix

Binary file not shown.

View File

@ -4,7 +4,7 @@
"description": "Helper for VS Code in TypeScript", "description": "Helper for VS Code in TypeScript",
"publisher": "IFX", "publisher": "IFX",
"repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper", "repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper",
"version": "1.2.0", "version": "1.2.1",
"engines": { "engines": {
"vscode": "^1.40.0" "vscode": "^1.40.0"
}, },
@ -18,6 +18,7 @@
"onCommand:helper.convertToRegularExpression", "onCommand:helper.convertToRegularExpression",
"onCommand:helper.expandSql", "onCommand:helper.expandSql",
"onCommand:helper.listToListFamily", "onCommand:helper.listToListFamily",
"onCommand:helper.listToListWrappedComma",
"onCommand:helper.prettySql", "onCommand:helper.prettySql",
"onCommand:helper.removeComment", "onCommand:helper.removeComment",
"onCommand:helper.sortNormal", "onCommand:helper.sortNormal",
@ -32,6 +33,7 @@
{ "command": "helper.convertToRegularExpression", "title": "Convert to Regular Expression" }, { "command": "helper.convertToRegularExpression", "title": "Convert to Regular Expression" },
{ "command": "helper.expandSql", "title": "Expand Sql" }, { "command": "helper.expandSql", "title": "Expand Sql" },
{ "command": "helper.listToListFamily", "title": "List to list family (Kristy, Mike ...)" }, { "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.prettySql", "title": "Pretty Sql" },
{ "command": "helper.removeComment", "title": "Remove comment" }, { "command": "helper.removeComment", "title": "Remove comment" },
{ "command": "helper.sortNormal", "title": "My Sort lines (ascending, case sensitive)" }, { "command": "helper.sortNormal", "title": "My Sort lines (ascending, case sensitive)" },

View File

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

View File

@ -10,6 +10,7 @@ enum LinesAction {
convertToRegularExpression, convertToRegularExpression,
expandSql, expandSql,
listToListFamily, listToListFamily,
listToListWrappedComma,
prettySql, prettySql,
removeComment, removeComment,
sortNormal, 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 { function prettySqlLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) { for (let i = 0; i < lines.length; ++i) {
lines[i] = ' ' + lines[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.convertToRegularExpression: { lines = convertToRegularExpressionLogic(lines); break; }
case LinesAction.expandSql: { expandSqlLogic(lines); break; } case LinesAction.expandSql: { expandSqlLogic(lines); break; }
case LinesAction.listToListFamily: { listToListFamilyLogic(lines); break; } case LinesAction.listToListFamily: { listToListFamilyLogic(lines); break; }
case LinesAction.listToListWrappedComma: { listToListWrappedCommaLogic(lines); break; }
case LinesAction.prettySql: { prettySqlLogic(lines); break; } case LinesAction.prettySql: { prettySqlLogic(lines); break; }
case LinesAction.removeComment: { removeCommentLogic(lines); break; } case LinesAction.removeComment: { removeCommentLogic(lines); break; }
case LinesAction.sortNormal: { sortNormalLogic(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 convertToRegularExpression = () => linesFunction(LinesAction.convertToRegularExpression);
export const expandSql = () => linesFunction(LinesAction.expandSql); export const expandSql = () => linesFunction(LinesAction.expandSql);
export const listToListFamily = () => linesFunction(LinesAction.listToListFamily); export const listToListFamily = () => linesFunction(LinesAction.listToListFamily);
export const listToListWrappedComma = () => linesFunction(LinesAction.listToListWrappedComma);
export const prettySql = () => linesFunction(LinesAction.prettySql); export const prettySql = () => linesFunction(LinesAction.prettySql);
export const removeComment = () => linesFunction(LinesAction.removeComment); export const removeComment = () => linesFunction(LinesAction.removeComment);
export const sortNormal = () => linesFunction(LinesAction.sortNormal); export const sortNormal = () => linesFunction(LinesAction.sortNormal);