## 1.124.0

This commit is contained in:
Mike Phares 2025-06-06 15:00:55 -07:00
commit 20a7c2ee08
53 changed files with 5191 additions and 0 deletions

308
.gitignore vendored Normal file
View File

@ -0,0 +1,308 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Mike Phares
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/**
type-script-helper/src/Card.js
type-script-helper/src/Card.js.map
type-script-helper/src/ColumnsToCardsWebviewViewProvider.js
type-script-helper/src/ColumnsToCardsWebviewViewProvider.js.map
type-script-helper/src/constants.js
type-script-helper/src/constants.js.map
type-script-helper/src/extension.js
type-script-helper/src/extension.js.map
type-script-helper/src/getNonce.js
type-script-helper/src/getNonce.js.map
type-script-helper/src/H2HexColor.js
type-script-helper/src/H2HexColor.js.map
type-script-helper/src/H2NoCheckboxes.js
type-script-helper/src/H2NoCheckboxes.js.map
type-script-helper/src/H2WithCheckboxes.js
type-script-helper/src/H2WithCheckboxes.js.map
type-script-helper/src/kanbanHelper.js
type-script-helper/src/kanbanHelper.js.map
type-script-helper/src/LineNumber.js
type-script-helper/src/LineNumber.js.map
type-script-helper/src/markdownHelper.js
type-script-helper/src/markdownHelper.js.map
type-script-helper/src/PostMessage.js
type-script-helper/src/PostMessage.js.map
type-script-helper/src/promiseLinesHelper.js
type-script-helper/src/promiseLinesHelper.js.map
type-script-helper/src/readOnlyLinesHelper.js
type-script-helper/src/readOnlyLinesHelper.js.map
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/*
Application.evtx

27
.vscode/settings.json vendored Normal file
View File

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

13
YO-VSCode.sln Normal file
View File

@ -0,0 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1169
MinimumVisualStudioVersion = 10.0.40219.1
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A47C35E0-F330-48D2-9FEE-B0B5C8396802}
EndGlobalSection
EndGlobal

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"
]
}

8
type-script-helper/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
.vscode-test/
.vscode/helper/**
*.vsix
dist
node_modules
out
src/*.js*
!src/embed.js

View File

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

30
type-script-helper/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,30 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// 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",
"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"
]
}
]
}

11
type-script-helper/.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,11 @@
---
type: "note"
created: "2023-10-20T03:53:13.742Z"
updated: "2023-10-20T04:00:37.259Z"
---
# mklink
```bash
mklink /J "L:\Git\YO-VSCode\type-script-helper\net8.0\win-x64\publish" "L:\DevOps\Mesa_FI\File-Folder-Helper\bin\Release\net8.0\win-x64\publish"
```

View File

@ -0,0 +1,29 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [
"Infineon",
"initialise",
"Kanban",
"Phares",
"signalr",
"VSIX",
"Weightest",
"WSJF"
],
"files.eol": "\n",
"files.exclude": {
"**/dist": false,
"**/node_modules": true,
"**/out": false
},
"files.watcherExclude": {
"**/node_modules": true
},
"explorer.sortOrder": "default",
"search.exclude": {
"**/dist": true,
"**/out": true
}
}

63
type-script-helper/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +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"
}

View File

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

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

