@lvce-editor/extension-host-worker 1.6.0 → 1.7.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.
- package/dist/extensionHostWorkerMain.js +39 -38
- package/package.json +1 -1
|
@@ -89,7 +89,7 @@ const fn = value => {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
const state$
|
|
92
|
+
const state$9 = {
|
|
93
93
|
/** @type{any[]} */
|
|
94
94
|
onDidOpenEditorListeners: [],
|
|
95
95
|
/** @type{any[]} */
|
|
@@ -101,19 +101,19 @@ const state$a = {
|
|
|
101
101
|
textDocuments: Object.create(null)
|
|
102
102
|
};
|
|
103
103
|
const setDocument = (textDocumentId, textDocument) => {
|
|
104
|
-
state$
|
|
104
|
+
state$9.textDocuments[textDocumentId] = textDocument;
|
|
105
105
|
};
|
|
106
106
|
const getDidOpenListeners = () => {
|
|
107
|
-
return state$
|
|
107
|
+
return state$9.onDidSaveTextDocumentListeners;
|
|
108
108
|
};
|
|
109
109
|
const getWillChangeListeners = () => {
|
|
110
|
-
return state$
|
|
110
|
+
return state$9.onWillChangeEditorListeners;
|
|
111
111
|
};
|
|
112
112
|
const getDidChangeListeners = () => {
|
|
113
|
-
return state$
|
|
113
|
+
return state$9.onDidChangeTextDocumentListeners;
|
|
114
114
|
};
|
|
115
115
|
const getDocument = textDocumentId => {
|
|
116
|
-
return state$
|
|
116
|
+
return state$9.textDocuments[textDocumentId];
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
const getOffset$1 = (textDocument, position) => {
|
|
@@ -320,7 +320,6 @@ const setLanguageId = (textDocumentId, languageId) => {
|
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
const BABEL_PARSER_SYNTAX_ERROR = 'BABEL_PARSER_SYNTAX_ERROR';
|
|
323
|
-
const E_COMMAND_NOT_FOUND$1 = 'E_COMMAND_NOT_FOUND';
|
|
324
323
|
const E_NO_PROVIDER_FOUND = 'E_NO_PROVIDER_FOUND';
|
|
325
324
|
|
|
326
325
|
class NoProviderFoundError extends Error {
|
|
@@ -676,7 +675,7 @@ const executeOrganizeImports = async uid => {
|
|
|
676
675
|
return edits;
|
|
677
676
|
};
|
|
678
677
|
|
|
679
|
-
const state$
|
|
678
|
+
const state$8 = {
|
|
680
679
|
commands: Object.create(null)
|
|
681
680
|
};
|
|
682
681
|
const getCommandDisplay = command => {
|
|
@@ -685,7 +684,7 @@ const getCommandDisplay = command => {
|
|
|
685
684
|
}
|
|
686
685
|
return '';
|
|
687
686
|
};
|
|
688
|
-
const registerCommand = command => {
|
|
687
|
+
const registerCommand$1 = command => {
|
|
689
688
|
try {
|
|
690
689
|
if (!command) {
|
|
691
690
|
if (command === null) {
|
|
@@ -699,10 +698,10 @@ const registerCommand = command => {
|
|
|
699
698
|
if (!command.execute) {
|
|
700
699
|
throw new Error('command is missing execute function');
|
|
701
700
|
}
|
|
702
|
-
if (command.id in state$
|
|
701
|
+
if (command.id in state$8.commands) {
|
|
703
702
|
throw new Error(`command cannot be registered multiple times`);
|
|
704
703
|
}
|
|
705
|
-
state$
|
|
704
|
+
state$8.commands[command.id] = command;
|
|
706
705
|
} catch (error) {
|
|
707
706
|
const commandDisplayId = getCommandDisplay(command);
|
|
708
707
|
throw new VError$1(error, `Failed to register command${commandDisplayId}`);
|
|
@@ -710,7 +709,7 @@ const registerCommand = command => {
|
|
|
710
709
|
};
|
|
711
710
|
const executeCommand = async (id, ...args) => {
|
|
712
711
|
try {
|
|
713
|
-
const command = state$
|
|
712
|
+
const command = state$8.commands[id];
|
|
714
713
|
if (!command) {
|
|
715
714
|
throw new Error(`command ${id} not found`);
|
|
716
715
|
}
|
|
@@ -749,14 +748,14 @@ const {
|
|
|
749
748
|
}]
|
|
750
749
|
});
|
|
751
750
|
|
|
752
|
-
const state$
|
|
751
|
+
const state$7 = {
|
|
753
752
|
configuration: Object.create(null)
|
|
754
753
|
};
|
|
755
754
|
const getConfiguration = key => {
|
|
756
|
-
return state$
|
|
755
|
+
return state$7.configuration[key] ?? '';
|
|
757
756
|
};
|
|
758
757
|
const setConfigurations = preferences => {
|
|
759
|
-
state$
|
|
758
|
+
state$7.configuration = preferences;
|
|
760
759
|
};
|
|
761
760
|
|
|
762
761
|
const Two = '2.0';
|
|
@@ -813,11 +812,11 @@ const get$4 = id => {
|
|
|
813
812
|
const remove = id => {
|
|
814
813
|
delete state$1$1.callbacks[id];
|
|
815
814
|
};
|
|
816
|
-
const state$
|
|
815
|
+
const state$6 = {
|
|
817
816
|
id: 0
|
|
818
817
|
};
|
|
819
818
|
const create$3$1 = () => {
|
|
820
|
-
return ++state$
|
|
819
|
+
return ++state$6.id;
|
|
821
820
|
};
|
|
822
821
|
const warn = (...args) => {
|
|
823
822
|
console.warn(...args);
|
|
@@ -1148,30 +1147,24 @@ const invokeAndTransfer$1 = async (ipc, method, ...params) => {
|
|
|
1148
1147
|
return result;
|
|
1149
1148
|
};
|
|
1150
1149
|
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
super(`Command "${id}" not found (${processName})`);
|
|
1156
|
-
this.name = 'CommandNotFoundError';
|
|
1157
|
-
// @ts-ignore
|
|
1158
|
-
this.code = E_COMMAND_NOT_FOUND$1;
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
const state$6 = {};
|
|
1150
|
+
const commands = Object.create(null);
|
|
1151
|
+
const registerCommand = (key, fn) => {
|
|
1152
|
+
commands[key] = fn;
|
|
1153
|
+
};
|
|
1163
1154
|
const register$1 = commandMap => {
|
|
1164
|
-
Object.
|
|
1155
|
+
for (const [key, value] of Object.entries(commandMap)) {
|
|
1156
|
+
registerCommand(key, value);
|
|
1157
|
+
}
|
|
1165
1158
|
};
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1159
|
+
const getCommand = key => {
|
|
1160
|
+
return commands[key];
|
|
1161
|
+
};
|
|
1162
|
+
const execute = (command, ...args) => {
|
|
1163
|
+
const fn = getCommand(command);
|
|
1170
1164
|
if (!fn) {
|
|
1171
|
-
throw new
|
|
1165
|
+
throw new Error(`command not found ${command}`);
|
|
1172
1166
|
}
|
|
1173
|
-
|
|
1174
|
-
return fn(...params);
|
|
1167
|
+
return fn(...args);
|
|
1175
1168
|
};
|
|
1176
1169
|
|
|
1177
1170
|
const requiresSocket$1 = () => {
|
|
@@ -2273,7 +2266,7 @@ const api = {
|
|
|
2273
2266
|
// Code Action
|
|
2274
2267
|
registerCodeActionsProvider: registerCodeActionProvider,
|
|
2275
2268
|
// Command
|
|
2276
|
-
registerCommand: registerCommand,
|
|
2269
|
+
registerCommand: registerCommand$1,
|
|
2277
2270
|
executeCommand: executeCommand,
|
|
2278
2271
|
// Completion
|
|
2279
2272
|
registerCompletionProvider: registerCompletionProvider,
|
|
@@ -3392,6 +3385,13 @@ const handleMessagePort = port => {
|
|
|
3392
3385
|
ipc.send('ready');
|
|
3393
3386
|
};
|
|
3394
3387
|
|
|
3388
|
+
const saveState = () => {
|
|
3389
|
+
console.log('TODO save state');
|
|
3390
|
+
return {
|
|
3391
|
+
x: 1
|
|
3392
|
+
};
|
|
3393
|
+
};
|
|
3394
|
+
|
|
3395
3395
|
const commandMap = {
|
|
3396
3396
|
['ExtensionHostDebug.evaluate']: evaluate,
|
|
3397
3397
|
['ExtensionHostDebug.getProperties']: getProperties,
|
|
@@ -3409,6 +3409,7 @@ const commandMap = {
|
|
|
3409
3409
|
['ExtensionHostWebView.load']: load,
|
|
3410
3410
|
['HandleBeforeUnload.handleBeforeUnload']: handleBeforeUnload,
|
|
3411
3411
|
['HandleMessagePort.handleMessagePort']: handleMessagePort,
|
|
3412
|
+
['SaveState.saveState']: saveState,
|
|
3412
3413
|
[BraceCompletionExecuteBraceCompletionProvider]: executeBraceCompletionProvider,
|
|
3413
3414
|
[ClosingTagExecuteClosingTagProvider]: executeClosingTagProvider,
|
|
3414
3415
|
[CommandExecute]: executeCommand,
|
package/package.json
CHANGED