pascal-vscode 0.1.0-beta.5 → 0.1.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # pascal-vscode
2
2
 
3
+ ## 0.1.0-beta.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`565f1eb`](https://github.com/hadez8877/pascal/commit/565f1ebe93a95b8c8cd7ba71aa379bb086731efe) Thanks [@hadez8877](https://github.com/hadez8877)! - Fixes the broken preview image in the README
8
+
9
+ ## 0.1.0-beta.6
10
+
11
+ ### Minor Changes
12
+
13
+ - [`c336677`](https://github.com/hadez8877/pascal/commit/c336677f224f95c76f1cdf56a31b598527fbd056) Thanks [@hadez8877](https://github.com/hadez8877)! - Adds a new `Pascal Solar` theme light variant!
14
+
15
+ Select it from the Command Palette via **Color Theme → Pascal Solar**, or set it directly:
16
+
17
+ ```json
18
+ {
19
+ "workbench.colorTheme": "Pascal Solar"
20
+ }
21
+ ```
22
+
23
+ ### Patch Changes
24
+
25
+ - [`fc2d714`](https://github.com/hadez8877/pascal/commit/fc2d714c7e0eb7c0603a4a1d9f440956b53697a8) Thanks [@hadez8877](https://github.com/hadez8877)! - Refactors the extension build to CommonJS to speed up theme activation and reduce bundle overhead
26
+
3
27
  ## 0.1.0-beta.5
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  Pascal is a dark theme for editors, shells, and more. The palette is tuned for long coding sessions: enough contrast to read code clearly, not so intense that your eyes notice it after an hour.
4
4
 
5
- ## Preview
6
-
7
- ![Preview](assets/screenshots/default.jpg)
5
+ ![Preview](https://raw.githubusercontent.com/hadez8877/pascal/refs/heads/main/.github/assets/preview.jpg)
8
6
 
9
7
  ## Installation
10
8
 
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import type { ExtensionContext } from 'vscode';
2
- export declare const activate: (context: ExtensionContext) => void;
1
+ import * as vscode from 'vscode';
2
+ export declare function activate(context: vscode.ExtensionContext): void;
package/dist/browser.js CHANGED
@@ -1 +1 @@
1
- import{window as t,workspace as e}from"vscode";var i=o=>{o.subscriptions.push(e.onDidChangeConfiguration(n=>{n.affectsConfiguration("pascal")&&t.showErrorMessage("VSCode Web doesn't support advanced Pascal options at the moment.")}))};export{i as activate};
1
+ "use strict";var r=Object.create;var t=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var u=(o,e)=>{for(var n in e)t(o,n,{get:e[n],enumerable:!0})},c=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of p(e))!v.call(o,s)&&s!==n&&t(o,s,{get:()=>e[s],enumerable:!(i=d(e,s))||i.enumerable});return o};var C=(o,e,n)=>(n=o!=null?r(f(o)):{},c(e||!o||!o.__esModule?t(n,"default",{value:o,enumerable:!0}):n,o)),g=o=>c(t({},"__esModule",{value:!0}),o);var m={};u(m,{activate:()=>h});module.exports=g(m);var a=C(require("vscode"));function h(o){o.subscriptions.push(a.workspace.onDidChangeConfiguration(e=>{e.affectsConfiguration("pascal")&&a.window.showErrorMessage("VSCode Web doesn't support advanced Pascal options at the moment.")}))}0&&(module.exports={activate});
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAyB,EAAE,EAAE;IACrD,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,SAAS,CAAC,wBAAwB,CAAC,CAAC,KAA+B,EAAE,EAAE;QACtE,IAAI,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,gBAAgB,CACtB,mEAAmE,CACnE,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CACF,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4BAUC;AAZD,+CAAiC;AAEjC,SAAgB,QAAQ,CAAC,OAAgC;IACxD,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC,KAAsC,EAAE,EAAE;QACpF,IAAI,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAC7B,mEAAmE,CACnE,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CACF,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import * as vscode from 'vscode';
2
+ export declare function registerChangelogCommand(context: vscode.ExtensionContext): void;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerChangelogCommand = registerChangelogCommand;
37
+ const marked_1 = require("marked");
38
+ const vscode = __importStar(require("vscode"));
39
+ function registerChangelogCommand(context) {
40
+ const changelogPath = vscode.Uri.joinPath(context.extensionUri, 'CHANGELOG.md');
41
+ context.subscriptions.push(vscode.commands.registerCommand('pascal.showChangelog', () => showChangelogCmd(changelogPath)));
42
+ }
43
+ async function showChangelogCmd(changelogPath) {
44
+ const content = await vscode.workspace.fs.readFile(changelogPath);
45
+ const contentHTML = await marked_1.marked.parse(content.toString());
46
+ const panel = vscode.window.createWebviewPanel('pascal.changelog', 'Pascal: Changelog', vscode.ViewColumn.Active, {
47
+ enableFindWidget: true,
48
+ enableScripts: true
49
+ });
50
+ panel.webview.html = contentHTML;
51
+ }
52
+ //# sourceMappingURL=showChangelog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"showChangelog.js","sourceRoot":"","sources":["../../src/commands/showChangelog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,4DAKC;AARD,mCAAgC;AAChC,+CAAiC;AAEjC,SAAgB,wBAAwB,CAAC,OAAgC;IACxE,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAChF,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAC9F,CAAC;AACH,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,aAAyB;IACxD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,MAAM,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAC7C,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,CAAC,UAAU,CAAC,MAAM,EACxB;QACC,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,IAAI;KACnB,CACD,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;AAClC,CAAC"}
@@ -1 +1,2 @@
1
- export declare function activate(): void;
1
+ import type * as vscode from 'vscode';
2
+ export declare function activate(context: vscode.ExtensionContext): void;
package/dist/extension.js CHANGED
@@ -1 +1 @@
1
- import{commands as g}from"vscode";import{TextDecoder as C}from"node:util";import{marked as h}from"marked";import{Uri as P,workspace as W}from"vscode";import l from"node:path";import{fileURLToPath as c}from"node:url";var w=c(import.meta.url),v=l.dirname(w);function i(...o){return l.join(v,...o)}import{Uri as b,ViewColumn as s,window as u}from"vscode";function m({id:o,displayName:t,run:n}){let e,r;return{id:o,displayName:t,dispose(){r&&(r.dispose(),r=void 0),e&&(e.dispose(),e=void 0)},async run(){let a=await n();if(e!==void 0)return e.webview.html=a||"No content available",e.reveal(s.Active);e=u.createWebviewPanel(o,t,s.Active,{enableCommandUris:!0,enableFindWidget:!0,enableScripts:!0,retainContextWhenHidden:!0});let f=i("../assets/icon.png");e.iconPath=b.file(f),e.onDidDispose(()=>{e=void 0,r=void 0}),e.webview.html=a||"No content available"}}}var p=m({id:"pascal.showChangelog",displayName:"Pascal Changelog",run:async()=>{let o=i("../CHANGELOG.md"),t=await W.fs.readFile(P.file(o)).then(n=>new C().decode(n)).then(n=>h.parse(n));return Promise.resolve(t)}});var d=[p];function F(){d.forEach(o=>{g.registerCommand(o.id,async()=>{await o.run()})})}export{F as activate};
1
+ "use strict";var m=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var h=(e,o)=>{for(var n in o)c(e,n,{get:o[n],enumerable:!0})},i=(e,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of l(o))!v.call(e,s)&&s!==n&&c(e,s,{get:()=>o[s],enumerable:!(a=g(o,s))||a.enumerable});return e};var C=(e,o,n)=>(n=e!=null?m(p(e)):{},i(o||!e||!e.__esModule?c(n,"default",{value:e,enumerable:!0}):n,e)),w=e=>i(c({},"__esModule",{value:!0}),e);var x={};h(x,{activate:()=>u});module.exports=w(x);var r=require("marked"),t=C(require("vscode"));function d(e){let o=t.Uri.joinPath(e.extensionUri,"CHANGELOG.md");e.subscriptions.push(t.commands.registerCommand("pascal.showChangelog",()=>f(o)))}async function f(e){let o=await t.workspace.fs.readFile(e),n=await r.marked.parse(o.toString()),a=t.window.createWebviewPanel("pascal.changelog","Pascal: Changelog",t.ViewColumn.Active,{enableFindWidget:!0,enableScripts:!0});a.webview.html=n}function u(e){d(e)}0&&(module.exports={activate});
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,UAAU,QAAQ;IACvB,iBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACrC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,IAAI,EAAE;YAC/C,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;AAKA,4BAEC;AAND,kEAAuE;AAEvE,yDAAyD;AACzD,0DAA0D;AAC1D,SAAgB,QAAQ,CAAC,OAAgC;IACxD,IAAA,2CAAwB,EAAC,OAAO,CAAC,CAAC;AACnC,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -1 +1,14 @@
1
- export declare function resolvePath(...paths: string[]): string;
1
+ import type { LogOutputChannel } from 'vscode';
2
+ export declare const logger: LogOutputChannel;
3
+ /**
4
+ * The reason why an update has been triggered, and a reload is needed
5
+ */
6
+ export declare const UPDATE_TRIGGER: {
7
+ readonly ConfigChange: "configuration change";
8
+ readonly FreshInstall: "update";
9
+ };
10
+ /**
11
+ * Shows a message to the user and reloads the window if the user clicks the action
12
+ * @param trigger - The reason why an update has been triggered, and a reload is needed
13
+ */
14
+ export declare const reloadWindow: (trigger: (typeof UPDATE_TRIGGER)[keyof typeof UPDATE_TRIGGER]) => void;
package/dist/utils.js CHANGED
@@ -1,8 +1,62 @@
1
- import path from 'node:path';
2
- import { fileURLToPath } from 'node:url';
3
- const __filename = fileURLToPath(import.meta.url);
4
- const __dirname = path.dirname(__filename);
5
- export function resolvePath(...paths) {
6
- return path.join(__dirname, ...paths);
7
- }
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.reloadWindow = exports.UPDATE_TRIGGER = exports.logger = void 0;
37
+ const vscode = __importStar(require("vscode"));
38
+ exports.logger = vscode.window.createOutputChannel('Pascal', { log: true });
39
+ /**
40
+ * The reason why an update has been triggered, and a reload is needed
41
+ */
42
+ exports.UPDATE_TRIGGER = {
43
+ ConfigChange: 'configuration change',
44
+ FreshInstall: 'update'
45
+ };
46
+ /**
47
+ * Shows a message to the user and reloads the window if the user clicks the action
48
+ * @param trigger - The reason why an update has been triggered, and a reload is needed
49
+ */
50
+ const reloadWindow = (trigger) => {
51
+ const ACTION = {
52
+ Value: 'Reload window',
53
+ Message: `Pascal has detected a ${trigger}. Please reload the window to apply the changes.`
54
+ };
55
+ vscode.window.showInformationMessage(ACTION.Message, ACTION.Value).then((selectedAction) => {
56
+ if (selectedAction === ACTION.Value) {
57
+ vscode.commands.executeCommand('workbench.action.reloadWindow');
58
+ }
59
+ });
60
+ };
61
+ exports.reloadWindow = reloadWindow;
8
62
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,UAAU,WAAW,CAAC,GAAG,KAAe;IAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAiC;AAEpB,QAAA,MAAM,GAAqB,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AAEnG;;GAEG;AACU,QAAA,cAAc,GAAG;IAC7B,YAAY,EAAE,sBAAsB;IACpC,YAAY,EAAE,QAAQ;CACb,CAAC;AAEX;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,OAA6D,EAAE,EAAE;IAC7F,MAAM,MAAM,GAAG;QACd,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,yBAAyB,OAAO,kDAAkD;KAClF,CAAC;IAEX,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE;QAC1F,IAAI,cAAc,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;YACrC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,+BAA+B,CAAC,CAAC;QACjE,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB"}
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "pascal-vscode",
3
- "displayName": "Pascal",
3
+ "displayName": "Pascal for Visual Studio Code",
4
4
  "publisher": "hadez8877",
