10 Commits

Author SHA1 Message Date
929d4e1ccd ## 1.5.1 2023-09-29 19:14:53 -07:00
9ee21dbe30 ## 1.4.4 2023-08-18 12:42:46 -07:00
bf07ffc3b8 ## 1.4.3 2023-08-16 12:36:42 -07:00
fb3c5c7a23 Insert DateTime 2023-08-11 12:28:28 -07:00
e3443b4ac2 1.4.1 - vsce package 2023-07-07 09:14:26 -07:00
0c0b5262bf 1.4.1 2023-06-08 21:16:38 -07:00
d1e8f544c7 npm publish 2023-02-01 10:58:44 -07:00
83a014c201 1.3.15 Distinct Lines 2023-01-25 15:55:07 -07:00
85fa349968 ## 1.3.12, 1.3.13, 1.3.14 2022-03-23 20:39:11 -07:00
eacebd708f 1.3.12
Split by Space Reverse Join Sort lines (ascending, case sensitive)
PathWithoutBracketsSingularized
2022-03-10 14:19:47 -07:00
72 changed files with 11162 additions and 2808 deletions

6
.gitignore vendored
View File

@ -264,3 +264,9 @@ __pycache__/
type-script-helper-1.1.6.vsix
type-script-helper-1.1.7.vsix
type-script-helper-1.1.8.vsix
.kanbn
*.exe
*.pdb
.vscode/helper/**

24
.vscode/settings.json vendored
View File

@ -1,5 +1,23 @@
{
"cSpell.words": [
"VSIX"
]
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [
"initialise",
"Kanban",
"VSIX"
],
"files.eol": "\n",
"files.exclude": {
"**/dist": false,
"**/node_modules": true,
"**/out": false
},
"files.watcherExclude": {
"**/node_modules": true
},
"search.exclude": {
"**/dist": true,
"**/out": true
}
}

BIN
Application.evtx Normal file

Binary file not shown.

6
package-lock.json generated
View File

@ -1,6 +0,0 @@
{
"name": "YO-VSCode",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,24 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}

View File

@ -1,4 +1,6 @@
out
node_modules
.vscode-test/
.vscode/helper/**
*.vsix
dist
node_modules
out

View File

@ -1,7 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
}

View File

@ -9,28 +9,21 @@
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
"${workspaceFolder}/dist/**/*.js"
]
},
{
"name": "Extension Tests",
"type": "extensionHost",
"type": "node",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"name": "Launch Program",
"program": "${workspaceFolder}/src/extension.ts",
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
"${workspaceFolder}/out/**/*.js"
]
}
]
}
}

View File

@ -1,11 +1,23 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [
"initialise",
"Kanban",
"VSIX"
],
"files.eol": "\n",
"files.exclude": {
"**/dist": false,
"**/node_modules": true,
"**/out": false
},
"files.watcherExclude": {
"**/node_modules": true
},
"search.exclude": {
"**/dist": true,
"**/out": true
}
}

View File

@ -1,20 +0,0 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@ -1,10 +1,14 @@
.vscode/**
.vscode-test/**
out/test/**
src/**
.gitignore
vsc-extension-quickstart.md
**/tsconfig.json
**/tslint.json
.vscode-test/**
.vscode/**
.yarnrc
**/.eslintrc.json
**/*.map
**/*.ts
**/*.ts
**/tsconfig.json
build/**
node_modules/**
src/**
webviews/**
vsc-extension-quickstart.md
webpack.config.js

View File

@ -1,9 +0,0 @@
# Change Log
All notable changes to the "type-script-helper" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

View File

@ -0,0 +1,27 @@
---
type: "note"
created: "2022-03-10T21:18:17.054Z"
updated: "2022-03-10T21:18:17.054Z"
---
# LICENSE
Copyright (c) Twitter Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,6 +1,10 @@
# type-script-helper README
---
type: "read-me"
created: "2023-09-30T01:47:18.241Z"
updated: "2023-09-30T01:47:18.242Z"
---
Helpers
# type-script-helper README
## Features
@ -8,7 +12,28 @@ See Contributions tab
## Requirements
None
```bash
# https://code.visualstudio.com/api/get-started/your-first-extension
npm install -g yo generator-code
yo code
# ? What type of extension do you want to create? New Extension (TypeScript)
# ? What's the name of your extension? HelloWorld
### Press <Enter> to choose default for all options below ###
# ? What's the identifier of your extension? hello-world
# ? What's the description of your extension? LEAVE BLANK
# ? Initialize a git repository? Yes
# ? Bundle the source code with webpack? No (should be yes?)
# ? Which package manager to use? npm
# ? Do you want to open the new folder with Visual Studio Code? Open with `code`
npm install -g @vscode/vsce
vsce package
```
## Extension Settings
@ -20,85 +45,75 @@ 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"
yo code
Type Script Helper
(type-script-helper)
Modify .package
Add publisher
cd "L:\GitHub\YO-VSCode\type-script-helper"
vsce package
F1
Extensions: Install from VSIX
## 1.0.0
Initial release of ...
## 1.0.1
Fixed issue in replace function
https://stackoverflow.com/questions/37197311/in-typescript-string-replace-only-replaces-first-occurrence-of-matched-string
Added split(' group by ').join('\r\n GROUP BY ').
## 1.1.0
-----------------------------------------------------------------------------------------------------------
Working with Markdown
For more information
## 1.2.4
-----------------------------------------------------------------------------------------------------------
Search Google
- Search Google
## 1.2.8
-----------------------------------------------------------------------------------------------------------
Search Google (Read Only Lines Helper)
- Search Google (Read Only Lines Helper)
## 1.2.9, 1.3.0, 1.3.1, 1.3.2
-----------------------------------------------------------------------------------------------------------
Quick Fix - Camel Case Properties
Quick Fix - CS0108 (Data Annotations)
Quick Fix - Proper Case Properties
Quick Fix - Public (Expression Body)
- Quick Fix - Camel Case Properties
- Quick Fix - CS0108 (Data Annotations)
- Quick Fix - Proper Case Properties
- Quick Fix - Public (Expression Body)
## 1.3.3, 1.3.4
-----------------------------------------------------------------------------------------------------------
Quick Fix - Instance Field to Calisthenics
- Quick Fix - Instance Field to Calisthenics
## 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11
-----------------------------------------------------------------------------------------------------------
Code Generator - Quick Pick {promiseLinesHelper.codeGeneratorQuickPick}
Open in New Window {open-in-new-window.open}
Learned npm install will do similar to nuget restore
Learned npm audit fix
Learned npm audit fix --force
Learned npm run compile will do similar to build
- Code Generator - Quick Pick {promiseLinesHelper.codeGeneratorQuickPick}
- Open in New Window {open-in-new-window.open}
- Learned npm install will do similar to nuget restore
- Learned npm audit fix
- Learned npm audit fix --force
- Learned npm run compile will do similar to build
- Quick Fix - Instance Field to Calisthenics
## 1.3.12, 1.3.13, 1.3.14
-----------------------------------------------------------------------------------------------------------
- Split by Space Reverse Join Sort lines (ascending, case sensitive)
- PathWithoutBracketsSingularized
## 1.3.15
-----------------------------------------------------------------------------------------------------------
- Distinct list
## 1.4.1
-----------------------------------------------------------------------------------------------------------
- new yo code template
## 1.4.2
-----------------------------------------------------------------------------------------------------------
- Insert date time
## 1.4.3
-----------------------------------------------------------------------------------------------------------
- Moved Insert date time
- Transform to Popper Case
## 1.4.4
-----------------------------------------------------------------------------------------------------------
- Transform to Param Case
## 1.5.1
-----------------------------------------------------------------------------------------------------------
- columns-to-cards-webview-view-provider
- file-folder-helper-exe
- clickable list

View File

@ -0,0 +1,41 @@
//@ts-check
'use strict';
const path = require('path');
/**@type {import('webpack').Configuration}*/
const config = {
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, '..', 'dist'),
filename: 'extension.js',
libraryTarget: 'commonjs2'
},
devtool: 'nosources-source-map',
externals: {
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
}
};
module.exports = config;

