1.3.3 - Code Generator - $ClassName$, ...

This commit is contained in:
Mike Phares 2022-01-11 20:12:23 -07:00
parent fe9a91d1cb
commit c9b2aca9c0
5 changed files with 2663 additions and 1096 deletions

View File

@ -75,3 +75,8 @@ Added split(' group by ').join('\r\n GROUP BY ').
## Quick Fix - CS0108 (Data Annotations)
## Quick Fix - Proper Case Properties
## Quick Fix - Public (Expression Body)
### 1.3.3
-----------------------------------------------------------------------------------------------------------
## Code Generator - $ClassName$, ...
## Learned - If you add dependencies to package.json then run "npm install" it adds the dependency to node_modules "npm run compile" to build

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +1,130 @@
{
"name": "type-script-helper",
"displayName": "Type Script Helper",
"description": "Helper for VS Code in TypeScript",
"publisher": "IFX",
"repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper",
"version": "1.3.2",
"engines": {
"displayName": "Type Script Helper",
"description": "Helper for VS Code in TypeScript",
"publisher": "IFX",
"repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper",
"version": "1.3.3",
"engines": {
"vscode": "^1.40.0"
},
"categories": [
"Other"
],
"main": "./out/extension.js",
"activationEvents": [
"onCommand:readOnlyLinesHelper.searchGoogle",
"onCommand:replaceLinesHelper.addCSharpComment",
"onCommand:replaceLinesHelper.addVBComment",
"onCommand:replaceLinesHelper.convertToRegularExpression",
"onCommand:replaceLinesHelper.cutEachLine",
"onCommand:replaceLinesHelper.expandSql",
"onCommand:replaceLinesHelper.listToListFamily",
"onCommand:replaceLinesHelper.listToListWrappedComma",
"onCommand:replaceLinesHelper.prettySql",
"onCommand:replaceLinesHelper.quickFixCamelCaseProperties",
"onCommand:replaceLinesHelper.quickFixCS0108",
"onCommand:replaceLinesHelper.quickFixProperCaseProperties",
"onCommand:replaceLinesHelper.quickFixPublic",
"onCommand:replaceLinesHelper.removeComment",
"onCommand:replaceLinesHelper.sortLength",
"onCommand:replaceLinesHelper.sortNormal",
"onCommand:replaceLinesHelper.unwrapSql",
"onCommand:replaceLinesHelper.wrapSqlCSharp",
"onCommand:replaceLinesHelper.wrapSqlVB"
],
"contributes": {
"main": "./out/extension.js",
"activationEvents": [
"onCommand:readOnlyLinesHelper.searchGoogle",
"onCommand:replaceLinesHelper.addCSharpComment",
"onCommand:replaceLinesHelper.addVBComment",
"onCommand:replaceLinesHelper.codeGeneratorQuickPick",
"onCommand:replaceLinesHelper.convertToRegularExpression",
"onCommand:replaceLinesHelper.cutEachLine",
"onCommand:replaceLinesHelper.expandSql",
"onCommand:replaceLinesHelper.listToListFamily",
"onCommand:replaceLinesHelper.listToListWrappedComma",
"onCommand:replaceLinesHelper.prettySql",
"onCommand:replaceLinesHelper.quickFixCamelCaseProperties",
"onCommand:replaceLinesHelper.quickFixCS0108",
"onCommand:replaceLinesHelper.quickFixProperCaseProperties",
"onCommand:replaceLinesHelper.quickFixPublic",
"onCommand:replaceLinesHelper.removeComment",
"onCommand:replaceLinesHelper.sortLength",
"onCommand:replaceLinesHelper.sortNormal",
"onCommand:replaceLinesHelper.unwrapSql",
"onCommand:replaceLinesHelper.wrapSqlCSharp",
"onCommand:replaceLinesHelper.wrapSqlVB"
],
"contributes": {
"commands": [
{ "command": "readOnlyLinesHelper.searchGoogle", "title": "Search Google" },
{ "command": "replaceLinesHelper.addCSharpComment", "title": "Add C# Comment" },
{ "command": "replaceLinesHelper.addVBComment", "title": "Add VB Comment" },
{ "command": "replaceLinesHelper.convertToRegularExpression", "title": "Convert to Regular Expression" },
{ "command": "replaceLinesHelper.cutEachLine", "title": "Cut each line after |||" },
{ "command": "replaceLinesHelper.expandSql", "title": "Expand Sql" },
{ "command": "replaceLinesHelper.listToListFamily", "title": "List to list family (Kristy, Mike ...)" },
{ "command": "replaceLinesHelper.listToListWrappedComma", "title": "List to list wrapped comma" },
{ "command": "replaceLinesHelper.prettySql", "title": "Pretty Sql" },
{ "command": "replaceLinesHelper.quickFixCamelCaseProperties", "title": "Quick Fix - Camel Case Properties" },
{ "command": "replaceLinesHelper.quickFixCS0108", "title": "Quick Fix - CS0108 (Data Annotations)" },
{ "command": "replaceLinesHelper.quickFixProperCaseProperties", "title": "Quick Fix - Proper Case Properties" },
{ "command": "replaceLinesHelper.quickFixPublic", "title": "Quick Fix - Public (Expression Body)" },
{ "command": "replaceLinesHelper.removeComment", "title": "Remove comment" },
{ "command": "replaceLinesHelper.sortLength", "title": "Sort by Length" },
{ "command": "replaceLinesHelper.sortNormal", "title": "My Sort lines (ascending, case sensitive)" },
{ "command": "replaceLinesHelper.unwrapSql", "title": "Un-wrap Sql" },
{ "command": "replaceLinesHelper.wrapSqlCSharp", "title": "Wrap Sql for C#" },
{ "command": "replaceLinesHelper.wrapSqlVB", "title": "Wrap Sql for VB" }
{
"command": "readOnlyLinesHelper.searchGoogle",
"title": "Search Google"
},
{
"command": "replaceLinesHelper.addCSharpComment",
"title": "Add C# Comment"
},
{
"command": "replaceLinesHelper.addVBComment",
"title": "Add VB Comment"
},
{
"command": "replaceLinesHelper.codeGeneratorQuickPick",
"title": "Code Generator - Quick Pick"
},
{
"command": "replaceLinesHelper.convertToRegularExpression",
"title": "Convert to Regular Expression"
},
{
"command": "replaceLinesHelper.cutEachLine",
"title": "Cut each line after |||"
},
{
"command": "replaceLinesHelper.expandSql",
"title": "Expand Sql"
},
{
"command": "replaceLinesHelper.listToListFamily",
"title": "List to list family (Kristy, Mike ...)"
},
{
"command": "replaceLinesHelper.listToListWrappedComma",
"title": "List to list wrapped comma"
},
{
"command": "replaceLinesHelper.prettySql",
"title": "Pretty Sql"
},
{
"command": "replaceLinesHelper.quickFixCamelCaseProperties",
"title": "Quick Fix - Camel Case Properties"
},
{
"command": "replaceLinesHelper.quickFixCS0108",
"title": "Quick Fix - CS0108 (Data Annotations)"
},
{
"command": "replaceLinesHelper.quickFixProperCaseProperties",
"title": "Quick Fix - Proper Case Properties"
},
{
"command": "replaceLinesHelper.quickFixPublic",
"title": "Quick Fix - Public (Expression Body)"
},
{
"command": "replaceLinesHelper.removeComment",
"title": "Remove comment"
},
{
"command": "replaceLinesHelper.sortLength",
"title": "Sort by Length"
},
{
"command": "replaceLinesHelper.sortNormal",
"title": "My Sort lines (ascending, case sensitive)"
},
{
"command": "replaceLinesHelper.unwrapSql",
"title": "Un-wrap Sql"
},
{
"command": "replaceLinesHelper.wrapSqlCSharp",
"title": "Wrap Sql for C#"
},
{
"command": "replaceLinesHelper.wrapSqlVB",
"title": "Wrap Sql for VB"
}
],
"keybindings": [
{
"command": "replaceLinesHelper.unwrapSql",
"key": "shift + f9",
"when": "editorTextFocus"
}
],
"menus": {
"keybindings": [
{
"command": "replaceLinesHelper.unwrapSql",
"key": "shift + f9",
"when": "editorTextFocus"
}
],
"menus": {
"editor/context": [
{
"command": "replaceLinesHelper.unwrapSql",
@ -74,20 +136,20 @@
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile",
"test": "node ./out/test/runTest.js"
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/mocha": "^5.2.7",
"@types/node": "^12.11.7",
"@types/vscode": "^1.40.0",
"glob": "^7.1.5",
"mocha": "^6.2.2",
"typescript": "^3.6.4",
"tslint": "^5.20.0",
"vscode-test": "^1.2.2"
"@types/mocha": "^5.2.7",
"@types/node": "^12.11.7",
"@types/vscode": "^1.40.0",
"glob": "^7.1.5",
"mocha": "^9.1.3",
"tslint": "^5.20.0",
"typescript": "^3.6.4",
"vscode-test": "^1.2.2"
}
}

View File

@ -3,6 +3,7 @@
import * as vscode from 'vscode';
import * as replaceLinesHelper from './replaceLinesHelper';
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
import * as promiseLinesHelper from './promiseLinesHelper';
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
@ -29,6 +30,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('readOnlyLinesHelper.searchGoogle', readOnlyLinesHelper.searchGoogle),
vscode.commands.registerCommand('replaceLinesHelper.addCSharpComment', replaceLinesHelper.addCSharpComment),
vscode.commands.registerCommand('replaceLinesHelper.addVBComment', replaceLinesHelper.addVBComment),
vscode.commands.registerCommand('replaceLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
vscode.commands.registerCommand('replaceLinesHelper.convertToRegularExpression', replaceLinesHelper.convertToRegularExpression),
vscode.commands.registerCommand('replaceLinesHelper.cutEachLine', replaceLinesHelper.cutEachLine),
vscode.commands.registerCommand('replaceLinesHelper.expandSql', replaceLinesHelper.expandSql),

View File

@ -0,0 +1,77 @@
import * as vscode from 'vscode';
import { QuickPickItem } from "vscode";
function codeGeneratorQuickPickLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
let thenable = vscode.window.showQuickPick(
[
{
label: "Class name",
detail: "Segments Minus One (Object || Array)",
output: "$ClassName$"
}, {
label: "Type",
detail: "Segments Minus One (!Object && !Array)",
output: "$Type$"
}, {
label: "Suggested Type",
detail: "Type based on values in *.json file",
output: "$SuggestedType$"
}, {
label: "Full Path",
detail: "Full Path and name in padded format",
output: "$Debug$"
}, {
label: "Name",
detail: "Segments Last only name (no path)",
output: "$Name$"
}, {
label: "Class name (Camel-Cased)",
detail: "Segments Minus One (Object || Array)",
output: "ClassNameCamel$"
}, {
label: "Type (Camel-Cased)",
detail: "Segments Minus One (!Object && !Array)",
output: "TypeCamel$"
}, {
label: "Suggested Type (Camel-Cased)",
detail: "Type based on values in *.json file",
output: "SuggestedTypeCamel$"
}, {
label: "Full Path (Camel-Cased)",
detail: "Full Path and name in padded format",
output: "$DebugCamel$"
}, {
label: "Name (Camel-Cased)",
detail: "Segments Last only name (no path)",
output: "$NameCamel$"
}, {
label: "Name (Camel-Cased and Plural)",
detail: "Segments Last only name (no path)",
output: "$NameCamelPlural$"
}
]
).then(item => {
if (!item) {
return;
}
const selection = textEditor.selection;
return textEditor.edit(editBuilder => {
var range;
if (selection.isEmpty) {
editBuilder.insert(selection.start, item.output)
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
editBuilder.replace(range, item.output);
}
});
});
return undefined;
}
export const codeGeneratorQuickPick = () => codeGeneratorQuickPickLogic();
export const open = () => codeGeneratorQuickPickLogic();