@lvce-editor/extension-host-worker 8.62.0 → 8.64.0

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.
@@ -5,12 +5,13 @@ export { executeCommand } from './parts/ExecuteCommand/ExecuteCommand.ts';
5
5
  export { showQuickPick } from './parts/QuickPick/QuickPick.ts';
6
6
  export { getPreference, setPreference } from './parts/Preferences/Preferences.ts';
7
7
  export { registerCommand } from './parts/CommandRegistry/CommandRegistry.ts';
8
+ export { registerDebugProvider, resetDebugProviderRegistry } from './parts/Debug/Debug.ts';
8
9
  export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from './parts/Completion/Completion.ts';
9
10
  export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from './parts/Diagnostic/Diagnostic.ts';
10
11
  export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from './parts/Formatting/Formatting.ts';
11
12
  export { exists, mkdir, readDirWithFileTypes, readFile, remove, stat, writeFile } from './parts/FileSystem/FileSystem.ts';
12
13
  export { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, registerFileSystemProvider, resetFileSystemProviderRegistry, } from './parts/FileSystemProviderRegistry/FileSystemProviderRegistry.ts';
13
- export { confirm, getWorkspaceFolder, getWorkspaceUri, handleWorkspaceRefresh, openUri } from './parts/Host/Host.ts';
14
+ export { confirm, getWorkspaceFolder, getWorkspaceUri, handleWorkspaceRefresh, openUri, showNotification, type NotificationType, } from './parts/Host/Host.ts';
14
15
  export { executeHoverProvider, getHoverProviderRegistrySnapshot, registerHoverProvider, resetHoverProviderRegistry } from './parts/Hover/Hover.ts';
15
16
  export { getPlatform, type Platform } from './parts/Platform/Platform.ts';
16
17
  export { getLanguageServerRegistrySnapshot, registerLanguageServer, resetLanguageServerRegistry } from './parts/LanguageServer/LanguageServer.ts';
@@ -28,6 +29,7 @@ export type { CommandCallback } from './parts/CommandCallback/CommandCallback.ts
28
29
  export type { CommandRegistrySnapshot } from './parts/CommandRegistrySnapshot/CommandRegistrySnapshot.ts';
29
30
  export type { CompletionItem, CompletionProvider, CompletionProviderRegistrySnapshot, RegisteredCompletionProvider, } from './parts/Completion/Completion.ts';
30
31
  export type { Diagnostic, DiagnosticProvider, DiagnosticProviderRegistrySnapshot, RegisteredDiagnosticProvider, } from './parts/Diagnostic/Diagnostic.ts';
32
+ export type { DebugEmitter, DebugProvider } from './parts/Debug/Debug.ts';
31
33
  export type { Disposable } from './parts/Disposable/Disposable.ts';
32
34
  export type { CreateElectronWebContentsViewOptions, ElectronWebContentsView, ElectronWebContentsViewStats, } from './parts/ElectronWebContentsView/ElectronWebContentsView.ts';
33
35
  export type { FormattingEdit, FormattingProvider, FormattingProviderRegistrySnapshot, RegisteredFormattingProvider, } from './parts/Formatting/Formatting.ts';
@@ -5,12 +5,13 @@ export { executeCommand } from "./parts/ExecuteCommand/ExecuteCommand.js";
5
5
  export { showQuickPick } from "./parts/QuickPick/QuickPick.js";
6
6
  export { getPreference, setPreference } from "./parts/Preferences/Preferences.js";
7
7
  export { registerCommand } from "./parts/CommandRegistry/CommandRegistry.js";
8
+ export { registerDebugProvider, resetDebugProviderRegistry } from "./parts/Debug/Debug.js";
8
9
  export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from "./parts/Completion/Completion.js";
9
10
  export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from "./parts/Diagnostic/Diagnostic.js";
10
11
  export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from "./parts/Formatting/Formatting.js";
11
12
  export { exists, mkdir, readDirWithFileTypes, readFile, remove, stat, writeFile } from "./parts/FileSystem/FileSystem.js";
12
13
  export { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, registerFileSystemProvider, resetFileSystemProviderRegistry, } from "./parts/FileSystemProviderRegistry/FileSystemProviderRegistry.js";
13
- export { confirm, getWorkspaceFolder, getWorkspaceUri, handleWorkspaceRefresh, openUri } from "./parts/Host/Host.js";
14
+ export { confirm, getWorkspaceFolder, getWorkspaceUri, handleWorkspaceRefresh, openUri, showNotification, } from "./parts/Host/Host.js";
14
15
  export { executeHoverProvider, getHoverProviderRegistrySnapshot, registerHoverProvider, resetHoverProviderRegistry } from "./parts/Hover/Hover.js";
