@lvce-editor/problems-view 1.8.0 → 1.10.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/problemsViewWorkerMain.js +375 -72
- package/package.json +1 -1
|
@@ -423,9 +423,103 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
423
423
|
listen: listen$6,
|
|
424
424
|
wrap: wrap$e
|
|
425
425
|
};
|
|
426
|
+
const addListener = (emitter, type, callback) => {
|
|
427
|
+
if ('addEventListener' in emitter) {
|
|
428
|
+
emitter.addEventListener(type, callback);
|
|
429
|
+
} else {
|
|
430
|
+
emitter.on(type, callback);
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
const removeListener = (emitter, type, callback) => {
|
|
434
|
+
if ('removeEventListener' in emitter) {
|
|
435
|
+
emitter.removeEventListener(type, callback);
|
|
436
|
+
} else {
|
|
437
|
+
emitter.off(type, callback);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
441
|
+
const {
|
|
442
|
+
resolve,
|
|
443
|
+
promise
|
|
444
|
+
} = Promise.withResolvers();
|
|
445
|
+
const listenerMap = Object.create(null);
|
|
446
|
+
const cleanup = value => {
|
|
447
|
+
for (const event of Object.keys(eventMap)) {
|
|
448
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
449
|
+
}
|
|
450
|
+
resolve(value);
|
|
451
|
+
};
|
|
452
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
453
|
+
const listener = event => {
|
|
454
|
+
cleanup({
|
|
455
|
+
type,
|
|
456
|
+
event
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
addListener(eventEmitter, event, listener);
|
|
460
|
+
listenerMap[event] = listener;
|
|
461
|
+
}
|
|
462
|
+
return promise;
|
|
463
|
+
};
|
|
464
|
+
const Message$1$1 = 3;
|
|
465
|
+
const create$5$1 = async ({
|
|
466
|
+
messagePort,
|
|
467
|
+
isMessagePortOpen
|
|
468
|
+
}) => {
|
|
469
|
+
if (!isMessagePort(messagePort)) {
|
|
470
|
+
throw new IpcError('port must be of type MessagePort');
|
|
471
|
+
}
|
|
472
|
+
if (isMessagePortOpen) {
|
|
473
|
+
return messagePort;
|
|
474
|
+
}
|
|
475
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
476
|
+
message: Message$1$1
|
|
477
|
+
});
|
|
478
|
+
messagePort.start();
|
|
479
|
+
const {
|
|
480
|
+
type,
|
|
481
|
+
event
|
|
482
|
+
} = await eventPromise;
|
|
483
|
+
if (type !== Message$1$1) {
|
|
484
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
485
|
+
}
|
|
486
|
+
if (event.data !== readyMessage) {
|
|
487
|
+
throw new IpcError('unexpected first message');
|
|
488
|
+
}
|
|
489
|
+
return messagePort;
|
|
490
|
+
};
|
|
491
|
+
const signal$1 = messagePort => {
|
|
492
|
+
messagePort.start();
|
|
493
|
+
};
|
|
494
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
495
|
+
getData = getData$2;
|
|
496
|
+
send(message) {
|
|
497
|
+
this._rawIpc.postMessage(message);
|
|
498
|
+
}
|
|
499
|
+
sendAndTransfer(message) {
|
|
500
|
+
const transfer = getTransferrables(message);
|
|
501
|
+
this._rawIpc.postMessage(message, transfer);
|
|
502
|
+
}
|
|
503
|
+
dispose() {
|
|
504
|
+
this._rawIpc.close();
|
|
505
|
+
}
|
|
506
|
+
onMessage(callback) {
|
|
507
|
+
this._rawIpc.addEventListener('message', callback);
|
|
508
|
+
}
|
|
509
|
+
onClose(callback) {}
|
|
510
|
+
}
|
|
511
|
+
const wrap$5 = messagePort => {
|
|
512
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
513
|
+
};
|
|
514
|
+
const IpcParentWithMessagePort$1 = {
|
|
515
|
+
__proto__: null,
|
|
516
|
+
create: create$5$1,
|
|
517
|
+
signal: signal$1,
|
|
518
|
+
wrap: wrap$5
|
|
519
|
+
};
|
|
426
520
|
|
|
427
521
|
const Two = '2.0';
|
|
428
|
-
const create$4 = (method, params) => {
|
|
522
|
+
const create$4$1 = (method, params) => {
|
|
429
523
|
return {
|
|
430
524
|
jsonrpc: Two,
|
|
431
525
|
method,
|
|
@@ -433,7 +527,7 @@ const create$4 = (method, params) => {
|
|
|
433
527
|
};
|
|
434
528
|
};
|
|
435
529
|
const callbacks = Object.create(null);
|
|
436
|
-
const set$
|
|
530
|
+
const set$4 = (id, fn) => {
|
|
437
531
|
callbacks[id] = fn;
|
|
438
532
|
};
|
|
439
533
|
const get$2 = id => {
|
|
@@ -452,7 +546,7 @@ const registerPromise = () => {
|
|
|
452
546
|
resolve,
|
|
453
547
|
promise
|
|
454
548
|
} = Promise.withResolvers();
|
|
455
|
-
set$
|
|
549
|
+
set$4(id, resolve);
|
|
456
550
|
return {
|
|
457
551
|
id,
|
|
458
552
|
promise
|
|
@@ -679,7 +773,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
679
773
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
680
774
|
return create$1$1(id, errorProperty);
|
|
681
775
|
};
|
|
682
|
-
const create$
|
|
776
|
+
const create$6 = (message, result) => {
|
|
683
777
|
return {
|
|
684
778
|
jsonrpc: Two,
|
|
685
779
|
id: message.id,
|
|
@@ -688,7 +782,7 @@ const create$5 = (message, result) => {
|
|
|
688
782
|
};
|
|
689
783
|
const getSuccessResponse = (message, result) => {
|
|
690
784
|
const resultProperty = result ?? null;
|
|
691
|
-
return create$
|
|
785
|
+
return create$6(message, resultProperty);
|
|
692
786
|
};
|
|
693
787
|
const getErrorResponseSimple = (id, error) => {
|
|
694
788
|
return {
|
|
@@ -792,11 +886,11 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
792
886
|
const responseMessage = await promise;
|
|
793
887
|
return unwrapJsonRpcResult(responseMessage);
|
|
794
888
|
};
|
|
795
|
-
const send = (transport, method, ...params) => {
|
|
796
|
-
const message = create$4(method, params);
|
|
889
|
+
const send$1 = (transport, method, ...params) => {
|
|
890
|
+
const message = create$4$1(method, params);
|
|
797
891
|
transport.send(message);
|
|
798
892
|
};
|
|
799
|
-
const invoke = (ipc, method, ...params) => {
|
|
893
|
+
const invoke$1 = (ipc, method, ...params) => {
|
|
800
894
|
return invokeHelper(ipc, method, params, false);
|
|
801
895
|
};
|
|
802
896
|
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
@@ -826,10 +920,10 @@ const createRpc = ipc => {
|
|
|
826
920
|
* @deprecated
|
|
827
921
|
*/
|
|
828
922
|
send(method, ...params) {
|
|
829
|
-
send(ipc, method, ...params);
|
|
923
|
+
send$1(ipc, method, ...params);
|
|
830
924
|
},
|
|
831
925
|
invoke(method, ...params) {
|
|
832
|
-
return invoke(ipc, method, ...params);
|
|
926
|
+
return invoke$1(ipc, method, ...params);
|
|
833
927
|
},
|
|
834
928
|
invokeAndTransfer(method, ...params) {
|
|
835
929
|
return invokeAndTransfer(ipc, method, ...params);
|
|
@@ -870,7 +964,41 @@ const listen$1 = async (module, options) => {
|
|
|
870
964
|
const ipc = module.wrap(rawIpc);
|
|
871
965
|
return ipc;
|
|
872
966
|
};
|
|
967
|
+
const create$5 = async ({
|
|
968
|
+
commandMap,
|
|
969
|
+
messagePort
|
|
970
|
+
}) => {
|
|
971
|
+
// TODO create a commandMap per rpc instance
|
|
972
|
+
register(commandMap);
|
|
973
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
974
|
+
messagePort,
|
|
975
|
+
isMessagePortOpen: true
|
|
976
|
+
});
|
|
977
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
978
|
+
handleIpc(ipc);
|
|
979
|
+
const rpc = createRpc(ipc);
|
|
980
|
+
messagePort.start();
|
|
981
|
+
return rpc;
|
|
982
|
+
};
|
|
873
983
|
const create$3 = async ({
|
|
984
|
+
commandMap,
|
|
985
|
+
send
|
|
986
|
+
}) => {
|
|
987
|
+
const {
|
|
988
|
+
port1,
|
|
989
|
+
port2
|
|
990
|
+
} = new MessageChannel();
|
|
991
|
+
await send(port1);
|
|
992
|
+
return create$5({
|
|
993
|
+
commandMap,
|
|
994
|
+
messagePort: port2
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
const TransferMessagePortRpcParent = {
|
|
998
|
+
__proto__: null,
|
|
999
|
+
create: create$3
|
|
1000
|
+
};
|
|
1001
|
+
const create$4 = async ({
|
|
874
1002
|
commandMap
|
|
875
1003
|
}) => {
|
|
876
1004
|
// TODO create a commandMap per rpc instance
|
|
@@ -882,7 +1010,7 @@ const create$3 = async ({
|
|
|
882
1010
|
};
|
|
883
1011
|
const WebWorkerRpcClient = {
|
|
884
1012
|
__proto__: null,
|
|
885
|
-
create: create$
|
|
1013
|
+
create: create$4
|
|
886
1014
|
};
|
|
887
1015
|
|
|
888
1016
|
const create$2 = () => {
|
|
@@ -980,22 +1108,38 @@ const create$1 = rpcId => {
|
|
|
980
1108
|
}
|
|
981
1109
|
};
|
|
982
1110
|
};
|
|
1111
|
+
const EditorWorker$1 = 99;
|
|
983
1112
|
const RendererWorker$1 = 1;
|
|
1113
|
+
const {
|
|
1114
|
+
invoke: invoke$c,
|
|
1115
|
+
set: set$c} = create$1(EditorWorker$1);
|
|
1116
|
+
const EditorWorker = {
|
|
1117
|
+
__proto__: null,
|
|
1118
|
+
invoke: invoke$c,
|
|
1119
|
+
set: set$c};
|
|
984
1120
|
const {
|
|
985
1121
|
invoke: invoke$3,
|
|
1122
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
986
1123
|
set: set$3} = create$1(RendererWorker$1);
|
|
1124
|
+
const sendMessagePortToEditorWorker$1 = async (port, rpcId) => {
|
|
1125
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1126
|
+
// @ts-ignore
|
|
1127
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1128
|
+
};
|
|
987
1129
|
const writeClipBoardText$1 = async text => {
|
|
988
1130
|
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
989
1131
|
};
|
|
990
1132
|
const RendererWorker = {
|
|
991
1133
|
__proto__: null,
|
|
1134
|
+
sendMessagePortToEditorWorker: sendMessagePortToEditorWorker$1,
|
|
992
1135
|
set: set$3,
|
|
993
1136
|
writeClipBoardText: writeClipBoardText$1
|
|
994
1137
|
};
|
|
995
1138
|
|
|
996
1139
|
const {
|
|
997
|
-
set: set$
|
|
998
|
-
writeClipBoardText
|
|
1140
|
+
set: set$2,
|
|
1141
|
+
writeClipBoardText,
|
|
1142
|
+
sendMessagePortToEditorWorker
|
|
999
1143
|
} = RendererWorker;
|
|
1000
1144
|
|
|
1001
1145
|
const writeText = async text => {
|
|
@@ -1017,7 +1161,7 @@ const Script = 2;
|
|
|
1017
1161
|
|
|
1018
1162
|
const {
|
|
1019
1163
|
get,
|
|
1020
|
-
set,
|
|
1164
|
+
set: set$1,
|
|
1021
1165
|
wrapCommand
|
|
1022
1166
|
} = create$2();
|
|
1023
1167
|
|
|
@@ -1025,10 +1169,9 @@ const None$1 = 0;
|
|
|
1025
1169
|
const Table = 1;
|
|
1026
1170
|
const List = 2;
|
|
1027
1171
|
|
|
1028
|
-
const create = (id, uri, x, y, width, height,
|
|
1172
|
+
const create = (id, uri, x, y, width, height, workspaceUri) => {
|
|
1029
1173
|
const state = {
|
|
1030
1174
|
uid: id,
|
|
1031
|
-
parentUid,
|
|
1032
1175
|
problems: [],
|
|
1033
1176
|
focusedIndex: -2,
|
|
1034
1177
|
message: '',
|
|
@@ -1045,9 +1188,10 @@ const create = (id, uri, x, y, width, height, args, parentUid) => {
|
|
|
1045
1188
|
listItems: [],
|
|
1046
1189
|
collapsedUris: [],
|
|
1047
1190
|
smallWidthBreakPoint: 650,
|
|
1048
|
-
filteredProblems: []
|
|
1191
|
+
filteredProblems: [],
|
|
1192
|
+
workspaceUri
|
|
1049
1193
|
};
|
|
1050
|
-
set(id, state, state);
|
|
1194
|
+
set$1(id, state, state);
|
|
1051
1195
|
};
|
|
1052
1196
|
|
|
1053
1197
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -1055,7 +1199,7 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
1055
1199
|
};
|
|
1056
1200
|
|
|
1057
1201
|
const isEqual = (oldState, newState) => {
|
|
1058
|
-
return oldState.problems === newState.problems && oldState.filterValue === newState.filterValue;
|
|
1202
|
+
return oldState.problems === newState.problems && oldState.filterValue === newState.filterValue && oldState.message === newState.message;
|
|
1059
1203
|
};
|
|
1060
1204
|
|
|
1061
1205
|
const RenderItems = 1;
|
|
@@ -1309,6 +1453,10 @@ const handleClickAt = (state, eventX, eventY) => {
|
|
|
1309
1453
|
};
|
|
1310
1454
|
};
|
|
1311
1455
|
|
|
1456
|
+
const handleClickButton = async (state, name) => {
|
|
1457
|
+
return state;
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1312
1460
|
const handleContextMenu = async (state, eventX, eventY) => {
|
|
1313
1461
|
// @ts-ignore
|
|
1314
1462
|
// await ContextMenu.show(eventX, eventY, MenuEntryId.Problems)
|
|
@@ -1330,13 +1478,139 @@ const handleIconThemeChange = state => {
|
|
|
1330
1478
|
};
|
|
1331
1479
|
};
|
|
1332
1480
|
|
|
1481
|
+
const send = port => {
|
|
1482
|
+
return sendMessagePortToEditorWorker(port, 0);
|
|
1483
|
+
};
|
|
1484
|
+
const createEditorWorkerRpc = async () => {
|
|
1485
|
+
try {
|
|
1486
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
1487
|
+
commandMap: {},
|
|
1488
|
+
send
|
|
1489
|
+
});
|
|
1490
|
+
return rpc;
|
|
1491
|
+
} catch (error) {
|
|
1492
|
+
throw new VError(error, `Failed to create editor worker rpc`);
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
const {
|
|
1497
|
+
invoke,
|
|
1498
|
+
set} = EditorWorker;
|
|
1499
|
+
|
|
1333
1500
|
const initialize = async () => {
|
|
1334
|
-
|
|
1501
|
+
const rpc = await createEditorWorkerRpc();
|
|
1502
|
+
set(rpc);
|
|
1335
1503
|
};
|
|
1336
1504
|
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
|
|
1505
|
+
const toProblem = (diagnostic, index) => {
|
|
1506
|
+
const {
|
|
1507
|
+
message,
|
|
1508
|
+
rowIndex,
|
|
1509
|
+
columnIndex,
|
|
1510
|
+
source,
|
|
1511
|
+
code,
|
|
1512
|
+
type,
|
|
1513
|
+
uri
|
|
1514
|
+
} = diagnostic;
|
|
1515
|
+
return {
|
|
1516
|
+
message: message || '',
|
|
1517
|
+
rowIndex: rowIndex || 0,
|
|
1518
|
+
columnIndex: columnIndex || 0,
|
|
1519
|
+
uri,
|
|
1520
|
+
relativePath: '',
|
|
1521
|
+
count: 0,
|
|
1522
|
+
source: source || '',
|
|
1523
|
+
code: code || '',
|
|
1524
|
+
type: type || 'error',
|
|
1525
|
+
listItemType: Item,
|
|
1526
|
+
posInSet: index,
|
|
1527
|
+
setSize: 1,
|
|
1528
|
+
level: 2,
|
|
1529
|
+
fileName: ''
|
|
1530
|
+
};
|
|
1531
|
+
};
|
|
1532
|
+
const getRelativeParentUri = (uri, workspaceUri) => {
|
|
1533
|
+
const slashIndex = uri.lastIndexOf('/');
|
|
1534
|
+
return uri.slice(0, slashIndex).slice(workspaceUri.length);
|
|
1535
|
+
};
|
|
1536
|
+
const getFileName = uri => {
|
|
1537
|
+
const slashIndex = uri.lastIndexOf('/');
|
|
1538
|
+
return uri.slice(slashIndex + 1);
|
|
1539
|
+
};
|
|
1540
|
+
const toProblems = (diagnostics, workspaceUri = '') => {
|
|
1541
|
+
const problems = [];
|
|
1542
|
+
let problem = {
|
|
1543
|
+
message: '',
|
|
1544
|
+
rowIndex: 0,
|
|
1545
|
+
columnIndex: 0,
|
|
1546
|
+
uri: '',
|
|
1547
|
+
relativePath: '',
|
|
1548
|
+
count: 0,
|
|
1549
|
+
source: '',
|
|
1550
|
+
code: '',
|
|
1551
|
+
level: 0,
|
|
1552
|
+
listItemType: 0,
|
|
1553
|
+
posInSet: 0,
|
|
1554
|
+
setSize: 0,
|
|
1555
|
+
type: '',
|
|
1556
|
+
fileName: ''
|
|
1557
|
+
};
|
|
1558
|
+
let relativeIndex = 0;
|
|
1559
|
+
for (const diagnostic of diagnostics) {
|
|
1560
|
+
if (diagnostic.uri === problem.uri) {
|
|
1561
|
+
relativeIndex++;
|
|
1562
|
+
problem.count++;
|
|
1563
|
+
} else {
|
|
1564
|
+
relativeIndex = 1;
|
|
1565
|
+
problem = {
|
|
1566
|
+
message: '',
|
|
1567
|
+
rowIndex: 0,
|
|
1568
|
+
columnIndex: 0,
|
|
1569
|
+
uri: diagnostic.uri,
|
|
1570
|
+
relativePath: '',
|
|
1571
|
+
count: 1,
|
|
1572
|
+
source: '',
|
|
1573
|
+
type: '',
|
|
1574
|
+
listItemType: Expanded,
|
|
1575
|
+
posInSet: relativeIndex,
|
|
1576
|
+
setSize: 123,
|
|
1577
|
+
level: 1,
|
|
1578
|
+
code: '',
|
|
1579
|
+
fileName: ''
|
|
1580
|
+
};
|
|
1581
|
+
problems.push(problem);
|
|
1582
|
+
}
|
|
1583
|
+
problems.push(toProblem(diagnostic, relativeIndex));
|
|
1584
|
+
}
|
|
1585
|
+
for (const problem of problems) {
|
|
1586
|
+
// TODO maybe rename property, this should be the relative path of the parent folder of the file
|
|
1587
|
+
// @ts-ignore
|
|
1588
|
+
problem.relativePath = getRelativeParentUri(problem.uri, workspaceUri);
|
|
1589
|
+
// @ts-ignore
|
|
1590
|
+
problem.fileName = getFileName(problem.uri);
|
|
1591
|
+
// problem.uri = problem.uri // TODO
|
|
1592
|
+
}
|
|
1593
|
+
return problems;
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
// TODO send event listener to editor, asking to send problem updates to this worker
|
|
1597
|
+
|
|
1598
|
+
const getProblems = async workspaceUri => {
|
|
1599
|
+
try {
|
|
1600
|
+
// @ts-ignore
|
|
1601
|
+
const diagnostics = await invoke('Editor.getProblems');
|
|
1602
|
+
// @ts-ignore
|
|
1603
|
+
const problems = toProblems(diagnostics, workspaceUri);
|
|
1604
|
+
return {
|
|
1605
|
+
problems,
|
|
1606
|
+
error: ''
|
|
1607
|
+
};
|
|
1608
|
+
} catch (error) {
|
|
1609
|
+
return {
|
|
1610
|
+
problems: [],
|
|
1611
|
+
error: `${error}`
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1340
1614
|
};
|
|
1341
1615
|
|
|
1342
1616
|
const emptyObject = {};
|
|
@@ -1440,7 +1714,16 @@ const getSavedCollapsedUris = savedState => {
|
|
|
1440
1714
|
return [];
|
|
1441
1715
|
};
|
|
1442
1716
|
const loadContent = async (state, savedState) => {
|
|
1443
|
-
const
|
|
1717
|
+
const {
|
|
1718
|
+
problems,
|
|
1719
|
+
error
|
|
1720
|
+
} = await getProblems(state.workspaceUri);
|
|
1721
|
+
if (error) {
|
|
1722
|
+
return {
|
|
1723
|
+
...state,
|
|
1724
|
+
message: error
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1444
1727
|
const message = getMessage(problems.length);
|
|
1445
1728
|
const viewMode = getSavedViewMode(savedState);
|
|
1446
1729
|
const filterValue = getSavedFilterValue(savedState);
|
|
@@ -1576,6 +1859,22 @@ const getProblemsFilterVirtualDom = action => {
|
|
|
1576
1859
|
})];
|
|
1577
1860
|
};
|
|
1578
1861
|
|
|
1862
|
+
const getNoResultsWithFilterVirtualDom = () => {
|
|
1863
|
+
return [{
|
|
1864
|
+
type: VirtualDomElements.Div,
|
|
1865
|
+
className: Message,
|
|
1866
|
+
childCount: 3
|
|
1867
|
+
}, {
|
|
1868
|
+
type: VirtualDomElements.Span,
|
|
1869
|
+
childCount: 1
|
|
1870
|
+
}, text(noResultsFoundWithProvidedFilterCriteria()), {
|
|
1871
|
+
type: VirtualDomElements.A,
|
|
1872
|
+
className: MessageAction,
|
|
1873
|
+
childCount: 1,
|
|
1874
|
+
onClick: HandleClearFilterClick
|
|
1875
|
+
}, text(clearFilter()), text('.')];
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1579
1878
|
const getBadgeVirtualDom = (className, count) => {
|
|
1580
1879
|
return [{
|
|
1581
1880
|
type: VirtualDomElements.Div,
|
|
@@ -1647,23 +1946,23 @@ const getTreeItemIndent = depth => {
|
|
|
1647
1946
|
|
|
1648
1947
|
const getProblemVirtualDom = problem => {
|
|
1649
1948
|
const {
|
|
1650
|
-
|
|
1651
|
-
rowIndex,
|
|
1949
|
+
code,
|
|
1652
1950
|
columnIndex,
|
|
1653
|
-
|
|
1654
|
-
uri,
|
|
1951
|
+
filterValueLength,
|
|
1655
1952
|
icon,
|
|
1656
|
-
|
|
1657
|
-
|
|
1953
|
+
isActive,
|
|
1954
|
+
isCollapsed,
|
|
1955
|
+
level,
|
|
1956
|
+
listItemType,
|
|
1957
|
+
message,
|
|
1658
1958
|
messageMatchIndex,
|
|
1659
|
-
filterValueLength,
|
|
1660
|
-
code,
|
|
1661
|
-
type,
|
|
1662
1959
|
posInSet,
|
|
1960
|
+
relativePath,
|
|
1961
|
+
rowIndex,
|
|
1663
1962
|
setSize,
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1963
|
+
source,
|
|
1964
|
+
type,
|
|
1965
|
+
fileName
|
|
1667
1966
|
} = problem;
|
|
1668
1967
|
let className = Problem;
|
|
1669
1968
|
if (isActive) {
|
|
@@ -1681,7 +1980,7 @@ const getProblemVirtualDom = problem => {
|
|
|
1681
1980
|
ariaExpanded: !isCollapsed,
|
|
1682
1981
|
ariaSelected: isActive,
|
|
1683
1982
|
role: AriaRoles.TreeItem
|
|
1684
|
-
}, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(), getFileIconVirtualDom(icon), text(
|
|
1983
|
+
}, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(), getFileIconVirtualDom(icon), text(fileName), {
|
|
1685
1984
|
type: VirtualDomElements.Div,
|
|
1686
1985
|
className: LabelDetail,
|
|
1687
1986
|
childCount: 1
|
|
@@ -1739,29 +2038,12 @@ const getProblemsListVirtualDom = problems => {
|
|
|
1739
2038
|
return dom;
|
|
1740
2039
|
};
|
|
1741
2040
|
|
|
1742
|
-
const getProblemsNoProblemsFoundVirtualDom =
|
|
1743
|
-
|
|
1744
|
-
const dom = [];
|
|
1745
|
-
dom.push({
|
|
2041
|
+
const getProblemsNoProblemsFoundVirtualDom = () => {
|
|
2042
|
+
return [{
|
|
1746
2043
|
type: VirtualDomElements.Div,
|
|
1747
2044
|
className: Message,
|
|
1748
2045
|
childCount: 1
|
|
1749
|
-
});
|
|
1750
|
-
if (filterValue) {
|
|
1751
|
-
dom[0].childCount += 2;
|
|
1752
|
-
dom.push({
|
|
1753
|
-
type: VirtualDomElements.Span,
|
|
1754
|
-
childCount: 1
|
|
1755
|
-
}, text(noResultsFoundWithProvidedFilterCriteria()), {
|
|
1756
|
-
type: VirtualDomElements.A,
|
|
1757
|
-
className: MessageAction,
|
|
1758
|
-
childCount: 1,
|
|
1759
|
-
onClick: HandleClearFilterClick
|
|
1760
|
-
}, text(clearFilter()), text('.'));
|
|
1761
|
-
} else {
|
|
1762
|
-
dom.push(text(noProblemsDetected()));
|
|
1763
|
-
}
|
|
1764
|
-
return dom;
|
|
2046
|
+
}, text(noProblemsDetected())];
|
|
1765
2047
|
};
|
|
1766
2048
|
|
|
1767
2049
|
const getClassName = isEven => {
|
|
@@ -1867,9 +2149,19 @@ const getProblemsTableVirtualDom = problems => {
|
|
|
1867
2149
|
return dom;
|
|
1868
2150
|
};
|
|
1869
2151
|
|
|
1870
|
-
const getProblemsVirtualDom$1 = (viewMode, problems, filterValue) => {
|
|
2152
|
+
const getProblemsVirtualDom$1 = (viewMode, problems, filterValue, message) => {
|
|
2153
|
+
if (problems.length === 0 && message) {
|
|
2154
|
+
return [{
|
|
2155
|
+
type: VirtualDomElements.Div,
|
|
2156
|
+
className: Message,
|
|
2157
|
+
childCount: 1
|
|
2158
|
+
}, text(message)];
|
|
2159
|
+
}
|
|
2160
|
+
if (problems.length === 0 && filterValue) {
|
|
2161
|
+
return getNoResultsWithFilterVirtualDom();
|
|
2162
|
+
}
|
|
1871
2163
|
if (problems.length === 0) {
|
|
1872
|
-
return getProblemsNoProblemsFoundVirtualDom(
|
|
2164
|
+
return getProblemsNoProblemsFoundVirtualDom();
|
|
1873
2165
|
}
|
|
1874
2166
|
if (viewMode === Table) {
|
|
1875
2167
|
return getProblemsTableVirtualDom(problems);
|
|
@@ -1877,7 +2169,7 @@ const getProblemsVirtualDom$1 = (viewMode, problems, filterValue) => {
|
|
|
1877
2169
|
return getProblemsListVirtualDom(problems);
|
|
1878
2170
|
};
|
|
1879
2171
|
|
|
1880
|
-
const getProblemsVirtualDom = (viewMode, problems, filterValue, isSmall) => {
|
|
2172
|
+
const getProblemsVirtualDom = (viewMode, problems, filterValue, isSmall, message) => {
|
|
1881
2173
|
// TODO avoid mutation
|
|
1882
2174
|
const dom = [];
|
|
1883
2175
|
dom.push({
|
|
@@ -1896,7 +2188,7 @@ const getProblemsVirtualDom = (viewMode, problems, filterValue, isSmall) => {
|
|
|
1896
2188
|
badgeText: '',
|
|
1897
2189
|
placeholder: filter()}));
|
|
1898
2190
|
}
|
|
1899
|
-
dom.push(...getProblemsVirtualDom$1(viewMode, problems, filterValue));
|
|
2191
|
+
dom.push(...getProblemsVirtualDom$1(viewMode, problems, filterValue, message));
|
|
1900
2192
|
return dom;
|
|
1901
2193
|
};
|
|
1902
2194
|
|
|
@@ -1973,9 +2265,19 @@ const getVisibleProblems = (problems, collapsedUris, focusedIndex, filterValue)
|
|
|
1973
2265
|
};
|
|
1974
2266
|
|
|
1975
2267
|
const renderItems = (oldState, newState) => {
|
|
1976
|
-
const
|
|
1977
|
-
|
|
1978
|
-
|
|
2268
|
+
const {
|
|
2269
|
+
problems,
|
|
2270
|
+
width,
|
|
2271
|
+
smallWidthBreakPoint,
|
|
2272
|
+
collapsedUris,
|
|
2273
|
+
focusedIndex,
|
|
2274
|
+
viewMode,
|
|
2275
|
+
filterValue,
|
|
2276
|
+
message
|
|
2277
|
+
} = newState;
|
|
2278
|
+
const visible = getVisibleProblems(problems, collapsedUris, focusedIndex, filterValue);
|
|
2279
|
+
const isSmall = width <= smallWidthBreakPoint;
|
|
2280
|
+
const dom = getProblemsVirtualDom(viewMode, visible, filterValue, isSmall, message);
|
|
1979
2281
|
return ['Viewlet.setDom2', dom];
|
|
1980
2282
|
};
|
|
1981
2283
|
|
|
@@ -2004,7 +2306,7 @@ const render2 = (uid, diffResult) => {
|
|
|
2004
2306
|
oldState,
|
|
2005
2307
|
newState
|
|
2006
2308
|
} = get(uid);
|
|
2007
|
-
set(uid, newState, newState);
|
|
2309
|
+
set$1(uid, newState, newState);
|
|
2008
2310
|
const commands = applyRender(oldState, newState, diffResult);
|
|
2009
2311
|
return commands;
|
|
2010
2312
|
};
|
|
@@ -2142,18 +2444,19 @@ const viewAsTable = state => {
|
|
|
2142
2444
|
};
|
|
2143
2445
|
|
|
2144
2446
|
const commandMap = {
|
|
2145
|
-
'Problems.copyMessage': copyMessage,
|
|
2447
|
+
'Problems.copyMessage': wrapCommand(copyMessage),
|
|
2146
2448
|
'Problems.create': create,
|
|
2147
2449
|
'Problems.diff2': diff2,
|
|
2148
|
-
'Problems.focusIndex': focusIndex,
|
|
2450
|
+
'Problems.focusIndex': wrapCommand(focusIndex),
|
|
2149
2451
|
'Problems.getCommandIds': getCommandIds,
|
|
2150
2452
|
'Problems.getKeyBindings': getKeyBindings,
|
|
2151
2453
|
'Problems.handleArrowLeft': wrapCommand(handleArrowLeft),
|
|
2152
2454
|
'Problems.handleArrowRight': wrapCommand(handleArrowRight),
|
|
2153
2455
|
'Problems.handleClickAt': wrapCommand(handleClickAt),
|
|
2154
|
-
'Problems.handleContextMenu': handleContextMenu,
|
|
2456
|
+
'Problems.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2457
|
+
'Problems.handleClickButton': wrapCommand(handleClickButton),
|
|
2155
2458
|
'Problems.handleFilterInput': wrapCommand(handleFilterInput),
|
|
2156
|
-
'Problems.handleIconThemeChange': handleIconThemeChange,
|
|
2459
|
+
'Problems.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
2157
2460
|
'Problems.initialize': initialize,
|
|
2158
2461
|
'Problems.loadContent': wrapCommand(loadContent),
|
|
2159
2462
|
'Problems.render2': render2,
|
|
@@ -2162,8 +2465,8 @@ const commandMap = {
|
|
|
2162
2465
|
'Problems.resize': resize,
|
|
2163
2466
|
'Problems.saveState': saveState,
|
|
2164
2467
|
'Problems.terminate': terminate,
|
|
2165
|
-
'Problems.viewAsList': viewAsList,
|
|
2166
|
-
'Problems.viewAsTable': viewAsTable
|
|
2468
|
+
'Problems.viewAsList': wrapCommand(viewAsList),
|
|
2469
|
+
'Problems.viewAsTable': wrapCommand(viewAsTable)
|
|
2167
2470
|
};
|
|
2168
2471
|
|
|
2169
2472
|
const listen = async () => {
|
|
@@ -2171,7 +2474,7 @@ const listen = async () => {
|
|
|
2171
2474
|
const rpc = await WebWorkerRpcClient.create({
|
|
2172
2475
|
commandMap: commandMapRef
|
|
2173
2476
|
});
|
|
2174
|
-
set$
|
|
2477
|
+
set$2(rpc);
|
|
2175
2478
|
};
|
|
2176
2479
|
|
|
2177
2480
|
const main = async () => {
|