View File

@ -0,0 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"/></svg>

After

Width:  |  Height:  |  Size: 479 B

View File

@ -0,0 +1,7 @@
// This script will be run within the webview itself
// It cannot access the main VS Code APIs directly.
(function () {
const vscode = acquireVsCodeApi();
console.log("hello there from javascript");
})();

View File

@ -0,0 +1,30 @@
html {
box-sizing: border-box;
font-size: 13px;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
margin: 0;
padding: 0;
font-weight: normal;
}
img {
max-width: 100%;
height: auto;
}

View File

@ -0,0 +1,91 @@
:root {
--container-paddding: 20px;
--input-padding-vertical: 6px;
--input-padding-horizontal: 4px;
--input-margin-vertical: 4px;
--input-margin-horizontal: 0;
}
body {
padding: 0 var(--container-paddding);
color: var(--vscode-foreground);
font-size: var(--vscode-font-size);
font-weight: var(--vscode-font-weight);
font-family: var(--vscode-font-family);
background-color: var(--vscode-editor-background);
}
ol,
ul {
padding-left: var(--container-paddding);
}
body > *,
form > * {
margin-block-start: var(--input-margin-vertical);
margin-block-end: var(--input-margin-vertical);
}
*:focus {
outline-color: var(--vscode-focusBorder) !important;
}
a {
color: var(--vscode-textLink-foreground);
}
a:hover,
a:active {
color: var(--vscode-textLink-activeForeground);
}
code {
font-size: var(--vscode-editor-font-size);
font-family: var(--vscode-editor-font-family);
}
button {
border: none;
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
width: 100%;
text-align: center;
outline: 1px solid transparent;
outline-offset: 2px !important;
color: var(--vscode-button-foreground);
background: var(--vscode-button-background);
}
button:hover {
cursor: pointer;
background: var(--vscode-button-hoverBackground);
}
button:focus {
outline-color: var(--vscode-focusBorder);
}
button.secondary {
color: var(--vscode-button-secondaryForeground);
background: var(--vscode-button-secondaryBackground);
}
button.secondary:hover {
background: var(--vscode-button-secondaryHoverBackground);
}
input:not([type="checkbox"]),
textarea {
display: block;
width: 100%;
border: none;
font-family: var(--vscode-font-family);
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
color: var(--vscode-input-foreground);
outline-color: var(--vscode-input-border);
background-color: var(--vscode-input-background);
}
input::placeholder,
textarea::placeholder {
color: var(--vscode-input-placeholderForeground);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +1,264 @@
{
"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.11",
"engines": {
"vscode": "^1.40.0"
},
"categories": [
"Other"
],
"main": "./out/extension.js",
"activationEvents": [
"onCommand:open-in-new-window.open",
"onCommand:promiseLinesHelper.codeGeneratorQuickPick",
"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.quickFixInstanceFieldToCalisthenics",
"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": "open-in-new-window.open",
"title": "Open in New Window"
},
{
"command": "promiseLinesHelper.codeGeneratorQuickPick",
"title": "Code Generator - Quick Pick"
},
{
"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.quickFixInstanceFieldToCalisthenics",
"title": "Quick Fix - Instance Field to Calisthenics"
},
{
"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"
}
],
"menus": {
"explorer/context": [
{
"command": "open-in-new-window.open",
"group": "openInNewWindowGroup"
}
]
"activationEvents": [],
"categories": [
"Other"
],
"contributes": {
"configuration": {
"type": "object",
"title": "Type Script Helper Configuration",
"properties": {
"fileTemplates.author": {
"type": [
"string",
"null"
],
"default": null,
"description": "Value to use to replace #{author} variable."
},
"fileTemplates.company": {
"type": [
"string",
"null"
],
"default": null,
"description": "Value to use to replace #{company} variable."
}
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile",
"test": "node ./out/test/runTest.js"
"commands": [
{
"category": "Helper",
"command": "open-in-new-window.open",
"title": "Open in New Window"
},
{
"category": "Helper",
"command": "promiseLinesHelper.codeGeneratorQuickPick",
"title": "Code Generator - Quick Pick"
},
{
"category": "Helper",
"command": "promiseLinesHelper.insertDateTime",
"title": "Insert DateTime"
},
{
"category": "Helper",
"command": "promiseLinesHelper.transformToParamCase",
"title": "Transform to Param Case"
},
{
"category": "Helper",
"command": "promiseLinesHelper.transformToPopperCase",
"title": "Transform to Popper Case"
},
{
"category": "Helper",
"command": "readOnlyLinesHelper.searchGoogle",
"title": "Search Google"
},
{
"category": "Kanban",
"command": "kanban.refreshBoth",
"title": "Refresh Kanban Both"
},
{
"category": "Kanban",
"command": "kanban.refreshSidebar",
"title": "Refresh Kanban Sidebar"
},
{
"category": "Kanban",
"command": "kanban.refreshWebView",
"title": "Refresh Kanban WebView"
},
{
"category": "Kanban",
"command": "kanban.debugReload",
"title": "Debug Reload Kanban"
},
{
"category": "Markdown",
"command": "markdown.newMarkdownFile",
"title": "New Markdown File"
},
{
"category": "Quick Fix",
"command": "replaceLinesHelper.quickFixCamelCaseProperties",
"title": "Camel Case Properties"
},
{
"category": "Quick Fix",
"command": "replaceLinesHelper.quickFixCS0108",
"title": " CS0108 (Data Annotations)"
},
{
"category": "Quick Fix",
"command": "replaceLinesHelper.quickFixInstanceFieldToCalisthenics",
"title": "Instance Field to Calisthenics"
},
{
"category": "Quick Fix",
"command": "replaceLinesHelper.quickFixProperCaseProperties",
"title": "Proper Case Properties"
},
{
"category": "Quick Fix",
"command": "replaceLinesHelper.quickFixPublic",
"title": "Public (Expression Body)"
},
{
"category": "Replace",
"command": "replaceLinesHelper.addCSharpComment",
"title": "Add C# Comment"
},
{
"category": "Replace",
"command": "replaceLinesHelper.addVBComment",
"title": "Add VB Comment"
},
{
"category": "Replace",
"command": "replaceLinesHelper.convertToRegularExpression",
"title": "Convert to Regular Expression"
},
{
"category": "Replace",
"command": "replaceLinesHelper.cutEachLine",
"title": "Cut each line after |||"
},
{
"category": "Replace",
"command": "replaceLinesHelper.distinctLines",
"title": "Distinct Lines"
},
{
"category": "Replace",
"command": "replaceLinesHelper.expandSql",
"title": "Expand Sql"
},
{
"category": "Replace",
"command": "replaceLinesHelper.listToListFamily",
"title": "List to list family (Kristy, Mike ...)"
},
{
"category": "Replace",
"command": "replaceLinesHelper.listToListWrappedComma",
"title": "List to list wrapped comma"
},
{
"category": "Replace",
"command": "replaceLinesHelper.prettySql",
"title": "Pretty Sql"
},
{
"category": "Replace",
"command": "replaceLinesHelper.removeComment",
"title": "Remove comment"
},
{
"category": "Replace",
"command": "replaceLinesHelper.sortLength",
"title": "Sort by Length"
},
{
"category": "Replace",
"command": "replaceLinesHelper.sortNormal",
"title": "My Sort lines (ascending, case sensitive)"
},
{
"category": "Replace",
"command": "replaceLinesHelper.splitBySpaceReverseJoinSort",
"title": "Split by Space Reverse Join Sort lines (ascending, case sensitive)"
},
{
"category": "Replace",
"command": "replaceLinesHelper.unwrapSql",
"title": "Un-wrap Sql"
},
{
"category": "Replace",
"command": "replaceLinesHelper.wrapSqlCSharp",
"title": "Wrap Sql for C#"
},
{
"category": "Replace",
"command": "replaceLinesHelper.wrapSqlVB",
"title": "Wrap Sql for VB"
},
{
"category": "WebView",
"command": "webView.webView",
"title": "Web View"
}
],
"views": {
"columns-to-cards-webview-view-provider-view": [
{
"contextualTitle": "Kanban",
"icon": "media/checklist.svg",
"id": "columns-to-cards-webview-view-provider",
"name": "Kanban",
"type": "webview"
}
]
},
"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": "^9.1.3",
"tslint": "^5.20.0",
"typescript": "^3.9.10",
"vscode-test": "^1.2.2"
"viewsContainers": {
"activitybar": [
{
"icon": "media/checklist.svg",
"id": "columns-to-cards-webview-view-provider-view",
"title": "Kanban"
}
]
}
}
},
"dependencies": {
"@vscode/vsce": "^2.19.0",
"polka": "^0.5.2"
},
"description": "Helper for VS Code in TypeScript",
"devDependencies": {
"@nodelib/fs.stat": "^3.0.0",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-typescript": "^11.1.4",
"@tsconfig/svelte": "^1.0.10",
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.1",
"@types/node": "20.2.5",
"@types/polka": "^0.5.1",
"@types/vscode": "^1.79.0",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"@vscode/test-electron": "^2.3.2",
"concurrently": "^8.2.1",
"eslint": "^8.41.0",
"glob": "^8.1.0",
"mocha": "^10.2.0",
"rollup": "^2.3.4",
"rollup-plugin-svelte": "^6.1.1",
"rollup-plugin-terser": "^7.0.2",
"svelte": "^3.31.0",
"svelte-check": "^1.1.23",
"svelte-preprocess": "^5.0.4",
"ts-loader": "^9.4.3",
"typescript": "^5.1.3",
"webpack": "^5.85.0",
"webpack-cli": "^5.1.1"
},
"displayName": "Type Script Helper",
"engines": {
"vscode": "^1.79.0"
},
"main": "./dist/extension.js",
"name": "type-script-helper",
"publisher": "IFX",
"repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper",
"scripts": {
"vscode:publish": "node node_modules/@vscode/vsce/vsce package",
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\""
},
"version": "1.5.2"
}

View File

@ -0,0 +1,68 @@
import svelte from "rollup-plugin-svelte";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";
import sveltePreprocess from "svelte-preprocess";
import typescript from "@rollup/plugin-typescript";
import path from "path";
import fs from "fs";
const production = !process.env.ROLLUP_WATCH;
export default fs
.readdirSync(path.join(__dirname, "webviews", "pages"))
.map((input) => {
const name = input.split(".")[0];
return {
input: "webviews/pages/" + input,
output: {
sourcemap: true,
format: "iife",
name: "app",
file: "out/compiled/" + name + ".js",
},
plugins: [
svelte({
// enable run-time checks when not in production
dev: !production,
// we'll extract any component CSS out into
// a separate file - better for performance
css: (css) => {
css.write(name + ".css");
},
preprocess: sveltePreprocess(),
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ["svelte"],
}),
commonjs(),
typescript({
tsconfig: "webviews/tsconfig.json",
sourceMap: !production,
inlineSources: !production,
}),
// In dev mode, call `npm run start` once
// the bundle has been generated
// !production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
// !production && livereload("public"),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser(),
],
watch: {
clearScreen: false,
},
};
});

View File

@ -0,0 +1,22 @@
import { H2HexColor } from "./H2HexColor";
import { LineNumber } from "./LineNumber";
import { H2NoCheckboxes } from "./H2NoCheckboxes";
import { H2WithCheckboxes } from "./H2WithCheckboxes";
export type Card = {
Assignees: Array<string>;
CreationDateTime: Date;
Directory: string;
Extension: string;
File: string;
FileName: string;
FileNameWithoutExtension: string;
H1: string;
H2HexColorCollection: Array<H2HexColor>;
H2NoCheckboxesCollection: Array<H2NoCheckboxes>;
H2WithCheckboxesCollection: Array<H2WithCheckboxes>;
LastWriteDateTime: Date;
LineNumber: LineNumber;
RequestedDateTime: string;
Type: string;
};

View File

@ -0,0 +1,188 @@
import { Card } from "./Card";
import { readFile } from "fs";
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
import { PostMessage } from "./PostMessage";
import { apiBaseUrl, key } from "./constants";
import { ExecException, exec } from 'child_process';
export function refreshSidebarLogic(): undefined {
vscode.commands.executeCommand("workbench.action.closeSidebar").then(_ => {
vscode.commands.executeCommand("workbench.view.extension.columns-to-cards-sidebar-view");
});
}
function columnsToCardsRead(webviewView: vscode.WebviewView, columnsToCardsUri: vscode.Uri, err: NodeJS.ErrnoException | null, data: string | Buffer) {
if (err)
vscode.window.showInformationMessage(`<${columnsToCardsUri.fsPath}> doesn't exist! ${err.message}`);
const columnsToCards: Record<string, Array<Card>> = {};
const jsonObject: any = JSON.parse(data.toString('utf8'));
for (const property in jsonObject) {
columnsToCards[property] = jsonObject[property];
}
const postMessage: PostMessage = { type: "columns-to-cards", value: columnsToCards };
webviewView.webview.postMessage(postMessage);
}
function execCallback(webviewView: vscode.WebviewView, destination: vscode.Uri, error: ExecException | null, stdout: string, stderr: string) {
if (error) {
vscode.window.showInformationMessage(error.message);
return;
}
if (stderr) {
vscode.window.showInformationMessage(stderr);
return;
}
console.log(`stdout: ${stdout}`);
const columnsToCards = vscode.Uri.joinPath(destination, "columnsToCards.json");
readFile(columnsToCards.fsPath, (err, data) =>
columnsToCardsRead(webviewView, columnsToCards, err, data));
};
async function postColumnsToCards(extensionUri: vscode.Uri, webviewView: vscode.WebviewView) {
if (vscode.workspace.workspaceFolders === undefined)
vscode.window.showInformationMessage("Open workspace first!");
else {
const workspaceFoldersZero = vscode.workspace.workspaceFolders[0].uri;
const destination: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, ".vscode", "helper");
const fileFolderHelper: vscode.Uri = vscode.Uri.joinPath(extensionUri, "net7.0", "win-x64", "publish", "File-Folder-Helper.exe");
const command: string = `${fileFolderHelper.fsPath} s M ${workspaceFoldersZero.fsPath} -s ${workspaceFoldersZero.fsPath} -d ${destination.fsPath}`;
exec(command, (error, stdout, stderr) =>
execCallback(webviewView, destination, error, stdout, stderr));
}
}
function getToken(workspaceState: vscode.Memento, webviewView: vscode.WebviewView) {
webviewView.webview.postMessage({
type: "token",
value: workspaceState.get(key),
});
}
function authenticate(workspaceState: vscode.Memento, webviewView: vscode.WebviewView) {
webviewView.webview.postMessage({
type: "token",
value: workspaceState.get(key),
});
}
function logout(workspaceState: vscode.Memento) {
workspaceState.update(key, "");
}
async function openCard(value: any) {
if (vscode.workspace.workspaceFolders === undefined)
vscode.window.showInformationMessage("Open workspace first!");
else {
if (!value.File)
vscode.window.showInformationMessage("File wasn't passed!");
else {
const textDocument: vscode.TextDocument = await vscode.workspace.openTextDocument(value.File);
vscode.window.showTextDocument(textDocument);
}
}
}
export class ColumnsToCardsWebviewViewProvider implements vscode.WebviewViewProvider {
_view?: vscode.WebviewView;
constructor(private readonly _extensionContext: vscode.ExtensionContext) {
}
public revive(panel: vscode.WebviewView) {
this._view = panel;
}
public resolveWebviewView(webviewView: vscode.WebviewView) {
this._view = webviewView;
webviewView.webview.options = {
// Allow scripts in the webview
enableScripts: true,
localResourceRoots: [this._extensionContext.extensionUri],
};
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
webviewView.webview.onDidReceiveMessage(async (postMessage: PostMessage) => {
switch (postMessage.type) {
case "logout":
logout(this._extensionContext.workspaceState);
break;
case "authenticate":
authenticate(this._extensionContext.workspaceState, webviewView);
break;
case "get-token":
getToken(this._extensionContext.workspaceState, webviewView);
break;
case "get-columns-to-cards":
postColumnsToCards(this._extensionContext.extensionUri, webviewView);
break;
case "open-card":
openCard(postMessage.value);
break;
case "on-info":
if (!postMessage.value)
return;
vscode.window.showInformationMessage(postMessage.value);
break;
case "on-error":
if (!postMessage.value)
return;
vscode.window.showErrorMessage(postMessage.value);
break;
default:
vscode.window.showErrorMessage(postMessage.type);
break;
}
});
}
private _getHtmlForWebview(webview: vscode.Webview) {
const styleResetUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "reset.css")
);
const styleVSCodeUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "vscode.css")
);
const scriptUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/ColumnsToCards.js")
);
const styleMainUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/ColumnsToCards.css")
);
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--
Use a content security policy to only allow loading images from https or from our extension directory,
and only allow scripts that have a specific nonce.
-->
<meta http-equiv="Content-Security-Policy"
content="img-src https: data:;
style-src 'unsafe-inline' ${webview.cspSource};
script-src 'nonce-${nonce}';">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${styleResetUri}" rel="stylesheet">
<link href="${styleVSCodeUri}" rel="stylesheet">
<link href="${styleMainUri}" rel="stylesheet">
<script nonce="${nonce}">
const acquiredVsCodeApi = acquireVsCodeApi();
const apiBaseUrl = ${JSON.stringify(apiBaseUrl)}
</script>
</head>
<body>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;
}
}
export const refreshSidebar = () => refreshSidebarLogic();