15
16
  export { getPlatform } from "./parts/Platform/Platform.js";
16
17
  export { getLanguageServerRegistrySnapshot, registerLanguageServer, resetLanguageServerRegistry } from "./parts/LanguageServer/LanguageServer.js";
@@ -48,4 +48,15 @@ export declare const commandMap: {
48
48
  'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
49
49
  'ExtensionApi.renderViewInstance': (uid: number) => Promise<import("../View/View.ts").ViewRenderResult>;
50
50
  'ExtensionApi.saveViewInstanceState': (uid: number) => Promise<unknown>;
51
+ 'ExtensionHostDebug.evaluate': (id: string, expression: string, callFrameId: string) => Promise<unknown>;
52
+ 'ExtensionHostDebug.getProperties': (id: string, objectId: string) => Promise<unknown>;
53
+ 'ExtensionHostDebug.listProcesses': (id: string, path?: string) => Promise<unknown>;
54
+ 'ExtensionHostDebug.pause': (id: string) => Promise<unknown>;
55
+ 'ExtensionHostDebug.resume': (id: string) => Promise<unknown>;
56
+ 'ExtensionHostDebug.setPauseOnExceptions': (id: string, value: number) => Promise<unknown>;
57
+ 'ExtensionHostDebug.start': (id: string, path?: string) => Promise<unknown>;
58
+ 'ExtensionHostDebug.step': (id: string) => Promise<unknown>;
59
+ 'ExtensionHostDebug.stepInto': (id: string) => Promise<unknown>;
60
+ 'ExtensionHostDebug.stepOut': (id: string) => Promise<unknown>;
61
+ 'ExtensionHostDebug.stepOver': (id: string) => Promise<unknown>;
51
62
  };
