6 Commits

Author SHA1 Message Date
ed2cd40f59 ## 1.6.4 2024-08-02 13:38:14 -07:00
2eae9ad27d ## 1.6.2 2024-06-13 13:40:21 -07:00
a3321fcb20 ## 1.6.1 2024-05-01 17:17:14 -07:00
3c0b01091a ## 1.6.0 2024-05-01 11:39:49 -07:00
927db6dbd5 ## 1.5.3 2024-01-05 18:48:46 -07:00
929d4e1ccd ## 1.5.1 2023-09-29 19:14:53 -07:00
49 changed files with 4983 additions and 3410 deletions

39
.gitignore vendored
View File

@ -264,3 +264,42 @@ __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
View File

@ -1,20 +0,0 @@
// 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"
]
}
]
}

25
.vscode/settings.json vendored
View File

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

BIN
Application.evtx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -14,22 +14,16 @@
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
]
},
{
"name": "Extension Tests",
"type": "extensionHost",
"type": "node",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"name": "Launch Program",
"program": "${workspaceFolder}/src/extension.ts",
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "tasks: watch-tests"
"${workspaceFolder}/out/**/*.js"
]
}
]
}
}

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

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

View File

@ -1,13 +1,23 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"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"
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [
"initialise",
"Kanban",
"VSIX"
],
"files.eol": "\n",
"files.exclude": {
"**/dist": false,
"**/node_modules": true,
"**/out": false
},
"files.watcherExclude": {
"**/node_modules": true
},
"search.exclude": {
"**/dist": true,
"**/out": true
}
}

View File

@ -1,40 +0,0 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$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": []
}
]
}

View File