@ -0,0 +1,268 @@
---
type: "read-me"
created: "2023-09-30T01:47:18.241Z"
updated: "2023-09-30T01:47:18.242Z"
---
# type-script-helper README
## Features
See Contributions tab
## Requirements
```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
None
## Known Issues
None
## Release Notes
## 1.2.4
-----------------------------------------------------------------------------------------------------------
- Search Google
## 1.2.8
-----------------------------------------------------------------------------------------------------------
- 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)
## 1.3.3, 1.3.4
-----------------------------------------------------------------------------------------------------------
- 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
- 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
## 1.5.2
-----------------------------------------------------------------------------------------------------------
- file-folder-helper-exe net8.0
## 1.5.3
-----------------------------------------------------------------------------------------------------------
- Updated File-Folder-Helper ccea8de8cf49343dd4190a77ac755d233bb4e528
## 1.6.0
-----------------------------------------------------------------------------------------------------------
- Updated File-Folder-Helper 4e3f06bb44b7e85ba40a5e589e6ca871cbdbfb3e
## 1.6.1
-----------------------------------------------------------------------------------------------------------
- Updated File-Folder-Helper 299aa19d538bcfd5e06e4743a5a05f6d62960a80
- code --install-extension D:\Tmp\phares\type-script-helper-1.6.1.vsix
- code-insiders --install-extension D:\Tmp\phares\type-script-helper-1.6.1.vsix
## 1.6.2
-----------------------------------------------------------------------------------------------------------
- Updated File-Folder-Helper 47e6b85c218f994216fb35d44906850a790c36d0
- Open with Text Editor Kanban
## 1.6.4 Fri Aug 02 2024 13:07:24 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Wrap directory in quotes
## 1.7.0 Fri Aug 30 2024 11:13:09 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Copy Syntax In Light Theme
- [Copy-Syntax-in-Light](https://github.com/Ahmed-Adel-Morsi/Copy-Syntax-in-Light)
## 1.8.0 Wed Nov 06 2024 06:03:59 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Change insert date to include epoch seconds and ticks *
## 1.9.0 1735586943373 = 638711837433730000 = Mon Dec 30 2024 12:29:02 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Insert All Extensions (Not Disabled)
## 1.110.0 1735689397890 = 638712861978900000 = Tue Dec 31 2024 16:56:37 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Open Sub-Kanban in New Window
## 1.111.0 1736196204601 = 638717930046010000 = 2025-0.Winter = Mon Jan 06 2025 13:43:24 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Added season to insert date
- Removed
- kanban.refreshBoth
- kanban.refreshSidebar
- kanban.refreshWebview
- kanban.debugReload
- columns-to-cards-webview-view-provider-view
- Open Sub-Kanban in New Window
## 1.111.1 1738206291411 = 638738030914110000 = 2025-0.Winter = Wed Jan 29 2025 20:04:50 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Changed trigger for code-insiders
## 1.112.0 1738349146299 = 638739459462990000 = 2025-0.Winter = Fri Jan 31 2025 11:45:45 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Added Cost of Delay (CoD)
## 1.113.0 1739287994496 = 638748847944960000 = 2025-0.Winter = Tue Feb 11 2025 08:33:14 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Add Code Insiders lines when not present
## 1.114.0 1739295723637 = 638748925236370000 = 2025-0.Winter = Tue Feb 11 2025 10:42:03 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- infineon-mes-mike-phares
## 1.115.0 1739295727065 = 638748925270650000 = 2025-0.Winter = Tue Feb 11 2025 10:42:06 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Infineon-Technologies-AG-Mesa-FI
## 1.116.0 1740441381597 = 638760381815970000 = 2025-0.Winter = Mon Feb 24 2025 16:56:21 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Calculator
- Explorer Sort Order
## 1.117.0 1740671831803 = 638762686318030000 = 2025-0.Winter = Thu Feb 27 2025 08:57:11 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- Close active after opening Sub-Kanban when directory found
## 1.118.0 1741303103654 = 638768999036540000 = 2025-0.Winter = Thu Mar 06 2025 16:18:23 GMT-0700 (Mountain Standard Time)
-----------------------------------------------------------------------------------------------------------
- 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)
-----------------------------------------------------------------------------------------------------------
- Changed ADO Priority servers
## 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

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;

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

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because one or more lines are too long

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,37 @@
#HeaderGridDiv,
#DetailsGridDiv {
font-size: 12px;
min-width: 1200px;
max-width: 1200px;
}
#HeaderGrid {
font-family: monospace;
margin-top: 60px;
}
#HeaderGrid tr td {
max-width: 200px;
padding: 5px;
}
#AllGrid {
font-family: monospace;
}
.navbar-brand {
min-width: 1200px;
background-color: whitesmoke;
}
tr:nth-of-type(odd) {
background-color: #eee;
}
#AllTextarea {
font-family: monospace;
}
#th-span {
margin-right: 500px;
}

View File

@ -0,0 +1,51 @@
$(document).ready(function () {
const fromHtml = true;
const username = _webviewUsername;
const machineId = _webviewMachineId;
const baseUri = 'https://eaf-dev.mes.infineon.com';
const apiUrl = 'https://eaf-dev.mes.infineon.com/api/v1/ado/';
const windowLocationHRef = window.location.href + '?site=' + _webviewSite + 'view=' + _webviewView;
const signalRUrl = baseUri + '/signalr';
const workItems = {
a: baseUri + '/markdown/bugs-features-with-parents.json?v=2025-04-10-15-59',
b: baseUri + '/markdown/{[]}.json?v=2025-04-10-15-59',
timeout: 3000,
};
const b = {
page: 'business',
description: 'Value',
th: 'Business Value',
span: 'What is the relative value to the Customer or business?<br>• Do our users prefer this over that?<br>• What is the revenue impact on our business?<br>• Is there a potential penalty or other negative effects if we delay?'
};
const r = {
page: 'risk',
description: 'Risk',
th: 'Risk Reduction and/or Opportunity Enablement',
span: 'What else does this do for our business?<br>• Reduce the risk of this or future delivery?<br>• Is there value in the information we will receive?<br>• Enable new business opportunities?'
};
const t = {
page: 'time',
description: 'Critical',
th: 'Time Criticality',
span: 'How does user/business value decay over time?<br>• Is there a fixed deadline?<br>• Will they wait for us or move to another Solution?<br>• What is the current effect on Customer satisfaction?'
};
const c = {
page: 'cod',
description: 'CoD',
th: 'Cost of Delay (CoD)',
span: "Cost of Delay (CoD) is the money lost by delaying or not doing a job for a specific time. It's a measure of the economic value of a job over time."
};
const e = {
page: 'effort',
description: 'Effort',
th: 'Effort',
span: 'Effort'
};
const w = {
page: 'wsjf',
description: 'WSJF',
th: 'Weightest Shortest Job First calculation (WSJF)',
span: 'Weightest Shortest Job First calculation (see @SCALE formula)'
};
initIndex(fromHtml, username, machineId, windowLocationHRef, workItems, b, r, t, c, e, w, apiUrl, signalRUrl);
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

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);
}

View File

@ -0,0 +1,373 @@
{
"activationEvents": [
"onLanguage:csharp",
"onLanguage:markdown",
"onLanguage:javascript",
"onLanguage:json",
"onLanguage:typescript",
"onLanguage:yaml"
],
"categories": [
"Other"
],
"contributes": {
"commands": [
{
"category": "Calculate",
"command": "extension.calcAppendWithCursor",
"title": "Calculate and append in front of cursor"
},
{
"category": "Calculate",
"command": "extension.calcAppend",
"title": "Calculate and append"
},
{
"category": "Calculate",
"command": "extension.calcReplaceWithCursor",
"title": "Calculate and replace in front of cursor"
},
{
"category": "Explorer",
"command": "extension.rotateExplorerSortOrder",
"title": "Rotate Explorer Sort Order"
},
{
"category": "FileSync",
"command": "webview.fileSync",
"title": "FileSync"
},
{
"category": "Calculate",
"command": "extension.calcReplace",
"title": "Calculate and replace"
},
{
"category": "Helper",
"command": "copyHelper.copySyntaxInLight",
"title": "Copy Syntax In Light Theme"
},
{
"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.insertAllExtensions",
"title": "Insert All Extensions (Not Disabled)"
},
{
"category": "Helper",
"command": "promiseLinesHelper.transformToParamCase",
"title": "Transform to Param (Kebab) Case"
},
{
"category": "Helper",
"command": "promiseLinesHelper.transformToProperCase",
"title": "Transform to Proper (Pascal) Case"
},
{
"category": "Helper",
"command": "readOnlyLinesHelper.searchGoogle",
"title": "Search Google"
},
{
"category": "Kanban",
"command": "kanban.openInNewWindow",
"title": "Open Sub-Kanban in New Window"
},
{
"category": "Kanban",
"command": "kanban.openWithTextEditor",
"title": "Open with Text Editor Kanban"
},
{
"category": "Leominster",
"command": "webview.backlogLeominster",
"title": "Backlog (Bugs & Features with parents)"
},
{
"category": "Leominster",
"command": "webview.costOfDelayLeominster",
"title": "Cost of Delay (CoD)"
},
{
"category": "Leominster",
"command": "webview.costOfDelayLiveLeominster",
"title": "Cost of Delay (CoD) - Live Update"
},
{
"category": "Leominster",
"command": "webview.costOfDelayEffortLeominster",
"title": "Effort"
},
{
"category": "Leominster",
"command": "webview.costOfDelayWSJFLeominster",
"title": "Weightest Shortest Job First calculation (WSJF)"
},
{
"category": "Markdown",
"command": "markdown.newMarkdownFile",
"title": "New Markdown File"
},
{
"category": "Mesa",
"command": "webview.backlogMesa",
"title": "Backlog (Bugs & Features with parents)"
},
{
"category": "Mesa",
"command": "webview.costOfDelayMesa",
"title": "Cost of Delay (CoD)"
},
{
"category": "Mesa",
"command": "webview.costOfDelayLiveMesa",
"title": "Cost of Delay (CoD) - Live Update"
},
{
"category": "Mesa",
"command": "webview.costOfDelayEffortMesa",
"title": "Effort"
},
{
"category": "Mesa",
"command": "webview.costOfDelayWSJFMesa",
"title": "Weightest Shortest Job First calculation (WSJF)"
},
{
"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.removeJsonNullValues",
"title": "Remove json null values"
},
{
"category": "Replace",
"command": "replaceLinesHelper.removeLinesContainingHighlighted",
"title": "Remove lines containing highlighted"
},
{
"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.example",
"title": "Webview Example"
}
],
"configuration": {
"properties": {
"fileTemplates.author": {
"default": null,
"description": "Value to use to replace #{author} variable.",
"type": [
"string",
"Mike Phares"
]
},
"fileTemplates.company": {
"default": null,
"description": "Value to use to replace #{company} variable.",
"type": [
"string",
"Infineon Technologies Americas Corp."
]
}
},
"title": "Cost of Delay Helper Configuration",
"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": {
"@vscode/vsce": "^3.2.1",
"polka": "^0.5.2"
},
"description": "Cost of Delay Helper",
"devDependencies": {
"@nodelib/fs.stat": "^3.0.0",
"@types/mocha": "^10.0.6",
"@types/node": "^18.11.0",
"@types/vscode": "^1.63.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"@vscode/test-electron": "^2.4.0",
"@vscode/test-web": "*",
"concurrently": "^8.2.2",
"editor-calc": "^2.1.0",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"glob": "^10.4.1",
"mocha": "^10.4.0",
"prettier": "^2.7.1",
"ts-loader": "^9.4.1",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"displayName": "Cost of Delay Helper",
"engines": {
"vscode": "^1.79.0"
},
"icon": "media/LOGO_RGB.png",
"keywords": [
"Backlog",
"CoD",
"Cost of Delay (CoD)",
"FI",
"Infineon",
"Leominster",
"Mesa",
"Phares",
"Weightest Shortest Job First calculation (WSJF)",
"WSJF"
],
"main": "./dist/extension.js",
"name": "infineon-technologies-ag-mesa-fi-cost-of-delay-helper",
"publisher": "Infineon-Technologies-AG-Mesa-FI",
"repository": "https://gitea.phares.duckdns.org/phares3757/yo-vscode.git",
"scripts": {
"tsc-build": "tsc",
"tsc-clean": "tsc --build --clean",
"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:package": "node node_modules/@vscode/vsce/vsce package",
"vscode:publish": "node node_modules/@vscode/vsce/vsce publish",
"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.124.0"
}

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,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,7 @@
export type ReceivedMessage = {
command: string;
collection: Array<any>;
subcommand: string;
value: any;
};

View File

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

@ -0,0 +1,223 @@
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
import { apiBaseUrl } from "./constants";
export class WebviewPanelCostOfDelay {
/**
* Track the currently panel. Only allow a single panel to exist at a time.
*/
public static _site: string;
public static _view: string;
public static _title: string;
public static currentPanel: WebviewPanelCostOfDelay | undefined;
public static readonly viewType = "web-view-panel";
private _disposables: vscode.Disposable[] = [];
public static createOrShow(extensionContext: vscode.ExtensionContext, site: string, view: string) {
this._site = site;
this._view = view;
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;
const title = view === '' ? 'Cost of Delay (CoD)' :
view === 'EFFORT' ? 'Effort' :
view === 'LIVE' ? 'Cost of Delay (CoD) - Live Update' :
view === 'HTML' ? 'Backlog (Bugs & Features with parents)' :
view === 'WSJF' ? 'Weightest Shortest Job First calculation (WSJF)' :
'CoD';
this._title = title;
// If we already have a panel, show it.
if (WebviewPanelCostOfDelay.currentPanel) {
WebviewPanelCostOfDelay.currentPanel._panel.reveal(column);
WebviewPanelCostOfDelay.currentPanel._update(site, title, view);
return;
}
// Otherwise, create a new panel.
const panel = vscode.window.createWebviewPanel(
WebviewPanelCostOfDelay.viewType,
title,
column || vscode.ViewColumn.One,
{
// Enable javascript in the webview
enableScripts: true,
enableFindWidget: 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"),
],
}
);
WebviewPanelCostOfDelay.currentPanel = new WebviewPanelCostOfDelay(extensionContext, panel, site, title, view);
}
public static kill() {
WebviewPanelCostOfDelay.currentPanel?.dispose();
WebviewPanelCostOfDelay.currentPanel = undefined;
}
public static revive(panel: vscode.WebviewPanel, extensionContext: vscode.ExtensionContext) {
WebviewPanelCostOfDelay.currentPanel = new WebviewPanelCostOfDelay(extensionContext, panel, this._site, this._title, this._view);
}
private constructor(private readonly _extensionContext: vscode.ExtensionContext, private readonly _panel: vscode.WebviewPanel, site: string, title: string, view: string) {
// Set the webview's initial html content
this._update(site, title, view);
// 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;
default:
vscode.window.showErrorMessage(message.text);
break;
}
},
null,
this._disposables
);
}
public dispose() {
WebviewPanelCostOfDelay.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(site: string, title: string, view: string) {
const webview = this._panel.webview;
this._panel.webview.html = this._getHtmlForWebview(site, title, view, webview);
webview.onDidReceiveMessage(async (message: string) => {
vscode.window.showErrorMessage(message);
});
}
private _getHtmlForWebview(site: string, title: string, view: string, webview: vscode.Webview) {
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') {
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>
<iframe width="100%" style="height: 100vh;" src="${baseUri}/html/mes.html?site=${site}" title="${title}">
</iframe>
</body>
</html>`;
}
else {
const styleBootstrapUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "bootstrap.min.css")
);
const styleCostOfDelayUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "cod.css")
);
const scriptJQueryUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "jquery-1.6.4.min.js")
);
const scriptSignalRUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "jquery.signalR-2.4.3.min.js")
);
const scriptCostOfDelayUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "cost-of-delay.js")
);
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}"></script>
<script nonce="${nonce}" src="${scriptSignalRUri}"></script>
<script nonce="${nonce}" src="${baseUri}/js/${scriptUri}" type="text/javascript"></script>
<script nonce="${nonce}">
const _webviewSite = '${site}';
const _webviewView = '${view}';
const acquiredVsCodeApi = acquireVsCodeApi();
const apiBaseUrl = ${JSON.stringify(apiBaseUrl)}
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">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;">
<div id="HeaderGridDiv">
<table id="HeaderGrid" border="1"></table>
</div>
<br />&nbsp;
<div id="AllGridDiv">
<table id="AllGrid"></table>
</div>
<textarea id="AllTextarea" rows="20" cols="147"></textarea>
</div>
<script nonce="${nonce}" src="${scriptCostOfDelayUri}"></script>
</body>
</html>`;
}
}
}

View File

@ -0,0 +1,167 @@
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
import { apiBaseUrl } from "./constants";
import { PostMessage } from "./PostMessage";
export function refreshWebviewPanelExample(extensionContext: vscode.ExtensionContext): any {
WebviewPanelExample.kill();
WebviewPanelExample.createOrShow(extensionContext);
}
export class WebviewPanelExample {
/**
* Track the currently panel. Only allow a single panel to exist at a time.
*/
public static currentPanel: WebviewPanelExample | 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 (WebviewPanelExample.currentPanel) {
WebviewPanelExample.currentPanel._panel.reveal(column);
WebviewPanelExample.currentPanel._update();
return;
}
// Otherwise, create a new panel.
const panel = vscode.window.createWebviewPanel(
WebviewPanelExample.viewType,
"Web-View-Panel",
column || vscode.ViewColumn.One,
{
// Enable javascript in the webview
enableScripts: true,
enableFindWidget: 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"),
],
}
);
WebviewPanelExample.currentPanel = new WebviewPanelExample(panel, extensionContext);
}
public static kill() {
WebviewPanelExample.currentPanel?.dispose();
WebviewPanelExample.currentPanel = undefined;
}
public static revive(panel: vscode.WebviewPanel, extensionContext: vscode.ExtensionContext) {
WebviewPanelExample.currentPanel = new WebviewPanelExample(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() {
WebviewPanelExample.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,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

@ -0,0 +1,193 @@
import * as vscode from 'vscode';
import * as editorCalc from 'editor-calc';
export class CalcProvider implements vscode.CompletionItemProvider {
public enableActive: boolean;
private decorationType: vscode.TextEditorDecorationType;
constructor(
public config: vscode.WorkspaceConfiguration,
private onError: (error: unknown) => any,
) {
this.enableActive = false;
this.decorationType = vscode.window.createTextEditorDecorationType({
dark: {
border: '1px dashed gray',
},
light: {
border: '1px dashed black',
},
});
}
public async highlight(range: vscode.Range) {
const editor = vscode.window.activeTextEditor;
if (editor) {
editor.setDecorations(this.decorationType, [range]);
}
}
public async clearHighlight() {
const editor = vscode.window.activeTextEditor;
if (editor) {
editor.setDecorations(this.decorationType, []);
}
}
public calculateLine(
position: vscode.Position,
exprLine: string,
): {
skip: number;
result: string;
insertText: string;
expressionRange: vscode.Range;
expressionWithEqualSignRange: vscode.Range;
expressionEndRange: vscode.Range;
} | null {
let skip, result;
try {
({ skip, result } = editorCalc.calculate(exprLine));
} catch (error) {
this.onError(error);
return null;
}
const formulaRaw = exprLine.slice(skip);
const leftMatches = formulaRaw.match(/^\s+/);
const leftEmpty = leftMatches ? leftMatches[0].length : 0;
const rightMatches = formulaRaw.match(/[\s=]+$/);
const rightEmpty = rightMatches ? rightMatches[0].length : 0;
const insertText = exprLine.endsWith(' =') ? ` ${result}` : result;
return {
skip,
result,
insertText,
expressionRange: new vscode.Range(
position.line,
skip + leftEmpty,
position.line,
position.character - rightEmpty,
),
expressionWithEqualSignRange: new vscode.Range(
position.line,
skip + leftEmpty,
position.line,
position.character,
),
expressionEndRange: new vscode.Range(
position.line,
position.character,
position.line,
position.character,
),
};
}
private getCompletionResultsFromExtraCursors(document: vscode.TextDocument): {
additionalReplacements: vscode.Range[];
additionalTextInserts: string[];
additionalResults: string[];
} {
const additionalReplacements = [];
const additionalTextInserts = [];
const additionalResults = [];
const editor = vscode.window.activeTextEditor;
if (editor) {
for (const selection of editor.selections.slice(1)) {
const position = selection.active;
const exprLine = document.getText(
new vscode.Range(new vscode.Position(position.line, 0), position),
);
const lineCalcResult = this.calculateLine(position, exprLine);
if (lineCalcResult == null) {
continue;
}
const { expressionWithEqualSignRange, insertText, result } =
lineCalcResult;
additionalReplacements.push(expressionWithEqualSignRange);
additionalTextInserts.push(insertText);
additionalResults.push(result);
}
}
return { additionalReplacements, additionalTextInserts, additionalResults };
}
public async provideCompletionItems(
document: vscode.TextDocument,
position: vscode.Position,
_token: vscode.CancellationToken,
_context: vscode.CompletionContext,
): Promise<vscode.CompletionItem[]> {
const exprLine = document.getText(
new vscode.Range(new vscode.Position(position.line, 0), position),
);
if (!this.enableActive && !exprLine.trimRight().endsWith('=')) {
return [];
}
const lineCalcResult = this.calculateLine(position, exprLine);
if (lineCalcResult == null) {
return [];
}
const {
skip,
result,
expressionRange,
expressionWithEqualSignRange,
expressionEndRange,
insertText,
} = lineCalcResult;
this.clearHighlight().catch(this.onError);
this.highlight(expressionRange).catch(this.onError);
const { additionalReplacements, additionalTextInserts, additionalResults } =
this.getCompletionResultsFromExtraCursors(document);
const documentationPostfix =
additionalResults.length > 0 ? ' (multiple)' : '';
return [
{
label: result,
kind: vscode.CompletionItemKind.Constant,
detail: `calc append${documentationPostfix}`,
documentation: `\`${exprLine
.slice(skip)
.trimStart()}${insertText}\`${documentationPostfix}`,
range: expressionEndRange,
additionalTextEdits: [
vscode.TextEdit.insert(expressionWithEqualSignRange.end, insertText),
...additionalReplacements.map((replacementRange, i) =>
vscode.TextEdit.insert(replacementRange.end, additionalTextInserts[i]),
),
],
insertText: '', // text specified here will be inserted on every line
},
{
label: result,
kind: vscode.CompletionItemKind.Constant,
detail: `calc replace${documentationPostfix}`,
documentation: `\`${result}\`${documentationPostfix}`,
additionalTextEdits: [
vscode.TextEdit.replace(expressionWithEqualSignRange, result),
...additionalReplacements.map((replacementRange, i) =>
vscode.TextEdit.replace(replacementRange, additionalResults[i]),
),
],
insertText: '',
},
];
}
async resolveCompletionItem(
item: vscode.CompletionItem,
_token: vscode.CancellationToken,
): Promise<vscode.CompletionItem> {
return item;
}
}