View File

@ -0,0 +1,4 @@
export type H2HexColor = {
H2: string;
HexColor: string;
};

View File

@ -0,0 +1,5 @@
export type H2NoCheckboxes = {
H2: string;
Lines: Array<string>;
};

View File

@ -0,0 +1,7 @@
export type H2WithCheckboxes = {
Completed: number;
H2: string;
NotCompleted: number;
Total: number;
};

View File

@ -0,0 +1,9 @@
export type LineNumber = {
Created: number;
H1: number;
FrontMatterYamlEnd: number;
Status: number;
Type: number;
Updated: number;
};

View File

@ -0,0 +1,5 @@
export type PostMessage = {
type: string;
value: any;
};

View File

@ -0,0 +1,166 @@
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
import { apiBaseUrl } from "./constants";
import { PostMessage } from "./PostMessage";
export function refreshWebView(extensionContext: vscode.ExtensionContext): undefined {
WebViewPanel.kill();
WebViewPanel.createOrShow(extensionContext);
}
export class WebViewPanel {
/**
* Track the currently panel. Only allow a single panel to exist at a time.
*/
public static currentPanel: WebViewPanel | undefined;
public static readonly viewType = "web-view-panel";
private _disposables: vscode.Disposable[] = [];
public static createOrShow(extensionContext: vscode.ExtensionContext) {
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;
// If we already have a panel, show it.
if (WebViewPanel.currentPanel) {
WebViewPanel.currentPanel._panel.reveal(column);
WebViewPanel.currentPanel._update();
return;
}
// Otherwise, create a new panel.
const panel = vscode.window.createWebviewPanel(
WebViewPanel.viewType,
"Web-View-Panel",
column || vscode.ViewColumn.One,
{
// Enable javascript in the webview
enableScripts: true,
// And restrict the webview to only loading content from our extension's `media` directory.
localResourceRoots: [
vscode.Uri.joinPath(extensionContext.extensionUri, "media"),
vscode.Uri.joinPath(extensionContext.extensionUri, "out/compiled"),
],
}
);
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionContext);
}
public static kill() {
WebViewPanel.currentPanel?.dispose();
WebViewPanel.currentPanel = undefined;
}
public static revive(panel: vscode.WebviewPanel, extensionContext: vscode.ExtensionContext) {
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionContext);
}
private constructor(private readonly _panel: vscode.WebviewPanel, private readonly _extensionContext: vscode.ExtensionContext) {
// Set the webview's initial html content
this._update();
// Listen for when the panel is disposed
// This happens when the user closes the panel or when the panel is closed programmatically
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
// // Handle messages from the webview
// this._panel.webview.onDidReceiveMessage(
// (message) => {
// switch (message.command) {
// case "alert":
// vscode.window.showErrorMessage(message.text);
// return;
// }
// },
// null,
// this._disposables
// );
}
public dispose() {
WebViewPanel.currentPanel = undefined;
// Clean up our resources
this._panel.dispose();
while (this._disposables.length) {
const x = this._disposables.pop();
if (x) {
x.dispose();
}
}
}
private async _update() {
const webview = this._panel.webview;
this._panel.webview.html = this._getHtmlForWebview(webview);
webview.onDidReceiveMessage(async (postMessage: PostMessage) => {
switch (postMessage.type) {
case "on-info":
if (!postMessage.value)
return;
vscode.window.showInformationMessage(postMessage.value);
break;
case "on-error":
if (!postMessage.value)
return;
vscode.window.showErrorMessage(postMessage.value);
break;
default:
vscode.window.showErrorMessage(postMessage.type);
break;
}
});
}
private _getHtmlForWebview(webview: vscode.Webview) {
const styleResetUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "reset.css")
);
const styleVSCodeUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "vscode.css")
);
const scriptUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/DisplayDate.js")
);
const styleMainUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/DisplayDate.css")
);
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--
Use a content security policy to only allow loading images from https or from our extension directory,
and only allow scripts that have a specific nonce.
-->
<meta http-equiv="Content-Security-Policy"
content="img-src https: data:;
style-src 'unsafe-inline' ${webview.cspSource};
script-src 'nonce-${nonce}';">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${styleResetUri}" rel="stylesheet">
<link href="${styleVSCodeUri}" rel="stylesheet">
<link href="${styleMainUri}" rel="stylesheet">
<script nonce="${nonce}">
const acquiredVsCodeApi = acquireVsCodeApi();
const apiBaseUrl = ${JSON.stringify(apiBaseUrl)}
</script>
</head>
<body>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;
}
}