5
5
  "description": "A modern dark theme for many editors, shells, and more!",
6
- "version": "0.1.0-beta.5",
7
- "type": "module",
8
- "icon": "assets/icon.png",
6
+ "version": "0.1.0-beta.7",
7
+ "type": "commonjs",
8
+ "icon": "icon.png",
9
9
  "main": "dist/extension.js",
10
10
  "browser": "dist/browser.js",
11
+ "galleryBanner": {
12
+ "color": "#121212",
13
+ "theme": "dark"
14
+ },
11
15
  "repository": {
12
16
  "type": "git",
13
17
  "url": "https://github.com/hadez8877/pascal.git",
@@ -48,6 +52,11 @@
48
52
  "label": "Pascal (Default)",
49
53
  "uiTheme": "vs-dark",
50
54
  "path": "themes/default.json"
55
+ },
56
+ {
57
+ "label": "Pascal Solar",
58
+ "uiTheme": "vs",
59
+ "path": "themes/solar.json"
51
60
  }
52
61
  ],
53
62
  "commands": [
@@ -65,7 +74,8 @@
65
74
  "default": "Pascal (Default)",
66
75
  "markdownDescription": "Switch to different editor theme",
67
76
  "enum": [
68
- "Pascal (Default)"
77
+ "Pascal (Default)",
78
+ "Pascal Solar"
69
79
  ]
70
80
  }