View File

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

View File

@ -0,0 +1,37 @@
import * as vscode from 'vscode';
async function copySyntaxInLightLogic(): Promise<any> {
try {
// Get the current configuration
const config = vscode.workspace.getConfiguration();
// Get the current color theme
const currentTheme = config.get("workbench.colorTheme");
// Set the color theme to "Default Light+"
await config.update(
"workbench.colorTheme",
"Default Light Modern",
vscode.ConfigurationTarget.Global
);
// Copy Selected Text
await vscode.commands.executeCommand(
"editor.action.clipboardCopyAction"
);
// Show success message
vscode.window.showInformationMessage("Text copied in Light Mode");
// Switch back to dark theme
await config.update(
"workbench.colorTheme",
currentTheme,
vscode.ConfigurationTarget.Global
);
} catch (error) {
vscode.window.showErrorMessage(`Error: ${error}`);
}
}
export const copySyntaxInLight = () => copySyntaxInLightLogic();

View File

@ -0,0 +1,203 @@
// 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 Calculator from './calculator';
import * as copyHelper from './copyHelper';
import * as kanbanHelper from './kanbanHelper';
import * as markdownHelper from './markdownHelper';
import * as settingsHelper from './settingsHelper';
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 { 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 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');
const onError = (error: unknown) => {
if (error instanceof Error) {
outputChannel.appendLine(error.message);
if (error.stack) outputChannel.appendLine(error.stack);
} else {
outputChannel.appendLine((error as any).toString().message);
}
};
const calcProvider = new Calculator.CalcProvider(config, onError);
extensionContext.subscriptions.push(
vscode.languages.registerCompletionItemProvider('*', calcProvider, '=', ' '),
vscode.workspace.onDidOpenTextDocument(() => {
calcProvider.clearHighlight().catch(onError);
}),
vscode.window.onDidChangeTextEditorSelection(() => {
calcProvider.clearHighlight().catch(onError);
}),
);
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(
editor: vscode.TextEditor,
positionsAndExpressions: [vscode.Position, string][],
mode: 'append' | 'replace',
) {
await editor.edit((editBuilder) => {
for (const [position, expression] of positionsAndExpressions) {
const lineCalcResult = calcProvider.calculateLine(position, expression);
if (lineCalcResult == null) {
continue;
}
const { insertText, expressionWithEqualSignRange, expressionEndRange } =
lineCalcResult;
if (mode === 'append') {
const endWithEqual = expression.trimEnd().endsWith('=');
editBuilder.replace(
expressionEndRange,
endWithEqual ? insertText : ` = ${insertText}`,
);
} else if (mode === 'replace') {
editBuilder.replace(expressionWithEqualSignRange, insertText);
}
}
});
}
async function replaceResult(
mode: 'append' | 'replace',
withCursor: boolean,
) {
const editor = vscode.window.activeTextEditor;
if (!editor || !editor.selection.isEmpty) {
return;
}
const doc = editor.document;
let positionsAndExpressions;
if (withCursor) {
positionsAndExpressions = editor.selections.map(
(selection) =>
<[vscode.Position, string]>[
selection.active,
doc
.lineAt(selection.active.line)
.text.slice(0, selection.active.character),
],
);
} else {
const uniqueLineNumbers = [
...new Set(editor.selections.map((selection) => selection.active.line)),
];
positionsAndExpressions = uniqueLineNumbers.map((number) => {
const line = doc.lineAt(number);
return <[vscode.Position, string]>[line.range.end, line.text];
});
}
await replaceResultsWithPositions(editor, positionsAndExpressions, mode);
}
extensionContext.subscriptions.push(
vscode.commands.registerTextEditorCommand('extension.calcAppendWithCursor', () => {
replaceResult('append', true).catch(onError);
}),
vscode.commands.registerTextEditorCommand('extension.calcAppend', () => {
replaceResult('append', false).catch(onError);
}),
vscode.commands.registerTextEditorCommand(
'extension.calcReplaceWithCursor',
() => {
replaceResult('replace', true).catch(onError);
},
),
vscode.commands.registerTextEditorCommand('extension.calcReplace', () => {
replaceResult('replace', false).catch(onError);
}),
);
const commands = [
vscode.commands.registerCommand("copyHelper.copySyntaxInLight", copyHelper.copySyntaxInLight),
vscode.commands.registerCommand("extension.rotateExplorerSortOrder", settingsHelper.rotateExplorerSortOrder),
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow),
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.insertAllExtensions", promiseLinesHelper.insertAllExtensions),
vscode.commands.registerCommand('promiseLinesHelper.transformToProperCase', promiseLinesHelper.transformToProperCase),
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),
vscode.commands.registerCommand('replaceLinesHelper.prettySql', replaceLinesHelper.prettySql),
vscode.commands.registerCommand('replaceLinesHelper.quickFixCamelCaseProperties', replaceLinesHelper.quickFixCamelCaseProperties),
vscode.commands.registerCommand('replaceLinesHelper.quickFixCS0108', replaceLinesHelper.quickFixCS0108),
vscode.commands.registerCommand('replaceLinesHelper.quickFixInstanceFieldToCalisthenics', replaceLinesHelper.quickFixInstanceFieldToCalisthenics),
vscode.commands.registerCommand('replaceLinesHelper.quickFixProperCaseProperties', replaceLinesHelper.quickFixProperCaseProperties),
vscode.commands.registerCommand('replaceLinesHelper.quickFixPublic', replaceLinesHelper.quickFixPublic),
vscode.commands.registerCommand('replaceLinesHelper.removeComment', replaceLinesHelper.removeComment),
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'); }),
vscode.commands.registerCommand("webview.costOfDelayLiveMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'LIVE'); }),
vscode.commands.registerCommand("webview.costOfDelayWSJFMesa", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'MES', 'WSJF'); }),
vscode.commands.registerCommand("webview.backlogLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'HTML'); }),
vscode.commands.registerCommand("webview.costOfDelayLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', ''); }),
vscode.commands.registerCommand("webview.costOfDelayEffortLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'EFFORT'); }),
vscode.commands.registerCommand("webview.costOfDelayLiveLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'LIVE'); }),
vscode.commands.registerCommand("webview.costOfDelayWSJFLeominster", () => { WebviewPanelCostOfDelay.WebviewPanelCostOfDelay.createOrShow(extensionContext, 'LEO', 'WSJF'); }),
vscode.commands.registerCommand("webview.example", () => { WebviewPanelExample.WebviewPanelExample.createOrShow(extensionContext); })
];
commands.forEach(command => extensionContext.subscriptions.push(command));
}
// 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,126 @@
import * as vscode from 'vscode';
import { paramCase } from './promiseLinesHelper';
async function updateWithLogic(textDocument: vscode.TextDocument) {
await vscode.window.showTextDocument(textDocument);
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
const now: Date = new Date();
const time: number = now.getTime();
const year: number = now.getFullYear();
const start: Date = new Date(year, 0, 0);
const oneDay: number = 1000 * 60 * 60 * 24;
const timezoneOffset: number = now.getTimezoneOffset();
let segments: string[] = textDocument.fileName.split('\\');
const diff: number = (time - start.getTime()) + ((start.getTimezoneOffset() - timezoneOffset) * 60 * 1000);
const day: number = Math.floor(diff / oneDay);
const seconds: number = time.valueOf() + timezoneOffset;
let notLastThree: string[] = segments.slice(0, -3);
let season: string = year + "-";
if (day < 78) {
season += "0.Winter";
} else if (day < 124) {
season += "1.Spring";
} else if (day < 171) {
season += "2.Spring";
} else if (day < 217) {
season += "3.Summer";
} else if (day < 264) {
season += "4.Summer";
} else if (day < 309) {
season += "5.Fall";
} else if (day < 354) {
season += "6.Fall";
} else {
season += "7.Winter";
}
let path: string = notLastThree.join('\\') + `\\${year}\\${season}\\${seconds}`;
const uri = vscode.Uri.parse(path);
textEditor.edit(editBuilder => {
let text: string = `\r\n## Code Insiders\r\n\r\n- [code-insiders](${path})\r\n\r\n## Sub-tasks\r\n\r\n- [ ] To do`;
let position: vscode.Position = new vscode.Position(textDocument.lineCount, 0);
editBuilder.insert(position, text);
});
}
async function openInNewWindowLogic(): Promise<any> {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
return;
}
if (vscode.window.tabGroups.activeTabGroup.activeTab === undefined) {
vscode.window.showInformationMessage("Open a tab first!");
return;
}
const activeTab = vscode.window.tabGroups.activeTabGroup.activeTab;
const tabs: vscode.Tab[] = vscode.window.tabGroups.all.map(tagGroup => tagGroup.tabs).flat();
const index = tabs.findIndex(tab => tab.label === activeTab.label);
const paramCaseActiveTabLabel: string = paramCase(activeTab.label);
vscode.window.showInformationMessage(`Searching for <${paramCaseActiveTabLabel}>`);
const fileUris: vscode.Uri[] = await vscode.workspace.findFiles(`**/${paramCaseActiveTabLabel}*`);
if (fileUris.length === 0) {
vscode.window.showInformationMessage(`Didn't find a file matching <${paramCaseActiveTabLabel}>!`);
return;
}
for (let i = 0; i < fileUris.length; ++i) {
let found: boolean = false;
const textDocument: vscode.TextDocument = await vscode.workspace.openTextDocument(fileUris[i]);
for (let j = 0; j < textDocument.lineCount; ++j) {
const text = textDocument.lineAt(j).text;
if (text.endsWith(')')) {
if (text.startsWith("- [code](")) {
found = true;
const uri = vscode.Uri.parse("file:" + text.substring(9, text.length - 1));
await vscode.commands.executeCommand('vscode.openFolder', uri, true);
break;
}
if (text.startsWith("- [codium](")) {
found = true;
const uri = vscode.Uri.parse("file:" + text.substring(11, text.length - 1));
await vscode.commands.executeCommand('vscode.openFolder', uri, true);
break;
}
if (text.startsWith("- [code-insiders](")) {
found = true;
const uri = vscode.Uri.parse("file:" + text.substring(18, text.length - 1));
await vscode.commands.executeCommand('vscode.openFolder', uri, true);
break;
}
}
}
if (!found) {
updateWithLogic(textDocument);
}
else if (index !== -1) {
await vscode.window.tabGroups.close(tabs[index]);
}
}
}
async function openWithTextEditorLogic(): Promise<any> {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
return;
}
if (vscode.window.tabGroups.activeTabGroup.activeTab === undefined) {
vscode.window.showInformationMessage("Open a tab first!");
return;
}
const activeTabLabel = vscode.window.tabGroups.activeTabGroup.activeTab.label;
const paramCaseActiveTabLabel: string = paramCase(activeTabLabel);
vscode.window.showInformationMessage(`Searching for <${paramCaseActiveTabLabel}>`);
const fileUris: vscode.Uri[] = await vscode.workspace.findFiles(`**/${paramCaseActiveTabLabel}*`);
if (fileUris.length === 0) {
vscode.window.showInformationMessage(`Didn't find a file matching <${paramCaseActiveTabLabel}>!`);
return;
}
for (let i = 0; i < fileUris.length; ++i) {
const textDocument: vscode.TextDocument = await vscode.workspace.openTextDocument(fileUris[i]);
await vscode.window.showTextDocument(textDocument);
}
}
export const openInNewWindow = () => openInNewWindowLogic();
export const openWithTextEditor = () => openWithTextEditorLogic();