View File

@ -0,0 +1,2 @@
export const apiBaseUrl: string = "http://localhost:3002";
export const key: string = "type-script-helper";

View File

@ -1,48 +1,56 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import * as kanbanHelper from './kanbanHelper';
import * as markdownHelper from './markdownHelper';
import * as promiseLinesHelper from './promiseLinesHelper';
import * as replaceLinesHelper from './replaceLinesHelper';
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
import * as promiseLinesHelper from './promiseLinesHelper';
import { WebViewPanel, refreshWebView } from "./WebViewPanel";
import { ColumnsToCardsWebviewViewProvider, refreshSidebar } from "./ColumnsToCardsWebviewViewProvider";
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export async function activate(extensionContext: vscode.ExtensionContext) {
const openCommand = 'open-in-new-window.open';
const columnsToCardsWebviewViewProvider = new ColumnsToCardsWebviewViewProvider(extensionContext);
const item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
item.text = "$(beaker) Show Kanban";
// item.command = "kanban.show";
item.show();
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("columns-to-cards-webview-view-provider", columnsToCardsWebviewViewProvider));
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "type-script-helper" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
// let disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
// // The command has been defined in the package.json file
// // Now provide the implementation of the command with registerCommand
// // The commandId parameter must match the command field in package.json
// let disposable = vscode.commands.registerCommand('type-script-helper.helloWorld', () => {
// // The code you place here will be executed every time your command is executed
// // Display a message box to the user
// vscode.window.showInformationMessage('Hello World!');
// vscode.window.showInformationMessage('Hello World from type-script-helper!');
// });
// context.subscriptions.push(disposable);
const commands = [
vscode.commands.registerCommand(openCommand, (uri) => {
if (!uri) {
vscode.window.showWarningMessage('The intended usage is from the explorer context menu.');
return;
}
vscode.window.showInformationMessage(`Opening ${uri.path} in new window!`);
vscode.commands.executeCommand('vscode.openFolder', uri, true);
}),
vscode.commands.registerCommand("kanban.refreshBoth", () => { kanbanHelper.refreshBoth(extensionContext); }),
vscode.commands.registerCommand("kanban.refreshSidebar", refreshSidebar),
vscode.commands.registerCommand("kanban.refreshWebView", () => { refreshWebView(extensionContext); }),
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
vscode.commands.registerCommand('promiseLinesHelper.insertDateTime', promiseLinesHelper.insertDateTime),
vscode.commands.registerCommand('promiseLinesHelper.transformToPopperCase', promiseLinesHelper.transformToPopperCase),
vscode.commands.registerCommand('promiseLinesHelper.transformToParamCase', promiseLinesHelper.transformToParamCase),
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.convertToRegularExpression', replaceLinesHelper.convertToRegularExpression),
vscode.commands.registerCommand('replaceLinesHelper.cutEachLine', replaceLinesHelper.cutEachLine),
vscode.commands.registerCommand('replaceLinesHelper.distinctLines', replaceLinesHelper.distinctLines),
vscode.commands.registerCommand('replaceLinesHelper.expandSql', replaceLinesHelper.expandSql),
vscode.commands.registerCommand('replaceLinesHelper.listToListFamily', replaceLinesHelper.listToListFamily),
vscode.commands.registerCommand('replaceLinesHelper.listToListWrappedComma', replaceLinesHelper.listToListWrappedComma),
@ -55,13 +63,15 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('replaceLinesHelper.removeComment', replaceLinesHelper.removeComment),
vscode.commands.registerCommand('replaceLinesHelper.sortLength', replaceLinesHelper.sortLength),
vscode.commands.registerCommand('replaceLinesHelper.sortNormal', replaceLinesHelper.sortNormal),
vscode.commands.registerCommand('replaceLinesHelper.splitBySpaceReverseJoinSort', replaceLinesHelper.splitBySpaceReverseJoinSort),
vscode.commands.registerCommand('replaceLinesHelper.unwrapSql', replaceLinesHelper.unwrapSql),
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlCSharp', replaceLinesHelper.wrapSqlCSharp),
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlVB', replaceLinesHelper.wrapSqlVB)
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlVB', replaceLinesHelper.wrapSqlVB),
vscode.commands.registerCommand("webView.webView", () => { WebViewPanel.createOrShow(extensionContext); })
];
commands.forEach(command => context.subscriptions.push(command));
commands.forEach(command => extensionContext.subscriptions.push(command));
}
// this method is called when your extension is deactivated
// This method is called when your extension is deactivated
export function deactivate() { }