71
81
  }
@@ -77,6 +87,7 @@
77
87
  },
78
88
  "scripts": {
79
89
  "build": "tsc -b && node scripts/build.mjs -- --minify",
90
+ "dev": "node scripts/build.mjs -- --watch",
80
91
  "lint": "biome lint . && eslint --cache --concurrency=auto ."
81
92
  }
82
93
  }
package/scripts/build.mjs CHANGED
@@ -17,7 +17,7 @@ export default async function build() {
17
17
  sourcemap: isDev,
18
18
  outdir: 'dist',
19
19
  external: ['vscode', 'marked'],
20
- format: 'esm',
20
+ format: 'cjs',
21
21
  platform: 'node',
22
22
  tsconfig: './tsconfig.json',
23
23
  define: { 'process.env.NODE_ENV': '"production"' },
package/src/browser.ts CHANGED
@@ -1,14 +1,13 @@
1
- import type { ConfigurationChangeEvent, ExtensionContext } from 'vscode';
2
- import { window, workspace } from 'vscode';
1
+ import * as vscode from 'vscode';
3
2
 
4
- export const activate = (context: ExtensionContext) => {
3
+ export function activate(context: vscode.ExtensionContext) {
5
4
  context.subscriptions.push(
6
- workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {
5
+ vscode.workspace.onDidChangeConfiguration((event: vscode.ConfigurationChangeEvent) => {
7
6
  if (event.affectsConfiguration('pascal')) {
8
- window.showErrorMessage(
7
+ vscode.window.showErrorMessage(
9
8
  "VSCode Web doesn't support advanced Pascal options at the moment."
10
9
  );
11
10
  }
12
11
  })
13
12
  );
14
- };
13
+ }
@@ -0,0 +1,26 @@
1
+ import { marked } from 'marked';
2
+ import * as vscode from 'vscode';
3
+
4
+ export function registerChangelogCommand(context: vscode.ExtensionContext) {
5
+ const changelogPath = vscode.Uri.joinPath(context.extensionUri, 'CHANGELOG.md');
6
+ context.subscriptions.push(
7
+ vscode.commands.registerCommand('pascal.showChangelog', () => showChangelogCmd(changelogPath))
8
+ );
9
+ }
10
+
11
+ async function showChangelogCmd(changelogPath: vscode.Uri) {
12
+ const content = await vscode.workspace.fs.readFile(changelogPath);
13
+ const contentHTML = await marked.parse(content.toString());
14
+
15
+ const panel = vscode.window.createWebviewPanel(
16
+ 'pascal.changelog',
17
+ 'Pascal: Changelog',
18
+ vscode.ViewColumn.Active,
19
+ {
20
+ enableFindWidget: true,
21
+ enableScripts: true
22
+ }
23
+ );
24
+
25
+ panel.webview.html = contentHTML;
26
+ }
package/src/extension.ts CHANGED
@@ -1,10 +1,8 @@
1
- import { commands } from 'vscode';
2
- import { availableWebviews } from './webviews/availableWebviews.js';
1
+ import type * as vscode from 'vscode';
2
+ import { registerChangelogCommand } from './commands/showChangelog.js';
3
3
 
4
- export function activate() {
5
- availableWebviews.forEach((webview) => {
6
- commands.registerCommand(webview.id, async () => {
7
- await webview.run();
8
- });
9
- });
4
+ // This method is called when the extension is activated.
5
+ // It initializes the core functionality of the extension.
6
+ export function activate(context: vscode.ExtensionContext) {
7
+ registerChangelogCommand(context);
10
8
  }
package/src/utils.ts CHANGED
@@ -1,9 +1,29 @@
1
- import path from 'node:path';
2
- import { fileURLToPath } from 'node:url';
1
+ import type { LogOutputChannel } from 'vscode';
2
+ import * as vscode from 'vscode';
3
3
 
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = path.dirname(__filename);
4
+ export const logger: LogOutputChannel = vscode.window.createOutputChannel('Pascal', { log: true });
6
5
 
7
- export function resolvePath(...paths: string[]) {
8
- return path.join(__dirname, ...paths);
9
- }
6
+ /**
7
+ * The reason why an update has been triggered, and a reload is needed
8
+ */
9
+ export const UPDATE_TRIGGER = {
10
+ ConfigChange: 'configuration change',
11
+ FreshInstall: 'update'
12
+ } as const;
13
+
14
+ /**
15
+ * Shows a message to the user and reloads the window if the user clicks the action
16
+ * @param trigger - The reason why an update has been triggered, and a reload is needed
17
+ */
18
+ export const reloadWindow = (trigger: (typeof UPDATE_TRIGGER)[keyof typeof UPDATE_TRIGGER]) => {
19
+ const ACTION = {
20
+ Value: 'Reload window',
21
+ Message: `Pascal has detected a ${trigger}. Please reload the window to apply the changes.`
22
+ } as const;
23
+
24
+ vscode.window.showInformationMessage(ACTION.Message, ACTION.Value).then((selectedAction) => {
25
+ if (selectedAction === ACTION.Value) {
26
+ vscode.commands.executeCommand('workbench.action.reloadWindow');
27
+ }
28
+ });
29
+ };
@@ -0,0 +1,503 @@
1
+ {
2
+ "$schema": "vscode://schemas/color-theme",
3
+ "name": "Pascal Solar",
4
+ "type": "light",
5
+ "semanticHighlighting": true,
6
+ "tokenColors": [
7
+ {
8
+ "scope": ["comment", "punctuation.definition.comment", "string.comment"],
9
+ "settings": {
10
+ "foreground": "#6b7280"
11
+ }
12
+ },
13
+ {
14
+ "scope": [
15
+ "constant",
16
+ "entity.name.constant",
17
+ "variable.other.constant",
18
+ "variable.other.enummember",
19
+ "variable.language"
20
+ ],
21
+ "settings": {
22
+ "foreground": "#0969da"
23
+ }
24
+ },
25
+ {
26
+ "scope": ["entity", "entity.name"],
27
+ "settings": {
28
+ "foreground": "#8250df"
29
+ }
30
+ },
31
+ {
32
+ "scope": "variable.parameter.function",
33
+ "settings": {
34
+ "foreground": "#24292f"
35
+ }
36
+ },
37
+ {
38
+ "scope": "entity.name.tag",
39
+ "settings": {
40
+ "foreground": "#1a7f37"
41
+ }
42
+ },
43
+ {
44
+ "scope": "keyword",
45
+ "settings": {
46
+ "foreground": "#cf222e"
47
+ }
48
+ },
49
+ {
50
+ "scope": ["storage", "storage.type"],
51
+ "settings": {
52
+ "foreground": "#cf222e"
53
+ }
54
+ },
55
+ {
56
+ "scope": ["storage.modifier.package", "storage.modifier.import", "storage.type.java"],
57
+ "settings": {
58
+ "foreground": "#24292f"
59
+ }
60
+ },
61
+ {
62
+ "scope": [
63
+ "string",
64
+ "punctuation.definition.string",
65
+ "string punctuation.section.embedded source"
66
+ ],
67
+ "settings": {
68
+ "foreground": "#0550ae"
69
+ }
70
+ },
71
+ {
72
+ "scope": "support",
73
+ "settings": {
74
+ "foreground": "#0969da"
75
+ }
76
+ },
77
+ {
78
+ "scope": "meta.property-name",
79
+ "settings": {
80
+ "foreground": "#0969da"
81
+ }
82
+ },
83
+ {
84
+ "scope": "variable",
85
+ "settings": {
86
+ "foreground": "#bc4a00"
87
+ }
88
+ },
89
+ {
90
+ "scope": "variable.other",
91
+ "settings": {
92
+ "foreground": "#24292f"
93
+ }
94
+ },
95
+ {
96
+ "scope": "invalid.broken",
97
+ "settings": {
98
+ "fontStyle": "italic",
99
+ "foreground": "#cf222e"
100
+ }
101
+ },
102
+ {
103
+ "scope": "invalid.deprecated",
104
+ "settings": {
105
+ "fontStyle": "italic",
106
+ "foreground": "#cf222e"
107
+ }
108
+ },
109
+ {
110
+ "scope": "invalid.illegal",
111
+ "settings": {
112
+ "fontStyle": "italic",
113
+ "foreground": "#cf222e"
114
+ }
115
+ },
116
+ {
117
+ "scope": "invalid.unimplemented",
118
+ "settings": {
119
+ "fontStyle": "italic",
120
+ "foreground": "#cf222e"
121
+ }
122
+ },
123
+ {
124
+ "scope": "carriage-return",
125
+ "settings": {
126
+ "background": "#cf222e",
127
+ "content": "^M",
128
+ "fontStyle": "italic underline",
129
+ "foreground": "#ffffff"
130
+ }
131
+ },
132
+ {
133
+ "scope": "message.error",
134
+ "settings": {
135
+ "foreground": "#cf222e"
136
+ }
137
+ },
138
+ {
139
+ "scope": "string variable",
140
+ "settings": {
141
+ "foreground": "#0969da"
142
+ }
143
+ },
144
+ {
145
+ "scope": ["source.regexp", "string.regexp"],
146
+ "settings": {
147
+ "foreground": "#0550ae"
148
+ }
149
+ },
150
+ {
151
+ "scope": [
152
+ "string.regexp.character-class",
153
+ "string.regexp constant.character.escape",
154
+ "string.regexp source.ruby.embedded",
155
+ "string.regexp string.regexp.arbitrary-repitition"
156
+ ],
157
+ "settings": {
158
+ "foreground": "#0550ae"
159
+ }
160
+ },
161
+ {
162
+ "scope": "string.regexp constant.character.escape",
163
+ "settings": {
164
+ "fontStyle": "bold",
165
+ "foreground": "#1a7f37"
166
+ }
167
+ },
168
+ {
169
+ "scope": "support.constant",
170
+ "settings": {
171
+ "foreground": "#0969da"
172
+ }
173
+ },
174
+ {
175
+ "scope": "support.variable",
176
+ "settings": {
177
+ "foreground": "#0969da"
178
+ }
179
+ },
180
+ {
181
+ "scope": "meta.module-reference",
182
+ "settings": {
183
+ "foreground": "#0969da"
184
+ }
185
+ },
186
+ {
187
+ "scope": "punctuation.definition.list.begin.markdown",
188
+ "settings": {
189
+ "foreground": "#bc4a00"
190
+ }
191
+ },
192
+ {
193
+ "scope": ["markup.heading", "markup.heading entity.name"],
194
+ "settings": {
195
+ "fontStyle": "bold",
196
+ "foreground": "#0969da"
197
+ }
198
+ },
199
+ {
200
+ "scope": "markup.quote",
201
+ "settings": {
202
+ "foreground": "#1a7f37"
203
+ }
204
+ },
205
+ {
206
+ "scope": "markup.italic",
207
+ "settings": {
208
+ "fontStyle": "italic",
209
+ "foreground": "#24292f"
210
+ }
211
+ },
212
+ {
213
+ "scope": "markup.bold",
214
+ "settings": {
215
+ "fontStyle": "bold",
216
+ "foreground": "#24292f"
217
+ }
218
+ },
219
+ {
220
+ "scope": ["markup.underline"],
221
+ "settings": {
222
+ "fontStyle": "underline"
223
+ }
224
+ },
225
+ {
226
+ "scope": ["markup.strikethrough"],
227
+ "settings": {
228
+ "fontStyle": "strikethrough"
229
+ }
230
+ },
231
+ {
232
+ "scope": "markup.inline.raw",
233
+ "settings": {
234
+ "foreground": "#0969da"
235
+ }
236
+ },
237
+ {
238
+ "scope": ["markup.deleted", "meta.diff.header.from-file", "punctuation.definition.deleted"],
239
+ "settings": {
240
+ "background": "#86181d",
241
+ "foreground": "#cf222e"
242
+ }
243
+ },
244
+ {
245
+ "scope": ["markup.inserted", "meta.diff.header.to-file", "punctuation.definition.inserted"],
246
+ "settings": {
247
+ "background": "#144620",
248
+ "foreground": "#1a7f37"
249
+ }
250
+ },
251
+ {
252
+ "scope": ["markup.changed", "punctuation.definition.changed"],
253
+ "settings": {
254
+ "background": "#c24e00",
255
+ "foreground": "#bc4a00"
256
+ }
257
+ },
258
+ {
259
+ "scope": ["markup.ignored", "markup.untracked"],
260
+ "settings": {
261
+ "background": "#0969da",
262
+ "foreground": "#ffffff"
263
+ }
264
+ },
265
+ {
266
+ "scope": "meta.diff.range",
267
+ "settings": {
268
+ "fontStyle": "bold",
269
+ "foreground": "#8250df"
270
+ }
271
+ },
272
+ {
273
+ "scope": "meta.diff.header",
274
+ "settings": {
275
+ "foreground": "#0969da"
276
+ }
277
+ },
278
+ {
279
+ "scope": "meta.separator",
280
+ "settings": {
281
+ "fontStyle": "bold",
282
+ "foreground": "#0969da"
283
+ }
284
+ },
285
+ {
286
+ "scope": "meta.output",
287
+ "settings": {
288
+ "foreground": "#0969da"
289
+ }
290
+ },
291
+ {
292
+ "scope": [
293
+ "brackethighlighter.tag",
294
+ "brackethighlighter.curly",
295
+ "brackethighlighter.round",
296
+ "brackethighlighter.square",
297
+ "brackethighlighter.angle",
298
+ "brackethighlighter.quote"
299
+ ],
300
+ "settings": {
301
+ "foreground": "#57606a"
302
+ }
303
+ },
304
+ {
305
+ "scope": "brackethighlighter.unmatched",
306
+ "settings": {
307
+ "foreground": "#cf222e"
308
+ }
309
+ },
310
+ {
311
+ "scope": ["constant.other.reference.link", "string.other.link"],
312
+ "settings": {
313
+ "fontStyle": "underline",
314
+ "foreground": "#0550ae"
315
+ }
316
+ }
317
+ ],
318
+ "colors": {
319
+ "activityBar.activeBorder": "#0969da",
320
+ "activityBar.background": "#f6f8fa",
321
+ "activityBar.border": "#d0d7de",
322
+ "activityBar.foreground": "#24292f",
323
+ "activityBar.inactiveForeground": "#8c959f",
324
+ "activityBarBadge.background": "#0969da",
325
+ "activityBarBadge.foreground": "#ffffff",
326
+ "badge.background": "#eaeef2",
327
+ "badge.foreground": "#24292f",
328
+ "breadcrumb.activeSelectionForeground": "#24292f",
329
+ "breadcrumb.focusForeground": "#24292f",
330
+ "breadcrumb.foreground": "#656d76",
331
+ "breadcrumbPicker.background": "#ffffff",
332
+ "button.background": "#f6f8fa",
333
+ "button.foreground": "#24292f",
334
+ "button.hoverBackground": "#eaeef2",
335
+ "button.secondaryBackground": "#eaeef2",
336
+ "button.secondaryForeground": "#24292f",
337
+ "button.secondaryHoverBackground": "#d8dee4",
338
+ "checkbox.background": "#ffffff",
339
+ "checkbox.border": "#afb8c1",
340
+ "debugToolBar.background": "#ffffff",
341
+ "descriptionForeground": "#656d76",
342
+ "diffEditor.insertedTextBackground": "#28a74530",
343
+ "diffEditor.removedTextBackground": "#d73a4930",
344
+ "dropdown.background": "#ffffff",
345
+ "dropdown.border": "#d0d7de",
346
+ "dropdown.foreground": "#24292f",
347
+ "dropdown.listBackground": "#ffffff",
348
+ "editor.background": "#ffffff",
349
+ "editor.findMatchBackground": "#fff8c5",
350
+ "editor.findMatchHighlightBackground": "#fff8c5",
351
+ "editor.focusedStackFrameHighlightBackground": "#ddf4ff",
352
+ "editor.foldBackground": "#afb8c133",
353
+ "editor.foreground": "#24292f",
354
+ "editor.inactiveSelectionBackground": "#0969da22",
355
+ "editor.lineHighlightBackground": "#f6f8fa",
356
+ "editor.linkedEditingBackground": "#0969da18",
357
+ "editor.selectionBackground": "#0969da2e",
358
+ "editor.selectionHighlightBackground": "#0969da18",
359
+ "editor.selectionHighlightBorder": "#0969da00",
360
+ "editor.stackFrameHighlightBackground": "#fff8c5",
361
+ "editor.wordHighlightBackground": "#0969da18",
362
+ "editor.wordHighlightBorder": "#0969da66",
363
+ "editor.wordHighlightStrongBackground": "#0969da24",
364
+ "editor.wordHighlightStrongBorder": "#0969da66",
365
+ "editorBracketHighlight.foreground1": "#0969da",
366
+ "editorBracketHighlight.foreground2": "#bc4a00",
367
+ "editorBracketHighlight.foreground3": "#8250df",
368
+ "editorBracketHighlight.foreground4": "#1a7f37",
369
+ "editorBracketHighlight.foreground5": "#cf222e",
370
+ "editorBracketHighlight.foreground6": "#0550ae",
371
+ "editorBracketMatch.background": "#0969da18",
372
+ "editorBracketMatch.border": "#0969da55",
373
+ "editorCursor.foreground": "#24292f",
374
+ "editorError.foreground": "#cf222e",
375
+ "editorGroup.border": "#d0d7de",
376
+ "editorGroupHeader.tabsBackground": "#f6f8fa",
377
+ "editorGroupHeader.tabsBorder": "#d0d7de",
378
+ "editorGutter.addedBackground": "#1a7f37",
379
+ "editorGutter.deletedBackground": "#cf222e",
380
+ "editorGutter.modifiedBackground": "#0969da",
381
+ "editorIndentGuide.activeBackground1": "#afb8c1",
382
+ "editorIndentGuide.background1": "#d8dee4",
383
+ "editorLineNumber.activeForeground": "#24292f",
384
+ "editorLineNumber.foreground": "#8c959f",
385
+ "editorOverviewRuler.border": "#d0d7de",
386
+ "editorWarning.foreground": "#9a6700",
387
+ "editorWhitespace.foreground": "#afb8c1",
388
+ "editorWidget.background": "#ffffff",
389
+ "errorForeground": "#cf222e",
390
+ "focusBorder": "#0969da",
391
+ "foreground": "#24292f",
392
+ "gitDecoration.addedResourceForeground": "#1a7f37",
393
+ "gitDecoration.conflictingResourceForeground": "#bc4a00",
394
+ "gitDecoration.deletedResourceForeground": "#cf222e",
395
+ "gitDecoration.ignoredResourceForeground": "#8c959f",
396
+ "gitDecoration.modifiedResourceForeground": "#0969da",
397
+ "gitDecoration.submoduleResourceForeground": "#8c959f",
398
+ "gitDecoration.untrackedResourceForeground": "#1a7f37",
399
+ "input.background": "#ffffff",
400
+ "input.border": "#d0d7de",
401
+ "input.foreground": "#24292f",
402
+ "input.placeholderForeground": "#8c959f",
403
+ "list.activeSelectionBackground": "#eaeef2",
404
+ "list.activeSelectionForeground": "#24292f",
405
+ "list.focusBackground": "#ddf4ff",
406
+ "list.hoverBackground": "#f6f8fa",
407
+ "list.hoverForeground": "#24292f",
408
+ "list.inactiveFocusBackground": "#f6f8fa",
409
+ "list.inactiveSelectionBackground": "#f6f8fa",
410
+ "list.inactiveSelectionForeground": "#57606a",
411
+ "notificationCenterHeader.background": "#f6f8fa",
412
+ "notificationCenterHeader.foreground": "#57606a",
413
+ "notifications.background": "#ffffff",
414
+ "notifications.border": "#d0d7de",
415
+ "notifications.foreground": "#24292f",
416
+ "notificationsErrorIcon.foreground": "#cf222e",
417
+ "notificationsInfoIcon.foreground": "#0969da",
418
+ "notificationsWarningIcon.foreground": "#9a6700",
419
+ "panel.background": "#ffffff",
420
+ "panel.border": "#d0d7de",
421
+ "panelInput.border": "#d0d7de",
422
+ "panelTitle.activeBorder": "#0969da",
423
+ "panelTitle.activeForeground": "#24292f",
424
+ "panelTitle.inactiveForeground": "#656d76",
425
+ "peekViewEditor.background": "#ffffff",
426
+ "peekViewEditor.matchHighlightBackground": "#fff8c5",
427
+ "peekViewResult.background": "#ffffff",
428
+ "peekViewResult.matchHighlightBackground": "#fff8c5",
429
+ "pickerGroup.border": "#afb8c1",
430
+ "pickerGroup.foreground": "#24292f",
431
+ "progressBar.background": "#0969da",
432
+ "quickInput.background": "#ffffff",
433
+ "quickInput.foreground": "#24292f",
434
+ "scrollbar.shadow": "#00000012",
435
+ "scrollbarSlider.activeBackground": "#8c959f66",
436
+ "scrollbarSlider.background": "#8c959f33",
437
+ "scrollbarSlider.hoverBackground": "#8c959f55",
438
+ "settings.headerForeground": "#24292f",
439
+ "settings.modifiedItemIndicator": "#0969da",
440
+ "sideBar.background": "#f6f8fa",
441
+ "sideBar.border": "#d0d7de",
442
+ "sideBar.foreground": "#24292f",
443
+ "sideBarSectionHeader.background": "#f6f8fa",
444
+ "sideBarSectionHeader.border": "#d0d7de",
445
+ "sideBarSectionHeader.foreground": "#24292f",
446
+ "sideBarTitle.foreground": "#24292f",
447
+ "statusBar.background": "#f6f8fa",
448
+ "statusBar.border": "#d0d7de",
449
+ "statusBar.debuggingBackground": "#cf222e",
450
+ "statusBar.debuggingForeground": "#ffffff",
451
+ "statusBar.foreground": "#57606a",
452
+ "statusBar.noFolderBackground": "#f6f8fa",
453
+ "statusBarItem.prominentBackground": "#eaeef2",
454
+ "statusBarItem.remoteBackground": "#f6f8fa",
455
+ "statusBarItem.remoteForeground": "#57606a",
456
+ "tab.activeBackground": "#ffffff",
457
+ "tab.activeBorder": "#d0d7de",
458
+ "tab.activeBorderTop": "#0969da",
459
+ "tab.activeForeground": "#24292f",
460
+ "tab.border": "#d0d7de",
461
+ "tab.hoverBackground": "#eaeef2",
462
+ "tab.inactiveBackground": "#f6f8fa",
463
+ "tab.inactiveForeground": "#656d76",
464
+ "tab.unfocusedActiveBorder": "#d0d7de",
465
+ "tab.unfocusedActiveBorderTop": "#afb8c1",
466
+ "tab.unfocusedHoverBackground": "#eaeef2",
467
+ "terminal.ansiBlack": "#57606a",
468
+ "terminal.ansiBlue": "#0969da",
469
+ "terminal.ansiBrightBlack": "#656d76",
470
+ "terminal.ansiBrightBlue": "#0550ae",
471
+ "terminal.ansiBrightCyan": "#0a7b83",
472
+ "terminal.ansiBrightGreen": "#1a7f37",
473
+ "terminal.ansiBrightMagenta": "#8250df",
474
+ "terminal.ansiBrightRed": "#cf222e",
475
+ "terminal.ansiBrightWhite": "#ffffff",
476
+ "terminal.ansiBrightYellow": "#9a6700",
477
+ "terminal.ansiCyan": "#0a7b83",
478
+ "terminal.ansiGreen": "#1a7f37",
479
+ "terminal.ansiMagenta": "#8250df",
480
+ "terminal.ansiRed": "#cf222e",
481
+ "terminal.ansiWhite": "#24292f",
482
+ "terminal.ansiYellow": "#9a6700",
483
+ "terminal.foreground": "#24292f",
484
+ "terminal.tab.activeBorder": "#0969da",
485
+ "terminalCursor.background": "#ffffff",
486
+ "terminalCursor.foreground": "#0969da",
487
+ "textBlockQuote.background": "#f6f8fa",
488
+ "textBlockQuote.border": "#d0d7de",
489
+ "textCodeBlock.background": "#f6f8fa",
490
+ "textLink.activeForeground": "#0550ae",
491
+ "textLink.foreground": "#0969da",
492
+ "textPreformat.foreground": "#57606a",
493
+ "textSeparator.foreground": "#8c959f",
494
+ "titleBar.activeBackground": "#f6f8fa",
495
+ "titleBar.activeForeground": "#24292f",
496
+ "titleBar.border": "#d0d7de",
497
+ "titleBar.inactiveBackground": "#f6f8fa",
498
+ "titleBar.inactiveForeground": "#656d76",
499
+ "tree.indentGuidesStroke": "#afb8c1",
500
+ "welcomePage.buttonBackground": "#f6f8fa",
501
+ "welcomePage.buttonHoverBackground": "#eaeef2"
502
+ }
503
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../configs/tsconfig.build.json",
2
+ "extends": "../../../configs/tsconfig.vscode-extension.json",
3
3
  "compilerOptions": {
4
4
  "emitDeclarationOnly": false,
5
5
  "sourceMap": true
Binary file
@@ -1,2 +0,0 @@
1
- import type { WebviewControllerInfo, WebviewControllerOptions } from './types/webview.js';
2
- export declare function webviewController({ id, displayName, run }: WebviewControllerOptions): WebviewControllerInfo;
@@ -1,41 +0,0 @@
1
- import { Uri, ViewColumn, window } from 'vscode';
2
- import { resolvePath } from './utils.js';
3
- export function webviewController({ id, displayName, run }) {
4
- let panel;
5
- let disposablePanel;
6
- return {
7
- id,
8
- displayName,
9
- dispose() {
10
- if (disposablePanel) {
11
- disposablePanel.dispose();
12
- disposablePanel = undefined;
13
- }
14
- if (panel) {
15
- panel.dispose();
16
- panel = undefined;
17
- }
18
- },
19
- async run() {
20
- const content = await run();
21
- if (panel !== undefined) {
22
- panel.webview.html = content || 'No content available';
23
- return panel.reveal(ViewColumn.Active);
24
- }
25
- panel = window.createWebviewPanel(id, displayName, ViewColumn.Active, {
26
- enableCommandUris: true,
27
- enableFindWidget: true,
28
- enableScripts: true,
29
- retainContextWhenHidden: true
30
- });
31
- const ICON_PATH = resolvePath('../assets/icon.png');
32
- panel.iconPath = Uri.file(ICON_PATH);
33
- panel.onDidDispose(() => {
34
- panel = undefined;
35
- disposablePanel = undefined;
36
- });
37
- panel.webview.html = content || 'No content available';
38
- }
39
- };
40
- }
41
- //# sourceMappingURL=webviewController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webviewController.js","sourceRoot":"","sources":["../src/webviewController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,EACjC,EAAE,EACF,WAAW,EACX,GAAG,EACuB;IAC1B,IAAI,KAA+B,CAAC;IACpC,IAAI,eAAuC,CAAC;IAE5C,OAAO;QACN,EAAE;QACF,WAAW;QAEX,OAAO;YACN,IAAI,eAAe,EAAE,CAAC;gBACrB,eAAe,CAAC,OAAO,EAAE,CAAC;gBAC1B,eAAe,GAAG,SAAS,CAAC;YAC7B,CAAC;YAED,IAAI,KAAK,EAAE,CAAC;gBACX,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChB,KAAK,GAAG,SAAS,CAAC;YACnB,CAAC;QACF,CAAC;QAED,KAAK,CAAC,GAAG;YACR,MAAM,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC;YAE5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACzB,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,IAAI,sBAAsB,CAAC;gBACvD,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACxC,CAAC;YAED,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,MAAM,EAAE;gBACrE,iBAAiB,EAAE,IAAI;gBACvB,gBAAgB,EAAE,IAAI;gBACtB,aAAa,EAAE,IAAI;gBACnB,uBAAuB,EAAE,IAAI;aAC7B,CAAC,CAAC;YAEH,MAAM,SAAS,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;YACpD,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAErC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;gBACvB,KAAK,GAAG,SAAS,CAAC;gBAClB,eAAe,GAAG,SAAS,CAAC;YAC7B,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,IAAI,sBAAsB,CAAC;QACxD,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { WebviewControllerInfo } from '../types/webview.js';
2
- export declare const availableWebviews: WebviewControllerInfo[];
@@ -1,3 +0,0 @@
1
- import { showChangelog } from './showChangelog.js';
2
- export const availableWebviews = [showChangelog];
3
- //# sourceMappingURL=availableWebviews.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"availableWebviews.js","sourceRoot":"","sources":["../../src/webviews/availableWebviews.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAA4B,CAAC,aAAa,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const showChangelog: import("../types/webview.js").WebviewControllerInfo;
@@ -1,18 +0,0 @@
1
- import { TextDecoder } from 'node:util';
2
- import { marked } from 'marked';
3
- import { Uri, workspace } from 'vscode';
4
- import { resolvePath } from '../utils.js';
5
- import { webviewController } from '../webviewController.js';
6
- export const showChangelog = webviewController({
7
- id: 'pascal.showChangelog',
8
- displayName: 'Pascal Changelog',
9
- run: async () => {
10
- const CHANGELOG_PATH = resolvePath('../CHANGELOG.md');
11
- const displayContent = await workspace.fs
12
- .readFile(Uri.file(CHANGELOG_PATH))
13
- .then((data) => new TextDecoder().decode(data))
14
- .then((content) => marked.parse(content));
15
- return Promise.resolve(displayContent);
16
- }
17
- });
18
- //# sourceMappingURL=showChangelog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"showChangelog.js","sourceRoot":"","sources":["../../src/webviews/showChangelog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC;IAC9C,EAAE,EAAE,sBAAsB;IAC1B,WAAW,EAAE,kBAAkB;IAE/B,GAAG,EAAE,KAAK,IAAI,EAAE;QACf,MAAM,cAAc,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;QACtD,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,EAAE;aACvC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aAClC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAC9C,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAE3C,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;CACD,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * The options for a webview controller
3
- */
4
- export type WebviewControllerOptions = {
5
- id: string;
6
- displayName: string;
7
- run(): Promise<void | string>;
8
- };
9
- export interface WebviewControllerInfo extends WebviewControllerOptions {
10
- dispose(): void;
11
- }
@@ -1,56 +0,0 @@
1
- import type { Disposable, WebviewPanel } from 'vscode';
2
- import { Uri, ViewColumn, window } from 'vscode';
3
- import type { WebviewControllerInfo, WebviewControllerOptions } from './types/webview.js';
4
- import { resolvePath } from './utils.js';
5
-
6
- export function webviewController({
7
- id,
8
- displayName,
9
- run
10
- }: WebviewControllerOptions): WebviewControllerInfo {
11
- let panel: WebviewPanel | undefined;
12
- let disposablePanel: Disposable | undefined;
13
-
14
- return {
15
- id,
16
- displayName,
17
-
18
- dispose() {
19
- if (disposablePanel) {
20
- disposablePanel.dispose();
21
- disposablePanel = undefined;
22
- }
23
-
24
- if (panel) {
25
- panel.dispose();
26
- panel = undefined;
27
- }
28
- },
29
-
30
- async run() {
31
- const content = await run();
32
-
33
- if (panel !== undefined) {
34
- panel.webview.html = content || 'No content available';
35
- return panel.reveal(ViewColumn.Active);
36
- }
37
-
38
- panel = window.createWebviewPanel(id, displayName, ViewColumn.Active, {
39
- enableCommandUris: true,
40
- enableFindWidget: true,
41
- enableScripts: true,
42
- retainContextWhenHidden: true
43
- });
44
-
45
- const ICON_PATH = resolvePath('../assets/icon.png');
46
- panel.iconPath = Uri.file(ICON_PATH);
47
-
48
- panel.onDidDispose(() => {
49
- panel = undefined;
50
- disposablePanel = undefined;
51
- });
52
-
53
- panel.webview.html = content || 'No content available';
54
- }
55
- };
56
- }
@@ -1,4 +0,0 @@
1
- import type { WebviewControllerInfo } from '../types/webview.js';
2
- import { showChangelog } from './showChangelog.js';
3
-
4
- export const availableWebviews: WebviewControllerInfo[] = [showChangelog];
@@ -1,20 +0,0 @@
1
- import { TextDecoder } from 'node:util';
2
- import { marked } from 'marked';
3
- import { Uri, workspace } from 'vscode';
4
- import { resolvePath } from '../utils.js';
5
- import { webviewController } from '../webviewController.js';
6
-
7
- export const showChangelog = webviewController({
8
- id: 'pascal.showChangelog',
9
- displayName: 'Pascal Changelog',
10
-
11
- run: async () => {
12
- const CHANGELOG_PATH = resolvePath('../CHANGELOG.md');
13
- const displayContent = await workspace.fs
14
- .readFile(Uri.file(CHANGELOG_PATH))
15
- .then((data) => new TextDecoder().decode(data))
16
- .then((content) => marked.parse(content));
17
-
18
- return Promise.resolve(displayContent);
19
- }
20
- });
File without changes