@lvce-editor/source-control-worker 3.0.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/sourceControlWorkerMain.js +566 -323
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ class AssertionError extends Error {
|
|
|
63
63
|
const Object$1 = 1;
|
|
64
64
|
const Number$1 = 2;
|
|
65
65
|
const Array$1 = 3;
|
|
66
|
-
const String = 4;
|
|
66
|
+
const String$1 = 4;
|
|
67
67
|
const Boolean$1 = 5;
|
|
68
68
|
const Function = 6;
|
|
69
69
|
const Null = 7;
|
|
@@ -75,7 +75,7 @@ const getType = value => {
|
|
|
75
75
|
case 'function':
|
|
76
76
|
return Function;
|
|
77
77
|
case 'string':
|
|
78
|
-
return String;
|
|
78
|
+
return String$1;
|
|
79
79
|
case 'object':
|
|
80
80
|
if (value === null) {
|
|
81
81
|
return Null;
|
|
@@ -98,7 +98,7 @@ const number = value => {
|
|
|
98
98
|
};
|
|
99
99
|
const string = value => {
|
|
100
100
|
const type = getType(value);
|
|
101
|
-
if (type !== String) {
|
|
101
|
+
if (type !== String$1) {
|
|
102
102
|
throw new AssertionError('expected value to be of type string');
|
|
103
103
|
}
|
|
104
104
|
};
|
|
@@ -456,7 +456,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
456
456
|
return promise;
|
|
457
457
|
};
|
|
458
458
|
const Message$1 = 3;
|
|
459
|
-
const create$5 = async ({
|
|
459
|
+
const create$5$1 = async ({
|
|
460
460
|
isMessagePortOpen,
|
|
461
461
|
messagePort
|
|
462
462
|
}) => {
|
|
@@ -507,11 +507,32 @@ const wrap$5 = messagePort => {
|
|
|
507
507
|
};
|
|
508
508
|
const IpcParentWithMessagePort$1 = {
|
|
509
509
|
__proto__: null,
|
|
510
|
-
create: create$5,
|
|
510
|
+
create: create$5$1,
|
|
511
511
|
signal: signal$1,
|
|
512
512
|
wrap: wrap$5
|
|
513
513
|
};
|
|
514
514
|
|
|
515
|
+
class CommandNotFoundError extends Error {
|
|
516
|
+
constructor(command) {
|
|
517
|
+
super(`Command not found ${command}`);
|
|
518
|
+
this.name = 'CommandNotFoundError';
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const commands = Object.create(null);
|
|
522
|
+
const register = commandMap => {
|
|
523
|
+
Object.assign(commands, commandMap);
|
|
524
|
+
};
|
|
525
|
+
const getCommand = key => {
|
|
526
|
+
return commands[key];
|
|
527
|
+
};
|
|
528
|
+
const execute = (command, ...args) => {
|
|
529
|
+
const fn = getCommand(command);
|
|
530
|
+
if (!fn) {
|
|
531
|
+
throw new CommandNotFoundError(command);
|
|
532
|
+
}
|
|
533
|
+
return fn(...args);
|
|
534
|
+
};
|
|
535
|
+
|
|
515
536
|
const Two$1 = '2.0';
|
|
516
537
|
const callbacks = Object.create(null);
|
|
517
538
|
const get$3 = id => {
|
|
@@ -536,12 +557,12 @@ const getErrorConstructor = (message, type) => {
|
|
|
536
557
|
switch (type) {
|
|
537
558
|
case DomException:
|
|
538
559
|
return DOMException;
|
|
539
|
-
case TypeError$1:
|
|
540
|
-
return TypeError;
|
|
541
|
-
case SyntaxError$1:
|
|
542
|
-
return SyntaxError;
|
|
543
560
|
case ReferenceError$1:
|
|
544
561
|
return ReferenceError;
|
|
562
|
+
case SyntaxError$1:
|
|
563
|
+
return SyntaxError;
|
|
564
|
+
case TypeError$1:
|
|
565
|
+
return TypeError;
|
|
545
566
|
default:
|
|
546
567
|
return Error;
|
|
547
568
|
}
|
|
@@ -697,56 +718,56 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
697
718
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
698
719
|
return {
|
|
699
720
|
code: MethodNotFound,
|
|
700
|
-
|
|
701
|
-
|
|
721
|
+
data: error.stack,
|
|
722
|
+
message: error.message
|
|
702
723
|
};
|
|
703
724
|
}
|
|
704
725
|
return {
|
|
705
726
|
code: Custom,
|
|
706
|
-
message: prettyError.message,
|
|
707
727
|
data: {
|
|
708
|
-
stack: getStack(prettyError),
|
|
709
|
-
codeFrame: prettyError.codeFrame,
|
|
710
|
-
type: getErrorType(prettyError),
|
|
711
728
|
code: prettyError.code,
|
|
712
|
-
|
|
713
|
-
|
|
729
|
+
codeFrame: prettyError.codeFrame,
|
|
730
|
+
name: prettyError.name,
|
|
731
|
+
stack: getStack(prettyError),
|
|
732
|
+
type: getErrorType(prettyError)
|
|
733
|
+
},
|
|
734
|
+
message: prettyError.message
|
|
714
735
|
};
|
|
715
736
|
};
|
|
716
|
-
const create$1$
|
|
737
|
+
const create$1$1 = (id, error) => {
|
|
717
738
|
return {
|
|
718
|
-
|
|
739
|
+
error,
|
|
719
740
|
id,
|
|
720
|
-
|
|
741
|
+
jsonrpc: Two$1
|
|
721
742
|
};
|
|
722
743
|
};
|
|
723
744
|
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
724
745
|
const prettyError = preparePrettyError(error);
|
|
725
746
|
logError(error, prettyError);
|
|
726
747
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
727
|
-
return create$1$
|
|
748
|
+
return create$1$1(id, errorProperty);
|
|
728
749
|
};
|
|
729
|
-
const create$
|
|
750
|
+
const create$8 = (message, result) => {
|
|
730
751
|
return {
|
|
731
|
-
jsonrpc: Two$1,
|
|
732
752
|
id: message.id,
|
|
753
|
+
jsonrpc: Two$1,
|
|
733
754
|
result: result ?? null
|
|
734
755
|
};
|
|
735
756
|
};
|
|
736
757
|
const getSuccessResponse = (message, result) => {
|
|
737
758
|
const resultProperty = result ?? null;
|
|
738
|
-
return create$
|
|
759
|
+
return create$8(message, resultProperty);
|
|
739
760
|
};
|
|
740
761
|
const getErrorResponseSimple = (id, error) => {
|
|
741
762
|
return {
|
|
742
|
-
jsonrpc: Two$1,
|
|
743
|
-
id,
|
|
744
763
|
error: {
|
|
745
764
|
code: Custom,
|
|
765
|
+
data: error,
|
|
746
766
|
// @ts-ignore
|
|
747
|
-
message: error.message
|
|
748
|
-
|
|
749
|
-
|
|
767
|
+
message: error.message
|
|
768
|
+
},
|
|
769
|
+
id,
|
|
770
|
+
jsonrpc: Two$1
|
|
750
771
|
};
|
|
751
772
|
};
|
|
752
773
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
@@ -776,35 +797,35 @@ const normalizeParams = args => {
|
|
|
776
797
|
if (args.length === 1) {
|
|
777
798
|
const options = args[0];
|
|
778
799
|
return {
|
|
800
|
+
execute: options.execute,
|
|
779
801
|
ipc: options.ipc,
|
|
802
|
+
logError: options.logError || defaultLogError,
|
|
780
803
|
message: options.message,
|
|
781
|
-
execute: options.execute,
|
|
782
|
-
resolve: options.resolve || defaultResolve,
|
|
783
804
|
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
784
|
-
|
|
785
|
-
|
|
805
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
806
|
+
resolve: options.resolve || defaultResolve
|
|
786
807
|
};
|
|
787
808
|
}
|
|
788
809
|
return {
|
|
810
|
+
execute: args[2],
|
|
789
811
|
ipc: args[0],
|
|
812
|
+
logError: args[5],
|
|
790
813
|
message: args[1],
|
|
791
|
-
execute: args[2],
|
|
792
|
-
resolve: args[3],
|
|
793
814
|
preparePrettyError: args[4],
|
|
794
|
-
|
|
795
|
-
|
|
815
|
+
requiresSocket: args[6],
|
|
816
|
+
resolve: args[3]
|
|
796
817
|
};
|
|
797
818
|
};
|
|
798
819
|
const handleJsonRpcMessage = async (...args) => {
|
|
799
820
|
const options = normalizeParams(args);
|
|
800
821
|
const {
|
|
801
|
-
message,
|
|
802
|
-
ipc,
|
|
803
822
|
execute,
|
|
804
|
-
|
|
805
|
-
preparePrettyError,
|
|
823
|
+
ipc,
|
|
806
824
|
logError,
|
|
807
|
-
|
|
825
|
+
message,
|
|
826
|
+
preparePrettyError,
|
|
827
|
+
requiresSocket,
|
|
828
|
+
resolve
|
|
808
829
|
} = options;
|
|
809
830
|
if ('id' in message) {
|
|
810
831
|
if ('method' in message) {
|
|
@@ -827,36 +848,17 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
827
848
|
throw new JsonRpcError('unexpected message');
|
|
828
849
|
};
|
|
829
850
|
|
|
830
|
-
class CommandNotFoundError extends Error {
|
|
831
|
-
constructor(command) {
|
|
832
|
-
super(`Command not found ${command}`);
|
|
833
|
-
this.name = 'CommandNotFoundError';
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
const commands = Object.create(null);
|
|
837
|
-
const register = commandMap => {
|
|
838
|
-
Object.assign(commands, commandMap);
|
|
839
|
-
};
|
|
840
|
-
const getCommand = key => {
|
|
841
|
-
return commands[key];
|
|
842
|
-
};
|
|
843
|
-
const execute = (command, ...args) => {
|
|
844
|
-
const fn = getCommand(command);
|
|
845
|
-
if (!fn) {
|
|
846
|
-
throw new CommandNotFoundError(command);
|
|
847
|
-
}
|
|
848
|
-
return fn(...args);
|
|
849
|
-
};
|
|
850
|
-
|
|
851
851
|
const Two = '2.0';
|
|
852
|
-
|
|
852
|
+
|
|
853
|
+
const create$7 = (method, params) => {
|
|
853
854
|
return {
|
|
854
855
|
jsonrpc: Two,
|
|
855
856
|
method,
|
|
856
857
|
params
|
|
857
858
|
};
|
|
858
859
|
};
|
|
859
|
-
|
|
860
|
+
|
|
861
|
+
const create$6 = (id, method, params) => {
|
|
860
862
|
const message = {
|
|
861
863
|
id,
|
|
862
864
|
jsonrpc: Two,
|
|
@@ -865,15 +867,14 @@ const create$r = (id, method, params) => {
|
|
|
865
867
|
};
|
|
866
868
|
return message;
|
|
867
869
|
};
|
|
870
|
+
|
|
868
871
|
let id = 0;
|
|
869
|
-
const create$
|
|
872
|
+
const create$5 = () => {
|
|
870
873
|
return ++id;
|
|
871
874
|
};
|
|
872
875
|
|
|
873
|
-
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
874
|
-
|
|
875
876
|
const registerPromise = map => {
|
|
876
|
-
const id = create$
|
|
877
|
+
const id = create$5();
|
|
877
878
|
const {
|
|
878
879
|
promise,
|
|
879
880
|
resolve
|
|
@@ -885,13 +886,12 @@ const registerPromise = map => {
|
|
|
885
886
|
};
|
|
886
887
|
};
|
|
887
888
|
|
|
888
|
-
// @ts-ignore
|
|
889
889
|
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
890
890
|
const {
|
|
891
891
|
id,
|
|
892
892
|
promise
|
|
893
893
|
} = registerPromise(callbacks);
|
|
894
|
-
const message = create$
|
|
894
|
+
const message = create$6(id, method, params);
|
|
895
895
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
896
896
|
ipc.sendAndTransfer(message);
|
|
897
897
|
} else {
|
|
@@ -927,12 +927,13 @@ const createRpc = ipc => {
|
|
|
927
927
|
* @deprecated
|
|
928
928
|
*/
|
|
929
929
|
send(method, ...params) {
|
|
930
|
-
const message = create$
|
|
930
|
+
const message = create$7(method, params);
|
|
931
931
|
ipc.send(message);
|
|
932
932
|
}
|
|
933
933
|
};
|
|
934
934
|
return rpc;
|
|
935
935
|
};
|
|
936
|
+
|
|
936
937
|
const requiresSocket = () => {
|
|
937
938
|
return false;
|
|
938
939
|
};
|
|
@@ -947,6 +948,7 @@ const handleMessage = event => {
|
|
|
947
948
|
const actualExecute = event?.target?.execute || execute;
|
|
948
949
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
949
950
|
};
|
|
951
|
+
|
|
950
952
|
const handleIpc = ipc => {
|
|
951
953
|
if ('addEventListener' in ipc) {
|
|
952
954
|
ipc.addEventListener('message', handleMessage);
|
|
@@ -955,6 +957,7 @@ const handleIpc = ipc => {
|
|
|
955
957
|
ipc.on('message', handleMessage);
|
|
956
958
|
}
|
|
957
959
|
};
|
|
960
|
+
|
|
958
961
|
const listen$1 = async (module, options) => {
|
|
959
962
|
const rawIpc = await module.listen(options);
|
|
960
963
|
if (module.signal) {
|
|
@@ -963,6 +966,7 @@ const listen$1 = async (module, options) => {
|
|
|
963
966
|
const ipc = module.wrap(rawIpc);
|
|
964
967
|
return ipc;
|
|
965
968
|
};
|
|
969
|
+
|
|
966
970
|
const create$4 = async ({
|
|
967
971
|
commandMap,
|
|
968
972
|
isMessagePortOpen = true,
|
|
@@ -980,11 +984,8 @@ const create$4 = async ({
|
|
|
980
984
|
messagePort.start();
|
|
981
985
|
return rpc;
|
|
982
986
|
};
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
create: create$4
|
|
986
|
-
};
|
|
987
|
-
const create$2 = async ({
|
|
987
|
+
|
|
988
|
+
const create$3 = async ({
|
|
988
989
|
commandMap,
|
|
989
990
|
isMessagePortOpen,
|
|
990
991
|
send
|
|
@@ -1000,11 +1001,8 @@ const create$2 = async ({
|
|
|
1000
1001
|
messagePort: port2
|
|
1001
1002
|
});
|
|
1002
1003
|
};
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
create: create$2
|
|
1006
|
-
};
|
|
1007
|
-
const create$1$1 = async ({
|
|
1004
|
+
|
|
1005
|
+
const create$2 = async ({
|
|
1008
1006
|
commandMap
|
|
1009
1007
|
}) => {
|
|
1010
1008
|
// TODO create a commandMap per rpc instance
|
|
@@ -1014,10 +1012,7 @@ const create$1$1 = async ({
|
|
|
1014
1012
|
const rpc = createRpc(ipc);
|
|
1015
1013
|
return rpc;
|
|
1016
1014
|
};
|
|
1017
|
-
|
|
1018
|
-
__proto__: null,
|
|
1019
|
-
create: create$1$1
|
|
1020
|
-
};
|
|
1015
|
+
|
|
1021
1016
|
const createMockRpc = ({
|
|
1022
1017
|
commandMap
|
|
1023
1018
|
}) => {
|
|
@@ -1038,6 +1033,54 @@ const createMockRpc = ({
|
|
|
1038
1033
|
return mockRpc;
|
|
1039
1034
|
};
|
|
1040
1035
|
|
|
1036
|
+
const rpcs = Object.create(null);
|
|
1037
|
+
const set$5 = (id, rpc) => {
|
|
1038
|
+
rpcs[id] = rpc;
|
|
1039
|
+
};
|
|
1040
|
+
const get$2 = id => {
|
|
1041
|
+
return rpcs[id];
|
|
1042
|
+
};
|
|
1043
|
+
const remove = id => {
|
|
1044
|
+
delete rpcs[id];
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1048
|
+
const create$1 = rpcId => {
|
|
1049
|
+
return {
|
|
1050
|
+
async dispose() {
|
|
1051
|
+
const rpc = get$2(rpcId);
|
|
1052
|
+
await rpc.dispose();
|
|
1053
|
+
},
|
|
1054
|
+
// @ts-ignore
|
|
1055
|
+
invoke(method, ...params) {
|
|
1056
|
+
const rpc = get$2(rpcId);
|
|
1057
|
+
// @ts-ignore
|
|
1058
|
+
return rpc.invoke(method, ...params);
|
|
1059
|
+
},
|
|
1060
|
+
// @ts-ignore
|
|
1061
|
+
invokeAndTransfer(method, ...params) {
|
|
1062
|
+
const rpc = get$2(rpcId);
|
|
1063
|
+
// @ts-ignore
|
|
1064
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1065
|
+
},
|
|
1066
|
+
registerMockRpc(commandMap) {
|
|
1067
|
+
const mockRpc = createMockRpc({
|
|
1068
|
+
commandMap
|
|
1069
|
+
});
|
|
1070
|
+
set$5(rpcId, mockRpc);
|
|
1071
|
+
// @ts-ignore
|
|
1072
|
+
mockRpc[Symbol.dispose] = () => {
|
|
1073
|
+
remove(rpcId);
|
|
1074
|
+
};
|
|
1075
|
+
// @ts-ignore
|
|
1076
|
+
return mockRpc;
|
|
1077
|
+
},
|
|
1078
|
+
set(rpc) {
|
|
1079
|
+
set$5(rpcId, rpc);
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1041
1084
|
const None$1 = 'none';
|
|
1042
1085
|
const ToolBar = 'toolbar';
|
|
1043
1086
|
const Tree$1 = 'tree';
|
|
@@ -1056,6 +1099,7 @@ const Span = 8;
|
|
|
1056
1099
|
const Text = 12;
|
|
1057
1100
|
const Img = 17;
|
|
1058
1101
|
const TextArea = 62;
|
|
1102
|
+
const Reference = 100;
|
|
1059
1103
|
|
|
1060
1104
|
const Button$1 = 'event.button';
|
|
1061
1105
|
const ClientX = 'event.clientX';
|
|
@@ -1092,54 +1136,6 @@ const Tree = 2;
|
|
|
1092
1136
|
|
|
1093
1137
|
const FocusSourceControlInput = 24;
|
|
1094
1138
|
|
|
1095
|
-
const rpcs = Object.create(null);
|
|
1096
|
-
const set$5 = (id, rpc) => {
|
|
1097
|
-
rpcs[id] = rpc;
|
|
1098
|
-
};
|
|
1099
|
-
const get$2 = id => {
|
|
1100
|
-
return rpcs[id];
|
|
1101
|
-
};
|
|
1102
|
-
const remove = id => {
|
|
1103
|
-
delete rpcs[id];
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1107
|
-
const create$1 = rpcId => {
|
|
1108
|
-
return {
|
|
1109
|
-
async dispose() {
|
|
1110
|
-
const rpc = get$2(rpcId);
|
|
1111
|
-
await rpc.dispose();
|
|
1112
|
-
},
|
|
1113
|
-
// @ts-ignore
|
|
1114
|
-
invoke(method, ...params) {
|
|
1115
|
-
const rpc = get$2(rpcId);
|
|
1116
|
-
// @ts-ignore
|
|
1117
|
-
return rpc.invoke(method, ...params);
|
|
1118
|
-
},
|
|
1119
|
-
// @ts-ignore
|
|
1120
|
-
invokeAndTransfer(method, ...params) {
|
|
1121
|
-
const rpc = get$2(rpcId);
|
|
1122
|
-
// @ts-ignore
|
|
1123
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1124
|
-
},
|
|
1125
|
-
registerMockRpc(commandMap) {
|
|
1126
|
-
const mockRpc = createMockRpc({
|
|
1127
|
-
commandMap
|
|
1128
|
-
});
|
|
1129
|
-
set$5(rpcId, mockRpc);
|
|
1130
|
-
// @ts-ignore
|
|
1131
|
-
mockRpc[Symbol.dispose] = () => {
|
|
1132
|
-
remove(rpcId);
|
|
1133
|
-
};
|
|
1134
|
-
// @ts-ignore
|
|
1135
|
-
return mockRpc;
|
|
1136
|
-
},
|
|
1137
|
-
set(rpc) {
|
|
1138
|
-
set$5(rpcId, rpc);
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
1139
|
const {
|
|
1144
1140
|
invoke: invoke$1,
|
|
1145
1141
|
set: set$4
|
|
@@ -1159,7 +1155,6 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1159
1155
|
number(menuId);
|
|
1160
1156
|
number(x);
|
|
1161
1157
|
number(y);
|
|
1162
|
-
// @ts-ignore
|
|
1163
1158
|
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1164
1159
|
};
|
|
1165
1160
|
const readFile$1 = async uri => {
|
|
@@ -1174,7 +1169,6 @@ const activateByEvent$1 = (event, assetDir, platform) => {
|
|
|
1174
1169
|
};
|
|
1175
1170
|
const sendMessagePortToTextMeasurementWorker$1 = async port => {
|
|
1176
1171
|
const command = 'TextMeasurement.handleMessagePort';
|
|
1177
|
-
// @ts-ignore
|
|
1178
1172
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1179
1173
|
};
|
|
1180
1174
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
@@ -1200,42 +1194,68 @@ const create = () => {
|
|
|
1200
1194
|
const states = Object.create(null);
|
|
1201
1195
|
const commandMapRef = {};
|
|
1202
1196
|
return {
|
|
1203
|
-
|
|
1204
|
-
|
|
1197
|
+
clear() {
|
|
1198
|
+
for (const key of Object.keys(states)) {
|
|
1199
|
+
delete states[key];
|
|
1200
|
+
}
|
|
1205
1201
|
},
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
};
|
|
1202
|
+
diff(uid, modules, numbers) {
|
|
1203
|
+
const {
|
|
1204
|
+
newState,
|
|
1205
|
+
oldState
|
|
1206
|
+
} = states[uid];
|
|
1207
|
+
const diffResult = [];
|
|
1208
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1209
|
+
const fn = modules[i];
|
|
1210
|
+
if (!fn(oldState, newState)) {
|
|
1211
|
+
diffResult.push(numbers[i]);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return diffResult;
|
|
1211
1215
|
},
|
|
1212
1216
|
dispose(uid) {
|
|
1213
1217
|
delete states[uid];
|
|
1214
1218
|
},
|
|
1219
|
+
get(uid) {
|
|
1220
|
+
return states[uid];
|
|
1221
|
+
},
|
|
1222
|
+
getCommandIds() {
|
|
1223
|
+
const keys = Object.keys(commandMapRef);
|
|
1224
|
+
const ids = keys.map(toCommandId);
|
|
1225
|
+
return ids;
|
|
1226
|
+
},
|
|
1215
1227
|
getKeys() {
|
|
1216
1228
|
return Object.keys(states).map(key => {
|
|
1217
|
-
return Number.
|
|
1229
|
+
return Number.parseFloat(key);
|
|
1218
1230
|
});
|
|
1219
1231
|
},
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1232
|
+
registerCommands(commandMap) {
|
|
1233
|
+
Object.assign(commandMapRef, commandMap);
|
|
1234
|
+
},
|
|
1235
|
+
set(uid, oldState, newState) {
|
|
1236
|
+
states[uid] = {
|
|
1237
|
+
newState,
|
|
1238
|
+
oldState
|
|
1239
|
+
};
|
|
1224
1240
|
},
|
|
1225
1241
|
wrapCommand(fn) {
|
|
1226
1242
|
const wrapped = async (uid, ...args) => {
|
|
1227
1243
|
const {
|
|
1228
|
-
|
|
1229
|
-
|
|
1244
|
+
newState,
|
|
1245
|
+
oldState
|
|
1230
1246
|
} = states[uid];
|
|
1231
1247
|
const newerState = await fn(newState, ...args);
|
|
1232
1248
|
if (oldState === newerState || newState === newerState) {
|
|
1233
1249
|
return;
|
|
1234
1250
|
}
|
|
1235
|
-
const
|
|
1251
|
+
const latestOld = states[uid];
|
|
1252
|
+
const latestNew = {
|
|
1253
|
+
...latestOld.newState,
|
|
1254
|
+
...newerState
|
|
1255
|
+
};
|
|
1236
1256
|
states[uid] = {
|
|
1237
|
-
|
|
1238
|
-
|
|
1257
|
+
newState: latestNew,
|
|
1258
|
+
oldState: latestOld.oldState
|
|
1239
1259
|
};
|
|
1240
1260
|
};
|
|
1241
1261
|
return wrapped;
|
|
@@ -1249,27 +1269,36 @@ const create = () => {
|
|
|
1249
1269
|
};
|
|
1250
1270
|
return wrapped;
|
|
1251
1271
|
},
|
|
1252
|
-
|
|
1253
|
-
const {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
|
|
1272
|
+
wrapLoadContent(fn) {
|
|
1273
|
+
const wrapped = async (uid, ...args) => {
|
|
1274
|
+
const {
|
|
1275
|
+
newState,
|
|
1276
|
+
oldState
|
|
1277
|
+
} = states[uid];
|
|
1278
|
+
const result = await fn(newState, ...args);
|
|
1279
|
+
const {
|
|
1280
|
+
error,
|
|
1281
|
+
state
|
|
1282
|
+
} = result;
|
|
1283
|
+
if (oldState === state || newState === state) {
|
|
1284
|
+
return {
|
|
1285
|
+
error
|
|
1286
|
+
};
|
|
1262
1287
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1288
|
+
const latestOld = states[uid];
|
|
1289
|
+
const latestNew = {
|
|
1290
|
+
...latestOld.newState,
|
|
1291
|
+
...state
|
|
1292
|
+
};
|
|
1293
|
+
states[uid] = {
|
|
1294
|
+
newState: latestNew,
|
|
1295
|
+
oldState: latestOld.oldState
|
|
1296
|
+
};
|
|
1297
|
+
return {
|
|
1298
|
+
error
|
|
1299
|
+
};
|
|
1300
|
+
};
|
|
1301
|
+
return wrapped;
|
|
1273
1302
|
}
|
|
1274
1303
|
};
|
|
1275
1304
|
};
|
|
@@ -1312,7 +1341,7 @@ const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
|
|
|
1312
1341
|
const {
|
|
1313
1342
|
length
|
|
1314
1343
|
} = items;
|
|
1315
|
-
const isExpanded = expandedGroups[id]
|
|
1344
|
+
const isExpanded = expandedGroups[id] ?? false;
|
|
1316
1345
|
const type = isExpanded ? DirectoryExpanded : Directory;
|
|
1317
1346
|
const icon = isExpanded ? 'ChevronDown' : 'ChevronRight';
|
|
1318
1347
|
if (length > 0) {
|
|
@@ -1451,9 +1480,13 @@ const executeProvider = async ({
|
|
|
1451
1480
|
|
|
1452
1481
|
const CommandExecute = 'ExtensionHostCommand.executeCommand';
|
|
1453
1482
|
const SourceControlAcceptInput = 'ExtensionHostSourceControl.acceptInput';
|
|
1483
|
+
const SourceControlGenerateCommitMessage = 'ExtensionHostSourceControl.generateCommitMessage';
|
|
1484
|
+
const SourceControlGetBadgeCount = 'ExtensionHostSourceControl.getBadgeCount';
|
|
1485
|
+
const SourceControlGetChangedFiles = 'ExtensionHost.sourceControlGetChangedFiles';
|
|
1454
1486
|
const SourceControlGetFileDecorations = 'ExtensionHostSourceControl.getFileDecorations';
|
|
1455
1487
|
const SourceControlGetEnabledProviderIds = 'ExtensionHostSourceControl.getEnabledProviderIds';
|
|
1456
1488
|
const SourceControlGetFileBefore = 'ExtensionHostSourceControl.getFileBefore';
|
|
1489
|
+
const SourceControlGetFeatures = 'ExtensionHostSourceControl.getFeatures';
|
|
1457
1490
|
const SourceControlGetGroups = 'ExtensionHostSourceControl.getGroups';
|
|
1458
1491
|
|
|
1459
1492
|
const acceptInput$2 = async (providerId, text, assetDir, platform) => {
|
|
@@ -1466,6 +1499,43 @@ const acceptInput$2 = async (providerId, text, assetDir, platform) => {
|
|
|
1466
1499
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1467
1500
|
});
|
|
1468
1501
|
};
|
|
1502
|
+
const generateCommitMessage$2 = async (providerId, assetDir, platform) => {
|
|
1503
|
+
return executeProvider({
|
|
1504
|
+
assetDir,
|
|
1505
|
+
event: 'none',
|
|
1506
|
+
method: SourceControlGenerateCommitMessage,
|
|
1507
|
+
params: [providerId],
|
|
1508
|
+
platform
|
|
1509
|
+
});
|
|
1510
|
+
};
|
|
1511
|
+
const getFeatures = async (providerId, assetDir, platform) => {
|
|
1512
|
+
return executeProvider({
|
|
1513
|
+
assetDir,
|
|
1514
|
+
event: 'none',
|
|
1515
|
+
method: SourceControlGetFeatures,
|
|
1516
|
+
params: [providerId],
|
|
1517
|
+
platform
|
|
1518
|
+
});
|
|
1519
|
+
};
|
|
1520
|
+
const getChangedFiles = (providerId, assetDir, platform) => {
|
|
1521
|
+
return executeProvider({
|
|
1522
|
+
assetDir,
|
|
1523
|
+
event: 'none',
|
|
1524
|
+
method: SourceControlGetChangedFiles,
|
|
1525
|
+
params: [providerId],
|
|
1526
|
+
platform
|
|
1527
|
+
// noProviderFoundMessage: 'No source control provider found',
|
|
1528
|
+
});
|
|
1529
|
+
};
|
|
1530
|
+
const getBadgeCount$2 = (providerId, assetDir, platform) => {
|
|
1531
|
+
return executeProvider({
|
|
1532
|
+
assetDir,
|
|
1533
|
+
event: 'none',
|
|
1534
|
+
method: SourceControlGetBadgeCount,
|
|
1535
|
+
params: [providerId],
|
|
1536
|
+
platform
|
|
1537
|
+
});
|
|
1538
|
+
};
|
|
1469
1539
|
const getFileDecorations$1 = (providerId, uris, assetDir, platform) => {
|
|
1470
1540
|
string(assetDir);
|
|
1471
1541
|
number(platform);
|
|
@@ -1513,11 +1583,68 @@ const getIconDefinitions$1 = async providerId => {
|
|
|
1513
1583
|
return result;
|
|
1514
1584
|
};
|
|
1515
1585
|
|
|
1586
|
+
const Disk = 'file';
|
|
1587
|
+
|
|
1588
|
+
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
1589
|
+
const getProtocol = uri => {
|
|
1590
|
+
if (!uri) {
|
|
1591
|
+
return Disk;
|
|
1592
|
+
}
|
|
1593
|
+
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
1594
|
+
if (protocolMatch) {
|
|
1595
|
+
return protocolMatch[1];
|
|
1596
|
+
}
|
|
1597
|
+
return Disk;
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1516
1600
|
const acceptInput$1 = (providerId, text, assetDir, platform) => {
|
|
1517
1601
|
string(providerId);
|
|
1518
1602
|
string(text);
|
|
1519
1603
|
return acceptInput$2(providerId, text, assetDir, platform);
|
|
1520
1604
|
};
|
|
1605
|
+
const generateCommitMessage$1 = (providerId, assetDir, platform) => {
|
|
1606
|
+
string(providerId);
|
|
1607
|
+
return generateCommitMessage$2(providerId, assetDir, platform);
|
|
1608
|
+
};
|
|
1609
|
+
const getShowGenerateCommitMessageButton = async (providerId, assetDir, platform) => {
|
|
1610
|
+
string(providerId);
|
|
1611
|
+
try {
|
|
1612
|
+
const features = await getFeatures(providerId, assetDir, platform);
|
|
1613
|
+
if (!features || typeof features !== 'object') {
|
|
1614
|
+
return true;
|
|
1615
|
+
}
|
|
1616
|
+
if ('showGenerateCommitMessageButton' in features && typeof features.showGenerateCommitMessageButton === 'boolean') {
|
|
1617
|
+
return features.showGenerateCommitMessageButton;
|
|
1618
|
+
}
|
|
1619
|
+
return true;
|
|
1620
|
+
} catch {
|
|
1621
|
+
return true;
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
const getProviderBadgeCount = async (providerId, assetDir, platform) => {
|
|
1625
|
+
try {
|
|
1626
|
+
return await getBadgeCount$2(providerId, assetDir, platform);
|
|
1627
|
+
} catch {
|
|
1628
|
+
try {
|
|
1629
|
+
const changedFiles = await getChangedFiles(providerId, assetDir, platform);
|
|
1630
|
+
return changedFiles.length;
|
|
1631
|
+
} catch {
|
|
1632
|
+
return 0;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
const getBadgeCount$1 = async (providerIds, assetDir, platform) => {
|
|
1637
|
+
let badgeCount = 0;
|
|
1638
|
+
for (const providerId of providerIds) {
|
|
1639
|
+
badgeCount += await getProviderBadgeCount(providerId, assetDir, platform);
|
|
1640
|
+
}
|
|
1641
|
+
return badgeCount;
|
|
1642
|
+
};
|
|
1643
|
+
const getWorkspaceBadgeCount = async (root, assetDir, platform) => {
|
|
1644
|
+
const scheme = getProtocol(root);
|
|
1645
|
+
const providerIds = await getEnabledProviderIds(scheme, root, assetDir, platform);
|
|
1646
|
+
return getBadgeCount$1(providerIds, assetDir, platform);
|
|
1647
|
+
};
|
|
1521
1648
|
const getFileDecorations = (providerId, uris, assetDir, platform) => {
|
|
1522
1649
|
return getFileDecorations$1(providerId, uris, assetDir, platform);
|
|
1523
1650
|
};
|
|
@@ -1555,6 +1682,12 @@ const getGroups = async (enabledProviderIds, root, assetDir, platform) => {
|
|
|
1555
1682
|
};
|
|
1556
1683
|
};
|
|
1557
1684
|
|
|
1685
|
+
const inputPaddingBlock = 11;
|
|
1686
|
+
const buttonBlockHeight = 34;
|
|
1687
|
+
const getHeaderHeight = (inputBoxHeight, sourceControlButtons) => {
|
|
1688
|
+
return inputBoxHeight + inputPaddingBlock + sourceControlButtons.length * buttonBlockHeight;
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1558
1691
|
const getTextHeight = async (input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight, inputPadding) => {
|
|
1559
1692
|
try {
|
|
1560
1693
|
if (!input) {
|
|
@@ -1598,20 +1731,6 @@ const getNumberOfVisibleItems = (listHeight, itemHeight) => {
|
|
|
1598
1731
|
return Math.ceil(listHeight / itemHeight) + 1;
|
|
1599
1732
|
};
|
|
1600
1733
|
|
|
1601
|
-
const Disk = 'file';
|
|
1602
|
-
|
|
1603
|
-
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
1604
|
-
const getProtocol = uri => {
|
|
1605
|
-
if (!uri) {
|
|
1606
|
-
return Disk;
|
|
1607
|
-
}
|
|
1608
|
-
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
1609
|
-
if (protocolMatch) {
|
|
1610
|
-
return protocolMatch[1];
|
|
1611
|
-
}
|
|
1612
|
-
return Disk;
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
1734
|
const emptySourceControlButtons = [];
|
|
1616
1735
|
|
|
1617
1736
|
const getContextId = (groupId, type) => {
|
|
@@ -1660,15 +1779,29 @@ const requestSourceActions = async () => {
|
|
|
1660
1779
|
const extensions = await getExtensions();
|
|
1661
1780
|
const newCache = Object.create(null);
|
|
1662
1781
|
for (const extension of extensions) {
|
|
1663
|
-
if (extension
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1782
|
+
if (!extension || !extension['source-control-actions']) {
|
|
1783
|
+
continue;
|
|
1784
|
+
}
|
|
1785
|
+
const sourceControlActions = Object.entries(extension['source-control-actions']);
|
|
1786
|
+
for (const [key, value] of sourceControlActions) {
|
|
1787
|
+
newCache[key] = value;
|
|
1667
1788
|
}
|
|
1668
1789
|
}
|
|
1669
1790
|
return newCache;
|
|
1670
1791
|
};
|
|
1671
1792
|
|
|
1793
|
+
const requestSourceControlButtons = async () => {
|
|
1794
|
+
const extensions = await getExtensions();
|
|
1795
|
+
const buttons = [];
|
|
1796
|
+
for (const extension of extensions) {
|
|
1797
|
+
if (!extension || !Array.isArray(extension['source-control-buttons'])) {
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
buttons.push(...extension['source-control-buttons']);
|
|
1801
|
+
}
|
|
1802
|
+
return buttons;
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1672
1805
|
/* eslint-disable unicorn/no-array-reduce */
|
|
1673
1806
|
const restoreExpandedGroups = groups => {
|
|
1674
1807
|
return groups.map(group => group.id).reduce((total, current) => {
|
|
@@ -1721,6 +1854,7 @@ const RevealInExplorerView = 'Reveal in Explorer View';
|
|
|
1721
1854
|
const OpenContainingFolder = 'Open Containing Folder';
|
|
1722
1855
|
const ViewAsTree$1 = 'View As Tree';
|
|
1723
1856
|
const CommitAndPush$1 = 'Commit and Push';
|
|
1857
|
+
const GenerateCommitMessage$1 = 'Generate Commit Message';
|
|
1724
1858
|
const Refresh$2 = 'Refresh';
|
|
1725
1859
|
const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
|
|
1726
1860
|
const SourceControlInput$1 = 'Source Control Input';
|
|
@@ -1755,6 +1889,9 @@ const viewAsTree$1 = () => {
|
|
|
1755
1889
|
const commitAndPush = () => {
|
|
1756
1890
|
return i18nString(CommitAndPush$1);
|
|
1757
1891
|
};
|
|
1892
|
+
const generateCommitMessage = () => {
|
|
1893
|
+
return i18nString(GenerateCommitMessage$1);
|
|
1894
|
+
};
|
|
1758
1895
|
const refresh$1 = () => {
|
|
1759
1896
|
return i18nString(Refresh$2);
|
|
1760
1897
|
};
|
|
@@ -1790,6 +1927,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1790
1927
|
platform
|
|
1791
1928
|
} = state;
|
|
1792
1929
|
const enabledProviderIds = await getEnabledProviderIds(scheme, root, assetDir, platform);
|
|
1930
|
+
const showGenerateCommitMessageButton = enabledProviderIds.length === 0 ? false : await getShowGenerateCommitMessageButton(enabledProviderIds[0], assetDir, platform);
|
|
1793
1931
|
const iconDefinitions = await getIconDefinitions(enabledProviderIds);
|
|
1794
1932
|
const {
|
|
1795
1933
|
allGroups,
|
|
@@ -1798,10 +1936,11 @@ const loadContent = async (state, savedState) => {
|
|
|
1798
1936
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
1799
1937
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
1800
1938
|
const actionsCache = await requestSourceActions();
|
|
1939
|
+
const sourceControlButtons = await requestSourceControlButtons();
|
|
1801
1940
|
|
|
1802
1941
|
// TODO make preferences async and more functional
|
|
1803
1942
|
const splitButtonEnabled = await get$1('sourceControl.splitButtonEnabled');
|
|
1804
|
-
const badgeCount =
|
|
1943
|
+
const badgeCount = await getBadgeCount$1(enabledProviderIds, assetDir, platform);
|
|
1805
1944
|
const total = displayItems.length;
|
|
1806
1945
|
const contentHeight = total * itemHeight;
|
|
1807
1946
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -1814,6 +1953,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1814
1953
|
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
1815
1954
|
const inputPlaceholder = messageEnterToCommitOnMaster();
|
|
1816
1955
|
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
1956
|
+
const headerHeight = getHeaderHeight(inputBoxHeight, sourceControlButtons);
|
|
1817
1957
|
return {
|
|
1818
1958
|
...state,
|
|
1819
1959
|
actionsCache,
|
|
@@ -1824,6 +1964,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1824
1964
|
fileIconCache: newFileIconCache,
|
|
1825
1965
|
finalDeltaY,
|
|
1826
1966
|
gitRoot,
|
|
1967
|
+
headerHeight,
|
|
1827
1968
|
iconDefinitions,
|
|
1828
1969
|
initial: false,
|
|
1829
1970
|
inputBoxHeight,
|
|
@@ -1833,6 +1974,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1833
1974
|
maxLineY,
|
|
1834
1975
|
root,
|
|
1835
1976
|
scrollBarHeight,
|
|
1977
|
+
showGenerateCommitMessageButton,
|
|
1978
|
+
sourceControlButtons,
|
|
1836
1979
|
splitButtonEnabled,
|
|
1837
1980
|
visibleItems
|
|
1838
1981
|
};
|
|
@@ -1859,15 +2002,76 @@ const acceptInput = async state => {
|
|
|
1859
2002
|
info('[ViewletSourceControl] no source control provider found');
|
|
1860
2003
|
return state;
|
|
1861
2004
|
}
|
|
1862
|
-
const providerId
|
|
1863
|
-
|
|
2005
|
+
for (const providerId of enabledProviderIds) {
|
|
2006
|
+
await acceptInput$1(providerId, inputValue, assetDir, platform);
|
|
2007
|
+
}
|
|
1864
2008
|
const newState = await loadContent(state, {});
|
|
1865
2009
|
return {
|
|
1866
2010
|
...newState,
|
|
2011
|
+
inputMessage: '',
|
|
1867
2012
|
inputValue: ''
|
|
1868
2013
|
};
|
|
1869
2014
|
};
|
|
1870
2015
|
|
|
2016
|
+
const createDefaultState = () => ({
|
|
2017
|
+
actionsCache: Object.create(null),
|
|
2018
|
+
allGroups: [],
|
|
2019
|
+
assetDir: '',
|
|
2020
|
+
badgeCount: 0,
|
|
2021
|
+
decorationIcons: [],
|
|
2022
|
+
deltaY: 0,
|
|
2023
|
+
enabledProviderIds: [],
|
|
2024
|
+
expandedGroups: Object.create(null),
|
|
2025
|
+
fileIconCache: {},
|
|
2026
|
+
finalDeltaY: 0,
|
|
2027
|
+
focus: 0,
|
|
2028
|
+
gitRoot: '',
|
|
2029
|
+
handleOffset: 0,
|
|
2030
|
+
headerHeight: 40,
|
|
2031
|
+
height: 100,
|
|
2032
|
+
history: [],
|
|
2033
|
+
iconDefinitions: [],
|
|
2034
|
+
id: 1,
|
|
2035
|
+
index: [],
|
|
2036
|
+
initial: false,
|
|
2037
|
+
inputBoxHeight: 30,
|
|
2038
|
+
inputBoxMaxHeight: 214,
|
|
2039
|
+
inputFontFamily: '',
|
|
2040
|
+
inputFontSize: 15,
|
|
2041
|
+
inputFontWeight: 400,
|
|
2042
|
+
inputLetterSpacing: 0.5,
|
|
2043
|
+
inputLineHeight: 14.95,
|
|
2044
|
+
inputMessage: '',
|
|
2045
|
+
inputPadding: 2,
|
|
2046
|
+
inputPlaceholder: '',
|
|
2047
|
+
inputSource: 0,
|
|
2048
|
+
inputValue: '',
|
|
2049
|
+
isVisible: true,
|
|
2050
|
+
itemHeight: 20,
|
|
2051
|
+
items: [],
|
|
2052
|
+
maxInputLines: 5,
|
|
2053
|
+
maxLineY: 0,
|
|
2054
|
+
merge: [],
|
|
2055
|
+
minimumSliderSize: 30,
|
|
2056
|
+
minLineY: 0,
|
|
2057
|
+
platform: 0,
|
|
2058
|
+
providerId: '',
|
|
2059
|
+
root: '/',
|
|
2060
|
+
scrollBarActive: false,
|
|
2061
|
+
scrollBarHeight: 0,
|
|
2062
|
+
showGenerateCommitMessageButton: false,
|
|
2063
|
+
sourceControlButtons: [],
|
|
2064
|
+
splitButtonEnabled: false,
|
|
2065
|
+
untracked: [],
|
|
2066
|
+
viewMode: 1,
|
|
2067
|
+
visibleItems: [],
|
|
2068
|
+
width: 100,
|
|
2069
|
+
workingTree: [],
|
|
2070
|
+
workspacePath: '',
|
|
2071
|
+
x: 0,
|
|
2072
|
+
y: 0
|
|
2073
|
+
});
|
|
2074
|
+
|
|
1871
2075
|
const {
|
|
1872
2076
|
get,
|
|
1873
2077
|
getCommandIds,
|
|
@@ -1877,59 +2081,16 @@ const {
|
|
|
1877
2081
|
wrapGetter
|
|
1878
2082
|
} = create();
|
|
1879
2083
|
|
|
1880
|
-
const create2 = (id,
|
|
2084
|
+
const create2 = (id, _uri, x, y, width, height, workspacePath, platform, assetDir) => {
|
|
2085
|
+
const defaultState = createDefaultState();
|
|
1881
2086
|
const state = {
|
|
1882
|
-
|
|
1883
|
-
allGroups: [],
|
|
2087
|
+
...defaultState,
|
|
1884
2088
|
assetDir,
|
|
1885
|
-
badgeCount: 0,
|
|
1886
|
-
decorationIcons: [],
|
|
1887
|
-
deltaY: 0,
|
|
1888
|
-
enabledProviderIds: [],
|
|
1889
|
-
expandedGroups: Object.create(null),
|
|
1890
|
-
fileIconCache: Object.create(null),
|
|
1891
|
-
finalDeltaY: 0,
|
|
1892
|
-
focus: 0,
|
|
1893
|
-
gitRoot: '',
|
|
1894
|
-
handleOffset: 0,
|
|
1895
|
-
headerHeight: 40,
|
|
1896
|
-
// TODO
|
|
1897
2089
|
height,
|
|
1898
|
-
history: [],
|
|
1899
|
-
iconDefinitions: [],
|
|
1900
2090
|
id,
|
|
1901
|
-
index: [],
|
|
1902
2091
|
initial: true,
|
|
1903
|
-
inputBoxHeight: 30,
|
|
1904
|
-
inputBoxMaxHeight: 214,
|
|
1905
|
-
inputFontFamily: 'system-ui, Ubuntu, "Droid Sans", sans-serif',
|
|
1906
|
-
inputFontSize: 13,
|
|
1907
|
-
inputFontWeight: 400,
|
|
1908
|
-
inputLetterSpacing: 0,
|
|
1909
|
-
inputLineHeight: 20,
|
|
1910
|
-
inputPadding: 2,
|
|
1911
|
-
inputPlaceholder: '',
|
|
1912
|
-
inputSource: 0,
|
|
1913
|
-
inputValue: '',
|
|
1914
|
-
isVisible: true,
|
|
1915
|
-
itemHeight: 20,
|
|
1916
|
-
items: [],
|
|
1917
|
-
maxInputLines: 5,
|
|
1918
|
-
maxLineY: 0,
|
|
1919
|
-
merge: [],
|
|
1920
|
-
minimumSliderSize: 20,
|
|
1921
|
-
minLineY: 0,
|
|
1922
2092
|
platform,
|
|
1923
|
-
providerId: '',
|
|
1924
|
-
root: '',
|
|
1925
|
-
scrollBarActive: false,
|
|
1926
|
-
scrollBarHeight: 0,
|
|
1927
|
-
splitButtonEnabled: false,
|
|
1928
|
-
untracked: [],
|
|
1929
|
-
viewMode: 1,
|
|
1930
|
-
visibleItems: [],
|
|
1931
2093
|
width,
|
|
1932
|
-
workingTree: [],
|
|
1933
2094
|
workspacePath,
|
|
1934
2095
|
x,
|
|
1935
2096
|
y
|
|
@@ -1946,7 +2107,7 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
1946
2107
|
};
|
|
1947
2108
|
|
|
1948
2109
|
const isEqual$1 = (oldState, newState) => {
|
|
1949
|
-
return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.visibleItems === newState.visibleItems;
|
|
2110
|
+
return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.sourceControlButtons === newState.sourceControlButtons && oldState.visibleItems === newState.visibleItems;
|
|
1950
2111
|
};
|
|
1951
2112
|
|
|
1952
2113
|
const RenderItems = 4;
|
|
@@ -2016,6 +2177,7 @@ const NavigateChild = 7;
|
|
|
2016
2177
|
const NavigateParent = 8;
|
|
2017
2178
|
const RemoveChild = 9;
|
|
2018
2179
|
const NavigateSibling = 10;
|
|
2180
|
+
const SetReferenceNodeUid = 11;
|
|
2019
2181
|
|
|
2020
2182
|
const isKey = key => {
|
|
2021
2183
|
return key !== 'type' && key !== 'childCount';
|
|
@@ -2083,6 +2245,16 @@ const compareNodes = (oldNode, newNode) => {
|
|
|
2083
2245
|
if (oldNode.type !== newNode.type) {
|
|
2084
2246
|
return null;
|
|
2085
2247
|
}
|
|
2248
|
+
// Handle reference nodes - special handling for uid changes
|
|
2249
|
+
if (oldNode.type === Reference) {
|
|
2250
|
+
if (oldNode.uid !== newNode.uid) {
|
|
2251
|
+
patches.push({
|
|
2252
|
+
type: SetReferenceNodeUid,
|
|
2253
|
+
uid: newNode.uid
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
return patches;
|
|
2257
|
+
}
|
|
2086
2258
|
// Handle text nodes
|
|
2087
2259
|
if (oldNode.type === Text && newNode.type === Text) {
|
|
2088
2260
|
if (oldNode.text !== newNode.text) {
|
|
@@ -2218,7 +2390,6 @@ const diffChildren = (oldChildren, newChildren, patches) => {
|
|
|
2218
2390
|
patches.push({
|
|
2219
2391
|
type: NavigateParent
|
|
2220
2392
|
});
|
|
2221
|
-
currentChildIndex = -1;
|
|
2222
2393
|
}
|
|
2223
2394
|
// Add remove patches in reverse order (highest index first)
|
|
2224
2395
|
// This ensures indices remain valid as we remove
|
|
@@ -2344,10 +2515,64 @@ const getMenuIds = () => {
|
|
|
2344
2515
|
return [SourceControl$1];
|
|
2345
2516
|
};
|
|
2346
2517
|
|
|
2518
|
+
const handleInput = async (state, value, inputSource = User) => {
|
|
2519
|
+
const {
|
|
2520
|
+
inputFontFamily,
|
|
2521
|
+
inputFontSize,
|
|
2522
|
+
inputFontWeight,
|
|
2523
|
+
inputLetterSpacing,
|
|
2524
|
+
inputLineHeight,
|
|
2525
|
+
inputPadding,
|
|
2526
|
+
width
|
|
2527
|
+
} = state;
|
|
2528
|
+
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
2529
|
+
return {
|
|
2530
|
+
...state,
|
|
2531
|
+
inputBoxHeight,
|
|
2532
|
+
inputMessage: '',
|
|
2533
|
+
inputSource,
|
|
2534
|
+
inputValue: value
|
|
2535
|
+
};
|
|
2536
|
+
};
|
|
2537
|
+
|
|
2538
|
+
const toErrorMessage = error => {
|
|
2539
|
+
if (error instanceof Error && error.message) {
|
|
2540
|
+
return `Failed to generate commit message: ${error.message}`;
|
|
2541
|
+
}
|
|
2542
|
+
return 'Failed to generate commit message';
|
|
2543
|
+
};
|
|
2544
|
+
const handleGenerateCommitMessage = async state => {
|
|
2545
|
+
const {
|
|
2546
|
+
assetDir,
|
|
2547
|
+
enabledProviderIds,
|
|
2548
|
+
platform
|
|
2549
|
+
} = state;
|
|
2550
|
+
if (enabledProviderIds.length === 0) {
|
|
2551
|
+
return {
|
|
2552
|
+
...state,
|
|
2553
|
+
inputMessage: 'Failed to generate commit message: no source control provider found'
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
try {
|
|
2557
|
+
const inputValue = await generateCommitMessage$1(enabledProviderIds[0], assetDir, platform);
|
|
2558
|
+
const newState = await handleInput(state, inputValue, Script);
|
|
2559
|
+
return {
|
|
2560
|
+
...newState,
|
|
2561
|
+
inputMessage: ''
|
|
2562
|
+
};
|
|
2563
|
+
} catch (error) {
|
|
2564
|
+
return {
|
|
2565
|
+
...state,
|
|
2566
|
+
inputMessage: toErrorMessage(error)
|
|
2567
|
+
};
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
|
|
2347
2571
|
const SourceControlInput = 'SourceControlInput';
|
|
2348
2572
|
const ViewAsTree = 'ViewAsTree';
|
|
2349
2573
|
const CommitAndPush = 'CommitAndPush';
|
|
2350
2574
|
const Refresh$1 = 'Refresh';
|
|
2575
|
+
const GenerateCommitMessage = 'GenerateCommitMessage';
|
|
2351
2576
|
|
|
2352
2577
|
const refresh = async state => {
|
|
2353
2578
|
const {
|
|
@@ -2369,7 +2594,7 @@ const refresh = async state => {
|
|
|
2369
2594
|
} = await getGroups(enabledProviderIds, root, assetDir, platform);
|
|
2370
2595
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2371
2596
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2372
|
-
const badgeCount =
|
|
2597
|
+
const badgeCount = await getBadgeCount$1(enabledProviderIds, assetDir, platform);
|
|
2373
2598
|
const total = displayItems.length;
|
|
2374
2599
|
const contentHeight = total * itemHeight;
|
|
2375
2600
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -2409,6 +2634,8 @@ const handleActionClick = async (state, actionName) => {
|
|
|
2409
2634
|
case CommitAndPush:
|
|
2410
2635
|
warn(`[source-control-worker] CommitAndPush action not yet implemented`);
|
|
2411
2636
|
return state;
|
|
2637
|
+
case GenerateCommitMessage:
|
|
2638
|
+
return handleGenerateCommitMessage(state);
|
|
2412
2639
|
case Refresh$1:
|
|
2413
2640
|
return refresh(state);
|
|
2414
2641
|
case ViewAsTree:
|
|
@@ -2613,32 +2840,13 @@ const handleInputFocus = async state => {
|
|
|
2613
2840
|
};
|
|
2614
2841
|
};
|
|
2615
2842
|
|
|
2616
|
-
const handleInput = async (state, value, inputSource = User) => {
|
|
2617
|
-
const {
|
|
2618
|
-
inputFontFamily,
|
|
2619
|
-
inputFontSize,
|
|
2620
|
-
inputFontWeight,
|
|
2621
|
-
inputLetterSpacing,
|
|
2622
|
-
inputLineHeight,
|
|
2623
|
-
inputPadding,
|
|
2624
|
-
width
|
|
2625
|
-
} = state;
|
|
2626
|
-
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
2627
|
-
return {
|
|
2628
|
-
...state,
|
|
2629
|
-
inputBoxHeight,
|
|
2630
|
-
inputSource,
|
|
2631
|
-
inputValue: value
|
|
2632
|
-
};
|
|
2633
|
-
};
|
|
2634
|
-
|
|
2635
2843
|
const handleInputBlur = async state => {
|
|
2636
2844
|
// TODO reset focus
|
|
2637
2845
|
return state;
|
|
2638
2846
|
};
|
|
2639
2847
|
|
|
2640
2848
|
const handleMessagePort = async port => {
|
|
2641
|
-
await
|
|
2849
|
+
await create$4({
|
|
2642
2850
|
commandMap: {},
|
|
2643
2851
|
messagePort: port
|
|
2644
2852
|
});
|
|
@@ -2679,6 +2887,21 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
|
2679
2887
|
return handleMouseOver(state, index);
|
|
2680
2888
|
};
|
|
2681
2889
|
|
|
2890
|
+
const handleSourceControlButtonClick = async (state, name) => {
|
|
2891
|
+
const button = state.sourceControlButtons.find(button => button.label === name);
|
|
2892
|
+
if (!button) {
|
|
2893
|
+
warn(`[source-control-worker] Source control button not found ${name}`);
|
|
2894
|
+
return state;
|
|
2895
|
+
}
|
|
2896
|
+
await executeCommand(button.command, state.assetDir, state.platform, state.inputValue);
|
|
2897
|
+
const newState = await loadContent(state, {});
|
|
2898
|
+
return {
|
|
2899
|
+
...newState,
|
|
2900
|
+
inputMessage: '',
|
|
2901
|
+
inputValue: ''
|
|
2902
|
+
};
|
|
2903
|
+
};
|
|
2904
|
+
|
|
2682
2905
|
const setDeltaY = async (state, newDeltaY) => {
|
|
2683
2906
|
const {
|
|
2684
2907
|
actionsCache,
|
|
@@ -2718,7 +2941,7 @@ const sendMessagePortToExtensionHostWorker = async port => {
|
|
|
2718
2941
|
|
|
2719
2942
|
const createExtensionHostRpc = async () => {
|
|
2720
2943
|
try {
|
|
2721
|
-
const rpc = await
|
|
2944
|
+
const rpc = await create$3({
|
|
2722
2945
|
commandMap: {},
|
|
2723
2946
|
send: sendMessagePortToExtensionHostWorker
|
|
2724
2947
|
});
|
|
@@ -2734,7 +2957,7 @@ const sendMessagePortToTextMeasurementWorker = async port => {
|
|
|
2734
2957
|
|
|
2735
2958
|
const createTextMeasurementWorkerRpc = async () => {
|
|
2736
2959
|
try {
|
|
2737
|
-
const rpc = await
|
|
2960
|
+
const rpc = await create$3({
|
|
2738
2961
|
commandMap: {},
|
|
2739
2962
|
send: sendMessagePortToTextMeasurementWorker
|
|
2740
2963
|
});
|
|
@@ -2746,7 +2969,7 @@ const createTextMeasurementWorkerRpc = async () => {
|
|
|
2746
2969
|
|
|
2747
2970
|
const createExtensionManagementWorkerRpc = async () => {
|
|
2748
2971
|
try {
|
|
2749
|
-
const rpc = await
|
|
2972
|
+
const rpc = await create$3({
|
|
2750
2973
|
commandMap: {},
|
|
2751
2974
|
send: port => sendMessagePortToExtensionManagementWorker(port, 0)
|
|
2752
2975
|
});
|
|
@@ -2771,6 +2994,12 @@ const initialize = async () => {
|
|
|
2771
2994
|
set$1(textRpc);
|
|
2772
2995
|
};
|
|
2773
2996
|
|
|
2997
|
+
const getIndentRule = indent => {
|
|
2998
|
+
return `.Indent-${indent} {
|
|
2999
|
+
padding-left: ${indent}px;
|
|
3000
|
+
}`;
|
|
3001
|
+
};
|
|
3002
|
+
|
|
2774
3003
|
const getUnique = items => {
|
|
2775
3004
|
const seens = [];
|
|
2776
3005
|
for (const item of items) {
|
|
@@ -2781,11 +3010,6 @@ const getUnique = items => {
|
|
|
2781
3010
|
return seens;
|
|
2782
3011
|
};
|
|
2783
3012
|
|
|
2784
|
-
const getIndentRule = indent => {
|
|
2785
|
-
return `.Indent-${indent} {
|
|
2786
|
-
padding-left: ${indent}px;
|
|
2787
|
-
}`;
|
|
2788
|
-
};
|
|
2789
3013
|
const renderCss = (oldState, newState) => {
|
|
2790
3014
|
const {
|
|
2791
3015
|
id,
|
|
@@ -2825,19 +3049,13 @@ const IconButton = 'IconButton';
|
|
|
2825
3049
|
const InputBox = 'InputBox';
|
|
2826
3050
|
const Label = 'Label';
|
|
2827
3051
|
const LabelDetail = 'LabelDetail';
|
|
2828
|
-
const
|
|
2829
|
-
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
3052
|
+
const Message = 'Message';
|
|
2830
3053
|
const SourceControl = 'SourceControl';
|
|
2831
3054
|
const SourceControlButton = 'SourceControlButton';
|
|
2832
3055
|
const SourceControlHeader = 'SourceControlHeader';
|
|
2833
3056
|
const SourceControlItems = 'SourceControlItems';
|
|
2834
3057
|
const SplitButton = 'SplitButton';
|
|
2835
3058
|
const SplitButtonContent = 'SplitButtonContent';
|
|
2836
|
-
const SplitButtonContentDisabled = 'SplitButtonContentDisabled';
|
|
2837
|
-
const SplitButtonDisabled = 'SplitButtonDisabled';
|
|
2838
|
-
const SplitButtonDropDown = 'SplitButtonDropDown';
|
|
2839
|
-
const SplitButtonDropDownDisabled = 'SplitButtonDropDownDisabled';
|
|
2840
|
-
const SplitButtonSeparator = 'SplitButtonSeparator';
|
|
2841
3059
|
const StrikeThrough = 'StrikeThrough';
|
|
2842
3060
|
const TreeItem = 'TreeItem';
|
|
2843
3061
|
const Viewlet = 'Viewlet';
|
|
@@ -2851,9 +3069,34 @@ const HandleMouseOver = 7;
|
|
|
2851
3069
|
const HandleMouseOverAt = 8;
|
|
2852
3070
|
const HandleWheel = 9;
|
|
2853
3071
|
const HandleClickAction = 10;
|
|
3072
|
+
const HandleClickSourceControlButton = 11;
|
|
2854
3073
|
|
|
2855
|
-
const
|
|
3074
|
+
const getSourceControlButtonVirtualDom = button => {
|
|
3075
|
+
const {
|
|
3076
|
+
id,
|
|
3077
|
+
label
|
|
3078
|
+
} = button;
|
|
2856
3079
|
return [{
|
|
3080
|
+
childCount: 1,
|
|
3081
|
+
className: SplitButton,
|
|
3082
|
+
type: Div
|
|
3083
|
+
}, {
|
|
3084
|
+
childCount: 1,
|
|
3085
|
+
className: SplitButtonContent,
|
|
3086
|
+
name: label,
|
|
3087
|
+
onClick: HandleClickSourceControlButton,
|
|
3088
|
+
tabIndex: 0,
|
|
3089
|
+
title: id,
|
|
3090
|
+
type: Div
|
|
3091
|
+
}, text(label)];
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
const getSourceControlButtonsVirtualDom = buttons => {
|
|
3095
|
+
return buttons.flatMap(getSourceControlButtonVirtualDom);
|
|
3096
|
+
};
|
|
3097
|
+
|
|
3098
|
+
const getSourceControlInputDom = (inputPlaceholder, inputMessage) => {
|
|
3099
|
+
const dom = [{
|
|
2857
3100
|
ariaLabel: sourceControlInput(),
|
|
2858
3101
|
autocapitalize: 'off',
|
|
2859
3102
|
autocorrect: 'off',
|
|
@@ -2866,14 +3109,26 @@ const getSourceControlInputDom = inputPlaceholder => {
|
|
|
2866
3109
|
spellcheck: false,
|
|
2867
3110
|
type: TextArea
|
|
2868
3111
|
}];
|
|
3112
|
+
if (inputMessage) {
|
|
3113
|
+
dom.push({
|
|
3114
|
+
childCount: 1,
|
|
3115
|
+
className: Message,
|
|
3116
|
+
type: Div
|
|
3117
|
+
}, {
|
|
3118
|
+
text: inputMessage,
|
|
3119
|
+
type: Text
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
return dom;
|
|
2869
3123
|
};
|
|
2870
3124
|
|
|
2871
|
-
const getSourceControlHeaderVirtualDom = inputPlaceholder => {
|
|
3125
|
+
const getSourceControlHeaderVirtualDom = (inputPlaceholder, inputMessage) => {
|
|
3126
|
+
const inputDom = getSourceControlInputDom(inputPlaceholder, inputMessage);
|
|
2872
3127
|
return [{
|
|
2873
|
-
childCount: 1,
|
|
3128
|
+
childCount: inputMessage ? 2 : 1,
|
|
2874
3129
|
className: SourceControlHeader,
|
|
2875
3130
|
type: Div
|
|
2876
|
-
}, ...
|
|
3131
|
+
}, ...inputDom];
|
|
2877
3132
|
};
|
|
2878
3133
|
|
|
2879
3134
|
const className$1 = mergeClassNames(Badge, SourceControlBadge);
|
|
@@ -2883,7 +3138,7 @@ const parentNode = {
|
|
|
2883
3138
|
type: Div
|
|
2884
3139
|
};
|
|
2885
3140
|
const getBadgeVirtualDom = count => {
|
|
2886
|
-
return [parentNode, text(
|
|
3141
|
+
return [parentNode, text(String(count))];
|
|
2887
3142
|
};
|
|
2888
3143
|
|
|
2889
3144
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
@@ -3072,40 +3327,10 @@ const getSourceControlListVirtualDom = items => {
|
|
|
3072
3327
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
3073
3328
|
};
|
|
3074
3329
|
|
|
3075
|
-
const getSplitButtonVirtualDom = (hasItems, splitButtonEnabled, buttonText) => {
|
|
3076
|
-
if (!splitButtonEnabled || !hasItems) {
|
|
3077
|
-
return [];
|
|
3078
|
-
}
|
|
3079
|
-
return [{
|
|
3080
|
-
childCount: 3,
|
|
3081
|
-
className: mergeClassNames(SplitButton, hasItems ? '' : SplitButtonDisabled),
|
|
3082
|
-
type: Div
|
|
3083
|
-
}, {
|
|
3084
|
-
childCount: 1,
|
|
3085
|
-
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
3086
|
-
tabIndex: 0,
|
|
3087
|
-
type: Div
|
|
3088
|
-
}, text(buttonText), {
|
|
3089
|
-
childCount: 0,
|
|
3090
|
-
className: SplitButtonSeparator,
|
|
3091
|
-
type: Div
|
|
3092
|
-
}, {
|
|
3093
|
-
childCount: 1,
|
|
3094
|
-
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
3095
|
-
tabIndex: 0,
|
|
3096
|
-
type: Div
|
|
3097
|
-
}, {
|
|
3098
|
-
childCount: 0,
|
|
3099
|
-
className: mergeClassNames(MaskIcon, MaskIconChevronDown),
|
|
3100
|
-
type: Div
|
|
3101
|
-
}];
|
|
3102
|
-
};
|
|
3103
|
-
|
|
3104
3330
|
const className = mergeClassNames(Viewlet, SourceControl);
|
|
3105
|
-
const getSourceControlVirtualDom = (items,
|
|
3106
|
-
const hasItems = items.length > 0;
|
|
3331
|
+
const getSourceControlVirtualDom = (items, sourceControlButtons, inputPlaceholder, inputMessage) => {
|
|
3107
3332
|
const dom = [{
|
|
3108
|
-
childCount:
|
|
3333
|
+
childCount: 2 + sourceControlButtons.length,
|
|
3109
3334
|
className: className,
|
|
3110
3335
|
onContextMenu: HandleContextMenu,
|
|
3111
3336
|
onMouseOver: HandleMouseOver,
|
|
@@ -3113,7 +3338,7 @@ const getSourceControlVirtualDom = (items, splitButtonEnabled, inputPlaceholder)
|
|
|
3113
3338
|
onWheel: HandleWheel,
|
|
3114
3339
|
tabIndex: 0,
|
|
3115
3340
|
type: Div
|
|
3116
|
-
}, ...getSourceControlHeaderVirtualDom(inputPlaceholder), ...
|
|
3341
|
+
}, ...getSourceControlHeaderVirtualDom(inputPlaceholder, inputMessage), ...getSourceControlButtonsVirtualDom(sourceControlButtons), ...getSourceControlListVirtualDom(items)];
|
|
3117
3342
|
return dom;
|
|
3118
3343
|
};
|
|
3119
3344
|
|
|
@@ -3121,14 +3346,15 @@ const renderItems = (oldState, newState) => {
|
|
|
3121
3346
|
const {
|
|
3122
3347
|
id,
|
|
3123
3348
|
initial,
|
|
3349
|
+
inputMessage,
|
|
3124
3350
|
inputPlaceholder,
|
|
3125
|
-
|
|
3351
|
+
sourceControlButtons,
|
|
3126
3352
|
visibleItems
|
|
3127
3353
|
} = newState;
|
|
3128
3354
|
if (initial) {
|
|
3129
3355
|
return [SetDom2, id, []];
|
|
3130
3356
|
}
|
|
3131
|
-
const dom = getSourceControlVirtualDom(visibleItems,
|
|
3357
|
+
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, inputPlaceholder, inputMessage);
|
|
3132
3358
|
return [SetDom2, id, dom];
|
|
3133
3359
|
};
|
|
3134
3360
|
|
|
@@ -3192,11 +3418,12 @@ const render2 = (uid, diffResult) => {
|
|
|
3192
3418
|
const Button = 1;
|
|
3193
3419
|
|
|
3194
3420
|
const Check = 'Check';
|
|
3421
|
+
const DebugAlt2 = 'DebugAlt2';
|
|
3195
3422
|
const ListFlat = 'ListFlat';
|
|
3196
3423
|
const Refresh = 'Refresh';
|
|
3197
3424
|
|
|
3198
|
-
const getActions =
|
|
3199
|
-
|
|
3425
|
+
const getActions = state => {
|
|
3426
|
+
const actions = [{
|
|
3200
3427
|
command: '',
|
|
3201
3428
|
icon: ListFlat,
|
|
3202
3429
|
id: viewAsTree$1(),
|
|
@@ -3215,6 +3442,16 @@ const getActions = () => {
|
|
|
3215
3442
|
name: Refresh$1,
|
|
3216
3443
|
type: Button
|
|
3217
3444
|
}];
|
|
3445
|
+
if (state.showGenerateCommitMessageButton) {
|
|
3446
|
+
actions.splice(2, 0, {
|
|
3447
|
+
command: '',
|
|
3448
|
+
icon: DebugAlt2,
|
|
3449
|
+
id: generateCommitMessage(),
|
|
3450
|
+
name: GenerateCommitMessage,
|
|
3451
|
+
type: Button
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
return actions;
|
|
3218
3455
|
};
|
|
3219
3456
|
|
|
3220
3457
|
const getActionButtonVirtualDom = action => {
|
|
@@ -3259,7 +3496,7 @@ const getActionsVirtualDom = actions => {
|
|
|
3259
3496
|
};
|
|
3260
3497
|
|
|
3261
3498
|
const renderActions = state => {
|
|
3262
|
-
const actions = getActions();
|
|
3499
|
+
const actions = getActions(state);
|
|
3263
3500
|
const dom = getActionsVirtualDom(actions);
|
|
3264
3501
|
return dom;
|
|
3265
3502
|
};
|
|
@@ -3298,6 +3535,9 @@ const renderEventListeners = () => {
|
|
|
3298
3535
|
}, {
|
|
3299
3536
|
name: HandleClickAction,
|
|
3300
3537
|
params: ['handleActionClick', TargetName]
|
|
3538
|
+
}, {
|
|
3539
|
+
name: HandleClickSourceControlButton,
|
|
3540
|
+
params: ['handleSourceControlButtonClick', TargetName]
|
|
3301
3541
|
}];
|
|
3302
3542
|
};
|
|
3303
3543
|
|
|
@@ -3358,12 +3598,14 @@ const commandMap = {
|
|
|
3358
3598
|
'SourceControl.getKeyBindings': getKeyBindings,
|
|
3359
3599
|
'SourceControl.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
3360
3600
|
'SourceControl.getMenuIds': getMenuIds,
|
|
3601
|
+
'SourceControl.getWorkspaceBadgeCount': getWorkspaceBadgeCount,
|
|
3361
3602
|
'SourceControl.handleActionClick': wrapCommand(handleActionClick),
|
|
3362
3603
|
'SourceControl.handleButtonClick': wrapCommand(handleButtonClick),
|
|
3363
3604
|
'SourceControl.handleClickAt': wrapCommand(handleClickAt),
|
|
3364
3605
|
'SourceControl.handleClickSourceControlButtons': wrapCommand(handleClickSourceControlButtons),
|
|
3365
3606
|
'SourceControl.handleContextMenu': wrapCommand(handleContextMenu),
|
|
3366
3607
|
'SourceControl.handleFocus': wrapCommand(handleInputFocus),
|
|
3608
|
+
'SourceControl.handleGenerateCommitMessage': wrapCommand(handleGenerateCommitMessage),
|
|
3367
3609
|
'SourceControl.handleInput': wrapCommand(handleInput),
|
|
3368
3610
|
'SourceControl.handleInputBlur': wrapCommand(handleInputBlur),
|
|
3369
3611
|
'SourceControl.handleMessagePort': handleMessagePort,
|
|
@@ -3371,6 +3613,7 @@ const commandMap = {
|
|
|
3371
3613
|
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
3372
3614
|
'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
|
|
3373
3615
|
'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
|
|
3616
|
+
'SourceControl.handleSourceControlButtonClick': wrapCommand(handleSourceControlButtonClick),
|
|
3374
3617
|
'SourceControl.handleWheel': wrapCommand(handleWheel),
|
|
3375
3618
|
'SourceControl.handleWorkspaceRefresh': wrapCommand(handleWorkspaceRefresh),
|
|
3376
3619
|
'SourceControl.loadContent': wrapCommand(loadContent),
|
|
@@ -3390,7 +3633,7 @@ const commandMap = {
|
|
|
3390
3633
|
|
|
3391
3634
|
const listen = async () => {
|
|
3392
3635
|
registerCommands(commandMap);
|
|
3393
|
-
const rpc = await
|
|
3636
|
+
const rpc = await create$2({
|
|
3394
3637
|
commandMap: commandMap
|
|
3395
3638
|
});
|
|
3396
3639
|
set$2(rpc);
|