View File

@ -0,0 +1,9 @@
export function getNonce() {
let text = "";
const possible =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (let i = 0; i < 32; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}

View File

@ -0,0 +1,9 @@
import * as vscode from 'vscode';
import { refreshWebView } from './WebViewPanel';
import { refreshSidebar } from './ColumnsToCardsWebviewViewProvider';
export function refreshBoth(extensionContext: vscode.ExtensionContext): undefined {
refreshSidebar();
refreshWebView(extensionContext);
setTimeout(() => { vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools"); }, 500);
}

View File

@ -0,0 +1,21 @@
import * as vscode from 'vscode';
import { paramCase } from './promiseLinesHelper';
async function newMarkdownFileLogic(): Promise<undefined> {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
return;
}
const workspaceFoldersZero = vscode.workspace.workspaceFolders[0].uri;
const cardTitle = await vscode.window.showInputBox({ prompt: 'Provide title for card.' });
if (cardTitle === undefined)
return;
const paramCaseCardTitle: string = paramCase(cardTitle);
const fileUri: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, `${paramCaseCardTitle}.md`);
const buffer: Buffer = Buffer.from(`# ${cardTitle}`, 'utf8');
await vscode.workspace.fs.writeFile(fileUri, buffer);
const textDocument: vscode.TextDocument = await vscode.workspace.openTextDocument(fileUri);
vscode.window.showTextDocument(textDocument);
}
export const newMarkdownFile = () => newMarkdownFileLogic();

View File

@ -1,5 +1,4 @@
import * as vscode from 'vscode';
import { QuickPickItem } from "vscode";
function codeGeneratorQuickPickLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
@ -87,7 +86,7 @@ function codeGeneratorQuickPickLogic(): undefined {
}, {
label: "Path without Brackets (Singularized)",
detail: "",
output: "%PathWithoutBracketSingularized%"
output: "%PathWithoutBracketsSingularized%"
}, {
label: "Suggested Type",
detail: "Type based on values in *.json file",
@ -129,4 +128,88 @@ function codeGeneratorQuickPickLogic(): undefined {
return undefined;
}
export const codeGeneratorQuickPick = () => codeGeneratorQuickPickLogic();
function insertDateTimeLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
const date = new Date();
const selection = textEditor.selection;
textEditor.edit(editBuilder => {
var range;
if (selection.isEmpty) {
editBuilder.insert(selection.start, date.toString())
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
editBuilder.replace(range, date.toString());
}
});
return undefined;
}
function camelCase(str: string) {
return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
if (+match === 0) return "";
return index === 0 ? match.toLowerCase() : match.toUpperCase();
});
}
function transformToPopperCaseLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
const selection = textEditor.selection;
textEditor.edit(editBuilder => {
var range;
if (selection.isEmpty) {
return undefined;
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
const highlighted = textEditor.document.getText(range);
let camelCased = camelCase(highlighted);
let properCased = camelCased.substring(0, 1).toUpperCase() + camelCased.substring(1, camelCased.length);
editBuilder.replace(range, properCased);
}
});
return undefined;
}
export function paramCase(str: string) {
return str
.replace(
/([A-Z]+(.))/g,
(_, separator, letter, offset) => (offset ? "-" + separator : separator).toLowerCase()
)
.split(/[\s!?.,@:;|\\/"'`£$%\^&*{}[\]()<>~#+\-=_¬]+/g)
.join('-')
.replace(/(^-|-$)/g, '');
};
function transformToParamCaseLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
const selection = textEditor.selection;
textEditor.edit(editBuilder => {
var range;
if (selection.isEmpty) {
return undefined;
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
const highlighted = textEditor.document.getText(range);
let paramCased = paramCase(highlighted);
editBuilder.replace(range, paramCased);
}
});
return undefined;
}
export const codeGeneratorQuickPick = () => codeGeneratorQuickPickLogic();
export const insertDateTime = () => insertDateTimeLogic();
export const transformToPopperCase = () => transformToPopperCaseLogic();
export const transformToParamCase = () => transformToParamCaseLogic();

View File

@ -8,6 +8,7 @@ enum LinesAction {
addVBComment,
convertToRegularExpression,
cutEachLine,
distinctLines,
expandSql,
listToListFamily,
listToListWrappedComma,
@ -21,6 +22,7 @@ enum LinesAction {
removeComment,
sortLength,
sortNormal,
splitBySpaceReverseJoinSort,
unwrapSql,
wrapSqlCSharp,
wrapSqlVB
@ -150,7 +152,7 @@ function prettySqlLogic(lines: string[]): void {
}
function camelCase(str: string) {
return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
if (+match === 0) return "";
return index === 0 ? match.toLowerCase() : match.toUpperCase();
});
@ -168,7 +170,7 @@ function capitalize(word: string) {
function quickFixCamelCasePropertiesLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
if(segments.length < 2 || segments.length > 3)
if (segments.length < 2 || segments.length > 3)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
@ -181,7 +183,7 @@ function quickFixCamelCasePropertiesLogic(lines: string[]): void {
function quickFixCS0108Logic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
if(segments.length < 2 || segments.length > 3)
if (segments.length < 2 || segments.length > 3)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
@ -196,15 +198,15 @@ function quickFixCS0108Logic(lines: string[]): void {
function quickFixInstanceFieldToCalisthenicsLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
if(segments.length !== 2)
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') {
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
@ -214,11 +216,11 @@ function quickFixInstanceFieldToCalisthenicsLogic(lines: string[]): void {
singularName = name.substring(0, singularName.length - 1);
}
segments = type.split('<');
if(segments.length === 2)
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)
if (segments.length === 2)
lines[i] = leftPadding + 'public ' + singularName + '[] ' + name + ' { get; } //' + segments[0];
else
lines[i] = leftPadding + 'public ' + singularName + ' ' + name + ' { get; } //' + type;
@ -230,7 +232,7 @@ function quickFixInstanceFieldToCalisthenicsLogic(lines: string[]): void {
function quickFixProperCasePropertiesLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
if(segments.length < 2 || segments.length > 3)
if (segments.length < 2 || segments.length > 3)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
@ -244,7 +246,7 @@ function quickFixProperCasePropertiesLogic(lines: string[]): void {
function quickFixPublicLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
if(segments.length < 2 || segments.length > 3)
if (segments.length < 2 || segments.length > 3)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
@ -282,6 +284,23 @@ function sortNormalLogic(lines: string[]): void {
lines = transformers.reduce((currentLines, transform) => transform(currentLines), lines);
}
function splitBySpaceReverseJoinSortLogic(lines: string[]): void {
var transformers: ArrayTransformer[] = [];
transformers.push(makeSorter());
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].split(' ').reverse().join(' ');
}
removeBlanks(lines);
lines = transformers.reduce((currentLines, transform) => transform(currentLines), lines);
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].split(' ').reverse().join(' ');
}
}
function unwrapSqlLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = "//" + lines[i].
@ -347,6 +366,15 @@ function cutEachLineLogic(lines: string[]): void {
removeBlanks(lines);
}
function distinctLinesLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
if (lines[i].trim() === '' || lines.indexOf(lines[i]) !== lines.lastIndexOf(lines[i])) {
lines.splice(i, 1);
i--;
}
}
}
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);
@ -372,6 +400,7 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
case LinesAction.addVBComment: { addVBCommentLogic(lines); break; }
case LinesAction.convertToRegularExpression: { lines = convertToRegularExpressionLogic(lines); break; }
case LinesAction.cutEachLine: { cutEachLineLogic(lines); break; }
case LinesAction.distinctLines: { distinctLinesLogic(lines); break; }
case LinesAction.expandSql: { expandSqlLogic(lines); break; }
case LinesAction.listToListFamily: { listToListFamilyLogic(lines); break; }
case LinesAction.listToListWrappedComma: { listToListWrappedCommaLogic(lines); break; }
@ -384,6 +413,7 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
case LinesAction.removeComment: { removeCommentLogic(lines); break; }
case LinesAction.sortLength: { sortLengthLogic(lines); break; }
case LinesAction.sortNormal: { sortNormalLogic(lines); break; }
case LinesAction.splitBySpaceReverseJoinSort: { splitBySpaceReverseJoinSortLogic(lines); break; }
case LinesAction.unwrapSql: { unwrapSqlLogic(lines); break; }
case LinesAction.wrapSqlCSharp: { wrapSqlCSharpLogic(lines); break; }
case LinesAction.wrapSqlVB: { wrapSqlVBLogic(lines); break; }
@ -396,6 +426,7 @@ 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 distinctLines = () => linesFunction(LinesAction.distinctLines);
export const expandSql = () => linesFunction(LinesAction.expandSql);
export const listToListFamily = () => linesFunction(LinesAction.listToListFamily);
export const listToListWrappedComma = () => linesFunction(LinesAction.listToListWrappedComma);
@ -409,6 +440,7 @@ 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 splitBySpaceReverseJoinSort = () => linesFunction(LinesAction.splitBySpaceReverseJoinSort);
export const unwrapSql = () => linesFunction(LinesAction.unwrapSql);
export const wrapSqlCSharp = () => linesFunction(LinesAction.wrapSqlCSharp);
export const wrapSqlVB = () => linesFunction(LinesAction.wrapSqlVB);

