Compare commits

...

No commits in common. "master" and "03-31-a" have entirely different histories.

36 changed files with 9396 additions and 2041 deletions

3
.gitignore vendored
View File

@ -303,6 +303,3 @@ type-script-helper/src/replaceLinesHelper.js
type-script-helper/src/replaceLinesHelper.js.map type-script-helper/src/replaceLinesHelper.js.map
type-script-helper/src/WebViewPanel.js type-script-helper/src/WebViewPanel.js
type-script-helper/src/WebViewPanel.js.map type-script-helper/src/WebViewPanel.js.map
svelte-helper/.dist/*
Application.evtx

BIN
Application.evtx Normal file

Binary file not shown.

Binary file not shown.

View File

@ -4,5 +4,4 @@
dist dist
node_modules node_modules
out out
src/*.js* src/*.js*
!src/embed.js

View File

@ -3,28 +3,27 @@
// Hover to view descriptions of existing attributes. // Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{ {
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Run Extension", "name": "Run Extension",
"type": "extensionHost", "type": "extensionHost",
"request": "launch", "request": "launch",
"preLaunchTask": "npm: webpack", "args": [
"args": [ "--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}" ],
], "outFiles": [
"outFiles": [ "${workspaceFolder}/dist/**/*.js"
"${workspaceFolder}/dist/**/*.js" ]
] },
}, {
{ "type": "node",
"type": "node", "request": "launch",
"request": "launch", "name": "Launch Program",
"name": "Launch Program", "program": "${workspaceFolder}/src/extension.ts",
"program": "${workspaceFolder}/src/extension.ts", "outFiles": [
"outFiles": [ "${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/out/**/*.js" ]
] }
} ]
]
} }

View File

@ -1,63 +1,63 @@
{ {
"tasks": [ "tasks": [
{ {
"type": "npm", "type": "npm",
"script": "tsc-build", "script": "tsc-build",
"group": "build", "group": "build",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: tsc-build", "label": "npm: tsc-build",
"detail": "tsc" "detail": "tsc"
}, },
{ {
"type": "npm", "type": "npm",
"script": "tsc-clean", "script": "tsc-clean",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: tsc-clean", "label": "npm: tsc-clean",
"detail": "tsc --build --clean" "detail": "tsc --build --clean"
}, },
{ {
"type": "npm", "type": "npm",
"script": "vscode:package", "script": "vscode:package",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: vscode:package", "label": "npm: vscode:package",
"detail": "node node_modules/@vscode/vsce/vsce package" "detail": "node node_modules/@vscode/vsce/vsce package"
}, },
{ {
"type": "npm", "type": "npm",
"script": "vscode:login", "script": "vscode:login",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: vscode:login", "label": "npm: vscode:login",
"detail": "node node_modules/@vscode/vsce/vsce login Infineon-Technologies-AG-Mesa-FI" "detail": "node node_modules/@vscode/vsce/vsce login Infineon-Technologies-AG-Mesa-FI"
}, },
{ {
"type": "npm", "type": "npm",
"script": "vscode:ls-publishers", "script": "vscode:ls-publishers",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: vscode:ls-publishers", "label": "npm: vscode:ls-publishers",
"detail": "node node_modules/@vscode/vsce/vsce ls-publishers" "detail": "node node_modules/@vscode/vsce/vsce ls-publishers"
}, },
{ {
"type": "npm", "type": "npm",
"script": "vscode:publish", "script": "vscode:publish",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: vscode:publish", "label": "npm: vscode:publish",
"detail": "node node_modules/@vscode/vsce/vsce publish" "detail": "node node_modules/@vscode/vsce/vsce publish"
}, },
{ {
"type": "npm", "type": "npm",
"script": "watch", "script": "watch",
"group": "build", "group": "build",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: watch", "label": "npm: watch",
"detail": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"" "detail": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\""
}, },
{ {
"type": "npm", "type": "npm",
"script": "webpack", "script": "webpack",
"problemMatcher": [], "problemMatcher": [],
"label": "npm: webpack", "label": "npm: webpack",
"detail": "webpack --config ./build/node-extension.webpack.config.js" "detail": "webpack --config ./build/node-extension.webpack.config.js"
} }
], ],
"version": "2.0.0" "version": "2.0.0"
} }

View File

