## 1.124.0

This commit is contained in:
Mike Phares 2025-06-06 14:37:45 -07:00
parent d87502a95e
commit 2147da203a
26 changed files with 1870 additions and 9301 deletions

2
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

@ -234,7 +234,7 @@ None
## 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 pallete images
- 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)
-----------------------------------------------------------------------------------------------------------
@ -256,3 +256,13 @@ None
-----------------------------------------------------------------------------------------------------------
- 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

1444
type-script-helper/bun.lock Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,11 @@
"command": "extension.rotateExplorerSortOrder",
"title": "Rotate Explorer Sort Order"
},
{
"category": "FileSync",
"command": "webview.fileSync",
"title": "FileSync"
},
{
"category": "Calculate",
"command": "extension.calcReplace",
@ -217,6 +222,16 @@
"command": "replaceLinesHelper.removeComment",
"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",
"command": "replaceLinesHelper.sortLength",
@ -354,5 +369,5 @@
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\"",
"webpack": "webpack --config ./build/node-extension.webpack.config.js"
},
"version": "1.123.1"
"version": "1.124.0"
}

View File

@ -1,68 +0,0 @@
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

@ -1,188 +0,0 @@
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

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

View File

@ -1,7 +1,7 @@
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
export class ViewCommandPalleteWebviewViewProvider implements vscode.WebviewViewProvider {
export class ViewCommandPalletteWebviewViewProvider implements vscode.WebviewViewProvider {
_webviewView?: vscode.WebviewView;
constructor(private readonly _extensionContext: vscode.ExtensionContext) {
@ -53,7 +53,7 @@ export class ViewCommandPalleteWebviewViewProvider implements vscode.WebviewView
<h1>Infineon Technologies Americas Corp.</h1>
<ul>
<li>View</li>
<li>Command Pallete... Ctrl+Shift+P</li>
<li>Command Pallette... Ctrl+Shift+P</li>
<li>Type Mesa or Leominster</li>
<li>Select item</li>
</ul>

View File

@ -0,0 +1,241 @@
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,2 +1,3 @@
export const apiBaseUrl: string = "http://localhost:3002";
export const key: string = "type-script-helper";
export const key: string = 'type-script-helper';
export const apiBaseUrl: string = 'http://localhost:3002';
export const fileFolderHelperExe: string = 'File-Folder-Helper.exe'

View File

@ -10,15 +10,16 @@ import * as promiseLinesHelper from './promiseLinesHelper';
import * as replaceLinesHelper from './replaceLinesHelper';
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
import * as WebviewPanelExample from './WebviewPanelExample';
import * as WebviewPanelFileSync from './WebviewPanelFileSync';
import * as WebviewPanelCostOfDelay from './WebviewPanelCostOfDelay';
import { ViewCommandPalleteWebviewViewProvider } from "./ViewCommandPalleteWebviewViewProvider";
import { ViewCommandPalletteWebviewViewProvider } from "./ViewCommandPalletteWebviewViewProvider";
// 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 viewCommandPalleteWebviewViewProvider = new ViewCommandPalleteWebviewViewProvider(extensionContext);
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("view-command-pallete-webview-view-provider", viewCommandPalleteWebviewViewProvider));
const viewCommandPalletteWebviewViewProvider = new ViewCommandPalletteWebviewViewProvider(extensionContext);
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("view-command-Pallette-webview-view-provider", viewCommandPalletteWebviewViewProvider));
const config = vscode.workspace.getConfiguration('calc');
const outputChannel = vscode.window.createOutputChannel('calc');
@ -173,12 +174,15 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
vscode.commands.registerCommand('replaceLinesHelper.quickFixProperCaseProperties', replaceLinesHelper.quickFixProperCaseProperties),
vscode.commands.registerCommand('replaceLinesHelper.quickFixPublic', replaceLinesHelper.quickFixPublic),
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.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("webview.fileSync", () => { WebviewPanelFileSync.WebviewPanelFileSync.createOrShow(extensionContext, 'File-Sync'); }),
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.costOfDelayEffortMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'EFFORT'); }),

View File

@ -1,11 +1,5 @@
import * as vscode from 'vscode';
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) {
await vscode.window.showTextDocument(textDocument);

View File

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

View File

@ -20,6 +20,8 @@ enum LinesAction {
quickFixPublic,
pdsfToFixedWidth,
removeComment,
removeJsonNullValues,
removeLinesContainingHighlighted,
sortLength,
sortNormal,
splitBySpaceReverseJoinSort,
@ -269,6 +271,25 @@ 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 {
return function (lines: string[]): string[] {
return lines.sort(algorithm);
@ -387,12 +408,25 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
if (!textEditor) {
return undefined;
}
var startLine = 0;
var endLine = textEditor.document.lineCount - 1;
let text;
var endLine;
var startLine;
const selection = textEditor.selection;
if (!selection.isEmpty) {
startLine = selection.start.line;
endLine = selection.end.line;
if (selection.isEmpty) {
text = '';
startLine = 0;
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);
switch (linesAction) {
@ -411,6 +445,8 @@ function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined
case LinesAction.quickFixProperCaseProperties: { quickFixProperCasePropertiesLogic(lines); break; }
case LinesAction.quickFixPublic: { quickFixPublicLogic(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.sortNormal: { sortNormalLogic(lines); break; }
case LinesAction.splitBySpaceReverseJoinSort: { splitBySpaceReverseJoinSortLogic(lines); break; }
@ -438,6 +474,8 @@ export const quickFixProperCaseProperties = () => linesFunction(LinesAction.quic
export const quickFixPublic = () => linesFunction(LinesAction.quickFixPublic);
export const pdsfToFixedWidth = () => linesFunction(LinesAction.pdsfToFixedWidth);
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 sortNormal = () => linesFunction(LinesAction.sortNormal);
export const splitBySpaceReverseJoinSort = () => linesFunction(LinesAction.splitBySpaceReverseJoinSort);

View File

@ -1,25 +0,0 @@
<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

@ -1,19 +0,0 @@
<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

@ -1,33 +0,0 @@
<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

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

View File

@ -1,10 +0,0 @@
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

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

View File

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

View File

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