View File

@ -1,6 +1,6 @@
import * as path from 'path';
import { runTests } from 'vscode-test';
import { runTests } from '@vscode/test-electron';
async function main() {
try {
@ -15,7 +15,7 @@ async function main() {
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error('Failed to run tests');
console.error('Failed to run tests', err);
process.exit(1);
}
}

View File

@ -3,13 +3,13 @@ import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
// import * as myExtension from '../extension';
// import * as myExtension from '../../extension';
suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');
test('Sample test', () => {
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
});
});

View File

@ -6,8 +6,8 @@ export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
color: true
});
mocha.useColors(true);
const testsRoot = path.resolve(__dirname, '..');
@ -30,6 +30,7 @@ export function run(): Promise<void> {
}
});
} catch (err) {
console.error(err);
e(err);
}
});

View File

@ -1,22 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"allowSyntheticDefaultImports": true,
"lib": [
"es6"
"ES2020"
],
"sourceMap": true,
"module": "commonjs",
"rootDir": "src",
"resolveJsonModule": true,
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
"sourceMap": true,
"strict": true,
"target": "ES2020"
},
"exclude": [
"node_modules",
".vscode-test"
".vscode-test",
"webviews"
]
}
}

View File

@ -1,15 +0,0 @@
{
"rules": {
"no-string-throw": true,
"no-unused-expression": true,
"no-duplicate-variable": true,
"curly": true,
"class-name": true,
"semicolon": [
true,
"always"
],
"triple-equals": true
},
"defaultSeverity": "warning"
}

