Merge branch 'master' of https://github.com/mikepharesjr/YO-VSCode
This commit is contained in:
commit
b3a9f0e822
BIN
type-script-helper-1.3.3.vsix
Normal file
BIN
type-script-helper-1.3.3.vsix
Normal file
Binary file not shown.
BIN
type-script-helper-1.3.4.vsix
Normal file
BIN
type-script-helper-1.3.4.vsix
Normal file
Binary file not shown.
@ -20,6 +20,18 @@ None
|
||||
|
||||
## Release Notes
|
||||
|
||||
npm install -g vsce
|
||||
|
||||
npm install typescript --save-dev
|
||||
|
||||
L:
|
||||
|
||||
cd "L:\GitHub\YO-VSCode\type-script-helper"
|
||||
|
||||
npm install typescript
|
||||
|
||||
npx tsc
|
||||
|
||||
L:
|
||||
|
||||
cd "L:\GitHub\YO-VSCode\type-script-helper"
|
||||
@ -75,8 +87,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
|
||||
|
||||
### 1.3.3, 1.3.4
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
## 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
|
||||
## Quick Fix - Instance Field to Calisthenics
|
||||
|
1953
type-script-helper/package-lock.json
generated
1953
type-script-helper/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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.3.3",
|
||||
"version": "1.3.4",
|
||||
"engines": {
|
||||
"vscode": "^1.40.0"
|
||||
},
|
||||
@ -16,7 +16,6 @@
|
||||
"onCommand:readOnlyLinesHelper.searchGoogle",
|
||||
"onCommand:replaceLinesHelper.addCSharpComment",
|
||||
"onCommand:replaceLinesHelper.addVBComment",
|
||||
"onCommand:replaceLinesHelper.codeGeneratorQuickPick",
|
||||
"onCommand:replaceLinesHelper.convertToRegularExpression",
|
||||
"onCommand:replaceLinesHelper.cutEachLine",
|
||||
"onCommand:replaceLinesHelper.expandSql",
|
||||
@ -25,6 +24,7 @@
|
||||
"onCommand:replaceLinesHelper.prettySql",
|
||||
"onCommand:replaceLinesHelper.quickFixCamelCaseProperties",
|
||||
"onCommand:replaceLinesHelper.quickFixCS0108",
|
||||
"onCommand:replaceLinesHelper.quickFixInstanceFieldToCalisthenics",
|
||||
"onCommand:replaceLinesHelper.quickFixProperCaseProperties",
|
||||
"onCommand:replaceLinesHelper.quickFixPublic",
|
||||
"onCommand:replaceLinesHelper.removeComment",
|
||||
@ -48,10 +48,6 @@
|
||||
"command": "replaceLinesHelper.addVBComment",
|
||||
"title": "Add VB Comment"
|
||||
},
|
||||
{
|
||||
"command": "replaceLinesHelper.codeGeneratorQuickPick",
|
||||
"title": "Code Generator - Quick Pick"
|
||||
},
|
||||
{
|
||||
"command": "replaceLinesHelper.convertToRegularExpression",
|
||||
"title": "Convert to Regular Expression"
|
||||
@ -84,6 +80,10 @@
|
||||
"command": "replaceLinesHelper.quickFixCS0108",
|
||||
"title": "Quick Fix - CS0108 (Data Annotations)"
|
||||
},
|
||||
{
|
||||
"command": "replaceLinesHelper.quickFixInstanceFieldToCalisthenics",
|
||||
"title": "Quick Fix - Instance Field to Calisthenics"
|
||||
},
|
||||
{
|
||||
"command": "replaceLinesHelper.quickFixProperCaseProperties",
|
||||
"title": "Quick Fix - Proper Case Properties"
|
||||
@ -147,9 +147,9 @@
|
||||
"@types/node": "^12.11.7",
|
||||
"@types/vscode": "^1.40.0",
|
||||
"glob": "^7.1.5",
|
||||
"mocha": "^9.1.3",
|
||||
"mocha": "^6.2.2",
|
||||
"tslint": "^5.20.0",
|
||||
"typescript": "^3.6.4",
|
||||
"typescript": "^3.9.10",
|
||||
"vscode-test": "^1.2.2"
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand('replaceLinesHelper.prettySql', replaceLinesHelper.prettySql),
|
||||
vscode.commands.registerCommand('replaceLinesHelper.quickFixCamelCaseProperties', replaceLinesHelper.quickFixCamelCaseProperties),
|
||||
vscode.commands.registerCommand('replaceLinesHelper.quickFixCS0108', replaceLinesHelper.quickFixCS0108),
|
||||
vscode.commands.registerCommand('replaceLinesHelper.quickFixInstanceFieldToCalisthenics', replaceLinesHelper.quickFixInstanceFieldToCalisthenics),
|
||||
vscode.commands.registerCommand('replaceLinesHelper.quickFixProperCaseProperties', replaceLinesHelper.quickFixProperCaseProperties),
|
||||
vscode.commands.registerCommand('replaceLinesHelper.quickFixPublic', replaceLinesHelper.quickFixPublic),
|
||||
vscode.commands.registerCommand('replaceLinesHelper.removeComment', replaceLinesHelper.removeComment),
|
||||
|
@ -14,6 +14,7 @@ enum LinesAction {
|
||||
prettySql,
|
||||
quickFixCamelCaseProperties,
|
||||
quickFixCS0108,
|
||||
quickFixInstanceFieldToCalisthenics,
|
||||
quickFixProperCaseProperties,
|
||||
quickFixPublic,
|
||||
pdsfToFixedWidth,
|
||||
@ -192,6 +193,40 @@ function quickFixCS0108Logic(lines: string[]): void {
|
||||
removeBlanks(lines);
|
||||
}
|
||||
|
||||
function quickFixInstanceFieldToCalisthenicsLogic(lines: string[]): void {
|
||||
for (let i = 0; i < lines.length; ++i) {
|
||||
let segments = lines[i].trim().split(' ');
|
||||
if(segments.length !== 2)
|
||||
continue;
|
||||
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
|
||||
let type = segments[0];
|
||||
let name = segments[1].split(';')[0];
|
||||
let singularName = name;
|
||||
if(name[name.length - 1] === 's') {
|
||||
if(name[name.length - 2] === 'e') {
|
||||
if(name[name.length - 3] === 'i') {
|
||||
singularName = name.substring(0, singularName.length - 3) + 'y';
|
||||
}
|
||||
else
|
||||
singularName = name.substring(0, singularName.length - 2);
|
||||
}
|
||||
else
|
||||
singularName = name.substring(0, singularName.length - 1);
|
||||
}
|
||||
segments = type.split('<');
|
||||
if(segments.length === 2)
|
||||
lines[i] = leftPadding + 'public ' + segments[0] + '<' + singularName + '> ' + name + ' { get; } //' + segments[1].split('>')[0];
|
||||
else {
|
||||
segments = type.split('[');
|
||||
if(segments.length === 2)
|
||||
lines[i] = leftPadding + 'public ' + singularName + '[] ' + name + ' { get; } //' + segments[0];
|
||||
else
|
||||
lines[i] = leftPadding + 'public ' + singularName + ' ' + name + ' { get; } //' + type;
|
||||
}
|
||||
}
|
||||
removeBlanks(lines);
|
||||
}
|
||||
|
||||
function quickFixProperCasePropertiesLogic(lines: string[]): void {
|
||||
for (let i = 0; i < lines.length; ++i) {
|
||||
let segments = lines[i].trim().split(' ');
|
||||
@ -343,6 +378,7 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
|
||||
case LinesAction.prettySql: { prettySqlLogic(lines); break; }
|
||||
case LinesAction.quickFixCamelCaseProperties: { quickFixCamelCasePropertiesLogic(lines); break; }
|
||||
case LinesAction.quickFixCS0108: { quickFixCS0108Logic(lines); break; }
|
||||
case LinesAction.quickFixInstanceFieldToCalisthenics: { quickFixInstanceFieldToCalisthenicsLogic(lines); break; }
|
||||
case LinesAction.quickFixProperCaseProperties: { quickFixProperCasePropertiesLogic(lines); break; }
|
||||
case LinesAction.quickFixPublic: { quickFixPublicLogic(lines); break; }
|
||||
case LinesAction.removeComment: { removeCommentLogic(lines); break; }
|
||||
@ -366,6 +402,7 @@ export const listToListWrappedComma = () => linesFunction(LinesAction.listToList
|
||||
export const prettySql = () => linesFunction(LinesAction.prettySql);
|
||||
export const quickFixCamelCaseProperties = () => linesFunction(LinesAction.quickFixCamelCaseProperties);
|
||||
export const quickFixCS0108 = () => linesFunction(LinesAction.quickFixCS0108);
|
||||
export const quickFixInstanceFieldToCalisthenics = () => linesFunction(LinesAction.quickFixInstanceFieldToCalisthenics);
|
||||
export const quickFixProperCaseProperties = () => linesFunction(LinesAction.quickFixProperCaseProperties);
|
||||
export const quickFixPublic = () => linesFunction(LinesAction.quickFixPublic);
|
||||
export const pdsfToFixedWidth = () => linesFunction(LinesAction.pdsfToFixedWidth);
|
||||
|
Loading…
x
Reference in New Issue
Block a user