@ -1,13 +1,14 @@
.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.vscode-test/**
.vscode/**
.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

View File

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

View File

@ -1,3 +1,11 @@
---
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
@ -16,4 +24,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.

View File

@ -1,3 +1,9 @@
---
type: "read-me"
created: "2023-09-30T01:47:18.241Z"
updated: "2023-09-30T01:47:18.242Z"
---
# type-script-helper README
## Features
@ -16,7 +22,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? helloworld
# ? What's the identifier of your extension? hello-world
# ? What's the description of your extension? LEAVE BLANK
# ? Initialize a git repository? Yes
# ? Bundle the source code with webpack? No (should be yes?)
@ -108,4 +114,39 @@ None
## 1.5.1
-----------------------------------------------------------------------------------------------------------
- Webview
- 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

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,28 @@
"Other"
],
"contributes": {
"configuration": {
"type": "object",
"title": "Type Script Helper Configuration",
"properties": {
"fileTemplates.author": {
"type": [
"string",
"null"
],
"default": null,
"description": "Value to use to replace #{author} variable."
},
"fileTemplates.company": {
"type": [
"string",
"null"
],
"default": null,
"description": "Value to use to replace #{company} variable."
}
}
},
"commands": [
{
"category": "Helper",
@ -37,24 +59,34 @@
},
{
"category": "Kanban",
"command": "kanban.apiAuthenticate",
"title": "API Authenticate Kanban"
"command": "kanban.refreshBoth",
"title": "Refresh Kanban Both"
},
{
"category": "Kanban",
"command": "kanban.newEntry",
"title": "New Kanban Entry"
"command": "kanban.refreshSidebar",
"title": "Refresh Kanban Sidebar"
},
{
"category": "Kanban",
"command": "kanban.refresh",
"title": "Refresh Kanban"
"command": "kanban.refreshWebView",
"title": "Refresh Kanban WebView"
},
{
"category": "Kanban",
"command": "kanban.debugReload",
"title": "Debug Reload Kanban"
},
{
"category": "Kanban",
"command": "kanban.openWithTextEditor",
"title": "Open with Text Editor Kanban"
},
{
"category": "Markdown",
"command": "markdown.newMarkdownFile",
"title": "New Markdown File"
},
{
"category": "Quick Fix",
"command": "replaceLinesHelper.quickFixCamelCaseProperties",
@ -167,11 +199,11 @@
}
],
"views": {
"kanban-sidebar-view": [
"columns-to-cards-webview-view-provider-view": [
{
"contextualTitle": "Kanban",
"icon": "media/checklist.svg",
"id": "kanban-sidebar",
"id": "columns-to-cards-webview-view-provider",
"name": "Kanban",
"type": "webview"
}
@ -181,7 +213,7 @@
"activitybar": [
{
"icon": "media/checklist.svg",
"id": "kanban-sidebar-view",
"id": "columns-to-cards-webview-view-provider-view",
"title": "Kanban"
}
]
@ -193,32 +225,25 @@
},
"description": "Helper for VS Code in TypeScript",
"devDependencies": {
"@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"
"@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",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"glob": "^10.4.1",
"mocha": "^10.4.0",
"prettier": "^2.7.1",
"ts-loader": "^9.4.1",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"displayName": "Type Script Helper",
"engines": {
@ -229,16 +254,10 @@
"publisher": "IFX",
"repository": "https://github.com/mikepharesjr/YO-VSCode/tree/master/type-script-helper",
"scripts": {
"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",
"tsc-build": "tsc",
"vscode:publish": "node node_modules/@vscode/vsce/vsce package",
"webpack": "webpack --config ./build/node-extension.webpack.config.js",
"watch": "concurrently \"rollup -c -w\" \"webpack --watch --config ./build/node-extension.webpack.config.js\""
},
"version": "1.5.1"
}
"version": "1.6.4"
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,115 +0,0 @@
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>`;
}
}

View File

@ -1,5 +1,12 @@
import * as vscode from "vscode";
import { getNonce } from "./getNonce";
import { apiBaseUrl } from "./constants";
import { PostMessage } from "./PostMessage";
export function refreshWebView(extensionContext: vscode.ExtensionContext): any {
WebViewPanel.kill();
WebViewPanel.createOrShow(extensionContext);
}
export class WebViewPanel {
/**
@ -9,11 +16,9 @@ export class WebViewPanel {
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) {
public static createOrShow(extensionContext: vscode.ExtensionContext) {
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;
@ -36,13 +41,13 @@ export class WebViewPanel {
// 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"),
vscode.Uri.joinPath(extensionContext.extensionUri, "media"),
vscode.Uri.joinPath(extensionContext.extensionUri, "out/compiled"),
],
}
);
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionUri);
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionContext);
}
public static kill() {
@ -50,13 +55,11 @@ export class WebViewPanel {
WebViewPanel.currentPanel = undefined;
}
public static revive(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) {
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionUri);
public static revive(panel: vscode.WebviewPanel, extensionContext: vscode.ExtensionContext) {
WebViewPanel.currentPanel = new WebViewPanel(panel, extensionContext);
}
private constructor(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) {
this._panel = panel;
this._extensionUri = extensionUri;
private constructor(private readonly _panel: vscode.WebviewPanel, private readonly _extensionContext: vscode.ExtensionContext) {
// Set the webview's initial html content
this._update();
@ -97,49 +100,41 @@ export class WebViewPanel {
const webview = this._panel.webview;
this._panel.webview.html = this._getHtmlForWebview(webview);
webview.onDidReceiveMessage(async (data) => {
switch (data.type) {
case "onInfo": {
if (!data.value) {
webview.onDidReceiveMessage(async (postMessage: PostMessage) => {
switch (postMessage.type) {
case "on-info":
if (!postMessage.value)
return;
}
vscode.window.showInformationMessage(data.value);
vscode.window.showInformationMessage(postMessage.value);
break;
}
case "onError": {
if (!data.value) {
case "on-error":
if (!postMessage.value)
return;
}
vscode.window.showErrorMessage(data.value);
vscode.window.showErrorMessage(postMessage.value);
break;
default:
vscode.window.showErrorMessage(postMessage.type);
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 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._extensionUri, "out/compiled", "WebView.js")
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/DisplayDate.js")
);
const styleMainUri = webview.asWebviewUri(
vscode.Uri.joinPath(this._extensionContext.extensionUri, "out", "compiled/DisplayDate.css")
);
// 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
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
return `<!DOCTYPE html>
@ -150,16 +145,22 @@ export class WebViewPanel {
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 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">
<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>
<script src="${scriptUri}" nonce="${nonce}">
</html>`;
}
}

View File

@ -1,34 +0,0 @@
// 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`)
// );
// }
// });
// };

View File

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

View File

@ -2,28 +2,28 @@
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import * as kanbanHelper from './kanbanHelper';
import * as markdownHelper from './markdownHelper';
import * as promiseLinesHelper from './promiseLinesHelper';
import * as replaceLinesHelper from './replaceLinesHelper';
import * as readOnlyLinesHelper from './readOnlyLinesHelper';
import * as promiseLinesHelper from './promiseLinesHelper';
import { SidebarProvider } from "./SidebarProvider";
import { WebViewPanel } from "./WebViewPanel";
import { WebViewPanel, refreshWebView } from "./WebViewPanel";
import { ColumnsToCardsWebviewViewProvider, refreshSidebar } from "./ColumnsToCardsWebviewViewProvider";
// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export async function activate(extensionContext: vscode.ExtensionContext) {
const sidebarProvider = new SidebarProvider(extensionContext);
const columnsToCardsWebviewViewProvider = new ColumnsToCardsWebviewViewProvider(extensionContext);
const item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
item.text = "$(beaker) Show Kanban";
// item.command = "kanban.show";
item.show();
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("kanban-sidebar", sidebarProvider));
extensionContext.subscriptions.push(vscode.window.registerWebviewViewProvider("columns-to-cards-webview-view-provider", columnsToCardsWebviewViewProvider));
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "type-script-helper" is now active!');
console.log('Congratulations, your extension "type-script-helper":1.6.2 is now active!');
// // The command has been defined in the package.json file
// // Now provide the implementation of the command with registerCommand
@ -37,10 +37,11 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
// context.subscriptions.push(disposable);
const commands = [
// 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("kanban.refreshBoth", () => { kanbanHelper.refreshBoth(extensionContext); }),
vscode.commands.registerCommand("kanban.refreshSidebar", refreshSidebar),
vscode.commands.registerCommand("kanban.refreshWebView", () => { refreshWebView(extensionContext); }),
vscode.commands.registerCommand("kanban.openWithTextEditor", kanbanHelper.openWithTextEditor),
vscode.commands.registerCommand("markdown.newMarkdownFile", markdownHelper.newMarkdownFile),
vscode.commands.registerCommand('promiseLinesHelper.codeGeneratorQuickPick', promiseLinesHelper.codeGeneratorQuickPick),
vscode.commands.registerCommand('promiseLinesHelper.insertDateTime', promiseLinesHelper.insertDateTime),
vscode.commands.registerCommand('promiseLinesHelper.transformToPopperCase', promiseLinesHelper.transformToPopperCase),
@ -67,7 +68,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.webView", () => { WebViewPanel.createOrShow(extensionContext.extensionUri); })
vscode.commands.registerCommand("webView.webView", () => { WebViewPanel.createOrShow(extensionContext); })
];
commands.forEach(command => extensionContext.subscriptions.push(command));

View File

@ -1,40 +1,35 @@
import * as vscode from 'vscode';
// import { authenticate } from "./authenticate";
import { SidebarProvider } from './SidebarProvider';
// import { WebViewPanel } from "./WebViewPanel";
import { refreshWebView } from './WebViewPanel';
import { paramCase } from './promiseLinesHelper';
import { refreshSidebar } from './ColumnsToCardsWebviewViewProvider';
export function newEntry(sidebarProvider: SidebarProvider): any {
const { activeTextEditor } = vscode.window;
if (!activeTextEditor) {
vscode.window.showInformationMessage("No active text editor");
export function refreshBoth(extensionContext: vscode.ExtensionContext): any {
refreshSidebar();
refreshWebView(extensionContext);
setTimeout(() => { vscode.commands.executeCommand("workbench.action.webview.openDeveloperTools"); }, 500);
}
async function openWithTextEditorLogic(): Promise<any> {
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showInformationMessage("Open workspace first!");
return;
}
const text = activeTextEditor.document.getText(
activeTextEditor.selection
);
sidebarProvider._view?.webview.postMessage({
type: "new-entry",
value: text,
});
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 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");
}
// 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);
// }
export const openWithTextEditor = () => openWithTextEditorLogic();

View File

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

View File

@ -177,7 +177,7 @@ function transformToPopperCaseLogic(): undefined {
return undefined;
}
function paramCase(str: string) {
export function paramCase(str: string) {
return str
.replace(
/([A-Z]+(.))/g,

View File

@ -1,23 +0,0 @@
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();

View File

@ -1,15 +0,0 @@
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));
});
});

View File

@ -1,38 +0,0 @@
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);
}
});
});
}

View File

@ -1,3 +1,11 @@
---
type: "note"
created: "2023-07-07T16:15:27.822Z"
updated: "2023-07-07T16:15:27.822Z"
---
# vsc-extension-quickstart
# Welcome to your VS Code Extension
## What's in the folder

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
import App from "../components/WebView.svelte";
import App from "../components/ColumnsToCards.svelte";
const app = new App({
target: document.body,

View File

@ -1,4 +1,4 @@
import App from "../components/Sidebar.svelte";
import App from "../components/DisplayDate.svelte";
const app = new App({
target: document.body,

View File

@ -1,11 +0,0 @@
export type User = {
id: string;
name: string;
githubId: string;
};
export type Entry = {
text: string;
completed: boolean;
id: number;
};