@ -226,43 +226,7 @@ None
- Add search page for Backlog - Add search page for Backlog
## 1.119.0 1744337196592 = 638799339965920000 = 2025-1.Spring = Thu Apr 10 2025 19:06:36 GMT-0700 (Mountain Standard Time) ## 1.119.0 1742607894338 = 638782046943380000 = 2025-1.Spring = Fri Mar 21 2025 18:44:53 GMT-0700 (Mountain Standard Time)
----------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------
- Changed ADO Priority servers - Generic File-Folder-Helper call
## 1.120.0 1744401374311 = 638799981743110000 = 2025-1.Spring = Fri Apr 11 2025 12:56:13 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Sidebar button for view command pallette images
## 1.121.0 1744403802837 = 638800006028370000 = 2025-1.Spring = Fri Apr 11 2025 13:36:42 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Extension logo
## 1.122.0 1744403802837 = 638800006028370000 = 2025-1.Spring = Fri Apr 11 2025 13:36:42 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Extension to javascript communication
- cod-1-122-0.js
## 1.123.0 1745545527205 = 638811423272050000 = 2025-1.Spring = Thu Apr 24 2025 18:45:26 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Enable find within Cost of Delay (CoD)
## 1.123.1 1746135167656 = 638817319676560000 = 2025-1.Spring = Thu May 01 2025 14:32:47 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Spelling fixes
## 1.124.0 1749244041290 = 638848408412900000 = 2025-2.Spring = Fri Jun 06 2025 14:07:20 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Delete remaining column-to-cards files
- Bun support
- Spelling of pallette
- FileSync prep
- json remove null lines
- Remove lines containing highlighted

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -7,9 +7,8 @@ $(document).ready(function () {
const windowLocationHRef = window.location.href + '?site=' + _webviewSite + 'view=' + _webviewView; const windowLocationHRef = window.location.href + '?site=' + _webviewSite + 'view=' + _webviewView;
const signalRUrl = baseUri + '/signalr'; const signalRUrl = baseUri + '/signalr';
const workItems = { const workItems = {
a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-04-10-15-59', a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-01-22-10-49',
b: baseUri + '/markdown/{[]}.json?v=2025-04-10-15-59', b: baseUri + '/markdown/{[]}.json?v=2025-01-22-10-49'
timeout: 3000,
}; };
const b = { const b = {
page: 'business', page: 'business',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

8819
type-script-helper/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,15 +28,10 @@
"title": "Calculate and replace in front of cursor" "title": "Calculate and replace in front of cursor"
}, },
{ {
"category": "Explorer", "category": "Explorer",
"command": "extension.rotateExplorerSortOrder", "command": "extension.rotateExplorerSortOrder",
"title": "Rotate Explorer Sort Order" "title": "Rotate Explorer Sort Order"
}, },
{
"category": "FileSync",
"command": "webview.fileSync",
"title": "FileSync"
},
{ {
"category": "Calculate", "category": "Calculate",
"command": "extension.calcReplace", "command": "extension.calcReplace",
@ -57,6 +52,11 @@
"command": "promiseLinesHelper.codeGeneratorQuickPick", "command": "promiseLinesHelper.codeGeneratorQuickPick",
"title": "Code Generator - Quick Pick" "title": "Code Generator - Quick Pick"
}, },
{
"category": "Helper",
"command": "promiseLinesHelper.genericFileFolderHelper",
"title": "Generic - File-Folder-Helper"
},
{ {
"category": "Helper", "category": "Helper",
"command": "promiseLinesHelper.insertDateTime", "command": "promiseLinesHelper.insertDateTime",
@ -70,12 +70,12 @@
{ {
"category": "Helper", "category": "Helper",
"command": "promiseLinesHelper.transformToParamCase", "command": "promiseLinesHelper.transformToParamCase",
"title": "Transform to Param (Kebab) Case" "title": "Transform to Param Case"
}, },
{ {
"category": "Helper", "category": "Helper",
"command": "promiseLinesHelper.transformToProperCase", "command": "promiseLinesHelper.transformToPopperCase",
"title": "Transform to Proper (Pascal) Case" "title": "Transform to Popper Case"
}, },
{ {
"category": "Helper", "category": "Helper",
@ -222,16 +222,6 @@
"command": "replaceLinesHelper.removeComment", "command": "replaceLinesHelper.removeComment",
"title": "Remove comment" "title": "Remove comment"
}, },
{
"category": "Replace",
"command": "replaceLinesHelper.removeJsonNullValues",
"title": "Remove json null values"
},
{
"category": "Replace",
"command": "replaceLinesHelper.removeLinesContainingHighlighted",
"title": "Remove lines containing highlighted"
},
{ {
"category": "Replace", "category": "Replace",
"command": "replaceLinesHelper.sortLength", "command": "replaceLinesHelper.sortLength",
@ -289,26 +279,6 @@
}, },
"title": "Cost of Delay Helper Configuration", "title": "Cost of Delay Helper Configuration",
"type": "object" "type": "object"
},
"views": {
"view-command-pallete-webview-view-provider-view": [
{
"contextualTitle": "Infineon Technologies Americas Corp.",
"icon": "media/lowres-LOGO_Black.png.png",
"id": "view-command-pallete-webview-view-provider",
"name": "Infineon",
"type": "webview"
}
]
},
"viewsContainers": {
"activitybar": [
{
"icon": "media/lowres-LOGO_Black.png.png",
"id": "view-command-pallete-webview-view-provider-view",
"title": "Infineon Technologies Americas Corp."
}
]
} }
}, },
"dependencies": { "dependencies": {
@ -342,7 +312,6 @@
"engines": { "engines": {
"vscode": "^1.79.0" "vscode": "^1.79.0"
}, },
"icon": "media/LOGO_RGB.png",
"keywords": [ "keywords": [
"Backlog", "Backlog",
"CoD", "CoD",
@ -362,12 +331,12 @@
"scripts": { "scripts": {
"tsc-build": "tsc", "tsc-build": "tsc",
"tsc-clean": "tsc --build --clean", "tsc-clean": "tsc --build --clean",
"vscode:package": "node node_modules/@vscode/vsce/vsce package",
"vscode:login": "node node_modules/@vscode/vsce/vsce login Infineon-Technologies-AG-Mesa-FI", "vscode:login": "node node_modules/@vscode/vsce/vsce login Infineon-Technologies-AG-Mesa-FI",
"vscode:ls-publishers": "node node_modules/@vscode/vsce/vsce ls-publishers", "vscode:ls-publishers": "node node_modules/@vscode/vsce/vsce ls-publishers",
"vscode:package": "node node_modules/@vscode/vsce/vsce package",
"vscode:publish": "node node_modules/@vscode/vsce/vsce publish", "vscode:publish": "node node_modules/@vscode/vsce/vsce publish",
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"", "watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"",
"webpack": "webpack --config ./build/node-extension.webpack.config.js" "webpack": "webpack --config ./build/node-extension.webpack.config.js"
}, },
"version": "1.124.0" "version": "1.119.0"
} }

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,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(): any {
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, "net8.0", "win-x64", "publish", "File-Folder-Helper.exe");
const command: string = `${fileFolderHelper.fsPath} s M "${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

@ -1,7 +0,0 @@
export type ReceivedMessage = {
command: string;
collection: Array<any>;
subcommand: string;
value: any;
};

View File

@ -1,65 +0,0 @@
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
export class ViewCommandPalletteWebviewViewProvider implements vscode.WebviewViewProvider {
_webviewView?: vscode.WebviewView;
constructor(private readonly _extensionContext: vscode.ExtensionContext) {
}
public revive(webviewView: vscode.WebviewView) {
this._webviewView = webviewView;
}
public resolveWebviewView(webviewView: vscode.WebviewView) {
this._webviewView = webviewView;
webviewView.webview.options = {
// Allow scripts in the webview
enableScripts: true,
localResourceRoots: [this._extensionContext.extensionUri],
};
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
}
private _getHtmlForWebview(webview: vscode.Webview) {
const imageA = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "Screenshot 2025-04-11 125031.png")
);
const imageB = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "Screenshot 2025-04-11 125350.png")
);
// 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">
</head>
<body>
<h1>Infineon Technologies Americas Corp.</h1>
<ul>
<li>View</li>
<li>Command Pallette... Ctrl+Shift+P</li>
<li>Type Mesa or Leominster</li>
<li>Select item</li>
</ul>
<img src="${imageA}" alt="Screenshot 2025-04-11 125031.png" width="75%" height="75%">
<img src="${imageB}" alt="Screenshot 2025-04-11 125350" width="75%" height="75%">
</body>
</html>`;
}
}

