@lvce-editor/problems-view 1.16.0 → 1.17.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.
@@ -1,3 +1,121 @@
1
+ const toCommandId = key => {
2
+ const dotIndex = key.indexOf('.');
3
+ return key.slice(dotIndex + 1);
4
+ };
5
+ const create$6 = () => {
6
+ const states = Object.create(null);
7
+ const commandMapRef = {};
8
+ return {
9
+ get(uid) {
10
+ return states[uid];
11
+ },
12
+ set(uid, oldState, newState) {
13
+ states[uid] = {
14
+ oldState,
15
+ newState
16
+ };
17
+ },
18
+ dispose(uid) {
19
+ delete states[uid];
20
+ },
21
+ getKeys() {
22
+ return Object.keys(states).map(key => {
23
+ return Number.parseInt(key);
24
+ });
25
+ },
26
+ clear() {
27
+ for (const key of Object.keys(states)) {
28
+ delete states[key];
29
+ }
30
+ },
31
+ wrapCommand(fn) {
32
+ const wrapped = async (uid, ...args) => {
33
+ const {
34
+ oldState,
35
+ newState
36
+ } = states[uid];
37
+ const newerState = await fn(newState, ...args);
38
+ if (oldState === newerState || newState === newerState) {
39
+ return;
40
+ }
41
+ const latest = states[uid];
42
+ states[uid] = {
43
+ oldState: latest.oldState,
44
+ newState: newerState
45
+ };
46
+ };
47
+ return wrapped;
48
+ },
49
+ wrapGetter(fn) {
50
+ const wrapped = (uid, ...args) => {
51
+ const {
52
+ newState
53
+ } = states[uid];
54
+ return fn(newState, ...args);
55
+ };
56
+ return wrapped;
57
+ },
58
+ diff(uid, modules, numbers) {
59
+ const {
60
+ oldState,
61
+ newState
62
+ } = states[uid];
63
+ const diffResult = [];
64
+ for (let i = 0; i < modules.length; i++) {
65
+ const fn = modules[i];
66
+ if (!fn(oldState, newState)) {
67
+ diffResult.push(numbers[i]);
68
+ }
69
+ }
70
+ return diffResult;
71
+ },
72
+ getCommandIds() {
73
+ const keys = Object.keys(commandMapRef);
74
+ const ids = keys.map(toCommandId);
75
+ return ids;
76
+ },
77
+ registerCommands(commandMap) {
78
+ Object.assign(commandMapRef, commandMap);
79
+ }
80
+ };
81
+ };
82
+ const terminate = () => {
83
+ globalThis.close();
84
+ };
85
+
86
+ const None$2 = 'none';
87
+ const ToolBar = 'toolbar';
88
+ const Tree = 'tree';
89
+ const TreeItem = 'treeitem';
90
+
91
+ const Button$1 = 1;
92
+ const Div = 4;
93
+ const Input = 6;
94
+ const Span = 8;
95
+ const Text = 12;
96
+ const Img = 17;
97
+ const A = 53;
98
+
99
+ const Space = 9;
100
+ const PageUp = 10;
101
+ const PageDown = 11;
102
+ const End = 255;
103
+ const Home = 12;
104
+ const LeftArrow = 13;
105
+ const UpArrow = 14;
106
+ const RightArrow = 15;
107
+ const DownArrow = 16;
108
+
109
+ const Script$1 = 2;
110
+
111
+ const ProblemsFilter$1 = 25;
112
+
113
+ const None$1 = 0;
114
+
115
+ const DebugWorker = 55;
116
+ const EditorWorker$1 = 99;
117
+ const RendererWorker$1 = 1;
118
+
1
119
  const normalizeLine = line => {
2
120
  if (line.startsWith('Error: ')) {
3
121
  return line.slice('Error: '.length);
@@ -969,6 +1087,53 @@ const listen$1 = async (module, options) => {
969
1087
  const ipc = module.wrap(rawIpc);
970
1088
  return ipc;
971
1089
  };
1090
+
1091
+ /* eslint-disable @typescript-eslint/no-misused-promises */
1092
+
1093
+ const createSharedLazyRpc = factory => {
1094
+ let rpcPromise;
1095
+ const getOrCreate = () => {
1096
+ if (!rpcPromise) {
1097
+ rpcPromise = factory();
1098
+ }
1099
+ return rpcPromise;
1100
+ };
1101
+ return {
1102
+ async dispose() {
1103
+ const rpc = await getOrCreate();
1104
+ await rpc.dispose();
1105
+ },
1106
+ async invoke(method, ...params) {
1107
+ const rpc = await getOrCreate();
1108
+ return rpc.invoke(method, ...params);
1109
+ },
1110
+ async invokeAndTransfer(method, ...params) {
1111
+ const rpc = await getOrCreate();
1112
+ return rpc.invokeAndTransfer(method, ...params);
1113
+ },
1114
+ async send(method, ...params) {
1115
+ const rpc = await getOrCreate();
1116
+ rpc.send(method, ...params);
1117
+ }
1118
+ };
1119
+ };
1120
+ const create$i = async ({
1121
+ commandMap,
1122
+ isMessagePortOpen,
1123
+ send
1124
+ }) => {
1125
+ return createSharedLazyRpc(() => {
1126
+ return create$2({
1127
+ commandMap,
1128
+ isMessagePortOpen,
1129
+ send
1130
+ });
1131
+ });
1132
+ };
1133
+ const LazyTransferMessagePortRpcParent = {
1134
+ __proto__: null,
1135
+ create: create$i
1136
+ };
972
1137
  const create$4 = async ({
973
1138
  commandMap,
974
1139
  isMessagePortOpen = true,
@@ -986,7 +1151,7 @@ const create$4 = async ({
986
1151
  messagePort.start();
987
1152
  return rpc;
988
1153
  };
989
- const create$2$1 = async ({
1154
+ const create$2 = async ({
990
1155
  commandMap,
991
1156
  isMessagePortOpen,
992
1157
  send
@@ -1002,10 +1167,6 @@ const create$2$1 = async ({
1002
1167
  messagePort: port2
1003
1168
  });
1004
1169
  };
1005
- const TransferMessagePortRpcParent = {
1006
- __proto__: null,
1007
- create: create$2$1
1008
- };
1009
1170
  const create$1$1 = async ({
1010
1171
  commandMap
1011
1172
  }) => {
@@ -1040,124 +1201,8 @@ const createMockRpc = ({
1040
1201
  return mockRpc;
1041
1202
  };
1042
1203
 
1043
- const toCommandId$1 = key => {
1044
- const dotIndex = key.indexOf('.');
1045
- return key.slice(dotIndex + 1);
1046
- };
1047
- const create$2 = () => {
1048
- const states = Object.create(null);
1049
- const commandMapRef = {};
1050
- return {
1051
- get(uid) {
1052
- return states[uid];
1053
- },
1054
- set(uid, oldState, newState) {
1055
- states[uid] = {
1056
- oldState,
1057
- newState
1058
- };
1059
- },
1060
- dispose(uid) {
1061
- delete states[uid];
1062
- },
1063
- getKeys() {
1064
- return Object.keys(states).map(key => {
1065
- return Number.parseInt(key);
1066
- });
1067
- },
1068
- clear() {
1069
- for (const key of Object.keys(states)) {
1070
- delete states[key];
1071
- }
1072
- },
1073
- wrapCommand(fn) {
1074
- const wrapped = async (uid, ...args) => {
1075
- const {
1076
- oldState,
1077
- newState
1078
- } = states[uid];
1079
- const newerState = await fn(newState, ...args);
1080
- if (oldState === newerState || newState === newerState) {
1081
- return;
1082
- }
1083
- const latest = states[uid];
1084
- states[uid] = {
1085
- oldState: latest.oldState,
1086
- newState: newerState
1087
- };
1088
- };
1089
- return wrapped;
1090
- },
1091
- wrapGetter(fn) {
1092
- const wrapped = (uid, ...args) => {
1093
- const {
1094
- newState
1095
- } = states[uid];
1096
- return fn(newState, ...args);
1097
- };
1098
- return wrapped;
1099
- },
1100
- diff(uid, modules, numbers) {
1101
- const {
1102
- oldState,
1103
- newState
1104
- } = states[uid];
1105
- const diffResult = [];
1106
- for (let i = 0; i < modules.length; i++) {
1107
- const fn = modules[i];
1108
- if (!fn(oldState, newState)) {
1109
- diffResult.push(numbers[i]);
1110
- }
1111
- }
1112
- return diffResult;
1113
- },
1114
- getCommandIds() {
1115
- const keys = Object.keys(commandMapRef);
1116
- const ids = keys.map(toCommandId$1);
1117
- return ids;
1118
- },
1119
- registerCommands(commandMap) {
1120
- Object.assign(commandMapRef, commandMap);
1121
- }
1122
- };
1123
- };
1124
- const terminate = () => {
1125
- globalThis.close();
1126
- };
1127
-
1128
- const None$1 = 'none';
1129
- const ToolBar = 'toolbar';
1130
- const Tree = 'tree';
1131
- const TreeItem = 'treeitem';
1132
-
1133
- const Button$1 = 1;
1134
- const Div = 4;
1135
- const Input = 6;
1136
- const Span = 8;
1137
- const Text = 12;
1138
- const Img = 17;
1139
- const A = 53;
1140
-
1141
- const Space = 9;
1142
- const PageUp = 10;
1143
- const PageDown = 11;
1144
- const End = 255;
1145
- const Home = 12;
1146
- const LeftArrow = 13;
1147
- const UpArrow = 14;
1148
- const RightArrow = 15;
1149
- const DownArrow = 16;
1150
-
1151
- const Script$1 = 2;
1152
-
1153
- const ProblemsFilter$1 = 25;
1154
-
1155
- const DebugWorker = 55;
1156
- const EditorWorker$1 = 99;
1157
- const RendererWorker$1 = 1;
1158
-
1159
1204
  const rpcs = Object.create(null);
1160
- const set$5 = (id, rpc) => {
1205
+ const set$4 = (id, rpc) => {
1161
1206
  rpcs[id] = rpc;
1162
1207
  };
1163
1208
  const get$1 = id => {
@@ -1190,7 +1235,7 @@ const create$1 = rpcId => {
1190
1235
  const mockRpc = createMockRpc({
1191
1236
  commandMap
1192
1237
  });
1193
- set$5(rpcId, mockRpc);
1238
+ set$4(rpcId, mockRpc);
1194
1239
  // @ts-ignore
1195
1240
  mockRpc[Symbol.dispose] = () => {
1196
1241
  remove(rpcId);
@@ -1199,7 +1244,7 @@ const create$1 = rpcId => {
1199
1244
  return mockRpc;
1200
1245
  },
1201
1246
  set(rpc) {
1202
- set$5(rpcId, rpc);
1247
+ set$4(rpcId, rpc);
1203
1248
  }
1204
1249
  };
1205
1250
  };
@@ -1209,7 +1254,7 @@ const {
1209
1254
  invoke: invoke$1,
1210
1255
  invokeAndTransfer: invokeAndTransfer$1,
1211
1256
  registerMockRpc: registerMockRpc$1,
1212
- set: set$4
1257
+ set: set$3
1213
1258
  } = create$1(EditorWorker$1);
1214
1259
  const sendMessagePortToExtensionHostWorker$1 = async port => {
1215
1260
  const command = 'HandleMessagePort.handleMessagePort2';
@@ -1307,7 +1352,7 @@ const EditorWorker = {
1307
1352
  invokeAndTransfer: invokeAndTransfer$1,
1308
1353
  registerMockRpc: registerMockRpc$1,
1309
1354
  sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
1310
- set: set$4,
1355
+ set: set$3,
1311
1356
  updateDebugInfo
1312
1357
  };
1313
1358
 
@@ -1316,7 +1361,7 @@ const {
1316
1361
  invoke,
1317
1362
  invokeAndTransfer,
1318
1363
  registerMockRpc,
1319
- set: set$3
1364
+ set: set$2
1320
1365
  } = create$1(RendererWorker$1);
1321
1366
  const searchFileHtml = async uri => {
1322
1367
  return invoke('ExtensionHost.searchFileWithHtml', uri);
@@ -1727,7 +1772,7 @@ const RendererWorker = {
1727
1772
  sendMessagePortToSourceControlWorker,
1728
1773
  sendMessagePortToSyntaxHighlightingWorker,
1729
1774
  sendMessagePortToTextMeasurementWorker,
1730
- set: set$3,
1775
+ set: set$2,
1731
1776
  setAdditionalFocus,
1732
1777
  setColorTheme,
1733
1778
  setExtensionsSearchValue,
@@ -1748,7 +1793,7 @@ const RendererWorker = {
1748
1793
 
1749
1794
  const {
1750
1795
  sendMessagePortToEditorWorker,
1751
- set: set$2,
1796
+ set: set$1,
1752
1797
  writeClipBoardText
1753
1798
  } = RendererWorker;
1754
1799
 
@@ -1771,9 +1816,12 @@ const Script = 2;
1771
1816
 
1772
1817
  const {
1773
1818
  get,
1774
- set: set$1,
1775
- wrapCommand
1776
- } = create$2();
1819
+ getCommandIds,
1820
+ registerCommands,
1821
+ set,
1822
+ wrapCommand,
1823
+ wrapGetter
1824
+ } = create$6();
1777
1825
 
1778
1826
  const None = 0;
1779
1827
  const Table = 1;
@@ -1801,7 +1849,7 @@ const create = (id, uri, x, y, width, height, workspaceUri) => {
1801
1849
  x,
1802
1850
  y
1803
1851
  };
1804
- set$1(id, state, state);
1852
+ set(id, state, state);
1805
1853
  };
1806
1854
 
1807
1855
  const isEqual$1 = (oldState, newState) => {
@@ -1845,18 +1893,6 @@ const focusIndex = (state, index) => {
1845
1893
  };
1846
1894
  };
1847
1895
 
1848
- const commandMapRef = {};
1849
-
1850
- const toCommandId = key => {
1851
- const dotIndex = key.indexOf('.');
1852
- return key.slice(dotIndex + 1);
1853
- };
1854
- const getCommandIds = () => {
1855
- const keys = Object.keys(commandMapRef);
1856
- const ids = keys.map(toCommandId);
1857
- return ids;
1858
- };
1859
-
1860
1896
  const mergeClassNames = (...classNames) => {
1861
1897
  return classNames.filter(Boolean).join(' ');
1862
1898
  };
@@ -1919,6 +1955,126 @@ const getKeyBindings = () => {
1919
1955
  }];
1920
1956
  };
1921
1957
 
1958
+ const emptyObject = {};
1959
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1960
+ const i18nString = (key, placeholders = emptyObject) => {
1961
+ if (placeholders === emptyObject) {
1962
+ return key;
1963
+ }
1964
+ const replacer = (match, rest) => {
1965
+ return placeholders[rest];
1966
+ };
1967
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1968
+ };
1969
+
1970
+ const ClearFilters = 'Clear Filters';
1971
+ const Code = 'Code';
1972
+ const File = 'File';
1973
+ const Filter$3 = 'Filter';
1974
+ const LineColumn = '[Ln {PH1}, Col {PH2}]';
1975
+ const Message$1 = 'Message';
1976
+ const NoProblemsDetected = 'No problems have been detected in the workspace.';
1977
+ const NoResultsFoundWithProvidedFilterCriteria = 'No results found with provided filter criteria.';
1978
+ const ProblemsDetected = 'Some problems have been detected in the workspace.';
1979
+ const ShowingOfItems = 'Showing {PH1} of {PH2} ';
1980
+ const Source = 'Source';
1981
+ const CollapseAll$1 = 'Collapse All';
1982
+ const ViewAsTable = 'View as Table';
1983
+ const ViewAsList = 'View as List';
1984
+ const ShowErrors = 'Show Errors';
1985
+ const ShowWarnings = 'Show Warnings';
1986
+ const ShowInfos = 'Show Infos';
1987
+
1988
+ const noProblemsDetected = () => {
1989
+ return i18nString(NoProblemsDetected);
1990
+ };
1991
+ const getMessage = problemsCount => {
1992
+ if (problemsCount === 0) {
1993
+ return i18nString(NoProblemsDetected);
1994
+ }
1995
+ return i18nString(ProblemsDetected);
1996
+ };
1997
+ const atLineColumn = (line, column) => {
1998
+ return i18nString(LineColumn, {
1999
+ PH1: line,
2000
+ PH2: column
2001
+ });
2002
+ };
2003
+ const clearFilter = () => {
2004
+ return i18nString(ClearFilters);
2005
+ };
2006
+ const code = () => {
2007
+ return i18nString(Code);
2008
+ };
2009
+ const message = () => {
2010
+ return i18nString(Message$1);
2011
+ };
2012
+ const file = () => {
2013
+ return i18nString(File);
2014
+ };
2015
+ const filter = () => {
2016
+ return i18nString(Filter$3);
2017
+ };
2018
+ const showingOf = (visibleCount, totalCount) => {
2019
+ return i18nString(ShowingOfItems, {
2020
+ PH1: visibleCount,
2021
+ PH2: totalCount
2022
+ });
2023
+ };
2024
+ const source = () => {
2025
+ return i18nString(Source);
2026
+ };
2027
+ const noResultsFoundWithProvidedFilterCriteria = () => {
2028
+ return i18nString(NoResultsFoundWithProvidedFilterCriteria);
2029
+ };
2030
+ const collapseAll = () => {
2031
+ return i18nString(CollapseAll$1);
2032
+ };
2033
+ const viewAsList$1 = () => {
2034
+ return i18nString(ViewAsList);
2035
+ };
2036
+ const viewAsTable$1 = () => {
2037
+ return i18nString(ViewAsTable);
2038
+ };
2039
+ const showErrors = () => {
2040
+ return i18nString(ShowErrors);
2041
+ };
2042
+ const showWarnings = () => {
2043
+ return i18nString(ShowWarnings);
2044
+ };
2045
+ const showInfos = () => {
2046
+ return i18nString(ShowInfos);
2047
+ };
2048
+
2049
+ const getMenuEntriesFilter = () => [{
2050
+ command: '-1',
2051
+ flags: None$1,
2052
+ id: 'show-errors',
2053
+ label: showErrors()
2054
+ }, {
2055
+ command: '-1',
2056
+ flags: None$1,
2057
+ id: 'show-warnings',
2058
+ label: showWarnings()
2059
+ }, {
2060
+ command: '-1',
2061
+ flags: None$1,
2062
+ id: 'show-infos',
2063
+ label: showInfos()
2064
+ }];
2065
+
2066
+ const getMenuEntries2 = (state, props) => {
2067
+ const {
2068
+ menuId
2069
+ } = props;
2070
+ switch (menuId) {
2071
+ case ProblemsFilter$1:
2072
+ return getMenuEntriesFilter();
2073
+ default:
2074
+ return [];
2075
+ }
2076
+ };
2077
+
1922
2078
  const getMenuIds = () => {
1923
2079
  return [ProblemsFilter$1];
1924
2080
  };
@@ -2064,30 +2220,12 @@ const handleIconThemeChange = state => {
2064
2220
  };
2065
2221
  };
2066
2222
 
2067
- const send = port => {
2068
- return sendMessagePortToEditorWorker(port, 0);
2069
- };
2070
- const createEditorWorkerRpc = async () => {
2071
- try {
2072
- const rpc = await TransferMessagePortRpcParent.create({
2073
- commandMap: {},
2074
- send
2075
- });
2076
- return rpc;
2077
- } catch (error) {
2078
- throw new VError(error, `Failed to create editor worker rpc`);
2079
- }
2223
+ const initialize = async () => {
2224
+ // function is not needed anymore
2080
2225
  };
2081
2226
 
2082
2227
  const {
2083
- getProblems: getProblems$1,
2084
- set
2085
- } = EditorWorker;
2086
-
2087
- const initialize = async () => {
2088
- const rpc = await createEditorWorkerRpc();
2089
- set(rpc);
2090
- };
2228
+ getProblems: getProblems$1} = EditorWorker;
2091
2229
 
2092
2230
  const toProblem = (diagnostic, index) => {
2093
2231
  const {
@@ -2199,85 +2337,6 @@ const getProblems = async workspaceUri => {
2199
2337
  }
2200
2338
  };
2201
2339
 
2202
- const emptyObject = {};
2203
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2204
- const i18nString = (key, placeholders = emptyObject) => {
2205
- if (placeholders === emptyObject) {
2206
- return key;
2207
- }
2208
- const replacer = (match, rest) => {
2209
- return placeholders[rest];
2210
- };
2211
- return key.replaceAll(RE_PLACEHOLDER, replacer);
2212
- };
2213
-
2214
- const ClearFilters = 'Clear Filters';
2215
- const Code = 'Code';
2216
- const File = 'File';
2217
- const Filter$3 = 'Filter';
2218
- const LineColumn = '[Ln {PH1}, Col {PH2}]';
2219
- const Message$1 = 'Message';
2220
- const NoProblemsDetected = 'No problems have been detected in the workspace.';
2221
- const NoResultsFoundWithProvidedFilterCriteria = 'No results found with provided filter criteria.';
2222
- const ProblemsDetected = 'Some problems have been detected in the workspace.';
2223
- const ShowingOfItems = 'Showing {PH1} of {PH2} ';
2224
- const Source = 'Source';
2225
- const CollapseAll$1 = 'Collapse All';
2226
- const ViewAsTable = 'View as Table';
2227
- const ViewAsList = 'View as List';
2228
-
2229
- const noProblemsDetected = () => {
2230
- return i18nString(NoProblemsDetected);
2231
- };
2232
- const getMessage = problemsCount => {
2233
- if (problemsCount === 0) {
2234
- return i18nString(NoProblemsDetected);
2235
- }
2236
- return i18nString(ProblemsDetected);
2237
- };
2238
- const atLineColumn = (line, column) => {
2239
- return i18nString(LineColumn, {
2240
- PH1: line,
2241
- PH2: column
2242
- });
2243
- };
2244
- const clearFilter = () => {
2245
- return i18nString(ClearFilters);
2246
- };
2247
- const code = () => {
2248
- return i18nString(Code);
2249
- };
2250
- const message = () => {
2251
- return i18nString(Message$1);
2252
- };
2253
- const file = () => {
2254
- return i18nString(File);
2255
- };
2256
- const filter = () => {
2257
- return i18nString(Filter$3);
2258
- };
2259
- const showingOf = (visibleCount, totalCount) => {
2260
- return i18nString(ShowingOfItems, {
2261
- PH1: visibleCount,
2262
- PH2: totalCount
2263
- });
2264
- };
2265
- const source = () => {
2266
- return i18nString(Source);
2267
- };
2268
- const noResultsFoundWithProvidedFilterCriteria = () => {
2269
- return i18nString(NoResultsFoundWithProvidedFilterCriteria);
2270
- };
2271
- const collapseAll = () => {
2272
- return i18nString(CollapseAll$1);
2273
- };
2274
- const viewAsList$1 = () => {
2275
- return i18nString(ViewAsList);
2276
- };
2277
- const viewAsTable$1 = () => {
2278
- return i18nString(ViewAsTable);
2279
- };
2280
-
2281
2340
  const getSavedViewMode = savedState => {
2282
2341
  if (savedState && typeof savedState.viewMode === 'number') {
2283
2342
  return savedState.viewMode;
@@ -2376,7 +2435,7 @@ const getIconVirtualDom = (icon, type = Div) => {
2376
2435
  return {
2377
2436
  childCount: 0,
2378
2437
  className: mergeClassNames('MaskIcon', `MaskIcon${icon}`),
2379
- role: None$1,
2438
+ role: None$2,
2380
2439
  type
2381
2440
  };
2382
2441
  };
@@ -2487,7 +2546,7 @@ const getFileIconVirtualDom = icon => {
2487
2546
  return {
2488
2547
  childCount: 0,
2489
2548
  className: FileIcon,
2490
- role: None$1,
2549
+ role: None$2,
2491
2550
  src: icon,
2492
2551
  type: Img
2493
2552
  };
@@ -2891,7 +2950,7 @@ const render2 = (uid, diffResult) => {
2891
2950
  newState,
2892
2951
  oldState
2893
2952
  } = get(uid);
2894
- set$1(uid, newState, newState);
2953
+ set(uid, newState, newState);
2895
2954
  const commands = applyRender(oldState, newState, diffResult);
2896
2955
  return commands;
2897
2956
  };
@@ -3038,6 +3097,7 @@ const commandMap = {
3038
3097
  'Problems.focusIndex': wrapCommand(focusIndex),
3039
3098
  'Problems.getCommandIds': getCommandIds,
3040
3099
  'Problems.getKeyBindings': getKeyBindings,
3100
+ 'Problems.getMenuEntries2': wrapGetter(getMenuEntries2),
3041
3101
  'Problems.getMenuIds': getMenuIds,
3042
3102
  'Problems.handleArrowLeft': wrapCommand(handleArrowLeft),
3043
3103
  'Problems.handleArrowRight': wrapCommand(handleArrowRight),
@@ -3053,18 +3113,41 @@ const commandMap = {
3053
3113
  'Problems.renderActions': renderActions,
3054
3114
  'Problems.renderEventListeners': renderEventListeners,
3055
3115
  'Problems.resize': resize,
3056
- 'Problems.saveState': saveState,
3116
+ 'Problems.saveState': wrapGetter(saveState),
3057
3117
  'Problems.terminate': terminate,
3058
3118
  'Problems.viewAsList': wrapCommand(viewAsList),
3059
3119
  'Problems.viewAsTable': wrapCommand(viewAsTable)
3060
3120
  };
3061
3121
 
3062
- const listen = async () => {
3063
- Object.assign(commandMapRef, commandMap);
3122
+ const commandMapRef = {};
3123
+
3124
+ const send = port => {
3125
+ return sendMessagePortToEditorWorker(port, 0);
3126
+ };
3127
+ const initializeEditorWorkerRpc = async () => {
3128
+ try {
3129
+ const rpc = await LazyTransferMessagePortRpcParent.create({
3130
+ commandMap: {},
3131
+ send
3132
+ });
3133
+ set$3(rpc);
3134
+ return rpc;
3135
+ } catch (error) {
3136
+ throw new VError(error, `Failed to create editor worker rpc`);
3137
+ }
3138
+ };
3139
+
3140
+ const initializeRendererWorker = async () => {
3064
3141
  const rpc = await WebWorkerRpcClient.create({
3065
3142
  commandMap: commandMapRef
3066
3143
  });
3067
- set$2(rpc);
3144
+ set$1(rpc);
3145
+ };
3146
+
3147
+ const listen = async () => {
3148
+ Object.assign(commandMapRef, commandMap);
3149
+ registerCommands(commandMap);
3150
+ await Promise.all([initializeRendererWorker(), initializeEditorWorkerRpc()]);
3068
3151
  };
3069
3152
 
3070
3153
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/problems-view",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Problems View Worker",
5
5
  "repository": {
6
6
  "type": "git",