diff --git a/type-script-helper-1.2.3.vsix b/type-script-helper-1.2.3.vsix new file mode 100644 index 0000000..f248370 Binary files /dev/null and b/type-script-helper-1.2.3.vsix differ diff --git a/type-script-helper/README.md b/type-script-helper/README.md index baa030a..2518eb0 100644 --- a/type-script-helper/README.md +++ b/type-script-helper/README.md @@ -22,7 +22,7 @@ None L: -cd "L:\GitHub\YO-VSCode" +cd "L:\GitHub\YO-VSCode\type-script-helper" yo code @@ -34,7 +34,7 @@ Modify .package Add publisher -cd type-script-helper +cd "L:\GitHub\YO-VSCode\type-script-helper" vsce package diff --git a/type-script-helper/package.json b/type-script-helper/package.json index ab9db72..5233d4f 100644 --- a/type-script-helper/package.json +++ b/type-script-helper/package.json @@ -4,7 +4,7 @@ "description": "Helper for VS Code in TypeScript", "publisher": "IFX", "repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper", - "version": "1.2.2", + "version": "1.2.3", "engines": { "vscode": "^1.40.0" }, @@ -25,7 +25,8 @@ "onCommand:helper.unwrapSql", "onCommand:helper.wrapSqlCSharp", "onCommand:helper.wrapSqlVB", - "onCommand:helper.sortLength" + "onCommand:helper.sortLength", + "onCommand:helper.cutEachLine" ], "contributes": { "commands": [ @@ -41,7 +42,8 @@ { "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.sortLength", "title": "Sort by Length" }, + { "command": "helper.cutEachLine", "title": "Cut each line after |||" } ], "keybindings": [ { diff --git a/type-script-helper/src/extension.ts b/type-script-helper/src/extension.ts index 854999e..e7bb140 100644 --- a/type-script-helper/src/extension.ts +++ b/type-script-helper/src/extension.ts @@ -37,7 +37,8 @@ export function activate(context: vscode.ExtensionContext) { 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.sortLength', helper.sortLength), + vscode.commands.registerCommand('helper.cutEachLine', helper.cutEachLine) ]; commands.forEach(command => context.subscriptions.push(command)); diff --git a/type-script-helper/src/helper.ts b/type-script-helper/src/helper.ts index 45e2225..715bfb6 100644 --- a/type-script-helper/src/helper.ts +++ b/type-script-helper/src/helper.ts @@ -17,7 +17,8 @@ enum LinesAction { unwrapSql, wrapSqlCSharp, wrapSqlVB, - sortLength + sortLength, + cutEachLine } function removeBlanks(lines: string[]): void { @@ -223,6 +224,16 @@ function sortLengthLogic(lines: string[]): void { removeBlanks(lines); } +function cutEachLineLogic(lines: string[]): void { + for (let i = 0; i < lines.length; ++i) { + if(lines[i].length > 0 && lines[i].indexOf("|||") > 0) { + lines[i] = lines[i].substr(0, lines[i].indexOf("|||")); + } + lines[i] = lines[i].trim(); + } + removeBlanks(lines); +} + function returnLines(textEditor: vscode.TextEditor, startLine: number, endLine: number, lines: string[]) { return textEditor.edit(editBuilder => { const range = new vscode.Range(startLine, 0, endLine, textEditor.document.lineAt(endLine).text.length); @@ -257,6 +268,7 @@ function linesFunction(linesAction: LinesAction): Thenable | undefined 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); @@ -274,4 +286,5 @@ 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); \ No newline at end of file +export const sortLength = () => linesFunction(LinesAction.sortLength); +export const cutEachLine = () => linesFunction(LinesAction.cutEachLine); \ No newline at end of file