View File

@ -0,0 +1,22 @@
import * as vscode from 'vscode';
import { paramCase } from './promiseLinesHelper';
async function newMarkdownFileLogic(): Promise<any> {
console.log(vscode.window.tabGroups.activeTabGroup.activeTab?.label);
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

@ -0,0 +1,266 @@
import * as vscode from 'vscode';
function codeGeneratorQuickPickLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
let thenable = vscode.window.showQuickPick(
[
{
label: "Class name",
detail: "Segments Minus One (Object || Array)",
output: "%ClassName%"
}, {
label: "Class name (Camel-Cased)",
detail: "Segments Minus One (Object || Array)",
output: "%ClassNameCamelCased%"
}, {
label: "Class name (Camel-Cased and Plural)",
detail: "Segments Minus One (Object || Array)",
output: "%ClassNameCamelCasedPlural%"
}, {
label: "Class name (Plural)",
detail: "Segments Minus One (Object || Array)",
output: "%ClassNamePlural%"
}, {
label: "Key Without Brackets Segment at Level",
detail: "",
output: "%KeyWithoutBracketsSegmentAtLevel%"
}, {
label: "Name",
detail: "Segments Last only name (no path)",
output: "%Name%"
}, {
label: "Namespace",
detail: "Namespace",
output: "%namespace%"
}, {
label: "Name (Camel-Cased)",
detail: "Segments Last only name (no path)",
output: "%NameCamelCased%"
}, {
label: "Name (Camel-Cased and Plural)",
detail: "Segments Last only name (no path)",
output: "%NameCamelCasedPlural%"
}, {
label: "Name Detail",
detail: "",
output: "%NameDetail%"
}, {
label: "Name Detail (Camel-Cased)",
detail: "",
output: "%NameDetailCamelCased%"
}, {
label: "Name Detail (Humanized)",
detail: "",
output: "%NameDetailHumanized%"
}, {
label: "Name Detail (Humanized) *Collection",
detail: "",
output: "%NameDetailHumanizedCollection%"
}, {
label: "Name (Humanized)",
detail: "Segments Last only name (no path)",
output: "%NameHumanized%"
}, {
label: "Name (Null Segments)",
detail: "",
output: "%NameNullSegments%"
}, {
label: "Name (Null Segments) *Collection",
detail: "",
output: "%NameNullSegmentsCollection%"
}, {
label: "Name (Plural)",
detail: "Segments Last only name (no path)",
output: "%NamePlural%"
}, {
label: "Name Segments",
detail: "",
output: "%NameSegments%"
}, {
label: "Name Segments *Collection",
detail: "",
output: "%NameSegmentsCollection%"
}, {
label: "Path without Brackets (Singularized)",
detail: "",
output: "%PathWithoutBracketsSingularized%"
}, {
label: "Suggested Type",
detail: "Type based on values in *.json file",
output: "%SuggestedType%"
}, {
label: "Suggested Type Id",
detail: "",
output: "%SuggestedTypeId%"
}, {
label: "Suggested Type Id (Camel-Cased)",
detail: "",
output: "%SuggestedTypeIdCamelCased%"
}, {
label: "Type",
detail: "Segments Minus One (!Object && !Array)",
output: "%Type%"
}, {
label: "Type (Camel-Cased)",
detail: "Segments Minus One (!Object && !Array)",
output: "%TypeCamelCased%"
}
]
).then(item => {
if (!item) {
return;
}
const selection = textEditor.selection;
return textEditor.edit(editBuilder => {
var range;
if (selection.isEmpty) {
editBuilder.insert(selection.start, item.output)
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
editBuilder.replace(range, item.output);
}
});
});
return undefined;
}
function insertDateTimeLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
const selection = textEditor.selection;
textEditor.edit(editBuilder => {
var range;
const now: Date = new Date();
const time: number = now.getTime();
const year: number = now.getFullYear();
const start: Date = new Date(year, 0, 0);
const oneDay: number = 1000 * 60 * 60 * 24;
const timezoneOffset: number = now.getTimezoneOffset();
const diff: number = (time - start.getTime()) + ((start.getTimezoneOffset() - timezoneOffset) * 60 * 1000);
const seconds: number = time.valueOf() + timezoneOffset;
const day: number = Math.floor(diff / oneDay);
const epoch: number = seconds * 10000;
const ticks: number = epoch + 621355968000000000;
let season: string = year + "-";
if (day < 78) {
season += "0.Winter";
} else if (day < 124) {
season += "1.Spring";
} else if (day < 171) {
season += "2.Spring";
} else if (day < 217) {
season += "3.Summer";
} else if (day < 264) {
season += "4.Summer";
} else if (day < 309) {
season += "5.Fall";
} else if (day < 354) {
season += "6.Fall";
} else {
season += "7.Winter";
}
const dateText = seconds + " = " + ticks + " = " + season + " = " + now.toString();
if (selection.isEmpty) {
editBuilder.insert(selection.start, dateText)
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
editBuilder.replace(range, dateText);
}
});
return undefined;
}
function insertAllExtensionsLogic(): undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
const selection = textEditor.selection;
textEditor.edit(editBuilder => {
var range;
let extensions = vscode.extensions.all;
let text = extensions.map(extension => extension.id).join("\n");
if (selection.isEmpty) {
editBuilder.insert(selection.start, text)
}
else {
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
editBuilder.replace(range, text);
}
});
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 transformToProperCaseLogic(): 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 insertAllExtensions = () => insertAllExtensionsLogic();
export const transformToProperCase = () => transformToProperCaseLogic();
export const transformToParamCase = () => transformToParamCaseLogic();

