Compare commits
1 Commits
03-31-a
...
WebView-wi
Author | SHA1 | Date | |
---|---|---|---|
5454183d86 |
39
.gitignore
vendored
39
.gitignore
vendored
@ -264,42 +264,3 @@ __pycache__/
|
||||
type-script-helper-1.1.6.vsix
|
||||
type-script-helper-1.1.7.vsix
|
||||
type-script-helper-1.1.8.vsix
|
||||
|
||||
.kanbn
|
||||
*.exe
|
||||
*.pdb
|
||||
|
||||
.vscode/helper/**
|
||||
|
||||
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
|
||||
|
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// 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",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/type-script-helper"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
29
.vscode/settings.json
vendored
29
.vscode/settings.json
vendored
@ -1,27 +1,6 @@
|
||||
{
|
||||
"[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
|
||||
}
|
||||
"cSpell.words": [
|
||||
"Kanban",
|
||||
"VSIX"
|
||||
]
|
||||
}
|
BIN
Application.evtx
BIN
Application.evtx
Binary file not shown.
BIN
type-script-helper-1.3.14.vsix
Normal file
BIN
type-script-helper-1.3.14.vsix
Normal file
Binary file not shown.
BIN
type-script-helper-1.3.15.vsix
Normal file
BIN
type-script-helper-1.3.15.vsix
Normal file
Binary file not shown.
BIN
type-script-helper-1.4.1.vsix
Normal file
BIN
type-script-helper-1.4.1.vsix
Normal file
Binary file not shown.
Binary file not shown.
8
type-script-helper/.gitignore
vendored
8
type-script-helper/.gitignore
vendored
@ -1,7 +1,5 @@
|
||||
.vscode-test/
|
||||
.vscode/helper/**
|
||||
*.vsix
|
||||
out
|
||||
dist
|
||||
node_modules
|
||||
out
|
||||
src/*.js*
|
||||
.vscode-test/
|
||||
*.vsix
|
||||
|
20
type-script-helper/.vscode/launch.json
vendored
20
type-script-helper/.vscode/launch.json
vendored
@ -14,16 +14,22 @@
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
]
|
||||
],
|
||||
"preLaunchTask": "${defaultBuildTask}"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"name": "Extension Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/src/extension.ts",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
]
|
||||
"${workspaceFolder}/out/**/*.js",
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "tasks: watch-tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
11
type-script-helper/.vscode/mklink.md
vendored
11
type-script-helper/.vscode/mklink.md
vendored
@ -1,11 +0,0 @@
|
||||
---
|
||||
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"
|
||||
```
|
38
type-script-helper/.vscode/settings.json
vendored
38
type-script-helper/.vscode/settings.json
vendored
@ -1,29 +1,13 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"[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
|
||||
}
|
||||
"files.exclude": {
|
||||
"out": false, // set this to true to hide the "out" folder with the compiled JS files
|
||||
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
|
||||
},
|
||||
"search.exclude": {
|
||||
"out": true, // set this to false to include "out" folder in search results
|
||||
"dist": true // set this to false to include "dist" folder in search results
|
||||
},
|
||||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
|
||||
"typescript.tsc.autoDetect": "off"
|
||||
}
|
101
type-script-helper/.vscode/tasks.json
vendored
101
type-script-helper/.vscode/tasks.json
vendored
@ -1,63 +1,40 @@
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"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"
|
||||
}
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$ts-webpack-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never",
|
||||
"group": "watchers"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch-tests",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never",
|
||||
"group": "watchers"
|
||||
},
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"label": "tasks: watch-tests",
|
||||
"dependsOn": [
|
||||
"npm: watch",
|
||||
"npm: watch-tests"
|
||||
],
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
.gitignore
|
||||
.vscode-test/**
|
||||
.vscode/**
|
||||
.vscode-test/**
|
||||
out/**
|
||||
node_modules/**
|
||||
src/**
|
||||
.gitignore
|
||||
.yarnrc
|
||||
webpack.config.js
|
||||
vsc-extension-quickstart.md
|
||||
**/tsconfig.json
|
||||
**/.eslintrc.json
|
||||
**/*.map
|
||||
**/*.ts
|
||||
**/tsconfig.json
|
||||
build/**
|
||||
node_modules/**
|
||||
src/**
|
||||
webviews/**
|
||||
vsc-extension-quickstart.md
|
||||
webpack.config.js
|
||||
|
9
type-script-helper/CHANGELOG.md
Normal file
9
type-script-helper/CHANGELOG.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to the "type-script-helper" extension will be documented in this file.
|
||||
|
||||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Initial release
|
@ -1,11 +1,3 @@
|
||||
---
|
||||
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
|
||||
@ -24,4 +16,4 @@ 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.
|
||||
THE SOFTWARE.
|
@ -1,9 +1,3 @@
|
||||
---
|
||||
type: "read-me"
|
||||
created: "2023-09-30T01:47:18.241Z"
|
||||
updated: "2023-09-30T01:47:18.242Z"
|
||||
---
|
||||
|
||||
# type-script-helper README
|
||||
|
||||
## Features
|
||||
@ -22,7 +16,7 @@ yo code
|
||||
# ? 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 identifier of your extension? helloworld
|
||||
# ? What's the description of your extension? LEAVE BLANK
|
||||
# ? Initialize a git repository? Yes
|
||||
# ? Bundle the source code with webpack? No (should be yes?)
|
||||
@ -114,119 +108,4 @@ None
|
||||
## 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 1742607894338 = 638782046943380000 = 2025-1.Spring = Fri Mar 21 2025 18:44:53 GMT-0700 (Mountain Standard Time)
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Generic File-Folder-Helper call
|
||||
- Webview
|
20
type-script-helper/media/bootstrap.min.css
vendored
20
type-script-helper/media/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,37 +0,0 @@
|
||||
#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;
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
$(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-01-22-10-49',
|
||||
b: baseUri + '/markdown/{[]}.json?v=2025-01-22-10-49'
|
||||
};
|
||||
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);
|
||||
});
|
4
type-script-helper/media/jquery-1.6.4.min.js
vendored
4
type-script-helper/media/jquery-1.6.4.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16065
type-script-helper/package-lock.json
generated
16065
type-script-helper/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,47 +1,10 @@
|
||||
{
|
||||
"activationEvents": [
|
||||
"onLanguage:csharp",
|
||||
"onLanguage:markdown",
|
||||
"onLanguage:javascript",
|
||||
"onLanguage:json",
|
||||
"onLanguage:typescript",
|
||||
"onLanguage:yaml"
|
||||
],
|
||||
"activationEvents": [],
|
||||
"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": "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",
|
||||
@ -52,21 +15,11 @@
|
||||
"command": "promiseLinesHelper.codeGeneratorQuickPick",
|
||||
"title": "Code Generator - Quick Pick"
|
||||
},
|
||||
{
|
||||
"category": "Helper",
|
||||
"command": "promiseLinesHelper.genericFileFolderHelper",
|
||||
"title": "Generic - File-Folder-Helper"
|
||||
},
|
||||
{
|
||||
"category": "Helper",
|
||||
"command": "promiseLinesHelper.insertDateTime",
|
||||
"title": "Insert DateTime"
|
||||
},
|
||||
{
|
||||
"category": "Helper",
|
||||
"command": "promiseLinesHelper.insertAllExtensions",
|
||||
"title": "Insert All Extensions (Not Disabled)"
|
||||
},
|
||||
{
|
||||
"category": "Helper",
|
||||
"command": "promiseLinesHelper.transformToParamCase",
|
||||
@ -84,68 +37,23 @@
|
||||
},
|
||||
{
|
||||
"category": "Kanban",
|
||||
"command": "kanban.openInNewWindow",
|
||||
"title": "Open Sub-Kanban in New Window"
|
||||
"command": "kanban.apiAuthenticate",
|
||||
"title": "API Authenticate Kanban"
|
||||
},
|
||||
{
|
||||
"category": "Kanban",
|
||||
"command": "kanban.openWithTextEditor",
|
||||
"title": "Open with Text Editor Kanban"
|
||||
"command": "kanban.newEntry",
|
||||
"title": "New Kanban Entry"
|
||||
},
|
||||
{
|
||||
"category": "Leominster",
|
||||
"command": "webview.backlogLeominster",
|
||||
"title": "Backlog (Bugs & Features with parents)"
|
||||
"category": "Kanban",
|
||||
"command": "kanban.refresh",
|
||||
"title": "Refresh Kanban"
|
||||
},
|
||||
{
|
||||
"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": "Kanban",
|
||||
"command": "kanban.debugReload",
|
||||
"title": "Debug Reload Kanban"
|
||||
},
|
||||
{
|
||||
"category": "Quick Fix",
|
||||
@ -253,90 +161,84 @@
|
||||
"title": "Wrap Sql for VB"
|
||||
},
|
||||
{
|
||||
"category": "Webview",
|
||||
"command": "webview.example",
|
||||
"title": "Webview Example"
|
||||
"category": "WebView",
|
||||
"command": "webView.webView",
|
||||
"title": "Web View"
|
||||
}
|
||||
],
|
||||
"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."
|
||||
]
|
||||
"views": {
|
||||
"kanban-sidebar-view": [
|
||||
{
|
||||
"contextualTitle": "Kanban",
|
||||
"icon": "media/checklist.svg",
|
||||
"id": "kanban-sidebar",
|
||||
"name": "Kanban",
|
||||
"type": "webview"
|
||||
}
|
||||
},
|
||||
"title": "Cost of Delay Helper Configuration",
|
||||
"type": "object"
|
||||
]
|
||||
},
|
||||
"viewsContainers": {
|
||||
"activitybar": [
|
||||
{
|
||||
"icon": "media/checklist.svg",
|
||||
"id": "kanban-sidebar-view",
|
||||
"title": "Kanban"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@vscode/vsce": "^3.2.1",
|
||||
"@vscode/vsce": "^2.19.0",
|
||||
"polka": "^0.5.2"
|
||||
},
|
||||
"description": "Cost of Delay Helper",
|
||||
"description": "Helper for VS Code in TypeScript",
|
||||
"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"
|
||||
"@rollup/plugin-commonjs": "^25.0.4",
|
||||
"@rollup/plugin-node-resolve": "^15.2.1",
|
||||
"@rollup/plugin-typescript": "^11.1.4",
|
||||
"@tsconfig/svelte": "^1.0.10",
|
||||
"@types/glob": "^8.1.0",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@types/node": "20.2.5",
|
||||
"@types/polka": "^0.5.1",
|
||||
"@types/vscode": "^1.79.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
||||
"@typescript-eslint/parser": "^5.59.8",
|
||||
"@vscode/test-electron": "^2.3.2",
|
||||
"concurrently": "^8.2.1",
|
||||
"eslint": "^8.41.0",
|
||||
"glob": "^8.1.0",
|
||||
"mocha": "^10.2.0",
|
||||
"rollup": "^2.3.4",
|
||||
"rollup-plugin-svelte": "^6.1.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"svelte": "^3.31.0",
|
||||
"svelte-check": "^1.1.23",
|
||||
"svelte-preprocess": "^5.0.4",
|
||||
"ts-loader": "^9.4.3",
|
||||
"typescript": "^5.1.3",
|
||||
"webpack": "^5.85.0",
|
||||
"webpack-cli": "^5.1.1"
|
||||
},
|
||||
"displayName": "Cost of Delay Helper",
|
||||
"displayName": "Type Script Helper",
|
||||
"engines": {
|
||||
"vscode": "^1.79.0"
|
||||
},
|
||||
"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",
|
||||
"name": "type-script-helper",
|
||||
"publisher": "IFX",
|
||||
"repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper",
|
||||
"scripts": {
|
||||
"tsc-build": "tsc",
|
||||
"tsc-clean": "tsc --build --clean",
|
||||
"vscode:package": "node node_modules/@vscode/vsce/vsce package",
|
||||
"vscode:login": "node node_modules/@vscode/vsce/vsce login Infineon-Technologies-AG-Mesa-FI",
|
||||
"vscode:ls-publishers": "node node_modules/@vscode/vsce/vsce ls-publishers",
|
||||
"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"
|
||||
"compile": "webpack --config ./build/node-extension.webpack.config.js",
|
||||
"lint": "eslint src --ext ts",
|
||||
"package": "webpack --mode production --devtool hidden-source-map --config ./build/node-extension.webpack.config.js",
|
||||
"pretest": "npm run test-compile && npm run lint",
|
||||
"rollup:compile": "rollup -c && webpack --mode production",
|
||||
"test": "node ./out/test/runTest.js",
|
||||
"test-compile": "tsc -p ./",
|
||||
"test-watch": "tsc -watch -p ./",
|
||||
"vscode:prepublish": "npm run package",
|
||||
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\""
|
||||
},
|
||||
"version": "1.119.0"
|
||||
"version": "1.5.1"
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
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;
|
||||
};
|
@ -1,188 +0,0 @@
|
||||
import { Card } from "./Card";
|
||||
import { readFile } from "fs";
|
||||
import * as vscode from "vscode";
|
||||
import { getNonce } from "./getNonce";
|
||||
import { PostMessage } from "./PostMessage";
|
||||
import { apiBaseUrl, key } from "./constants";
|
||||
import { ExecException, exec } from 'child_process';
|
||||
|
||||
export function refreshSidebarLogic(): any {
|
||||
vscode.commands.executeCommand("workbench.action.closeSidebar").then(_ => {
|
||||
vscode.commands.executeCommand("workbench.view.extension.columns-to-cards-sidebar-view");
|
||||
});
|
||||
}
|
||||
|
||||
function columnsToCardsRead(webviewView: vscode.WebviewView, columnsToCardsUri: vscode.Uri, err: NodeJS.ErrnoException | null, data: string | Buffer) {
|
||||
if (err)
|
||||
vscode.window.showInformationMessage(`<${columnsToCardsUri.fsPath}> doesn't exist! ${err.message}`);
|
||||
const columnsToCards: Record<string, Array<Card>> = {};
|
||||
const jsonObject: any = JSON.parse(data.toString('utf8'));
|
||||
for (const property in jsonObject) {
|
||||
columnsToCards[property] = jsonObject[property];
|
||||
}
|
||||
const postMessage: PostMessage = { type: "columns-to-cards", value: columnsToCards };
|
||||
webviewView.webview.postMessage(postMessage);
|
||||
}
|
||||
|
||||
function execCallback(webviewView: vscode.WebviewView, destination: vscode.Uri, error: ExecException | null, stdout: string, stderr: string) {
|
||||
if (error) {
|
||||
vscode.window.showInformationMessage(error.message);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
vscode.window.showInformationMessage(stderr);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
const columnsToCards = vscode.Uri.joinPath(destination, "columnsToCards.json");
|
||||
readFile(columnsToCards.fsPath, (err, data) =>
|
||||
columnsToCardsRead(webviewView, columnsToCards, err, data));
|
||||
};
|
||||
|
||||
async function postColumnsToCards(extensionUri: vscode.Uri, webviewView: vscode.WebviewView) {
|
||||
if (vscode.workspace.workspaceFolders === undefined)
|
||||
vscode.window.showInformationMessage("Open workspace first!");
|
||||
else {
|
||||
const workspaceFoldersZero = vscode.workspace.workspaceFolders[0].uri;
|
||||
const destination: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, ".vscode", "helper");
|
||||
const fileFolderHelper: vscode.Uri = vscode.Uri.joinPath(extensionUri, "net8.0", "win-x64", "publish", "File-Folder-Helper.exe");
|
||||
const command: string = `${fileFolderHelper.fsPath} s M "${workspaceFoldersZero.fsPath}" -d "${destination.fsPath}"`;
|
||||
exec(command, (error, stdout, stderr) =>
|
||||
execCallback(webviewView, destination, error, stdout, stderr));
|
||||
}
|
||||
}
|
||||
|
||||
function getToken(workspaceState: vscode.Memento, webviewView: vscode.WebviewView) {
|
||||
webviewView.webview.postMessage({
|
||||
type: "token",
|
||||
value: workspaceState.get(key),
|
||||
});
|
||||
}
|
||||
|
||||
function authenticate(workspaceState: vscode.Memento, webviewView: vscode.WebviewView) {
|
||||
webviewView.webview.postMessage({
|
||||
type: "token",
|
||||
value: workspaceState.get(key),
|
||||
});
|
||||
}
|
||||
|
||||
function logout(workspaceState: vscode.Memento) {
|
||||
workspaceState.update(key, "");
|
||||
}
|
||||
|
||||
async function openCard(value: any) {
|
||||
if (vscode.workspace.workspaceFolders === undefined)
|
||||
vscode.window.showInformationMessage("Open workspace first!");
|
||||
else {
|
||||
if (!value.File)
|
||||
vscode.window.showInformationMessage("File wasn't passed!");
|
||||
else {
|
||||
const textDocument: vscode.TextDocument = await vscode.workspace.openTextDocument(value.File);
|
||||
vscode.window.showTextDocument(textDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ColumnsToCardsWebviewViewProvider implements vscode.WebviewViewProvider {
|
||||
_view?: vscode.WebviewView;
|
||||
|
||||
constructor(private readonly _extensionContext: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
public revive(panel: vscode.WebviewView) {
|
||||
this._view = panel;
|
||||
}
|
||||
|
||||
public resolveWebviewView(webviewView: vscode.WebviewView) {
|
||||
this._view = webviewView;
|
||||
|
||||
webviewView.webview.options = {
|
||||
// Allow scripts in the webview
|
||||
enableScripts: true,
|
||||
|
||||
localResourceRoots: [this._extensionContext.extensionUri],
|
||||
};
|
||||
|
||||
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
|
||||
|
||||
webviewView.webview.onDidReceiveMessage(async (postMessage: PostMessage) => {
|
||||
switch (postMessage.type) {
|
||||
case "logout":
|
||||
logout(this._extensionContext.workspaceState);
|
||||
break;
|
||||
case "authenticate":
|
||||
authenticate(this._extensionContext.workspaceState, webviewView);
|
||||
break;
|
||||
case "get-token":
|
||||
getToken(this._extensionContext.workspaceState, webviewView);
|
||||
break;
|
||||
case "get-columns-to-cards":
|
||||
postColumnsToCards(this._extensionContext.extensionUri, webviewView);
|
||||
break;
|
||||
case "open-card":
|
||||
openCard(postMessage.value);
|
||||
break;
|
||||
case "on-info":
|
||||
if (!postMessage.value)
|
||||
return;
|
||||
vscode.window.showInformationMessage(postMessage.value);
|
||||
break;
|
||||
case "on-error":
|
||||
if (!postMessage.value)
|
||||
return;
|
||||
vscode.window.showErrorMessage(postMessage.value);
|
||||
break;
|
||||
default:
|
||||
vscode.window.showErrorMessage(postMessage.type);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private _getHtmlForWebview(webview: vscode.Webview) {
|
||||
const styleResetUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "reset.css")
|
||||
);
|
||||
const styleVSCodeUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "vscode.css")
|
||||
);
|
||||
|
||||
const scriptUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/ColumnsToCards.js")
|
||||
);
|
||||
const styleMainUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/ColumnsToCards.css")
|
||||
);
|
||||
|
||||
// Use a nonce to only allow a specific script to be run.
|
||||
const nonce = getNonce();
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!--
|
||||
Use a content security policy to only allow loading images from https or from our extension directory,
|
||||
and only allow scripts that have a specific nonce.
|
||||
-->
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="img-src https: data:;
|
||||
style-src 'unsafe-inline' ${webview.cspSource};
|
||||
script-src 'nonce-${nonce}';">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="${styleResetUri}" rel="stylesheet">
|
||||
<link href="${styleVSCodeUri}" rel="stylesheet">
|
||||
<link href="${styleMainUri}" rel="stylesheet">
|
||||
<script nonce="${nonce}">
|
||||
const acquiredVsCodeApi = acquireVsCodeApi();
|
||||
const apiBaseUrl = ${JSON.stringify(apiBaseUrl)}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script nonce="${nonce}" src="${scriptUri}"></script>
|
||||
</body>
|
||||
</html>`;
|
||||
}
|
||||
}
|
||||
|
||||
export const refreshSidebar = () => refreshSidebarLogic();
|
@ -1,4 +0,0 @@
|
||||
export type H2HexColor = {
|
||||
H2: string;
|
||||
HexColor: string;
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
|
||||
export type H2NoCheckboxes = {
|
||||
H2: string;
|
||||
Lines: Array<string>;
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
|
||||
export type H2WithCheckboxes = {
|
||||
Completed: number;
|
||||
H2: string;
|
||||
NotCompleted: number;
|
||||
Total: number;
|
||||
};
|
@ -1,9 +0,0 @@
|
||||
|
||||
export type LineNumber = {
|
||||
Created: number;
|
||||
H1: number;
|
||||
FrontMatterYamlEnd: number;
|
||||
Status: number;
|
||||
Type: number;
|
||||
Updated: number;
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
|
||||
export type PostMessage = {
|
||||
type: string;
|
||||
value: any;
|
||||
};
|
115
type-script-helper/src/SidebarProvider.ts
Normal file
115
type-script-helper/src/SidebarProvider.ts
Normal file
@ -0,0 +1,115 @@
|
||||
import * as vscode from "vscode";
|
||||
// import { authenticate } from "./authenticate";
|
||||
import { apiBaseUrl } from "./constants";
|
||||
import { key } from "./constants";
|
||||
import { getNonce } from "./getNonce";
|
||||
|
||||
export class SidebarProvider implements vscode.WebviewViewProvider {
|
||||
_view?: vscode.WebviewView;
|
||||
_doc?: vscode.TextDocument;
|
||||
|
||||
constructor(private readonly _extensionContext: vscode.ExtensionContext) { }
|
||||
|
||||
public resolveWebviewView(webviewView: vscode.WebviewView) {
|
||||
this._view = webviewView;
|
||||
|
||||
webviewView.webview.options = {
|
||||
// Allow scripts in the webview
|
||||
enableScripts: true,
|
||||
|
||||
localResourceRoots: [this._extensionContext.extensionUri],
|
||||
};
|
||||
|
||||
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
|
||||
|
||||
webviewView.webview.onDidReceiveMessage(async (data) => {
|
||||
switch (data.type) {
|
||||
case "logout": {
|
||||
this._extensionContext.workspaceState.update(key, "");
|
||||
break;
|
||||
}
|
||||
case "authenticate": {
|
||||
// authenticate(this._extensionContext, () => {
|
||||
// webviewView.webview.postMessage({
|
||||
// type: "token",
|
||||
// value: this._extensionContext.workspaceState.get(key),
|
||||
// });
|
||||
// });
|
||||
webviewView.webview.postMessage({
|
||||
type: "token",
|
||||
value: this._extensionContext.workspaceState.get(key),
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "get-token": {
|
||||
webviewView.webview.postMessage({
|
||||
type: "token",
|
||||
value: this._extensionContext.workspaceState.get(key),
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "onInfo": {
|
||||
if (!data.value) {
|
||||
return;
|
||||
}
|
||||
vscode.window.showInformationMessage(data.value);
|
||||
break;
|
||||
}
|
||||
case "onError": {
|
||||
if (!data.value) {
|
||||
return;
|
||||
}
|
||||
vscode.window.showErrorMessage(data.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public revive(panel: vscode.WebviewView) {
|
||||
this._view = panel;
|
||||
}
|
||||
|
||||
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/sidebar.js")
|
||||
);
|
||||
const styleMainUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/sidebar.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>`;
|
||||
}
|
||||
}
|
165
type-script-helper/src/WebViewPanel.ts
Normal file
165
type-script-helper/src/WebViewPanel.ts
Normal file
@ -0,0 +1,165 @@
|
||||
import * as vscode from "vscode";
|
||||
import { getNonce } from "./getNonce";
|
||||
|
||||
export class WebViewPanel {
|
||||
/**
|
||||
* Track the currently panel. Only allow a single panel to exist at a time.
|
||||
*/
|
||||
public static currentPanel: WebViewPanel | undefined;
|
||||
|
||||
public static readonly viewType = "web-view-panel";
|
||||
|
||||
private readonly _panel: vscode.WebviewPanel;
|
||||
private readonly _extensionUri: vscode.Uri;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
public static createOrShow(extensionUri: vscode.Uri) {
|
||||
const column = vscode.window.activeTextEditor
|
||||
? vscode.window.activeTextEditor.viewColumn
|
||||
: undefined;
|
||||
|
||||
// If we already have a panel, show it.
|
||||
if (WebViewPanel.currentPanel) {
|
||||
WebViewPanel.currentPanel._panel.reveal(column);
|
||||
WebViewPanel.currentPanel._update();
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, create a new panel.
|
||||
const panel = vscode.window.createWebviewPanel(
|
||||
WebViewPanel.viewType,
|
||||
"Web-View-Panel",
|
||||
column || vscode.ViewColumn.One,
|
||||
{
|
||||
// Enable javascript in the webview
|
||||
enableScripts: true,
|
||||
|
||||
// And restrict the webview to only loading content from our extension's `media` directory.
|
||||
localResourceRoots: [
|
||||
vscode.Uri.joinPath(extensionUri, "media"),
|
||||
vscode.Uri.joinPath(extensionUri, "out/compiled"),
|
||||
],
|
||||
}
|
||||
);
|
||||
|
||||
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionUri);
|
||||
}
|
||||
|
||||
public static kill() {
|
||||
WebViewPanel.currentPanel?.dispose();
|
||||
WebViewPanel.currentPanel = undefined;
|
||||
}
|
||||
|
||||
public static revive(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) {
|
||||
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionUri);
|
||||
}
|
||||
|
||||
private constructor(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) {
|
||||
this._panel = panel;
|
||||
this._extensionUri = extensionUri;
|
||||
|
||||
// Set the webview's initial html content
|
||||
this._update();
|
||||
|
||||
// Listen for when the panel is disposed
|
||||
// This happens when the user closes the panel or when the panel is closed programmatically
|
||||
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
|
||||
|
||||
// // Handle messages from the webview
|
||||
// this._panel.webview.onDidReceiveMessage(
|
||||
// (message) => {
|
||||
// switch (message.command) {
|
||||
// case "alert":
|
||||
// vscode.window.showErrorMessage(message.text);
|
||||
// return;
|
||||
// }
|
||||
// },
|
||||
// null,
|
||||
// this._disposables
|
||||
// );
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
WebViewPanel.currentPanel = undefined;
|
||||
|
||||
// Clean up our resources
|
||||
this._panel.dispose();
|
||||
|
||||
while (this._disposables.length) {
|
||||
const x = this._disposables.pop();
|
||||
if (x) {
|
||||
x.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async _update() {
|
||||
const webview = this._panel.webview;
|
||||
|
||||
this._panel.webview.html = this._getHtmlForWebview(webview);
|
||||
webview.onDidReceiveMessage(async (data) => {
|
||||
switch (data.type) {
|
||||
case "onInfo": {
|
||||
if (!data.value) {
|
||||
return;
|
||||
}
|
||||
vscode.window.showInformationMessage(data.value);
|
||||
break;
|
||||
}
|
||||
case "onError": {
|
||||
if (!data.value) {
|
||||
return;
|
||||
}
|
||||
vscode.window.showErrorMessage(data.value);
|
||||
break;
|
||||
}
|
||||
// case "tokens": {
|
||||
// await Util.globalState.update(accessTokenKey, data.accessToken);
|
||||
// await Util.globalState.update(refreshTokenKey, data.refreshToken);
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private _getHtmlForWebview(webview: vscode.Webview) {
|
||||
// // And the uri we use to load this script in the webview
|
||||
const scriptUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionUri, "out/compiled", "WebView.js")
|
||||
);
|
||||
|
||||
// Uri to load styles into webview
|
||||
const stylesResetUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionUri, "media", "reset.css")
|
||||
);
|
||||
const stylesMainUri = webview.asWebviewUri(
|
||||
vscode.Uri.joinPath(this._extensionUri, "media", "vscode.css")
|
||||
);
|
||||
// const cssUri = webview.asWebviewUri(
|
||||
// vscode.Uri.joinPath(this._extensionUri, "out", "compiled/swiper.css")
|
||||
// );
|
||||
|
||||
// // Use a nonce to only allow specific scripts 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="${stylesResetUri}" rel="stylesheet">
|
||||
<link href="${stylesMainUri}" rel="stylesheet">
|
||||
<script nonce="${nonce}">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
<script src="${scriptUri}" nonce="${nonce}">
|
||||
</html>`;
|
||||
}
|
||||
}
|
@ -1,236 +0,0 @@
|
||||
import * as vscode from "vscode";
|
||||
import { getNonce } from "./getNonce";
|
||||
import { apiBaseUrl } from "./constants";
|
||||
import { PostMessage } from "./PostMessage";
|
||||
import { title } from "process";
|
||||
|
||||
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,
|
||||
|
||||
// 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;
|
||||
// }
|
||||
// },
|
||||
// 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 (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(site: string, title: string, view: string, webview: vscode.Webview) {
|
||||
const baseUri = 'https://eaf-dev.mes.infineon.com';
|
||||
|
||||
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")
|
||||
);
|
||||
|
||||
// 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">
|
||||
<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}/signalr/hubs"></script>
|
||||
<script nonce="${nonce}" src="${baseUri}/js/cod-b.js?v=2025-01-22-10-49" type="text/javascript"></script>
|
||||
<script nonce="${nonce}">
|
||||
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"> </span> -
|
||||
<span id="th-span"> </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">
|
||||
|
||||
</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 />
|
||||
|
||||
<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>`;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,166 +0,0 @@
|
||||
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,
|
||||
|
||||
// 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>`;
|
||||
}
|
||||
}
|
34
type-script-helper/src/authenticate.ts
Normal file
34
type-script-helper/src/authenticate.ts
Normal file
@ -0,0 +1,34 @@
|
||||
// import * as vscode from "vscode";
|
||||
// import { apiBaseUrl } from "./constants";
|
||||
// import { key } from "./constants";
|
||||
// import * as polka from "polka";
|
||||
|
||||
// export const authenticate = (extensionContext: vscode.ExtensionContext, fn: () => void) => {
|
||||
// const app = polka();
|
||||
|
||||
// app.get(`/auth/:token`, async (req, res) => {
|
||||
// const { token } = req.params;
|
||||
// if (!token) {
|
||||
// res.end(`<h1>something went wrong</h1>`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// await extensionContext.workspaceState.update(key, token);
|
||||
// fn();
|
||||
|
||||
// res.end(`<h1>auth was successful, you can close this now</h1>`);
|
||||
|
||||
// (app as any).server.close();
|
||||
// });
|
||||
|
||||
// app.listen(54321, (err: Error) => {
|
||||
// if (err) {
|
||||
// vscode.window.showErrorMessage(err.message);
|
||||
// } else {
|
||||
// vscode.commands.executeCommand(
|
||||
// "vscode.open",
|
||||
// vscode.Uri.parse(`${apiBaseUrl}/auth/github`)
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// };
|
@ -1,193 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,2 +1,2 @@
|
||||
export const apiBaseUrl: string = "http://localhost:3002";
|
||||
export const key: string = "type-script-helper";
|
||||
export const key = "type-script-helper";
|
||||
export const apiBaseUrl = "http://localhost:3002";
|
||||
|
@ -1,37 +0,0 @@
|
||||
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();
|
@ -1,144 +1,48 @@
|
||||
// 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 WebviewPanelCostOfDelay from './WebviewPanelCostOfDelay';
|
||||
import * as ColumnsToCardsWebviewViewProvider from './ColumnsToCardsWebviewViewProvider';
|
||||
import * as promiseLinesHelper from './promiseLinesHelper';
|
||||
import { SidebarProvider } from "./SidebarProvider";
|
||||
import { WebViewPanel } from "./WebViewPanel";
|
||||
|
||||
// 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 columnsToCardsWebviewViewProvider = new ColumnsToCardsWebviewViewProvider.ColumnsToCardsWebviewViewProvider(extensionContext);
|
||||
const sidebarProvider = new SidebarProvider(extensionContext);
|
||||
|
||||
const item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
||||
item.text = "$(beaker) Show Kanban";
|
||||
// item.command = "kanban.show";
|
||||
item.show();
|
||||
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("columns-to-cards-webview-view-provider", columnsToCardsWebviewViewProvider));
|
||||
|
||||
const config = vscode.workspace.getConfiguration('calc');
|
||||
const outputChannel = vscode.window.createOutputChannel('calc');
|
||||
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("kanban-sidebar", sidebarProvider));
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
// Use the console to output diagnostic information (console.log) and errors (console.error)
|
||||
// This line of code will only be executed once when your extension is activated
|
||||
console.log('Congratulations, your extension "type-script-helper" is now active!');
|
||||
|
||||
const calcProvider = new Calculator.CalcProvider(config, onError);
|
||||
// // The command has been defined in the package.json file
|
||||
// // Now provide the implementation of the command with registerCommand
|
||||
// // The commandId parameter must match the command field in package.json
|
||||
// let disposable = vscode.commands.registerCommand('type-script-helper.helloWorld', () => {
|
||||
// // The code you place here will be executed every time your command is executed
|
||||
// // Display a message box to the user
|
||||
// vscode.window.showInformationMessage('Hello World from type-script-helper!');
|
||||
// });
|
||||
|
||||
extensionContext.subscriptions.push(
|
||||
vscode.languages.registerCompletionItemProvider('*', calcProvider, '=', ' '),
|
||||
vscode.workspace.onDidOpenTextDocument(() => {
|
||||
calcProvider.clearHighlight().catch(onError);
|
||||
}),
|
||||
vscode.window.onDidChangeTextEditorSelection(() => {
|
||||
calcProvider.clearHighlight().catch(onError);
|
||||
}),
|
||||
);
|
||||
|
||||
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);
|
||||
}),
|
||||
);
|
||||
// context.subscriptions.push(disposable);
|
||||
|
||||
const commands = [
|
||||
vscode.commands.registerCommand("copyHelper.copySyntaxInLight", copyHelper.copySyntaxInLight),
|
||||
vscode.commands.registerCommand("extension.rotateExplorerSortOrder", settingsHelper.rotateExplorerSortOrder),
|
||||
vscode.commands.registerCommand("kanban.refreshBoth", () => { kanbanHelper.refreshBoth(extensionContext); }),
|
||||
vscode.commands.registerCommand("kanban.refreshSidebar", ColumnsToCardsWebviewViewProvider.refreshSidebar),
|
||||
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
|
||||
vscode.commands.registerCommand("kanban.openInNewWindow", kanbanHelper.openInNewWindow),
|
||||
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
|
||||
// vscode.commands.registerCommand("kanban.apiAuthenticate", kanbanHelper.apiAuthenticate(extensionContext)),
|
||||
vscode.commands.registerCommand("kanban.newEntry", kanbanHelper.newEntry(sidebarProvider)),
|
||||
vscode.commands.registerCommand("kanban.refresh", await kanbanHelper.refresh()),
|
||||
// vscode.commands.registerCommand("kanban.debugReload", await kanbanHelper.debugReload(extensionContext)),
|
||||
vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
|
||||
vscode.commands.registerCommand('promiseLinesHelper.genericFileFolderHelper', promiseLinesHelper.genericFileFolderHelper),
|
||||
vscode.commands.registerCommand('promiseLinesHelper.insertDateTime', promiseLinesHelper.insertDateTime),
|
||||
vscode.commands.registerCommand("promiseLinesHelper.insertAllExtensions", promiseLinesHelper.insertAllExtensions),
|
||||
vscode.commands.registerCommand('promiseLinesHelper.transformToPopperCase', promiseLinesHelper.transformToPopperCase),
|
||||
vscode.commands.registerCommand('promiseLinesHelper.transformToParamCase', promiseLinesHelper.transformToParamCase),
|
||||
vscode.commands.registerCommand('readOnlyLinesHelper.searchGoogle', readOnlyLinesHelper.searchGoogle),
|
||||
@ -163,17 +67,7 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
|
||||
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.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); })
|
||||
vscode.commands.registerCommand("webView.webView", () => { WebViewPanel.createOrShow(extensionContext.extensionUri); })
|
||||
];
|
||||
|
||||
commands.forEach(command => extensionContext.subscriptions.push(command));
|
||||
|
@ -1,132 +1,40 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { paramCase } from './promiseLinesHelper';
|
||||
import { refreshSidebar } from './ColumnsToCardsWebviewViewProvider';
|
||||
// import { authenticate } from "./authenticate";
|
||||
import { SidebarProvider } from './SidebarProvider';
|
||||
// import { WebViewPanel } from "./WebViewPanel";
|
||||
|
||||
export function refreshBoth(extensionContext: vscode.ExtensionContext): any {
|
||||
refreshSidebar();
|
||||
setTimeout(() => { vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools"); }, 500);
|
||||
}
|
||||
|
||||
async function updateWithLogic(textDocument: vscode.TextDocument) {
|
||||
await vscode.window.showTextDocument(textDocument);
|
||||
const textEditor = vscode.window.activeTextEditor;
|
||||
if (!textEditor) {
|
||||
return undefined;
|
||||
export function newEntry(sidebarProvider: SidebarProvider): any {
|
||||
const { activeTextEditor } = vscode.window;
|
||||
if (!activeTextEditor) {
|
||||
vscode.window.showInformationMessage("No active text editor");
|
||||
return;
|
||||
}
|
||||
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);
|
||||
const text = activeTextEditor.document.getText(
|
||||
activeTextEditor.selection
|
||||
);
|
||||
sidebarProvider._view?.webview.postMessage({
|
||||
type: "new-entry",
|
||||
value: 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]);
|
||||
}
|
||||
}
|
||||
// export function apiAuthenticate(extensionContext: vscode.ExtensionContext): any {
|
||||
// try {
|
||||
// authenticate(extensionContext, () => { });
|
||||
// } catch (err) {
|
||||
// console.log(err);
|
||||
// }
|
||||
// }
|
||||
|
||||
export async function refresh(): Promise<any> {
|
||||
await vscode.commands.executeCommand("workbench.action.closeSidebar");
|
||||
await vscode.commands.executeCommand("workbench.view.extension.kanban-sidebar-view");
|
||||
}
|
||||
|
||||
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();
|
||||
// export async function debugReload(extensionContext: vscode.ExtensionContext): Promise<any> {
|
||||
// WebViewPanel.kill();
|
||||
// WebViewPanel.createOrShow(extensionContext.extensionUri);
|
||||
// await vscode.commands.executeCommand("workbench.action.closeSidebar");
|
||||
// await vscode.commands.executeCommand("workbench.view.extension.kanban-sidebar-view");
|
||||
// setTimeout(() => { vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools"); }, 500);
|
||||
// }
|
||||
|
@ -1,22 +0,0 @@
|
||||
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();
|
@ -133,107 +133,21 @@ function insertDateTimeLogic(): undefined {
|
||||
if (!textEditor) {
|
||||
return undefined;
|
||||
}
|
||||
const date = new Date();
|
||||
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)
|
||||
editBuilder.insert(selection.start, date.toString())
|
||||
}
|
||||
else {
|
||||
range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
|
||||
editBuilder.replace(range, dateText);
|
||||
editBuilder.replace(range, date.toString());
|
||||
}
|
||||
});
|
||||
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 genericFileFolderHelperLogic(): undefined {
|
||||
const textEditor = vscode.window.activeTextEditor;
|
||||
if (!textEditor) {
|
||||
vscode.window.showInformationMessage("Open a text editor first!");
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
const selection = textEditor.selection;
|
||||
if (selection.isEmpty) {
|
||||
vscode.window.showInformationMessage("Highlight text to pass first!");
|
||||
return undefined;
|
||||
}
|
||||
let range = new vscode.Range(selection.start, selection.end)
|
||||
let text = textEditor.document.getText(range);
|
||||
if (vscode.workspace.workspaceFolders === undefined) {
|
||||
vscode.window.showInformationMessage("Open workspace first!");
|
||||
return undefined;
|
||||
}
|
||||
const workspaceFoldersZero = vscode.workspace.workspaceFolders[0].uri;
|
||||
const jsonFile: vscode.Uri = vscode.Uri.joinPath(workspaceFoldersZero, ".vscode", "helper", ".json");
|
||||
let data = {
|
||||
workspaceFoldersZero: workspaceFoldersZero.path,
|
||||
text: text,
|
||||
};
|
||||
let json = JSON.stringify(data);
|
||||
const buffer: Buffer = Buffer.from(json, 'utf8');
|
||||
vscode.workspace.fs.writeFile(jsonFile, buffer);
|
||||
textEditor.edit(editBuilder => {
|
||||
let range = new vscode.Range(selection.start.line, selection.start.character, selection.end.line, selection.end.character);
|
||||
editBuilder.replace(range, "");
|
||||
});
|
||||
textEditor.document.save();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function camelCase(str: string) {
|
||||
return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
|
||||
if (+match === 0) return "";
|
||||
@ -263,7 +177,7 @@ function transformToPopperCaseLogic(): undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function paramCase(str: string) {
|
||||
function paramCase(str: string) {
|
||||
return str
|
||||
.replace(
|
||||
/([A-Z]+(.))/g,
|
||||
@ -296,8 +210,6 @@ function transformToParamCaseLogic(): undefined {
|
||||
}
|
||||
|
||||
export const codeGeneratorQuickPick = () => codeGeneratorQuickPickLogic();
|
||||
export const genericFileFolderHelper = () => genericFileFolderHelperLogic();
|
||||
export const insertDateTime = () => insertDateTimeLogic();
|
||||
export const insertAllExtensions = () => insertAllExtensionsLogic();
|
||||
export const transformToPopperCase = () => transformToPopperCaseLogic();
|
||||
export const transformToParamCase = () => transformToParamCaseLogic();
|
@ -1,29 +0,0 @@
|
||||
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();
|
23
type-script-helper/src/test/runTest.ts
Normal file
23
type-script-helper/src/test/runTest.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import * as path from 'path';
|
||||
|
||||
import { runTests } from '@vscode/test-electron';
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// The folder containing the Extension Manifest package.json
|
||||
// Passed to `--extensionDevelopmentPath`
|
||||
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
|
||||
|
||||
// The path to test runner
|
||||
// Passed to --extensionTestsPath
|
||||
const extensionTestsPath = path.resolve(__dirname, './suite/index');
|
||||
|
||||
// Download VS Code, unzip it and run the integration test
|
||||
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
||||
} catch (err) {
|
||||
console.error('Failed to run tests', err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
15
type-script-helper/src/test/suite/extension.test.ts
Normal file
15
type-script-helper/src/test/suite/extension.test.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
// You can import and use all API from the 'vscode' module
|
||||
// as well as import your extension to test it
|
||||
import * as vscode from 'vscode';
|
||||
// import * as myExtension from '../../extension';
|
||||
|
||||
suite('Extension Test Suite', () => {
|
||||
vscode.window.showInformationMessage('Start all tests.');
|
||||
|
||||
test('Sample test', () => {
|
||||
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
|
||||
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
|
||||
});
|
||||
});
|
38
type-script-helper/src/test/suite/index.ts
Normal file
38
type-script-helper/src/test/suite/index.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import * as path from 'path';
|
||||
import * as Mocha from 'mocha';
|
||||
import * as glob from 'glob';
|
||||
|
||||
export function run(): Promise<void> {
|
||||
// Create the mocha test
|
||||
const mocha = new Mocha({
|
||||
ui: 'tdd',
|
||||
color: true
|
||||
});
|
||||
|
||||
const testsRoot = path.resolve(__dirname, '..');
|
||||
|
||||
return new Promise((c, e) => {
|
||||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
|
||||
if (err) {
|
||||
return e(err);
|
||||
}
|
||||
|
||||
// Add files to the test suite
|
||||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
|
||||
|
||||
try {
|
||||
// Run the mocha test
|
||||
mocha.run(failures => {
|
||||
if (failures > 0) {
|
||||
e(new Error(`${failures} tests failed.`));
|
||||
} else {
|
||||
c();
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
e(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["./node_modules/@types"],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"lib": [
|
||||
"ES2020"
|
||||
|
@ -1,11 +1,3 @@
|
||||
---
|
||||
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
|
||||
|
@ -1,25 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Card } from "../../src/Card";
|
||||
|
||||
export let key: string;
|
||||
export let card: Card;
|
||||
export let index: number;
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore missing-declaration -->
|
||||
<li id={index.toString()}>
|
||||
<!-- svelte-ignore a11y-invalid-attribute -->
|
||||
<a
|
||||
href="#{index.toString()}"
|
||||
title="{key}"
|
||||
on:click={async () => {
|
||||
acquiredVsCodeApi.postMessage({
|
||||
type: "open-card",
|
||||
value: { File: card.File },
|
||||
});
|
||||
}}
|
||||
>
|
||||
{card.H1}
|
||||
</a>
|
||||
</li>
|
@ -1,19 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Card } from "../../src/Card";
|
||||
import CardComponent from "./CardComponent.svelte";
|
||||
|
||||
export let key: string = "";
|
||||
export let value: Array<Card> = [];
|
||||
</script>
|
||||
|
||||
{#if !value}
|
||||
<div>loading...</div>
|
||||
{:else}
|
||||
<hr>
|
||||
<h1>{key}</h1>
|
||||
<ul>
|
||||
{#each value as card, index}
|
||||
<CardComponent {key} {card} {index} />
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
@ -1,33 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import Cards from "./Cards.svelte";
|
||||
import type { Card } from "../../src/Card";
|
||||
import type { PostMessage } from "../../src/PostMessage";
|
||||
|
||||
let columnsToCards: Record<string, Array<Card>> = {};
|
||||
|
||||
onMount(async () => {
|
||||
window.addEventListener("message", async (event) => {
|
||||
const postMessage: PostMessage = event.data;
|
||||
switch (postMessage.type) {
|
||||
case "columns-to-cards": {
|
||||
columnsToCards = postMessage.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
const postMessage: PostMessage = {
|
||||
type: "get-columns-to-cards",
|
||||
value: undefined,
|
||||
};
|
||||
acquiredVsCodeApi.postMessage(postMessage);
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if Object.entries(columnsToCards).length == 0}
|
||||
<div>loading...</div>
|
||||
{:else}
|
||||
{#each Object.entries(columnsToCards) as [key, value], index (key)}
|
||||
<Cards {key} {value} />
|
||||
{/each}
|
||||
{/if}
|
@ -1,4 +0,0 @@
|
||||
<script lang="ts">
|
||||
</script>
|
||||
|
||||
<h1>2023-09-23-15-20</h1>
|
87
type-script-helper/webviews/components/Entries.svelte
Normal file
87
type-script-helper/webviews/components/Entries.svelte
Normal file
@ -0,0 +1,87 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import type { User } from "../types";
|
||||
import type { Entry } from "../types";
|
||||
|
||||
export let user: User;
|
||||
export let accessToken: string;
|
||||
let text = "";
|
||||
let entries: Array<Entry> = [];
|
||||
|
||||
async function addEntry(t: string) {
|
||||
const response = await fetch(`${apiBaseUrl}/entry`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
text: t,
|
||||
}),
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
const { entry } = await response.json();
|
||||
entries = [entry, ...entries];
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
window.addEventListener("message", async (event) => {
|
||||
const message = event.data;
|
||||
switch (message.type) {
|
||||
case "new-entry":
|
||||
addEntry(message.value);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
const response = await fetch(`${apiBaseUrl}/entry`, {
|
||||
headers: {
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
const payload = await response.json();
|
||||
entries = payload.entries;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div>Hello: {user.name}</div>
|
||||
|
||||
<form
|
||||
on:submit|preventDefault={async () => {
|
||||
addEntry(text);
|
||||
text = "";
|
||||
}}
|
||||
>
|
||||
<input bind:value={text} />
|
||||
</form>
|
||||
|
||||
<ul>
|
||||
{#each entries as entry (entry.id)}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore missing-declaration -->
|
||||
<li
|
||||
class:complete={entry.completed}
|
||||
on:click={async () => {
|
||||
entry.completed = !entry.completed;
|
||||
const response = await fetch(`${apiBaseUrl}/entry`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({
|
||||
id: entry.id,
|
||||
}),
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
console.log(await response.json());
|
||||
}}
|
||||
>
|
||||
{entry.text}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<style>
|
||||
.complete {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
</style>
|
70
type-script-helper/webviews/components/Sidebar.svelte
Normal file
70
type-script-helper/webviews/components/Sidebar.svelte
Normal file
@ -0,0 +1,70 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import type { User } from "../types";
|
||||
import Entries from "./Entries.svelte";
|
||||
|
||||
let accessToken = "";
|
||||
let loading = true;
|
||||
let user: User | null = null;
|
||||
let page: "entries" | "contact" =
|
||||
acquiredVsCodeApi.getState()?.page || "entries";
|
||||
|
||||
$: {
|
||||
acquiredVsCodeApi.setState({ page });
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
window.addEventListener("message", async (event) => {
|
||||
const message = event.data;
|
||||
switch (message.type) {
|
||||
case "token":
|
||||
accessToken = message.value;
|
||||
const response = await fetch(`${apiBaseUrl}/me`, {
|
||||
headers: {
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
const data = await response.json();
|
||||
user = data.user;
|
||||
loading = false;
|
||||
}
|
||||
});
|
||||
|
||||
acquiredVsCodeApi.postMessage({ type: "get-token", value: undefined });
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if loading}
|
||||
<div>loading...</div>
|
||||
{:else if user}
|
||||
{#if page === "entries"}
|
||||
<Entries {user} {accessToken} />
|
||||
<button
|
||||
on:click={() => {
|
||||
page = "contact";
|
||||
}}>go to contact</button
|
||||
>
|
||||
{:else}
|
||||
<div>Contact me here: adlkfjjqioefeqio</div>
|
||||
<button
|
||||
on:click={() => {
|
||||
page = "entries";
|
||||
}}>go back</button
|
||||
>
|
||||
{/if}
|
||||
<!-- svelte-ignore missing-declaration -->
|
||||
<button
|
||||
on:click={() => {
|
||||
accessToken = "";
|
||||
user = null;
|
||||
acquiredVsCodeApi.postMessage({ type: "logout", value: undefined });
|
||||
}}>logout</button
|
||||
>
|
||||
{:else}
|
||||
<!-- svelte-ignore missing-declaration -->
|
||||
<button
|
||||
on:click={() => {
|
||||
acquiredVsCodeApi.postMessage({ type: "authenticate", value: undefined });
|
||||
}}>login with GitHub</button
|
||||
>
|
||||
{/if}
|
4
type-script-helper/webviews/components/WebView.svelte
Normal file
4
type-script-helper/webviews/components/WebView.svelte
Normal file
@ -0,0 +1,4 @@
|
||||
<script lang="ts">
|
||||
</script>
|
||||
|
||||
<h1>WebView 2023-09-23-15-20</h1>
|
4
type-script-helper/webviews/globals.d.ts
vendored
4
type-script-helper/webviews/globals.d.ts
vendored
@ -1,10 +1,10 @@
|
||||
import * as _vscode from "vscode";
|
||||
import type { PostMessage } from "../types";
|
||||
|
||||
declare global {
|
||||
const acquiredVsCodeApi: {
|
||||
postMessage: (PostMessage) => void;
|
||||
postMessage: ({ type: string, value: any }) => void;
|
||||
getState: () => any;
|
||||
setState: (state: any) => void;
|
||||
};
|
||||
const apiBaseUrl: string;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import App from "../components/DisplayDate.svelte";
|
||||
import App from "../components/Sidebar.svelte";
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
@ -1,4 +1,4 @@
|
||||
import App from "../components/ColumnsToCards.svelte";
|
||||
import App from "../components/WebView.svelte";
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
11
type-script-helper/webviews/types.ts
Normal file
11
type-script-helper/webviews/types.ts
Normal file
@ -0,0 +1,11 @@
|
||||
export type User = {
|
||||
id: string;
|
||||
name: string;
|
||||
githubId: string;
|
||||
};
|
||||
|
||||
export type Entry = {
|
||||
text: string;
|
||||
completed: boolean;
|
||||
id: number;
|
||||
};
|
Reference in New Issue
Block a user