View File

@ -1,3 +1,11 @@
---
type: "note"
created: "2023-07-07T16:15:27.822Z"
updated: "2023-07-07T16:15:27.822Z"
---
# vsc-extension-quickstart
# Welcome to your VS Code Extension
## What's in the folder
@ -9,6 +17,11 @@
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
## Setup
* install the recommended extensions (amodio.tsl-problem-matcher and dbaeumer.vscode-eslint)
## Get up and running straight away
* Press `F5` to open a new window with your extension loaded.
@ -37,6 +50,6 @@
## Go further
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).

View File

@ -0,0 +1,25 @@
<script lang="ts">
import type { Card } from "../../src/Card";
export let key: string;
export let card: Card;
export let index: number;
</script>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore missing-declaration -->
<li id={index.toString()}>
<!-- svelte-ignore a11y-invalid-attribute -->
<a
href="#{index.toString()}"
title="{key}"
on:click={async () => {
acquiredVsCodeApi.postMessage({
type: "open-card",
value: { File: card.File },
});
}}
>
{card.H1}
</a>
</li>

View File

@ -0,0 +1,19 @@
<script lang="ts">
import type { Card } from "../../src/Card";
import CardComponent from "./CardComponent.svelte";
export let key: string = "";
export let value: Array<Card> = [];
</script>
{#if !value}
<div>loading...</div>
{:else}
<hr>
<h1>{key}</h1>
<ul>
{#each value as card, index}
<CardComponent {key} {card} {index} />
{/each}
</ul>
{/if}

View File

@ -0,0 +1,33 @@
<script lang="ts">
import { onMount } from "svelte";
import Cards from "./Cards.svelte";
import type { Card } from "../../src/Card";
import type { PostMessage } from "../../src/PostMessage";
let columnsToCards: Record<string, Array<Card>> = {};
onMount(async () => {
window.addEventListener("message", async (event) => {
const postMessage: PostMessage = event.data;
switch (postMessage.type) {
case "columns-to-cards": {
columnsToCards = postMessage.value;
break;
}
}
});
const postMessage: PostMessage = {
type: "get-columns-to-cards",
value: undefined,
};
acquiredVsCodeApi.postMessage(postMessage);
});
</script>
{#if Object.entries(columnsToCards).length == 0}
<div>loading...</div>
{:else}
{#each Object.entries(columnsToCards) as [key, value], index (key)}
<Cards {key} {value} />
{/each}
{/if}

View File

@ -0,0 +1,4 @@
<script lang="ts">
</script>
<h1>2023-09-23-15-20</h1>

View File

@ -0,0 +1,10 @@
import * as _vscode from "vscode";
import type { PostMessage } from "../types";
declare global {
const acquiredVsCodeApi: {
postMessage: (PostMessage) => void;
getState: () => any;
setState: (state: any) => void;
};
}

View File

@ -0,0 +1,7 @@
import App from "../components/ColumnsToCards.svelte";
const app = new App({
target: document.body,
});
export default app;

View File

@ -0,0 +1,7 @@
import App from "../components/DisplayDate.svelte";
const app = new App({
target: document.body,
});
export default app;

View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"ignoreDeprecations": "5.0",
"strict": true
},
"exclude": [
"../node_modules/*"
],
"extends": "@tsconfig/svelte/tsconfig.json",
"include": [
"./**/*"
]
}