View File

@ -0,0 +1,55 @@
import * as vscode from 'vscode';
enum LinesAction {
searchGoogle
}
function searchGoogleLogic(text: string, lines: string[]): void {
let searchText: string = '';
if (text.length > 0) {
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()}`)
)
}
}
function getLines(textEditor: vscode.TextEditor, startLine: number, endLine: number) {
let results: string[] = [];
for (let i = startLine; i <= endLine; i++) {
results.push(textEditor.document.lineAt(i).text);
}
return results;
}
function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
let text = '';
var startLine = 0;
var endLine = textEditor.document.lineCount - 1;
const selection = textEditor.selection;
if (!selection.isEmpty) {
startLine = selection.start.line;
endLine = selection.end.line;
let range = new vscode.Range(selection.start, selection.end)
text = textEditor.document.getText(range);
}
let lines: string[] = getLines(textEditor, startLine, endLine);
switch (linesAction) {
case LinesAction.searchGoogle: { searchGoogleLogic(text, lines); break; }
default: { throw new Error(); }
}
return undefined;
}
export const searchGoogle = () => linesFunction(LinesAction.searchGoogle);

View File

@ -0,0 +1,484 @@
import * as vscode from 'vscode';
type ArrayTransformer = (lines: string[]) => string[];
type SortingAlgorithm = (a: string, b: string) => number;
enum LinesAction {
addCSharpComment,
addVBComment,
convertToRegularExpression,
cutEachLine,
distinctLines,
expandSql,
listToListFamily,
listToListWrappedComma,
prettySql,
quickFixCamelCaseProperties,
quickFixCS0108,
quickFixInstanceFieldToCalisthenics,
quickFixProperCaseProperties,
quickFixPublic,
pdsfToFixedWidth,
removeComment,
removeJsonNullValues,
removeLinesContainingHighlighted,
sortLength,
sortNormal,
splitBySpaceReverseJoinSort,
unwrapSql,
wrapSqlCSharp,
wrapSqlVB
}
function removeBlanks(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
if (lines[i].trim() === '') {
lines.splice(i, 1);
i--;
}
}
}
function getLines(textEditor: vscode.TextEditor, startLine: number, endLine: number) {
let results: string[] = [];
for (let i = startLine; i <= endLine; i++) {
results.push(textEditor.document.lineAt(i).text);
}
return results;
}
function addCSharpCommentLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = '//' + lines[i].trim();
}
}
function addVBCommentLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = "'" + lines[i].trim();
}
}
function convertToRegularExpressionLogic(lines: string[]): string[] {
let results: string[];
let result: string = "";
let explicitLines = 50;
for (let i = 0; i < lines.length - 1 && i < explicitLines; ++i) {
result = result + lines[i].trim().
split('\\').join('\\\\').
split('(').join('\\(').
split(')').join('\\)').
split('[').join('\\[').
split(']').join('\\]').
split('{').join('\\{').
split('}').join('\\}').
split('.').join('\\.').
split('*').join('\\*').
split('+').join('\\+').
split('?').join('\\?').
split('|').join('\\|').
split('$').join('\\$').
split('^').join('\\^') +
'~';
}
for (let i = explicitLines; i < lines.length - 1; ++i) {
result = result + '.*~';
}
result = result.
substring(0, result.length - 1).
split('~').join('\\r\\n\?\\s\*');
results = [result];
return results;
}
function expandSqlLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = ' ' + lines[i];
lines[i] = lines[i].
split(' select ').join(' SELECT\r\n').
split(' from ').join('\r\n FROM ').
split(' where ').join('\r\n WHERE ').
split(' and ').join('\r\n and ').
split(' join ').join('\r\n join ').
split(' left join ').join('\r\n left join ').
split(' on ').join('\r\n ON ').
split(' group by ').join('\r\n GROUP BY ').
split(' order by ').join('\r\n ORDER BY ').
split(' SELECT ').join(' SELECT\r\n').
split(' FROM ').join('\r\n FROM ').
split(' WHERE ').join('\r\n WHERE ').
split(' AND ').join('\r\n AND ').
split(' JOIN ').join('\r\n JOIN ').
split(' LEFT JOIN ').join('\r\n LEFT JOIN ').
split(' ON ').join('\r\n ON ').
split(' GROUP BY ').join('\r\n GROUP BY ').
split(' ORDER BY ').join('\r\n ORDER BY ').
split('\r\n\r\n').join('\r\n').
trim();
}
removeBlanks(lines);
prettySqlLogic(lines);
}
function listToListFamilyLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = "Kristy" + lines[i].trim() + "Mike" + lines[i].trim() + "Jason" + lines[i].trim() + "Mackenzie" + lines[i].trim() + "Logan" + lines[i].trim() + "Lilly" + lines[i].trim() + "Chelsea" + lines[i].trim() + "Piper" + lines[i].trim();
}
}
function listToListWrappedCommaLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = "'" + lines[i].trim() + "',";
}
}
function prettySqlLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = ' ' + lines[i];
lines[i] = lines[i].
split(' select ').join(' SELECT ').
split(' distinct ').join(' DISTINCT ').
split(' as ').join(' AS ').
split(' from ').join(' FROM ').
split(' where ').join(' WHERE ').
split(' and ').join(' AND ').
split(' join ').join(' JOIN ').
split(' left join ').join(' LEFT JOIN ').
split(' on ').join(' ON ').
split(' group by ').join(' GROUP BY ').
split(' order by ').join(' ORDER BY ').
split('\r\n\r\n').join('\r\n').
trim();
}
removeBlanks(lines);
}
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 toCapitalizedWords(name: string) {
let words = name.match(/[A-Za-z][a-z]*|[0-9]+/g) || [];
return words.map(capitalize).join(" ");
}
function capitalize(word: string) {
return word.charAt(0).toUpperCase() + word.substring(1);
}
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)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
let camelCased = camelCase(segments[2]);
lines[i] = leftPadding + segments[0] + ' ' + segments[1] + ' ' + camelCased;
}
removeBlanks(lines);
}
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)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
let camelCased = camelCase(segments[2]);
let properCased = camelCased.substring(0, 1).toUpperCase() + camelCased.substring(1, camelCased.length - 1);
let capitalizedWords = toCapitalizedWords(properCased);
lines[i] = leftPadding + '[Display(Name = "' + capitalizedWords + '"), Required] public new ' + segments[1] + ' ' + properCased + ' { get; set; }';
}
removeBlanks(lines);
}
function quickFixInstanceFieldToCalisthenicsLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
if (segments.length !== 2)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
let type = segments[0];
let name = segments[1].split(';')[0];
let singularName = name;
if (name[name.length - 1] === 's') {
if (name[name.length - 2] === 'e') {
if (name[name.length - 3] === 'i') {
singularName = name.substring(0, singularName.length - 3) + 'y';
}
else
singularName = name.substring(0, singularName.length - 2);
}
else
singularName = name.substring(0, singularName.length - 1);
}
segments = type.split('<');
if (segments.length === 2)
lines[i] = leftPadding + 'public ' + segments[0] + '<' + singularName + '> ' + name + ' { get; } //' + segments[1].split('>')[0];
else {
segments = type.split('[');
if (segments.length === 2)
lines[i] = leftPadding + 'public ' + singularName + '[] ' + name + ' { get; } //' + segments[0];
else
lines[i] = leftPadding + 'public ' + singularName + ' ' + name + ' { get; } //' + type;
}
}
removeBlanks(lines);
}
function quickFixProperCasePropertiesLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
let segments = lines[i].trim().split(' ');
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(' ');
let camelCased = camelCase(segments[2]);
let properCased = camelCased.substring(0, 1).toUpperCase() + camelCased.substring(1, camelCased.length - 1);
lines[i] = leftPadding + segments[0] + ' ' + segments[1] + ' ' + properCased + ';';
}
removeBlanks(lines);
}
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)
continue;
let leftPadding = lines[i].substring(0, lines[i].indexOf(segments[0]));
if (segments.length === 2) segments = ('protected ' + lines[i].trim()).split(' ');
let camelCased = camelCase(segments[2]);
let properCased = camelCased.substring(0, 1).toUpperCase() + camelCased.substring(1, camelCased.length - 1);
lines[i] = leftPadding + 'public ' + segments[1] + ' ' + properCased + ' => ' + camelCased;
}
removeBlanks(lines);
}
function removeCommentLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].trim();
if (lines[i].length > 1 && lines[i][0] === '/' && lines[i][1] === '/') {
lines[i] = lines[i].substr(2);
}
if (lines[i].length > 0 && lines[i][0] === "'") {
lines[i] = lines[i].substr(1);
}
}
}
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);
};
}
function sortNormalLogic(lines: string[]): void {
var transformers: ArrayTransformer[] = [];
transformers.push(makeSorter());
removeBlanks(lines);
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].
split('sql = "').join('').
split('sql = sql & "').join('').
split('sql.Append("').join('').
split('.Append("').join('').
split('Append("').join('').
split('");').join('').
split('").').join('').
split('")').join('').
split('" & ').join('$').
split(' & "').join('$').
split('"').join('').
trim();
}
}
function wrapSqlCSharpLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].trim();
if (lines[i].length > 1 && lines[i][0] === '/' && lines[i][1] === '/') {
lines[i] = lines[i].substr(2);
}
lines[i] = 'Append(" ' + lines[i] + ' ").';
}
if (lines.length > 0) {
lines[0] = 'sql.' + lines[0];
lines[lines.length - 1] = lines[lines.length - 1].split(' ").').join(' ");');
}
}
function wrapSqlVBLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
lines[i] = lines[i].trim();
if (lines[i].length > 0 && lines[i][0] === "'") {
lines[i] = lines[i].substr(1);
}
lines[i] = 'Append(" ' + lines[i] + ' ").';
}
if (lines.length > 0) {
lines[0] = 'sql.' + lines[0];
}
}
function sortLengthLogic(lines: string[]): void {
lines.sort(function (a, b) {
// ASC -> a.length - b.length
// DESC -> b.length - a.length
return a.length - b.length || // sort by length, if equal then
a.localeCompare(b); // sort by dictionary order
});
removeBlanks(lines);
}
function cutEachLineLogic(lines: string[]): void {
for (let i = 0; i < lines.length; ++i) {
if (lines[i].length > 0 && lines[i].indexOf("|||") > 0) {
lines[i] = lines[i].substr(0, lines[i].indexOf("|||"));
}
lines[i] = lines[i].trim();
}
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);
editBuilder.replace(range, lines.join('\n'));
});
}
function linesFunction(linesAction: LinesAction): Thenable<boolean> | undefined {
const textEditor = vscode.window.activeTextEditor;
if (!textEditor) {
return undefined;
}
let text;
var endLine;
var startLine;
const selection = textEditor.selection;
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) {
case LinesAction.addCSharpComment: { addCSharpCommentLogic(lines); break; }
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; }
case LinesAction.prettySql: { prettySqlLogic(lines); break; }
case LinesAction.quickFixCamelCaseProperties: { quickFixCamelCasePropertiesLogic(lines); break; }
case LinesAction.quickFixCS0108: { quickFixCS0108Logic(lines); break; }
case LinesAction.quickFixInstanceFieldToCalisthenics: { quickFixInstanceFieldToCalisthenicsLogic(lines); break; }
case LinesAction.quickFixProperCaseProperties: { quickFixProperCasePropertiesLogic(lines); break; }
case LinesAction.quickFixPublic: { quickFixPublicLogic(lines); break; }
case LinesAction.removeComment: { removeCommentLogic(lines); break; }
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; }
case LinesAction.unwrapSql: { unwrapSqlLogic(lines); break; }
case LinesAction.wrapSqlCSharp: { wrapSqlCSharpLogic(lines); break; }
case LinesAction.wrapSqlVB: { wrapSqlVBLogic(lines); break; }
default: { throw new Error(); }
}
return returnLines(textEditor, startLine, endLine, lines);
}
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);
export const prettySql = () => linesFunction(LinesAction.prettySql);
export const quickFixCamelCaseProperties = () => linesFunction(LinesAction.quickFixCamelCaseProperties);
export const quickFixCS0108 = () => linesFunction(LinesAction.quickFixCS0108);
export const quickFixInstanceFieldToCalisthenics = () => linesFunction(LinesAction.quickFixInstanceFieldToCalisthenics);
export const quickFixProperCaseProperties = () => linesFunction(LinesAction.quickFixProperCaseProperties);
export const quickFixPublic = () => linesFunction(LinesAction.quickFixPublic);
export const pdsfToFixedWidth = () => linesFunction(LinesAction.pdsfToFixedWidth);
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);
export const unwrapSql = () => linesFunction(LinesAction.unwrapSql);
export const wrapSqlCSharp = () => linesFunction(LinesAction.wrapSqlCSharp);
export const wrapSqlVB = () => linesFunction(LinesAction.wrapSqlVB);

View File

@ -0,0 +1,29 @@
import * as vscode from 'vscode';
async function rotateExplorerSortOrderLogic(): Promise<any> {
const config = vscode.workspace.getConfiguration("explorer");
const sortOrder = config.get("sortOrder");
let sortOrderOptions = [
"default",
"modified",
"type",
"mixed",
"filesFirst",
"foldersNestsFiles",
];
let index = sortOrderOptions.findIndex(l => l === sortOrder);
if (index !== -1)
index++;
else
index = 0;
if (index >= sortOrderOptions.length)
index = 0;
let value = sortOrderOptions[index];
await config.update("sortOrder", value);
index++;
if (index >= sortOrderOptions.length)
index = 0;
vscode.window.showInformationMessage(`Explorer Sort Order set to: ${value}; next will be: ${sortOrderOptions[index]};`);
}
export const rotateExplorerSortOrder = () => rotateExplorerSortOrderLogic();

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"typeRoots": ["./node_modules/@types"],
"allowSyntheticDefaultImports": true,
"lib": [
"ES2020"
],
"module": "commonjs",
"rootDir": "src",
"sourceMap": true,
"strict": true,
"target": "ES2020"
},
"exclude": [
"node_modules",
".vscode-test",
"webviews"
]
}

View File

@ -0,0 +1,55 @@
---
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
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your extension and command.
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesnt yet need to load the plugin.
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
* 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.
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
* Find output from your extension in the debug console.
## Make changes
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Explore the API
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
## Run tests
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
* Press `F5` to run the tests in a new window with your extension loaded.
* See the output of the test result in the debug console.
* Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
* You can create folders inside the `test` folder to structure your tests any way you want.
## 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 VS Code extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).