@@ -0,0 +1,34 @@
1
+ import type { Disposable } from '../Disposable/Disposable.ts';
2
+ export interface DebugEmitter {
3
+ readonly handleChange: (params: unknown) => Promise<void>;
4
+ readonly handlePaused: (params: unknown) => Promise<void>;
5
+ readonly handleResumed: () => Promise<void>;
6
+ readonly handleScriptParsed: (script: unknown) => Promise<void>;
7
+ }
8
+ export interface DebugProvider {
9
+ readonly evaluate: (expression: string, callFrameId: string) => unknown;
10
+ readonly getProperties: (objectId: string) => unknown;
11
+ readonly id: string;
12
+ readonly listProcesses: (path?: string) => unknown;
13
+ readonly pause: () => unknown;
14
+ readonly resume: () => unknown;
15
+ readonly setPauseOnExceptions: (value: number) => unknown;
16
+ readonly start: (emitter: DebugEmitter, path?: string) => unknown;
17
+ readonly step: () => unknown;
18
+ readonly stepInto: () => unknown;
19
+ readonly stepOut: () => unknown;
20
+ readonly stepOver: () => unknown;
21
+ }
22
+ export declare const registerDebugProvider: (provider: DebugProvider) => Disposable;
23
+ export declare const executeDebugStart: (id: string, path?: string) => Promise<unknown>;
24
+ export declare const executeDebugListProcesses: (id: string, path?: string) => Promise<unknown>;
25
+ export declare const executeDebugResume: (id: string) => Promise<unknown>;
26
+ export declare const executeDebugPause: (id: string) => Promise<unknown>;
27
+ export declare const executeDebugStepOver: (id: string) => Promise<unknown>;
28
+ export declare const executeDebugStepInto: (id: string) => Promise<unknown>;
29
+ export declare const executeDebugStepOut: (id: string) => Promise<unknown>;
30
+ export declare const executeDebugStep: (id: string) => Promise<unknown>;
31
+ export declare const executeDebugSetPauseOnExceptions: (id: string, value: number) => Promise<unknown>;
32
+ export declare const executeDebugGetProperties: (id: string, objectId: string) => Promise<unknown>;
33
+ export declare const executeDebugEvaluate: (id: string, expression: string, callFrameId: string) => Promise<unknown>;
34
+ export declare const resetDebugProviderRegistry: () => void;
@@ -0,0 +1,98 @@
1
+ import { executeCommand } from "../ExecuteCommand/ExecuteCommand.js";
2
+ import { ExtensionApiError } from "../ExtensionApiError/ExtensionApiError.js";
3
+ const providers = Object.create(null);
4
+ const requiredMethods = [
5
+ 'evaluate',
6
+ 'getProperties',
7
+ 'listProcesses',
8
+ 'pause',
9
+ 'resume',
10
+ 'setPauseOnExceptions',
11
+ 'start',
12
+ 'step',
13
+ 'stepInto',
14
+ 'stepOut',
15
+ 'stepOver',
16
+ ];
17
+ const assertDebugProvider = (provider) => {
18
+ if (!provider) {
19
+ throw new ExtensionApiError('debug provider is not defined');
20
+ }
21
+ if (typeof provider.id !== 'string' || provider.id.length === 0) {
22
+ throw new ExtensionApiError('debug provider is missing id');
23
+ }
24
+ for (const methodName of requiredMethods) {
25
+ if (typeof provider[methodName] !== 'function') {
26
+ throw new ExtensionApiError(`debug provider ${provider.id} is missing ${methodName} function`);
27
+ }
28
+ }
29
+ if (provider.id in providers) {
30
+ throw new ExtensionApiError(`debug provider ${provider.id} is already registered`);
31
+ }
32
+ };
33
+ const getProvider = (id) => {
34
+ const provider = providers[id];
35
+ if (!provider) {
36
+ throw new ExtensionApiError(`debug provider ${id} not found`);
37
+ }
38
+ return provider;
39
+ };
40
+ const emitter = {
41
+ async handleChange() { },
42
+ async handlePaused(params) {
43
+ await executeCommand('Debug.paused', params);
44
+ },
45
+ async handleResumed() {
46
+ await executeCommand('Debug.resumed');
47
+ },
48
+ async handleScriptParsed(script) {
49
+ await executeCommand('Debug.scriptParsed', script);
50
+ },
51
+ };
52
+ export const registerDebugProvider = (provider) => {
53
+ assertDebugProvider(provider);
54
+ providers[provider.id] = provider;
55
+ return {
56
+ dispose() {
57
+ delete providers[provider.id];
58
+ },
59
+ };
60
+ };
61
+ export const executeDebugStart = async (id, path) => {
62
+ return getProvider(id).start(emitter, path);
63
+ };
64
+ export const executeDebugListProcesses = async (id, path) => {
65
+ return getProvider(id).listProcesses(path);
66
+ };
67
+ export const executeDebugResume = async (id) => {
68
+ return getProvider(id).resume();
69
+ };
70
+ export const executeDebugPause = async (id) => {
71
+ return getProvider(id).pause();
72
+ };
73
+ export const executeDebugStepOver = async (id) => {
74
+ return getProvider(id).stepOver();
75
+ };
76
+ export const executeDebugStepInto = async (id) => {
77
+ return getProvider(id).stepInto();
78
+ };
79
+ export const executeDebugStepOut = async (id) => {
80
+ return getProvider(id).stepOut();
81
+ };
82
+ export const executeDebugStep = async (id) => {
83
+ return getProvider(id).step();
84
+ };
85
+ export const executeDebugSetPauseOnExceptions = async (id, value) => {
86
+ return getProvider(id).setPauseOnExceptions(value);
87
+ };
88
+ export const executeDebugGetProperties = async (id, objectId) => {
89
+ return getProvider(id).getProperties(objectId);
90
+ };
91
+ export const executeDebugEvaluate = async (id, expression, callFrameId) => {
92
+ return getProvider(id).evaluate(expression, callFrameId);
93
+ };
94
+ export const resetDebugProviderRegistry = () => {
95
+ for (const id of Object.keys(providers)) {
96
+ delete providers[id];
97
+ }
98
+ };
@@ -47,4 +47,15 @@ export declare const commandMap: {
47
47
  'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
48
48
  'ExtensionApi.renderViewInstance': (uid: number) => Promise<import("../View/View.ts").ViewRenderResult>;
49
49
  'ExtensionApi.saveViewInstanceState': (uid: number) => Promise<unknown>;
50
+ 'ExtensionHostDebug.evaluate': (id: string, expression: string, callFrameId: string) => Promise<unknown>;
51
+ 'ExtensionHostDebug.getProperties': (id: string, objectId: string) => Promise<unknown>;
52
+ 'ExtensionHostDebug.listProcesses': (id: string, path?: string) => Promise<unknown>;
53
+ 'ExtensionHostDebug.pause': (id: string) => Promise<unknown>;
54
+ 'ExtensionHostDebug.resume': (id: string) => Promise<unknown>;
55
+ 'ExtensionHostDebug.setPauseOnExceptions': (id: string, value: number) => Promise<unknown>;
56
+ 'ExtensionHostDebug.start': (id: string, path?: string) => Promise<unknown>;
57
+ 'ExtensionHostDebug.step': (id: string) => Promise<unknown>;
58
+ 'ExtensionHostDebug.stepInto': (id: string) => Promise<unknown>;
59
+ 'ExtensionHostDebug.stepOut': (id: string) => Promise<unknown>;
60
+ 'ExtensionHostDebug.stepOver': (id: string) => Promise<unknown>;
50
61
  };
