@lvce-editor/activity-bar-worker 2.3.0 → 3.1.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/activityBarWorkerMain.js +211 -115
- package/package.json +1 -1
|
@@ -225,8 +225,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
225
225
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
226
226
|
const message = lines[messageIndex];
|
|
227
227
|
return {
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
229
|
+
message
|
|
230
230
|
};
|
|
231
231
|
};
|
|
232
232
|
const isModuleNotFoundError = stderr => {
|
|
@@ -249,14 +249,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
249
249
|
const getNativeModuleErrorMessage = stderr => {
|
|
250
250
|
const message = getMessageCodeBlock(stderr);
|
|
251
251
|
return {
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
253
|
+
message: `Incompatible native node module: ${message}`
|
|
254
254
|
};
|
|
255
255
|
};
|
|
256
256
|
const getModuleSyntaxError = () => {
|
|
257
257
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
259
|
+
message: `ES Modules are not supported in electron`
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
262
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -275,8 +275,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
275
275
|
rest
|
|
276
276
|
} = getDetails(lines);
|
|
277
277
|
return {
|
|
278
|
-
message: actualMessage,
|
|
279
278
|
code: '',
|
|
279
|
+
message: actualMessage,
|
|
280
280
|
stack: rest
|
|
281
281
|
};
|
|
282
282
|
};
|
|
@@ -286,8 +286,8 @@ class IpcError extends VError {
|
|
|
286
286
|
if (stdout || stderr) {
|
|
287
287
|
// @ts-ignore
|
|
288
288
|
const {
|
|
289
|
-
message,
|
|
290
289
|
code,
|
|
290
|
+
message,
|
|
291
291
|
stack
|
|
292
292
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
293
293
|
const cause = new Error(message);
|
|
@@ -348,8 +348,8 @@ const wrap$f = global => {
|
|
|
348
348
|
};
|
|
349
349
|
const waitForFirstMessage = async port => {
|
|
350
350
|
const {
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
promise,
|
|
352
|
+
resolve
|
|
353
353
|
} = Promise.withResolvers();
|
|
354
354
|
port.addEventListener('message', resolve, {
|
|
355
355
|
once: true
|
|
@@ -369,8 +369,8 @@ const listen$6 = async () => {
|
|
|
369
369
|
const type = firstMessage.params[0];
|
|
370
370
|
if (type === 'message-port') {
|
|
371
371
|
parentIpc.send({
|
|
372
|
-
jsonrpc: '2.0',
|
|
373
372
|
id: firstMessage.id,
|
|
373
|
+
jsonrpc: '2.0',
|
|
374
374
|
result: null
|
|
375
375
|
});
|
|
376
376
|
parentIpc.dispose();
|
|
@@ -412,56 +412,14 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
412
412
|
wrap: wrap$e
|
|
413
413
|
};
|
|
414
414
|
|
|
415
|
-
const Two = '2.0';
|
|
416
|
-
const create$4 = (method, params) => {
|
|
417
|
-
return {
|
|
418
|
-
jsonrpc: Two,
|
|
419
|
-
method,
|
|
420
|
-
params
|
|
421
|
-
};
|
|
422
|
-
};
|
|
415
|
+
const Two$1 = '2.0';
|
|
423
416
|
const callbacks = Object.create(null);
|
|
424
|
-
const set$3 = (id, fn) => {
|
|
425
|
-
callbacks[id] = fn;
|
|
426
|
-
};
|
|
427
417
|
const get$2 = id => {
|
|
428
418
|
return callbacks[id];
|
|
429
419
|
};
|
|
430
|
-
const remove = id => {
|
|
420
|
+
const remove$1 = id => {
|
|
431
421
|
delete callbacks[id];
|
|
432
422
|
};
|
|
433
|
-
let id = 0;
|
|
434
|
-
const create$3$1 = () => {
|
|
435
|
-
return ++id;
|
|
436
|
-
};
|
|
437
|
-
const registerPromise = () => {
|
|
438
|
-
const id = create$3$1();
|
|
439
|
-
const {
|
|
440
|
-
resolve,
|
|
441
|
-
promise
|
|
442
|
-
} = Promise.withResolvers();
|
|
443
|
-
set$3(id, resolve);
|
|
444
|
-
return {
|
|
445
|
-
id,
|
|
446
|
-
promise
|
|
447
|
-
};
|
|
448
|
-
};
|
|
449
|
-
const create$2$1 = (method, params) => {
|
|
450
|
-
const {
|
|
451
|
-
id,
|
|
452
|
-
promise
|
|
453
|
-
} = registerPromise();
|
|
454
|
-
const message = {
|
|
455
|
-
jsonrpc: Two,
|
|
456
|
-
method,
|
|
457
|
-
params,
|
|
458
|
-
id
|
|
459
|
-
};
|
|
460
|
-
return {
|
|
461
|
-
message,
|
|
462
|
-
promise
|
|
463
|
-
};
|
|
464
|
-
};
|
|
465
423
|
class JsonRpcError extends Error {
|
|
466
424
|
constructor(message) {
|
|
467
425
|
super(message);
|
|
@@ -612,7 +570,7 @@ const resolve = (id, response) => {
|
|
|
612
570
|
return;
|
|
613
571
|
}
|
|
614
572
|
fn(response);
|
|
615
|
-
remove(id);
|
|
573
|
+
remove$1(id);
|
|
616
574
|
};
|
|
617
575
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
618
576
|
const getErrorType = prettyError => {
|
|
@@ -655,9 +613,9 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
655
613
|
}
|
|
656
614
|
};
|
|
657
615
|
};
|
|
658
|
-
const create$1$
|
|
616
|
+
const create$1$2 = (id, error) => {
|
|
659
617
|
return {
|
|
660
|
-
jsonrpc: Two,
|
|
618
|
+
jsonrpc: Two$1,
|
|
661
619
|
id,
|
|
662
620
|
error
|
|
663
621
|
};
|
|
@@ -666,22 +624,22 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
666
624
|
const prettyError = preparePrettyError(error);
|
|
667
625
|
logError(error, prettyError);
|
|
668
626
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
669
|
-
return create$1$
|
|
627
|
+
return create$1$2(id, errorProperty);
|
|
670
628
|
};
|
|
671
|
-
const create$
|
|
629
|
+
const create$3 = (message, result) => {
|
|
672
630
|
return {
|
|
673
|
-
jsonrpc: Two,
|
|
631
|
+
jsonrpc: Two$1,
|
|
674
632
|
id: message.id,
|
|
675
633
|
result: result ?? null
|
|
676
634
|
};
|
|
677
635
|
};
|
|
678
636
|
const getSuccessResponse = (message, result) => {
|
|
679
637
|
const resultProperty = result ?? null;
|
|
680
|
-
return create$
|
|
638
|
+
return create$3(message, resultProperty);
|
|
681
639
|
};
|
|
682
640
|
const getErrorResponseSimple = (id, error) => {
|
|
683
641
|
return {
|
|
684
|
-
jsonrpc: Two,
|
|
642
|
+
jsonrpc: Two$1,
|
|
685
643
|
id,
|
|
686
644
|
error: {
|
|
687
645
|
code: Custom,
|
|
@@ -768,29 +726,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
768
726
|
}
|
|
769
727
|
throw new JsonRpcError('unexpected message');
|
|
770
728
|
};
|
|
771
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
772
|
-
const {
|
|
773
|
-
message,
|
|
774
|
-
promise
|
|
775
|
-
} = create$2$1(method, params);
|
|
776
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
777
|
-
ipc.sendAndTransfer(message);
|
|
778
|
-
} else {
|
|
779
|
-
ipc.send(message);
|
|
780
|
-
}
|
|
781
|
-
const responseMessage = await promise;
|
|
782
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
783
|
-
};
|
|
784
|
-
const send = (transport, method, ...params) => {
|
|
785
|
-
const message = create$4(method, params);
|
|
786
|
-
transport.send(message);
|
|
787
|
-
};
|
|
788
|
-
const invoke$1 = (ipc, method, ...params) => {
|
|
789
|
-
return invokeHelper(ipc, method, params, false);
|
|
790
|
-
};
|
|
791
|
-
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
792
|
-
return invokeHelper(ipc, method, params, true);
|
|
793
|
-
};
|
|
794
729
|
|
|
795
730
|
class CommandNotFoundError extends Error {
|
|
796
731
|
constructor(command) {
|
|
@@ -813,24 +748,87 @@ const execute = (command, ...args) => {
|
|
|
813
748
|
return fn(...args);
|
|
814
749
|
};
|
|
815
750
|
|
|
751
|
+
const Two = '2.0';
|
|
752
|
+
const create$s = (method, params) => {
|
|
753
|
+
return {
|
|
754
|
+
jsonrpc: Two,
|
|
755
|
+
method,
|
|
756
|
+
params
|
|
757
|
+
};
|
|
758
|
+
};
|
|
759
|
+
const create$r = (id, method, params) => {
|
|
760
|
+
const message = {
|
|
761
|
+
id,
|
|
762
|
+
jsonrpc: Two,
|
|
763
|
+
method,
|
|
764
|
+
params
|
|
765
|
+
};
|
|
766
|
+
return message;
|
|
767
|
+
};
|
|
768
|
+
let id = 0;
|
|
769
|
+
const create$q = () => {
|
|
770
|
+
return ++id;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
774
|
+
|
|
775
|
+
const registerPromise = map => {
|
|
776
|
+
const id = create$q();
|
|
777
|
+
const {
|
|
778
|
+
promise,
|
|
779
|
+
resolve
|
|
780
|
+
} = Promise.withResolvers();
|
|
781
|
+
map[id] = resolve;
|
|
782
|
+
return {
|
|
783
|
+
id,
|
|
784
|
+
promise
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
// @ts-ignore
|
|
789
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
790
|
+
const {
|
|
791
|
+
id,
|
|
792
|
+
promise
|
|
793
|
+
} = registerPromise(callbacks);
|
|
794
|
+
const message = create$r(id, method, params);
|
|
795
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
796
|
+
ipc.sendAndTransfer(message);
|
|
797
|
+
} else {
|
|
798
|
+
ipc.send(message);
|
|
799
|
+
}
|
|
800
|
+
const responseMessage = await promise;
|
|
801
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
802
|
+
};
|
|
816
803
|
const createRpc = ipc => {
|
|
804
|
+
const callbacks = Object.create(null);
|
|
805
|
+
ipc._resolve = (id, response) => {
|
|
806
|
+
const fn = callbacks[id];
|
|
807
|
+
if (!fn) {
|
|
808
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
fn(response);
|
|
812
|
+
delete callbacks[id];
|
|
813
|
+
};
|
|
817
814
|
const rpc = {
|
|
815
|
+
async dispose() {
|
|
816
|
+
await ipc?.dispose();
|
|
817
|
+
},
|
|
818
|
+
invoke(method, ...params) {
|
|
819
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
820
|
+
},
|
|
821
|
+
invokeAndTransfer(method, ...params) {
|
|
822
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
823
|
+
},
|
|
818
824
|
// @ts-ignore
|
|
819
825
|
ipc,
|
|
820
826
|
/**
|
|
821
827
|
* @deprecated
|
|
822
828
|
*/
|
|
823
829
|
send(method, ...params) {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
invoke(method, ...params) {
|
|
827
|
-
return invoke$1(ipc, method, ...params);
|
|
828
|
-
},
|
|
829
|
-
invokeAndTransfer(method, ...params) {
|
|
830
|
-
return invokeAndTransfer(ipc, method, ...params);
|
|
831
|
-
},
|
|
832
|
-
async dispose() {
|
|
833
|
-
await ipc?.dispose();
|
|
830
|
+
const message = create$s(method, params);
|
|
831
|
+
ipc.send(message);
|
|
834
832
|
}
|
|
835
833
|
};
|
|
836
834
|
return rpc;
|
|
@@ -847,7 +845,7 @@ const logError = () => {
|
|
|
847
845
|
const handleMessage = event => {
|
|
848
846
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
849
847
|
const actualExecute = event?.target?.execute || execute;
|
|
850
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
848
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
851
849
|
};
|
|
852
850
|
const handleIpc = ipc => {
|
|
853
851
|
if ('addEventListener' in ipc) {
|
|
@@ -865,7 +863,7 @@ const listen$1 = async (module, options) => {
|
|
|
865
863
|
const ipc = module.wrap(rawIpc);
|
|
866
864
|
return ipc;
|
|
867
865
|
};
|
|
868
|
-
const create$
|
|
866
|
+
const create$1$1 = async ({
|
|
869
867
|
commandMap
|
|
870
868
|
}) => {
|
|
871
869
|
// TODO create a commandMap per rpc instance
|
|
@@ -877,7 +875,26 @@ const create$3 = async ({
|
|
|
877
875
|
};
|
|
878
876
|
const WebWorkerRpcClient = {
|
|
879
877
|
__proto__: null,
|
|
880
|
-
create: create$
|
|
878
|
+
create: create$1$1
|
|
879
|
+
};
|
|
880
|
+
const createMockRpc = ({
|
|
881
|
+
commandMap
|
|
882
|
+
}) => {
|
|
883
|
+
const invocations = [];
|
|
884
|
+
const invoke = (method, ...params) => {
|
|
885
|
+
invocations.push([method, ...params]);
|
|
886
|
+
const command = commandMap[method];
|
|
887
|
+
if (!command) {
|
|
888
|
+
throw new Error(`command ${method} not found`);
|
|
889
|
+
}
|
|
890
|
+
return command(...params);
|
|
891
|
+
};
|
|
892
|
+
const mockRpc = {
|
|
893
|
+
invocations,
|
|
894
|
+
invoke,
|
|
895
|
+
invokeAndTransfer: invoke
|
|
896
|
+
};
|
|
897
|
+
return mockRpc;
|
|
881
898
|
};
|
|
882
899
|
|
|
883
900
|
const Button$2 = 'button';
|
|
@@ -930,9 +947,17 @@ const set$2 = (id, rpc) => {
|
|
|
930
947
|
const get$1 = id => {
|
|
931
948
|
return rpcs[id];
|
|
932
949
|
};
|
|
950
|
+
const remove = id => {
|
|
951
|
+
delete rpcs[id];
|
|
952
|
+
};
|
|
933
953
|
|
|
954
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
934
955
|
const create$2 = rpcId => {
|
|
935
956
|
return {
|
|
957
|
+
async dispose() {
|
|
958
|
+
const rpc = get$1(rpcId);
|
|
959
|
+
await rpc.dispose();
|
|
960
|
+
},
|
|
936
961
|
// @ts-ignore
|
|
937
962
|
invoke(method, ...params) {
|
|
938
963
|
const rpc = get$1(rpcId);
|
|
@@ -945,19 +970,28 @@ const create$2 = rpcId => {
|
|
|
945
970
|
// @ts-ignore
|
|
946
971
|
return rpc.invokeAndTransfer(method, ...params);
|
|
947
972
|
},
|
|
973
|
+
registerMockRpc(commandMap) {
|
|
974
|
+
const mockRpc = createMockRpc({
|
|
975
|
+
commandMap
|
|
976
|
+
});
|
|
977
|
+
set$2(rpcId, mockRpc);
|
|
978
|
+
// @ts-ignore
|
|
979
|
+
mockRpc[Symbol.dispose] = () => {
|
|
980
|
+
remove(rpcId);
|
|
981
|
+
};
|
|
982
|
+
// @ts-ignore
|
|
983
|
+
return mockRpc;
|
|
984
|
+
},
|
|
948
985
|
set(rpc) {
|
|
949
986
|
set$2(rpcId, rpc);
|
|
950
|
-
},
|
|
951
|
-
async dispose() {
|
|
952
|
-
const rpc = get$1(rpcId);
|
|
953
|
-
await rpc.dispose();
|
|
954
987
|
}
|
|
955
988
|
};
|
|
956
989
|
};
|
|
957
990
|
|
|
958
991
|
const {
|
|
959
992
|
invoke,
|
|
960
|
-
set: set$1
|
|
993
|
+
set: set$1
|
|
994
|
+
} = create$2(RendererWorker);
|
|
961
995
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
962
996
|
number(uid);
|
|
963
997
|
number(menuId);
|
|
@@ -1065,6 +1099,7 @@ const {
|
|
|
1065
1099
|
// TODO parentUid might ot be needed
|
|
1066
1100
|
const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) => {
|
|
1067
1101
|
const state = {
|
|
1102
|
+
accountEnabled: false,
|
|
1068
1103
|
activityBarItems: [],
|
|
1069
1104
|
currentViewletId: '',
|
|
1070
1105
|
filteredItems: [],
|
|
@@ -1195,6 +1230,20 @@ const getKeyBindings = () => {
|
|
|
1195
1230
|
}];
|
|
1196
1231
|
};
|
|
1197
1232
|
|
|
1233
|
+
const getMenuEntriesAccount = state => {
|
|
1234
|
+
return [{
|
|
1235
|
+
command: 'Account.signIn',
|
|
1236
|
+
flags: None,
|
|
1237
|
+
id: 'signIn',
|
|
1238
|
+
label: 'Sign In'
|
|
1239
|
+
}, {
|
|
1240
|
+
command: 'Account.signOut',
|
|
1241
|
+
flags: None,
|
|
1242
|
+
id: 'signOut',
|
|
1243
|
+
label: 'Sign Out'
|
|
1244
|
+
}];
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1198
1247
|
const Tab = 1;
|
|
1199
1248
|
const Button = 1 << 1;
|
|
1200
1249
|
const Progress = 1 << 2;
|
|
@@ -1215,6 +1264,7 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
1215
1264
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1216
1265
|
};
|
|
1217
1266
|
|
|
1267
|
+
const Account$1 = 'Account';
|
|
1218
1268
|
const Explorer$1 = 'Explorer';
|
|
1219
1269
|
const Search$2 = 'Search';
|
|
1220
1270
|
const SourceControl$2 = 'Source Control';
|
|
@@ -1231,6 +1281,9 @@ const ColorTheme = 'Color Theme';
|
|
|
1231
1281
|
const CommandPalette = 'Command Palette';
|
|
1232
1282
|
const KeyboardShortcuts = 'Keyboard Shortcuts';
|
|
1233
1283
|
|
|
1284
|
+
const account = () => {
|
|
1285
|
+
return i18nString(Account$1);
|
|
1286
|
+
};
|
|
1234
1287
|
const explorer = () => {
|
|
1235
1288
|
return i18nString(Explorer$1);
|
|
1236
1289
|
};
|
|
@@ -1401,11 +1454,15 @@ const getMenuEntriesSettings = state => {
|
|
|
1401
1454
|
return items;
|
|
1402
1455
|
};
|
|
1403
1456
|
|
|
1457
|
+
// Use a unique number for the Account menu ID
|
|
1458
|
+
const ACCOUNT_MENU_ID$1 = 1000;
|
|
1404
1459
|
const getMenuEntries = (state, options) => {
|
|
1405
1460
|
const {
|
|
1406
1461
|
menuId
|
|
1407
1462
|
} = options;
|
|
1408
1463
|
switch (menuId) {
|
|
1464
|
+
case ACCOUNT_MENU_ID$1:
|
|
1465
|
+
return getMenuEntriesAccount();
|
|
1409
1466
|
case ActivityBar$3:
|
|
1410
1467
|
return getMenuEntriesActivityBar(state);
|
|
1411
1468
|
case ActivityBarAdditionalViews:
|
|
@@ -1489,6 +1546,18 @@ const show2 = async (uid, menuId, x, y, args) => {
|
|
|
1489
1546
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
1490
1547
|
};
|
|
1491
1548
|
|
|
1549
|
+
// Use a unique number for the Account menu ID
|
|
1550
|
+
const ACCOUNT_MENU_ID = 1000;
|
|
1551
|
+
const handleClickAccount = async (state, eventX, eventY, viewletId) => {
|
|
1552
|
+
const {
|
|
1553
|
+
uid
|
|
1554
|
+
} = state;
|
|
1555
|
+
await show2(uid, ACCOUNT_MENU_ID, eventX, eventY, {
|
|
1556
|
+
menuId: ACCOUNT_MENU_ID
|
|
1557
|
+
});
|
|
1558
|
+
return state;
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1492
1561
|
const handleClickAdditionalViews = async (state, eventX, eventY, viewletId) => {
|
|
1493
1562
|
const {
|
|
1494
1563
|
uid
|
|
@@ -1552,6 +1621,8 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1552
1621
|
const item = filteredItems[index];
|
|
1553
1622
|
const viewletId = item.id;
|
|
1554
1623
|
switch (viewletId) {
|
|
1624
|
+
case 'Account':
|
|
1625
|
+
return handleClickAccount(state, x, y);
|
|
1555
1626
|
case 'Additional Views':
|
|
1556
1627
|
return handleClickAdditionalViews(state, x, y, viewletId);
|
|
1557
1628
|
case 'Settings':
|
|
@@ -1582,6 +1653,7 @@ const handleContextMenu = async (state, button, eventX, eventY) => {
|
|
|
1582
1653
|
return state;
|
|
1583
1654
|
};
|
|
1584
1655
|
|
|
1656
|
+
const Account = 'Account';
|
|
1585
1657
|
const DebugAlt2 = 'DebugAlt2';
|
|
1586
1658
|
const Extensions$1 = 'Extensions';
|
|
1587
1659
|
const Files = 'Files';
|
|
@@ -1730,8 +1802,20 @@ const RunAndDebug = 'Run And Debug';
|
|
|
1730
1802
|
const Search = 'Search';
|
|
1731
1803
|
const SourceControl = 'Source Control';
|
|
1732
1804
|
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1805
|
+
const getActiveView = async () => {
|
|
1806
|
+
try {
|
|
1807
|
+
const activeView = await invoke('Layout.getActiveSideBarView');
|
|
1808
|
+
return activeView;
|
|
1809
|
+
} catch {
|
|
1810
|
+
return Explorer;
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
const getActivityBarItems = state => {
|
|
1815
|
+
const {
|
|
1816
|
+
accountEnabled
|
|
1817
|
+
} = state;
|
|
1818
|
+
const items = [
|
|
1735
1819
|
// Top
|
|
1736
1820
|
{
|
|
1737
1821
|
flags: Tab | Enabled,
|
|
@@ -1763,15 +1847,26 @@ const getActivityBarItems = () => {
|
|
|
1763
1847
|
id: Extensions,
|
|
1764
1848
|
keyShortcuts: 'Control+Shift+X',
|
|
1765
1849
|
title: extensions()
|
|
1766
|
-
}
|
|
1850
|
+
}
|
|
1767
1851
|
// Bottom
|
|
1768
|
-
|
|
1852
|
+
];
|
|
1853
|
+
if (accountEnabled) {
|
|
1854
|
+
items.push({
|
|
1855
|
+
flags: Button | Enabled | MarginTop,
|
|
1856
|
+
icon: Account,
|
|
1857
|
+
id: 'Account',
|
|
1858
|
+
keyShortcuts: '',
|
|
1859
|
+
title: account()
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
items.push({
|
|
1769
1863
|
flags: Button | Enabled | MarginTop,
|
|
1770
1864
|
icon: SettingsGear,
|
|
1771
1865
|
id: 'Settings',
|
|
1772
1866
|
keyShortcuts: '',
|
|
1773
1867
|
title: settings()
|
|
1774
|
-
}
|
|
1868
|
+
});
|
|
1869
|
+
return items;
|
|
1775
1870
|
};
|
|
1776
1871
|
|
|
1777
1872
|
const loadContent = async (state, savedState) => {
|
|
@@ -1779,9 +1874,10 @@ const loadContent = async (state, savedState) => {
|
|
|
1779
1874
|
height,
|
|
1780
1875
|
itemHeight
|
|
1781
1876
|
} = state;
|
|
1782
|
-
const items = getActivityBarItems();
|
|
1783
|
-
const
|
|
1784
|
-
const
|
|
1877
|
+
const items = getActivityBarItems(state);
|
|
1878
|
+
const activeView = await getActiveView();
|
|
1879
|
+
const index = items.findIndex(item => item.id === activeView);
|
|
1880
|
+
const itemsWithSelected = markSelected(items, index);
|
|
1785
1881
|
const filteredItems = getFilteredActivityBarItems(itemsWithSelected, height, itemHeight);
|
|
1786
1882
|
const newItems = await updateItemsWithBadgeCount(filteredItems);
|
|
1787
1883
|
return {
|
|
@@ -1789,7 +1885,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1789
1885
|
activityBarItems: itemsWithSelected,
|
|
1790
1886
|
currentViewletId: Explorer,
|
|
1791
1887
|
filteredItems: newItems,
|
|
1792
|
-
selectedIndex:
|
|
1888
|
+
selectedIndex: index,
|
|
1793
1889
|
sideBarLocation: Left,
|
|
1794
1890
|
sideBarVisible: true
|
|
1795
1891
|
};
|
|
@@ -1824,9 +1920,9 @@ const mergeClassNames = (...classNames) => {
|
|
|
1824
1920
|
|
|
1825
1921
|
const text = data => {
|
|
1826
1922
|
return {
|
|
1827
|
-
|
|
1923
|
+
childCount: 0,
|
|
1828
1924
|
text: data,
|
|
1829
|
-
|
|
1925
|
+
type: Text
|
|
1830
1926
|
};
|
|
1831
1927
|
};
|
|
1832
1928
|
|