View File

@ -1,6 +1,8 @@
import * as vscode from "vscode"; import * as vscode from "vscode";
import { getNonce } from "./getNonce"; import { getNonce } from "./getNonce";
import { apiBaseUrl } from "./constants"; import { apiBaseUrl } from "./constants";
import { PostMessage } from "./PostMessage";
import { title } from "process";
export class WebviewPanelCostOfDelay { export class WebviewPanelCostOfDelay {
/** /**
@ -46,7 +48,6 @@ export class WebviewPanelCostOfDelay {
{ {
// Enable javascript in the webview // Enable javascript in the webview
enableScripts: true, enableScripts: true,
enableFindWidget: true,
// And restrict the webview to only loading content from our extension's `media` directory. // And restrict the webview to only loading content from our extension's `media` directory.
localResourceRoots: [ localResourceRoots: [
@ -77,21 +78,18 @@ export class WebviewPanelCostOfDelay {
// This happens when the user closes the panel or when the panel is closed programmatically // This happens when the user closes the panel or when the panel is closed programmatically
this._panel.onDidDispose(() => this.dispose(), null, this._disposables); this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
// Handle messages from the webview // // Handle messages from the webview
this._panel.webview.onDidReceiveMessage( // this._panel.webview.onDidReceiveMessage(
(message) => { // (message) => {
switch (message.command) { // switch (message.command) {
case "alert": // case "alert":
vscode.window.showErrorMessage(message.text); // vscode.window.showErrorMessage(message.text);
return; // return;
default: // }
vscode.window.showErrorMessage(message.text); // },
break; // null,
} // this._disposables
}, // );
null,
this._disposables
);
} }
public dispose() { public dispose() {
@ -110,18 +108,29 @@ export class WebviewPanelCostOfDelay {
private async _update(site: string, title: string, view: string) { private async _update(site: string, title: string, view: string) {
const webview = this._panel.webview; const webview = this._panel.webview;
this._panel.webview.html = this._getHtmlForWebview(site, title, view, webview); this._panel.webview.html = this._getHtmlForWebview(site, title, view, webview);
webview.onDidReceiveMessage(async (message: string) => { webview.onDidReceiveMessage(async (postMessage: PostMessage) => {
vscode.window.showErrorMessage(message); 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(site: string, title: string, view: string, webview: vscode.Webview) { private _getHtmlForWebview(site: string, title: string, view: string, webview: vscode.Webview) {
const baseUri = 'https://eaf-dev.mes.infineon.com'; const baseUri = 'https://eaf-dev.mes.infineon.com';
const scriptUri = 'cod-1-123-0.js?v=2025-04-14-08-10';
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
if (view === 'HTML') { if (view === 'HTML') {
return `<!DOCTYPE html> return `<!DOCTYPE html>
@ -154,6 +163,9 @@ export class WebviewPanelCostOfDelay {
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "cost-of-delay.js") vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "cost-of-delay.js")
); );
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
return `<!DOCTYPE html> return `<!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -165,7 +177,8 @@ export class WebviewPanelCostOfDelay {
<link href="${styleCostOfDelayUri}" rel="stylesheet" /> <link href="${styleCostOfDelayUri}" rel="stylesheet" />
<script nonce="${nonce}" src="${scriptJQueryUri}"></script> <script nonce="${nonce}" src="${scriptJQueryUri}"></script>
<script nonce="${nonce}" src="${scriptSignalRUri}"></script> <script nonce="${nonce}" src="${scriptSignalRUri}"></script>
<script nonce="${nonce}" src="${baseUri}/js/${scriptUri}" type="text/javascript"></script> <script nonce="${nonce}" src="${baseUri}/signalr/hubs"></script>
<script nonce="${nonce}" src="${baseUri}/js/cod-b.js?v=2025-01-22-10-49" type="text/javascript"></script>
<script nonce="${nonce}"> <script nonce="${nonce}">
const _webviewSite = '${site}'; const _webviewSite = '${site}';
const _webviewView = '${view}'; const _webviewView = '${view}';

View File

@ -38,7 +38,6 @@ export class WebviewPanelExample {
{ {
// Enable javascript in the webview // Enable javascript in the webview
enableScripts: true, enableScripts: true,
enableFindWidget: true,
// And restrict the webview to only loading content from our extension's `media` directory. // And restrict the webview to only loading content from our extension's `media` directory.
localResourceRoots: [ localResourceRoots: [

View File

@ -1,241 +0,0 @@
import { readFile } from 'fs';
import * as vscode from 'vscode';
import { getNonce } from './getNonce';
import { fileFolderHelperExe } from './constants';
import { ExecException, exec } from 'child_process';
import { ReceivedMessage } from './ReceivedMessage';
async function postRelativePath(extensionUri: vscode.Uri, webviewPanel: vscode.WebviewPanel, receivedMessage: ReceivedMessage) {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage('Open workspace first!');
}
else {
const workspaceFoldersZero = vscode.workspace.workspaceFolders[0].uri;
const inputUri: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, '.vscode', 'input.json');
readFile(inputUri.fsPath, (err, data) =>
inputUriRead(extensionUri, webviewPanel, receivedMessage, workspaceFoldersZero, inputUri, err, data.toString('utf8')));
}
}
function inputUriRead(extensionUri: vscode.Uri, webviewPanel: vscode.WebviewPanel, receivedMessage: ReceivedMessage, workspaceFoldersZero: vscode.Uri, inputUri: vscode.Uri, err: NodeJS.ErrnoException | null, data: string) {
if (err) {
vscode.window.showInformationMessage(`<${inputUri.fsPath}> doesn't exist! ${err.message}`);
}
else {
const jsonObject: any = JSON.parse(data);
if (!jsonObject.BaseAddresses || !jsonObject.Page || jsonObject.BaseAddresses.length === 0) {
vscode.window.showInformationMessage(`<${inputUri.fsPath}> doesn't have valid json! ${data}`);
}
else {
const relativePathUri: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, '.vscode', 'RelativePath.json');
const fileFolderHelper: vscode.Uri = vscode.Uri.joinPath(extensionUri, 'net8.0', 'win-x64', 'publish', fileFolderHelperExe);
const command: string = `${fileFolderHelper.fsPath} s X "${workspaceFoldersZero.fsPath}" Day-Helper-2025-05-19 "${inputUri.fsPath}"`;
exec(command, (error, stdout, stderr) =>
execCallback(webviewPanel, receivedMessage, jsonObject, relativePathUri, error, stdout, stderr));
}
}
}
function execCallback(webviewPanel: vscode.WebviewPanel, receivedMessage: ReceivedMessage, jsonObject: any, relativePathUri: 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}`);
readFile(relativePathUri.fsPath, (err, data) =>
relativePathUriRead(webviewPanel, receivedMessage, jsonObject, relativePathUri, err, data.toString('utf8')));
};
function relativePathUriRead(webviewPanel: vscode.WebviewPanel, receivedMessage: ReceivedMessage, jsonObject: any, relativePathUri: vscode.Uri, err: NodeJS.ErrnoException | null, data: string) {
if (err) {
vscode.window.showInformationMessage(`<${relativePathUri.fsPath}> doesn't exist! ${err.message}`);
}
else {
// const jsonObject: any = JSON.parse(data);
// const receivedMessage: ReceivedMessage = { command: 'File-Folder-Helper', subcommand: 'post', value: jsonObject, collection: [] };
// receivedMessage.command = 'done';
// webviewPanel.webview.postMessage(receivedMessage);
const message = { command: receivedMessage.subcommand, from: receivedMessage.command + '-' + receivedMessage.subcommand, input: jsonObject, relativePath: data };
webviewPanel.webview.postMessage(message);
}
}
export class WebviewPanelFileSync {
public static _title: string;
public static readonly viewType = 'web-view-panel';
public static currentPanel: WebviewPanelFileSync | undefined;
private _disposables: vscode.Disposable[] = [];
public static createOrShow(extensionContext: vscode.ExtensionContext, title: string) {
this._title = title;
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;
if (WebviewPanelFileSync.currentPanel) {
WebviewPanelFileSync.currentPanel._panel.reveal(column);
WebviewPanelFileSync.currentPanel._update(title);
return;
}
const panel = vscode.window.createWebviewPanel(
WebviewPanelFileSync.viewType,
title,
column || vscode.ViewColumn.One,
{
enableScripts: true,
enableFindWidget: true,
localResourceRoots: [
vscode.Uri.joinPath(extensionContext.extensionUri, 'dist'),
vscode.Uri.joinPath(extensionContext.extensionUri, 'media'),
],
}
);
WebviewPanelFileSync.currentPanel = new WebviewPanelFileSync(extensionContext, panel, title);
}
public static kill() {
WebviewPanelFileSync.currentPanel?.dispose();
WebviewPanelFileSync.currentPanel = undefined;
}
public static revive(panel: vscode.WebviewPanel, extensionContext: vscode.ExtensionContext) {
WebviewPanelFileSync.currentPanel = new WebviewPanelFileSync(extensionContext, panel, this._title);
}
public dispose() {
WebviewPanelFileSync.currentPanel = undefined;
this._panel.dispose();
while (this._disposables.length) {
const x = this._disposables.pop();
if (x) {
x.dispose();
}
}
}
private constructor(private readonly _extensionContext: vscode.ExtensionContext, private readonly _panel: vscode.WebviewPanel, title: string) {
this._update(title);
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
}
private async _update(title: string) {
const webview = this._panel.webview;
this._panel.webview.html = this._getHtmlForWebview(title, webview);
webview.onDidReceiveMessage(
(receivedMessage: ReceivedMessage) => {
WebviewPanelFileSync.onDidReceiveMessage(
this._extensionContext.extensionUri,
this._panel,
receivedMessage
);
},
null,
this._disposables
);
}
private static onDidReceiveMessage(extensionUri: vscode.Uri, webviewPanel: vscode.WebviewPanel, receivedMessage: ReceivedMessage) {
switch (receivedMessage.command) {
case 'alert':
vscode.window.showErrorMessage(receivedMessage.value);
return;
case fileFolderHelperExe:
if (receivedMessage.subcommand === 'post') {
postRelativePath(extensionUri, webviewPanel, receivedMessage);
}
return;
default:
vscode.window.showErrorMessage(receivedMessage.value);
break;
}
}
private _getHtmlForWebview(title: string, webview: vscode.Webview) {
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
if (title === 'HTML') {
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infineon - ${title}</title>
</head>
<body>
${title}
</body>
</html>`;
}
else {
const styleCostOfDelayUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "cod.css"));
const scriptEmbedRollup = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionContext.extensionUri, "dist", "embed-rollup.js"));
const scriptJQueryUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "jquery-1.6.4.min.js"));
const styleBootstrapUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "bootstrap.min.css"));
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infineon - ${title}</title>
<link href="${styleBootstrapUri}" rel="stylesheet" />
<link href="${styleCostOfDelayUri}" rel="stylesheet" />
<script nonce="${nonce}" src="${scriptJQueryUri}" type="text/javascript"></script>
<script nonce="${nonce}" type="text/javascript">
const acquiredVsCodeApi = acquireVsCodeApi();
const _webviewUsername = '${process.env.USERNAME}';
const _webviewMachineId = '${vscode.env.machineId}';
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand">
<span id="siteHeader">&nbsp;</span> -
<span id="th-span">&nbsp;</span>
<button id="toggle" onclick="getRelativePathAndPost()">Toggle</button>
</div>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</ul>
<p class="navbar-text navbar-right">
&nbsp;
</p>
</div>
</div>
</div>
<div class="container-fluid body-content" style="margin-top: 40px; margin-left: 15px;">
<script nonce="${nonce}" src="${scriptEmbedRollup}" type="text/javascript"></script>
<div id="HeaderGridDiv">
<table id="HeaderGrid" border="1"></table>
</div>
<br />&nbsp;
<textarea id="AllTextarea" rows="20" cols="147"></textarea>
</div>
</body>
</html>`;
}
}
}

View File

@ -1,3 +1,2 @@
export const key: string = 'type-script-helper'; export const apiBaseUrl: string = "http://localhost:3002";
export const apiBaseUrl: string = 'http://localhost:3002'; export const key: string = "type-script-helper";
export const fileFolderHelperExe: string = 'File-Folder-Helper.exe'

View File

@ -10,16 +10,20 @@ import * as promiseLinesHelper from './promiseLinesHelper';
import * as replaceLinesHelper from './replaceLinesHelper'; import * as replaceLinesHelper from './replaceLinesHelper';
import * as readOnlyLinesHelper from './readOnlyLinesHelper'; import * as readOnlyLinesHelper from './readOnlyLinesHelper';
import * as WebviewPanelExample from './WebviewPanelExample'; import * as WebviewPanelExample from './WebviewPanelExample';
import * as WebviewPanelFileSync from './WebviewPanelFileSync';
import * as WebviewPanelCostOfDelay from './WebviewPanelCostOfDelay'; import * as WebviewPanelCostOfDelay from './WebviewPanelCostOfDelay';
import { ViewCommandPalletteWebviewViewProvider } from "./ViewCommandPalletteWebviewViewProvider"; import * as ColumnsToCardsWebviewViewProvider from './ColumnsToCardsWebviewViewProvider';
// This method is called when your extension is activated // This method is called when your extension is activated
// Your extension is activated the very first time the command is executed // Your extension is activated the very first time the command is executed
export async function activate(extensionContext: vscode.ExtensionContext) { export async function activate(extensionContext: vscode.ExtensionContext) {
const viewCommandPalletteWebviewViewProvider = new ViewCommandPalletteWebviewViewProvider(extensionContext); const columnsToCardsWebviewViewProvider = new ColumnsToCardsWebviewViewProvider.ColumnsToCardsWebviewViewProvider(extensionContext);
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("view-command-Pallette-webview-view-provider", viewCommandPalletteWebviewViewProvider));
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));
const config = vscode.workspace.getConfiguration('calc'); const config = vscode.workspace.getConfiguration('calc');
const outputChannel = vscode.window.createOutputChannel('calc'); const outputChannel = vscode.window.createOutputChannel('calc');
@ -45,30 +49,6 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
}), }),
); );
function getWebviewView(title: string) {
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;
// Otherwise, create a new panel.
const webviewView = vscode.window.createWebviewPanel(
"web-view-panel",
title,
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"),
],
}
);
return webviewView;
}
async function replaceResultsWithPositions( async function replaceResultsWithPositions(
editor: vscode.TextEditor, editor: vscode.TextEditor,
positionsAndExpressions: [vscode.Position, string][], positionsAndExpressions: [vscode.Position, string][],
@ -150,13 +130,16 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
const commands = [ const commands = [
vscode.commands.registerCommand("copyHelper.copySyntaxInLight", copyHelper.copySyntaxInLight), vscode.commands.registerCommand("copyHelper.copySyntaxInLight", copyHelper.copySyntaxInLight),
vscode.commands.registerCommand("extension.rotateExplorerSortOrder", settingsHelper.rotateExplorerSortOrder), vscode.commands.registerCommand("extension.rotateExplorerSortOrder", settingsHelper.rotateExplorerSortOrder),
vscode.commands.registerCommand("kanban.refreshBoth", () => { kanbanHelper.refreshBoth(extensionContext); }),
vscode.commands.registerCommand("kanban.refreshSidebar", ColumnsToCardsWebviewViewProvider.refreshSidebar),
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor), vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow), vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow),
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile), vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick), vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
vscode.commands.registerCommand('promiseLinesHelper.genericFileFolderHelper', promiseLinesHelper.genericFileFolderHelper),
vscode.commands.registerCommand('promiseLinesHelper.insertDateTime', promiseLinesHelper.insertDateTime), vscode.commands.registerCommand('promiseLinesHelper.insertDateTime', promiseLinesHelper.insertDateTime),
vscode.commands.registerCommand("promiseLinesHelper.insertAllExtensions", promiseLinesHelper.insertAllExtensions), vscode.commands.registerCommand("promiseLinesHelper.insertAllExtensions", promiseLinesHelper.insertAllExtensions),
vscode.commands.registerCommand('promiseLinesHelper.transformToProperCase', promiseLinesHelper.transformToProperCase), vscode.commands.registerCommand('promiseLinesHelper.transformToPopperCase', promiseLinesHelper.transformToPopperCase),
vscode.commands.registerCommand('promiseLinesHelper.transformToParamCase', promiseLinesHelper.transformToParamCase), vscode.commands.registerCommand('promiseLinesHelper.transformToParamCase', promiseLinesHelper.transformToParamCase),
vscode.commands.registerCommand('readOnlyLinesHelper.searchGoogle', readOnlyLinesHelper.searchGoogle), vscode.commands.registerCommand('readOnlyLinesHelper.searchGoogle', readOnlyLinesHelper.searchGoogle),
vscode.commands.registerCommand('replaceLinesHelper.addCSharpComment', replaceLinesHelper.addCSharpComment), vscode.commands.registerCommand('replaceLinesHelper.addCSharpComment', replaceLinesHelper.addCSharpComment),
@ -174,15 +157,12 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
vscode.commands.registerCommand('replaceLinesHelper.quickFixProperCaseProperties', replaceLinesHelper.quickFixProperCaseProperties), vscode.commands.registerCommand('replaceLinesHelper.quickFixProperCaseProperties', replaceLinesHelper.quickFixProperCaseProperties),
vscode.commands.registerCommand('replaceLinesHelper.quickFixPublic', replaceLinesHelper.quickFixPublic), vscode.commands.registerCommand('replaceLinesHelper.quickFixPublic', replaceLinesHelper.quickFixPublic),
vscode.commands.registerCommand('replaceLinesHelper.removeComment', replaceLinesHelper.removeComment), vscode.commands.registerCommand('replaceLinesHelper.removeComment', replaceLinesHelper.removeComment),
vscode.commands.registerCommand('replaceLinesHelper.removeJsonNullValues', replaceLinesHelper.removeJsonNullValues),
vscode.commands.registerCommand('replaceLinesHelper.removeLinesContainingHighlighted', replaceLinesHelper.removeLinesContainingHighlighted),
vscode.commands.registerCommand('replaceLinesHelper.sortLength', replaceLinesHelper.sortLength), vscode.commands.registerCommand('replaceLinesHelper.sortLength', replaceLinesHelper.sortLength),
vscode.commands.registerCommand('replaceLinesHelper.sortNormal', replaceLinesHelper.sortNormal), vscode.commands.registerCommand('replaceLinesHelper.sortNormal', replaceLinesHelper.sortNormal),
vscode.commands.registerCommand('replaceLinesHelper.splitBySpaceReverseJoinSort', replaceLinesHelper.splitBySpaceReverseJoinSort), vscode.commands.registerCommand('replaceLinesHelper.splitBySpaceReverseJoinSort', replaceLinesHelper.splitBySpaceReverseJoinSort),
vscode.commands.registerCommand('replaceLinesHelper.unwrapSql', replaceLinesHelper.unwrapSql), vscode.commands.registerCommand('replaceLinesHelper.unwrapSql', replaceLinesHelper.unwrapSql),
vscode.commands.registerCommand('replaceLinesHelper.wrapSqlCSharp', replaceLinesHelper.wrapSqlCSharp), 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.fileSync", () => { WebviewPanelFileSync.WebviewPanelFileSync.createOrShow(extensionContext, 'File-Sync'); }),
vscode.commands.registerCommand("webview.backlogMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'HTML'); }), vscode.commands.registerCommand("webview.backlogMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'HTML'); }),
vscode.commands.registerCommand("webview.costOfDelayMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', ''); }), vscode.commands.registerCommand("webview.costOfDelayMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', ''); }),
vscode.commands.registerCommand("webview.costOfDelayEffortMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'EFFORT'); }), vscode.commands.registerCommand("webview.costOfDelayEffortMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'EFFORT'); }),

View File

@ -1,5 +1,11 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { paramCase } from './promiseLinesHelper'; import { paramCase } from './promiseLinesHelper';
import { refreshSidebar } from './ColumnsToCardsWebviewViewProvider';
export function refreshBoth(extensionContext: vscode.ExtensionContext): any {
refreshSidebar();
setTimeout(() => { vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools"); }, 500);
}
async function updateWithLogic(textDocument: vscode.TextDocument) { async function updateWithLogic(textDocument: vscode.TextDocument) {
await vscode.window.showTextDocument(textDocument); await vscode.window.showTextDocument(textDocument);

View File

@ -198,6 +198,42 @@ function insertAllExtensionsLogic(): undefined {
return undefined; return undefined;
} }
function genericFileFolderHelperLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
vscode.window.showInformationMessage("Open a text editor first!");
return undefined;
}
else {
const selection = textEditor.selection;
if (selection.isEmpty) {
vscode.window.showInformationMessage("Highlight text to pass first!");
return undefined;
}
let range = new vscode.Range(selection.start, selection.end)
let text = textEditor.document.getText(range);
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
return undefined;
}
const workspaceFoldersZero = vscode.workspace.workspaceFolders[0].uri;
const jsonFile: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, ".vscode", "helper", ".json");
let data = {
workspaceFoldersZero: workspaceFoldersZero.path,
text: text,
};
let json = JSON.stringify(data);
const buffer: Buffer = Buffer.from(json, 'utf8');
vscode.workspace.fs.writeFile(jsonFile, buffer);
textEditor.edit(editBuilder => {
let range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
editBuilder.replace(range, "");
});
textEditor.document.save();
}
return undefined;
}
function camelCase(str: string) { 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 ""; if (+match === 0) return "";
@ -205,7 +241,7 @@ function camelCase(str: string) {
}); });
} }
function transformToProperCaseLogic(): undefined { function transformToPopperCaseLogic(): undefined {
const textEditor = vscode.window.activeTextEditor; const textEditor = vscode.window.activeTextEditor;
if (!textEditor) { if (!textEditor) {
return undefined; return undefined;
@ -260,7 +296,8 @@ function transformToParamCaseLogic(): undefined {
} }
export const codeGeneratorQuickPick = () => codeGeneratorQuickPickLogic(); export const codeGeneratorQuickPick = () => codeGeneratorQuickPickLogic();
export const genericFileFolderHelper = () => genericFileFolderHelperLogic();
export const insertDateTime = () => insertDateTimeLogic(); export const insertDateTime = () => insertDateTimeLogic();
export const insertAllExtensions = () => insertAllExtensionsLogic(); export const insertAllExtensions = () => insertAllExtensionsLogic();
export const transformToProperCase = () => transformToProperCaseLogic(); export const transformToPopperCase = () => transformToPopperCaseLogic();
export const transformToParamCase = () => transformToParamCaseLogic(); export const transformToParamCase = () => transformToParamCaseLogic();

View File

@ -5,16 +5,12 @@ enum LinesAction {
} }
function searchGoogleLogic(text: string, lines: string[]): void { function searchGoogleLogic(text: string, lines: string[]): void {
let searchText: string = '';
if (text.length > 0) { if (text.length > 0) {
searchText = text.trim(); vscode.env.openExternal(
vscode.Uri.parse(`https://www.google.com/search?q=${text.trim()}`)
)
} }
else if (lines.length > 0) { else if (lines.length > 0) {
searchText = lines[0].trim();
}
else
return undefined;
if (searchText != '') {
vscode.env.openExternal( vscode.env.openExternal(
vscode.Uri.parse(`https://www.google.com/search?q=${lines[0].trim()}`) vscode.Uri.parse(`https://www.google.com/search?q=${lines[0].trim()}`)
) )

View File

@ -20,8 +20,6 @@ enum LinesAction {
quickFixPublic, quickFixPublic,
pdsfToFixedWidth, pdsfToFixedWidth,
removeComment, removeComment,
removeJsonNullValues,
removeLinesContainingHighlighted,
sortLength, sortLength,
sortNormal, sortNormal,
splitBySpaceReverseJoinSort, splitBySpaceReverseJoinSort,
@ -271,25 +269,6 @@ function removeCommentLogic(lines: string[]): void {
} }
} }
function removeJsonNullValuesLogic(lines: string[]): void {
let text = ': null,';
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].trim();
if (text.length > 1 && lines[i].length > 1 && lines[i].includes(text)) {
lines[i] = '';
}
}
}
function removeLinesContainingHighlightedLogic(lines: string[], text: string): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].trim();
if (text.length > 1 && lines[i].length > 1 && lines[i].includes(text)) {
lines[i] = '';
}
}
}
function makeSorter(algorithm?: SortingAlgorithm): ArrayTransformer { function makeSorter(algorithm?: SortingAlgorithm): ArrayTransformer {
return function (lines: string[]): string[] { return function (lines: string[]): string[] {
return lines.sort(algorithm); return lines.sort(algorithm);
@ -408,25 +387,12 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
if (!textEditor) { if (!textEditor) {
return undefined; return undefined;
} }
let text; var startLine = 0;
var endLine; var endLine = textEditor.document.lineCount - 1;
var startLine;
const selection = textEditor.selection; const selection = textEditor.selection;
if (selection.isEmpty) { if (!selection.isEmpty) {
text = ''; startLine = selection.start.line;
startLine = 0; endLine = selection.end.line;
endLine = textEditor.document.lineCount - 1;
} else {
if (linesAction !== LinesAction.removeLinesContainingHighlighted) {
text = '';
endLine = selection.end.line;
startLine = selection.start.line;
} else {
startLine = 0;
endLine = textEditor.document.lineCount - 1;
let range = new vscode.Range(selection.start, selection.end)
text = textEditor.document.getText(range);
}
} }
let lines: string[] = getLines(textEditor, startLine, endLine); let lines: string[] = getLines(textEditor, startLine, endLine);
switch (linesAction) { switch (linesAction) {
@ -445,8 +411,6 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
case LinesAction.quickFixProperCaseProperties: { quickFixProperCasePropertiesLogic(lines); break; } case LinesAction.quickFixProperCaseProperties: { quickFixProperCasePropertiesLogic(lines); break; }
case LinesAction.quickFixPublic: { quickFixPublicLogic(lines); break; } case LinesAction.quickFixPublic: { quickFixPublicLogic(lines); break; }
case LinesAction.removeComment: { removeCommentLogic(lines); break; } case LinesAction.removeComment: { removeCommentLogic(lines); break; }
case LinesAction.removeJsonNullValues: { removeJsonNullValuesLogic(lines); break; }
case LinesAction.removeLinesContainingHighlighted: { removeLinesContainingHighlightedLogic(lines, text); break; }
case LinesAction.sortLength: { sortLengthLogic(lines); break; } case LinesAction.sortLength: { sortLengthLogic(lines); break; }
case LinesAction.sortNormal: { sortNormalLogic(lines); break; } case LinesAction.sortNormal: { sortNormalLogic(lines); break; }
case LinesAction.splitBySpaceReverseJoinSort: { splitBySpaceReverseJoinSortLogic(lines); break; } case LinesAction.splitBySpaceReverseJoinSort: { splitBySpaceReverseJoinSortLogic(lines); break; }
@ -474,8 +438,6 @@ export const quickFixProperCaseProperties = () => linesFunction(LinesAction.quic
export const quickFixPublic = () => linesFunction(LinesAction.quickFixPublic); export const quickFixPublic = () => linesFunction(LinesAction.quickFixPublic);
export const pdsfToFixedWidth = () => linesFunction(LinesAction.pdsfToFixedWidth); export const pdsfToFixedWidth = () => linesFunction(LinesAction.pdsfToFixedWidth);
export const removeComment = () => linesFunction(LinesAction.removeComment); export const removeComment = () => linesFunction(LinesAction.removeComment);
export const removeJsonNullValues = () => linesFunction(LinesAction.removeJsonNullValues);
export const removeLinesContainingHighlighted = () => linesFunction(LinesAction.removeLinesContainingHighlighted);
export const sortLength = () => linesFunction(LinesAction.sortLength); export const sortLength = () => linesFunction(LinesAction.sortLength);
export const sortNormal = () => linesFunction(LinesAction.sortNormal); export const sortNormal = () => linesFunction(LinesAction.sortNormal);
export const splitBySpaceReverseJoinSort = () => linesFunction(LinesAction.splitBySpaceReverseJoinSort); export const splitBySpaceReverseJoinSort = () => linesFunction(LinesAction.splitBySpaceReverseJoinSort);

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": [
"./**/*"
]
}