@@ -1,5 +1,6 @@
1
1
  import { executeCommand, getCommandRegistrySnapshot } from "../CommandRegistry/CommandRegistry.js";
2
2
  import { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot } from "../Completion/Completion.js";
3
+ import { executeDebugEvaluate, executeDebugGetProperties, executeDebugListProcesses, executeDebugPause, executeDebugResume, executeDebugSetPauseOnExceptions, executeDebugStart, executeDebugStep, executeDebugStepInto, executeDebugStepOut, executeDebugStepOver, } from "../Debug/Debug.js";
3
4
  import { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot } from "../Diagnostic/Diagnostic.js";
4
5
  import { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, } from "../FileSystemProviderRegistry/FileSystemProviderRegistry.js";
5
6
  import { executeFormattingProvider, getFormattingProviderRegistrySnapshot } from "../Formatting/Formatting.js";
@@ -55,4 +56,15 @@ export const commandMap = {
55
56
  'ExtensionApi.getViewRegistrySnapshot': getViewRegistrySnapshot,
56
57
  'ExtensionApi.renderViewInstance': renderViewInstance,
57
58
  'ExtensionApi.saveViewInstanceState': saveViewInstanceState,
59
+ 'ExtensionHostDebug.evaluate': executeDebugEvaluate,
60
+ 'ExtensionHostDebug.getProperties': executeDebugGetProperties,
61
+ 'ExtensionHostDebug.listProcesses': executeDebugListProcesses,
62
+ 'ExtensionHostDebug.pause': executeDebugPause,
63
+ 'ExtensionHostDebug.resume': executeDebugResume,
64
+ 'ExtensionHostDebug.setPauseOnExceptions': executeDebugSetPauseOnExceptions,
65
+ 'ExtensionHostDebug.start': executeDebugStart,
66
+ 'ExtensionHostDebug.step': executeDebugStep,
67
+ 'ExtensionHostDebug.stepInto': executeDebugStepInto,
68
+ 'ExtensionHostDebug.stepOut': executeDebugStepOut,
69
+ 'ExtensionHostDebug.stepOver': executeDebugStepOver,
58
70
  };
@@ -49,4 +49,15 @@ export declare const commandMap: {
49
49
  'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
50
50
  'ExtensionApi.renderViewInstance': (uid: number) => Promise<import("../View/View.ts").ViewRenderResult>;
51
51
  'ExtensionApi.saveViewInstanceState': (uid: number) => Promise<unknown>;
52
+ 'ExtensionHostDebug.evaluate': (id: string, expression: string, callFrameId: string) => Promise<unknown>;
53
+ 'ExtensionHostDebug.getProperties': (id: string, objectId: string) => Promise<unknown>;
54
+ 'ExtensionHostDebug.listProcesses': (id: string, path?: string) => Promise<unknown>;
55
+ 'ExtensionHostDebug.pause': (id: string) => Promise<unknown>;
56
+ 'ExtensionHostDebug.resume': (id: string) => Promise<unknown>;
57
+ 'ExtensionHostDebug.setPauseOnExceptions': (id: string, value: number) => Promise<unknown>;
58
+ 'ExtensionHostDebug.start': (id: string, path?: string) => Promise<unknown>;
59
+ 'ExtensionHostDebug.step': (id: string) => Promise<unknown>;
60
+ 'ExtensionHostDebug.stepInto': (id: string) => Promise<unknown>;
61
+ 'ExtensionHostDebug.stepOut': (id: string) => Promise<unknown>;
62
+ 'ExtensionHostDebug.stepOver': (id: string) => Promise<unknown>;
52
63
  };
@@ -1,5 +1,7 @@
1
+ export type NotificationType = 'error' | 'info' | 'warning';
1
2
  export declare const confirm: (message: string) => Promise<boolean>;
2
3
  export declare const getWorkspaceFolder: () => Promise<string>;
3
4
  export declare const getWorkspaceUri: () => Promise<string>;
4
5
  export declare const handleWorkspaceRefresh: () => Promise<void>;
5
6
  export declare const openUri: (uri: string) => Promise<void>;
7
+ export declare const showNotification: (type: NotificationType, message: string) => Promise<void>;
@@ -14,3 +14,6 @@ export const handleWorkspaceRefresh = async () => {
14
14
  export const openUri = async (uri) => {
15
15
  await executeCommand('Main.openUri', uri);
16
16
  };
17
+ export const showNotification = async (type, message) => {
18
+ await executeCommand('Notification.create', type, message);
19
+ };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/api",
3
- "version": "8.62.0",
3
+ "version": "8.64.0",
4
4
  "description": "Tree-shakeable extension API for Lvce Editor extensions.",
5
5
  "keywords": [
6
6
  "lvce-editor",