@lvce-editor/extension-search-view 7.8.0 → 7.9.1
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/extensionSearchViewWorkerMain.js +877 -311
- package/package.json +1 -1
|
@@ -145,7 +145,6 @@ const walkValue = (value, transferrables, isTransferrable) => {
|
|
|
145
145
|
for (const property of Object.values(value)) {
|
|
146
146
|
walkValue(property, transferrables, isTransferrable);
|
|
147
147
|
}
|
|
148
|
-
return;
|
|
149
148
|
}
|
|
150
149
|
};
|
|
151
150
|
const getTransferrables = value => {
|
|
@@ -299,7 +298,14 @@ class IpcError extends VError {
|
|
|
299
298
|
const cause = new Error(message);
|
|
300
299
|
// @ts-ignore
|
|
301
300
|
cause.code = code;
|
|
302
|
-
|
|
301
|
+
if (stack) {
|
|
302
|
+
Object.defineProperty(cause, 'stack', {
|
|
303
|
+
configurable: true,
|
|
304
|
+
enumerable: false,
|
|
305
|
+
value: stack,
|
|
306
|
+
writable: true
|
|
307
|
+
});
|
|
308
|
+
}
|
|
303
309
|
super(cause, betterMessage);
|
|
304
310
|
} else {
|
|
305
311
|
super(betterMessage);
|
|
@@ -603,8 +609,10 @@ const getCurrentStack = () => {
|
|
|
603
609
|
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
604
610
|
return currentStack;
|
|
605
611
|
};
|
|
606
|
-
const getNewLineIndex = (string, startIndex
|
|
607
|
-
|
|
612
|
+
const getNewLineIndex = (string, startIndex) => {
|
|
613
|
+
{
|
|
614
|
+
return string.indexOf(NewLine);
|
|
615
|
+
}
|
|
608
616
|
};
|
|
609
617
|
const getParentStack = error => {
|
|
610
618
|
let parentStack = error.stack || error.data || error.message || '';
|
|
@@ -615,55 +623,77 @@ const getParentStack = error => {
|
|
|
615
623
|
};
|
|
616
624
|
const MethodNotFound = -32601;
|
|
617
625
|
const Custom = -32001;
|
|
626
|
+
const restoreExistingError = (error, currentStack) => {
|
|
627
|
+
if (typeof error.stack === 'string') {
|
|
628
|
+
error.stack = error.stack + NewLine + currentStack;
|
|
629
|
+
}
|
|
630
|
+
return error;
|
|
631
|
+
};
|
|
632
|
+
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
633
|
+
const restoredError = new JsonRpcError(error.message);
|
|
634
|
+
const parentStack = getParentStack(error);
|
|
635
|
+
restoredError.stack = parentStack + NewLine + currentStack;
|
|
636
|
+
return restoredError;
|
|
637
|
+
};
|
|
638
|
+
const restoreStackFromData = (restoredError, error, currentStack) => {
|
|
639
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
640
|
+
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (error.data.stack) {
|
|
644
|
+
restoredError.stack = error.data.stack;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
const applyDataProperties = (restoredError, error) => {
|
|
648
|
+
if (!error.data) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
restoreStackFromData(restoredError, error, getCurrentStack());
|
|
652
|
+
if (error.data.codeFrame) {
|
|
653
|
+
// @ts-ignore
|
|
654
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
655
|
+
}
|
|
656
|
+
if (error.data.code) {
|
|
657
|
+
// @ts-ignore
|
|
658
|
+
restoredError.code = error.data.code;
|
|
659
|
+
}
|
|
660
|
+
if (error.data.type) {
|
|
661
|
+
// @ts-ignore
|
|
662
|
+
restoredError.name = error.data.type;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
const applyDirectProperties = (restoredError, error) => {
|
|
666
|
+
if (error.stack) {
|
|
667
|
+
const lowerStack = restoredError.stack || '';
|
|
668
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
669
|
+
const parentStack = getParentStack(error);
|
|
670
|
+
// @ts-ignore
|
|
671
|
+
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
672
|
+
}
|
|
673
|
+
if (error.codeFrame) {
|
|
674
|
+
// @ts-ignore
|
|
675
|
+
restoredError.codeFrame = error.codeFrame;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
const restoreMessageError = (error, _currentStack) => {
|
|
679
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
680
|
+
if (error.data) {
|
|
681
|
+
applyDataProperties(restoredError, error);
|
|
682
|
+
} else {
|
|
683
|
+
applyDirectProperties(restoredError, error);
|
|
684
|
+
}
|
|
685
|
+
return restoredError;
|
|
686
|
+
};
|
|
618
687
|
const restoreJsonRpcError = error => {
|
|
619
688
|
const currentStack = getCurrentStack();
|
|
620
689
|
if (error && error instanceof Error) {
|
|
621
|
-
|
|
622
|
-
error.stack = error.stack + NewLine + currentStack;
|
|
623
|
-
}
|
|
624
|
-
return error;
|
|
690
|
+
return restoreExistingError(error, currentStack);
|
|
625
691
|
}
|
|
626
692
|
if (error && error.code && error.code === MethodNotFound) {
|
|
627
|
-
|
|
628
|
-
const parentStack = getParentStack(error);
|
|
629
|
-
restoredError.stack = parentStack + NewLine + currentStack;
|
|
630
|
-
return restoredError;
|
|
693
|
+
return restoreMethodNotFoundError(error, currentStack);
|
|
631
694
|
}
|
|
632
695
|
if (error && error.message) {
|
|
633
|
-
|
|
634
|
-
if (error.data) {
|
|
635
|
-
if (error.data.stack && error.data.type && error.message) {
|
|
636
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
637
|
-
} else if (error.data.stack) {
|
|
638
|
-
restoredError.stack = error.data.stack;
|
|
639
|
-
}
|
|
640
|
-
if (error.data.codeFrame) {
|
|
641
|
-
// @ts-ignore
|
|
642
|
-
restoredError.codeFrame = error.data.codeFrame;
|
|
643
|
-
}
|
|
644
|
-
if (error.data.code) {
|
|
645
|
-
// @ts-ignore
|
|
646
|
-
restoredError.code = error.data.code;
|
|
647
|
-
}
|
|
648
|
-
if (error.data.type) {
|
|
649
|
-
// @ts-ignore
|
|
650
|
-
restoredError.name = error.data.type;
|
|
651
|
-
}
|
|
652
|
-
} else {
|
|
653
|
-
if (error.stack) {
|
|
654
|
-
const lowerStack = restoredError.stack || '';
|
|
655
|
-
// @ts-ignore
|
|
656
|
-
const indexNewLine = getNewLineIndex(lowerStack);
|
|
657
|
-
const parentStack = getParentStack(error);
|
|
658
|
-
// @ts-ignore
|
|
659
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
660
|
-
}
|
|
661
|
-
if (error.codeFrame) {
|
|
662
|
-
// @ts-ignore
|
|
663
|
-
restoredError.codeFrame = error.codeFrame;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
return restoredError;
|
|
696
|
+
return restoreMessageError(error);
|
|
667
697
|
}
|
|
668
698
|
if (typeof error === 'string') {
|
|
669
699
|
return new Error(`JsonRpc Error: ${error}`);
|
|
@@ -747,7 +777,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
747
777
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
748
778
|
return create$1$1(id, errorProperty);
|
|
749
779
|
};
|
|
750
|
-
const create$
|
|
780
|
+
const create$a = (message, result) => {
|
|
751
781
|
return {
|
|
752
782
|
id: message.id,
|
|
753
783
|
jsonrpc: Two$1,
|
|
@@ -756,7 +786,7 @@ const create$9 = (message, result) => {
|
|
|
756
786
|
};
|
|
757
787
|
const getSuccessResponse = (message, result) => {
|
|
758
788
|
const resultProperty = result ?? null;
|
|
759
|
-
return create$
|
|
789
|
+
return create$a(message, resultProperty);
|
|
760
790
|
};
|
|
761
791
|
const getErrorResponseSimple = (id, error) => {
|
|
762
792
|
return {
|
|
@@ -850,7 +880,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
850
880
|
|
|
851
881
|
const Two = '2.0';
|
|
852
882
|
|
|
853
|
-
const create$
|
|
883
|
+
const create$9 = (method, params) => {
|
|
854
884
|
return {
|
|
855
885
|
jsonrpc: Two,
|
|
856
886
|
method,
|
|
@@ -858,7 +888,7 @@ const create$8 = (method, params) => {
|
|
|
858
888
|
};
|
|
859
889
|
};
|
|
860
890
|
|
|
861
|
-
const create$
|
|
891
|
+
const create$8 = (id, method, params) => {
|
|
862
892
|
const message = {
|
|
863
893
|
id,
|
|
864
894
|
jsonrpc: Two,
|
|
@@ -869,12 +899,12 @@ const create$7 = (id, method, params) => {
|
|
|
869
899
|
};
|
|
870
900
|
|
|
871
901
|
let id$1 = 0;
|
|
872
|
-
const create$
|
|
902
|
+
const create$7 = () => {
|
|
873
903
|
return ++id$1;
|
|
874
904
|
};
|
|
875
905
|
|
|
876
906
|
const registerPromise = map => {
|
|
877
|
-
const id = create$
|
|
907
|
+
const id = create$7();
|
|
878
908
|
const {
|
|
879
909
|
promise,
|
|
880
910
|
resolve
|
|
@@ -891,7 +921,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
891
921
|
id,
|
|
892
922
|
promise
|
|
893
923
|
} = registerPromise(callbacks);
|
|
894
|
-
const message = create$
|
|
924
|
+
const message = create$8(id, method, params);
|
|
895
925
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
896
926
|
ipc.sendAndTransfer(message);
|
|
897
927
|
} else {
|
|
@@ -927,7 +957,7 @@ const createRpc = ipc => {
|
|
|
927
957
|
* @deprecated
|
|
928
958
|
*/
|
|
929
959
|
send(method, ...params) {
|
|
930
|
-
const message = create$
|
|
960
|
+
const message = create$9(method, params);
|
|
931
961
|
ipc.send(message);
|
|
932
962
|
}
|
|
933
963
|
};
|
|
@@ -967,7 +997,7 @@ const listen$1 = async (module, options) => {
|
|
|
967
997
|
return ipc;
|
|
968
998
|
};
|
|
969
999
|
|
|
970
|
-
const create$
|
|
1000
|
+
const create$6 = async ({
|
|
971
1001
|
commandMap,
|
|
972
1002
|
isMessagePortOpen = true,
|
|
973
1003
|
messagePort
|
|
@@ -985,7 +1015,7 @@ const create$5 = async ({
|
|
|
985
1015
|
return rpc;
|
|
986
1016
|
};
|
|
987
1017
|
|
|
988
|
-
const create$
|
|
1018
|
+
const create$5 = async ({
|
|
989
1019
|
commandMap,
|
|
990
1020
|
isMessagePortOpen,
|
|
991
1021
|
send
|
|
@@ -995,14 +1025,14 @@ const create$4 = async ({
|
|
|
995
1025
|
port2
|
|
996
1026
|
} = new MessageChannel();
|
|
997
1027
|
await send(port1);
|
|
998
|
-
return create$
|
|
1028
|
+
return create$6({
|
|
999
1029
|
commandMap,
|
|
1000
1030
|
isMessagePortOpen,
|
|
1001
1031
|
messagePort: port2
|
|
1002
1032
|
});
|
|
1003
1033
|
};
|
|
1004
1034
|
|
|
1005
|
-
const create$
|
|
1035
|
+
const create$4 = async ({
|
|
1006
1036
|
commandMap
|
|
1007
1037
|
}) => {
|
|
1008
1038
|
// TODO create a commandMap per rpc instance
|
|
@@ -1045,7 +1075,7 @@ const remove = id => {
|
|
|
1045
1075
|
};
|
|
1046
1076
|
|
|
1047
1077
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1048
|
-
const create$
|
|
1078
|
+
const create$3 = rpcId => {
|
|
1049
1079
|
return {
|
|
1050
1080
|
async dispose() {
|
|
1051
1081
|
const rpc = get$1(rpcId);
|
|
@@ -1083,14 +1113,175 @@ const create$2 = rpcId => {
|
|
|
1083
1113
|
|
|
1084
1114
|
const None$3 = 'none';
|
|
1085
1115
|
|
|
1116
|
+
const Audio = 0;
|
|
1086
1117
|
const Button$2 = 1;
|
|
1118
|
+
const Col = 2;
|
|
1119
|
+
const ColGroup = 3;
|
|
1087
1120
|
const Div = 4;
|
|
1121
|
+
const H1 = 5;
|
|
1088
1122
|
const Input$1 = 6;
|
|
1123
|
+
const Kbd = 7;
|
|
1089
1124
|
const Span = 8;
|
|
1125
|
+
const Table = 9;
|
|
1126
|
+
const TBody = 10;
|
|
1127
|
+
const Td = 11;
|
|
1090
1128
|
const Text = 12;
|
|
1129
|
+
const Th = 13;
|
|
1130
|
+
const THead = 14;
|
|
1131
|
+
const Tr = 15;
|
|
1132
|
+
const I = 16;
|
|
1091
1133
|
const Img = 17;
|
|
1134
|
+
const Root = 0;
|
|
1135
|
+
const Ins = 20;
|
|
1136
|
+
const Del = 21;
|
|
1137
|
+
const H2 = 22;
|
|
1138
|
+
const H3 = 23;
|
|
1139
|
+
const H4 = 24;
|
|
1140
|
+
const H5 = 25;
|
|
1141
|
+
const H6 = 26;
|
|
1142
|
+
const Article = 27;
|
|
1143
|
+
const Aside = 28;
|
|
1144
|
+
const Footer = 29;
|
|
1145
|
+
const Header = 30;
|
|
1146
|
+
const Nav = 40;
|
|
1147
|
+
const Section = 41;
|
|
1148
|
+
const Search = 42;
|
|
1149
|
+
const Dd = 43;
|
|
1150
|
+
const Dl = 44;
|
|
1151
|
+
const Figcaption = 45;
|
|
1152
|
+
const Figure = 46;
|
|
1153
|
+
const Hr = 47;
|
|
1154
|
+
const Li = 48;
|
|
1155
|
+
const Ol = 49;
|
|
1156
|
+
const P = 50;
|
|
1157
|
+
const Pre = 51;
|
|
1158
|
+
const A = 53;
|
|
1159
|
+
const Abbr = 54;
|
|
1160
|
+
const Br = 55;
|
|
1161
|
+
const Cite = 56;
|
|
1162
|
+
const Data = 57;
|
|
1163
|
+
const Time = 58;
|
|
1164
|
+
const Tfoot = 59;
|
|
1165
|
+
const Ul = 60;
|
|
1166
|
+
const Video = 61;
|
|
1167
|
+
const TextArea = 62;
|
|
1168
|
+
const Select = 63;
|
|
1169
|
+
const Option$1 = 64;
|
|
1170
|
+
const Code = 65;
|
|
1171
|
+
const Label = 66;
|
|
1172
|
+
const Dt = 67;
|
|
1173
|
+
const Iframe = 68;
|
|
1174
|
+
const Main = 69;
|
|
1175
|
+
const Strong = 70;
|
|
1176
|
+
const Em = 71;
|
|
1177
|
+
const Style = 72;
|
|
1178
|
+
const Html = 73;
|
|
1179
|
+
const Head = 74;
|
|
1180
|
+
const Title = 75;
|
|
1181
|
+
const Meta = 76;
|
|
1182
|
+
const Canvas = 77;
|
|
1183
|
+
const Form = 78;
|
|
1184
|
+
const BlockQuote = 79;
|
|
1185
|
+
const Quote = 80;
|
|
1186
|
+
const Circle = 81;
|
|
1187
|
+
const Defs = 82;
|
|
1188
|
+
const Ellipse = 83;
|
|
1189
|
+
const G = 84;
|
|
1190
|
+
const Line = 85;
|
|
1191
|
+
const Path = 86;
|
|
1192
|
+
const Polygon = 87;
|
|
1193
|
+
const Polyline = 88;
|
|
1194
|
+
const Rect = 89;
|
|
1195
|
+
const Svg = 90;
|
|
1196
|
+
const Use = 91;
|
|
1092
1197
|
const Reference = 100;
|
|
1093
1198
|
|
|
1199
|
+
const VirtualDomElements = {
|
|
1200
|
+
__proto__: null,
|
|
1201
|
+
A,
|
|
1202
|
+
Abbr,
|
|
1203
|
+
Article,
|
|
1204
|
+
Aside,
|
|
1205
|
+
Audio,
|
|
1206
|
+
BlockQuote,
|
|
1207
|
+
Br,
|
|
1208
|
+
Button: Button$2,
|
|
1209
|
+
Canvas,
|
|
1210
|
+
Circle,
|
|
1211
|
+
Cite,
|
|
1212
|
+
Code,
|
|
1213
|
+
Col,
|
|
1214
|
+
ColGroup,
|
|
1215
|
+
Data,
|
|
1216
|
+
Dd,
|
|
1217
|
+
Defs,
|
|
1218
|
+
Del,
|
|
1219
|
+
Div,
|
|
1220
|
+
Dl,
|
|
1221
|
+
Dt,
|
|
1222
|
+
Ellipse,
|
|
1223
|
+
Em,
|
|
1224
|
+
Figcaption,
|
|
1225
|
+
Figure,
|
|
1226
|
+
Footer,
|
|
1227
|
+
Form,
|
|
1228
|
+
G,
|
|
1229
|
+
H1,
|
|
1230
|
+
H2,
|
|
1231
|
+
H3,
|
|
1232
|
+
H4,
|
|
1233
|
+
H5,
|
|
1234
|
+
H6,
|
|
1235
|
+
Head,
|
|
1236
|
+
Header,
|
|
1237
|
+
Hr,
|
|
1238
|
+
Html,
|
|
1239
|
+
I,
|
|
1240
|
+
Iframe,
|
|
1241
|
+
Img,
|
|
1242
|
+
Input: Input$1,
|
|
1243
|
+
Ins,
|
|
1244
|
+
Kbd,
|
|
1245
|
+
Label,
|
|
1246
|
+
Li,
|
|
1247
|
+
Line,
|
|
1248
|
+
Main,
|
|
1249
|
+
Meta,
|
|
1250
|
+
Nav,
|
|
1251
|
+
Ol,
|
|
1252
|
+
Option: Option$1,
|
|
1253
|
+
P,
|
|
1254
|
+
Path,
|
|
1255
|
+
Polygon,
|
|
1256
|
+
Polyline,
|
|
1257
|
+
Pre,
|
|
1258
|
+
Quote,
|
|
1259
|
+
Rect,
|
|
1260
|
+
Reference,
|
|
1261
|
+
Root,
|
|
1262
|
+
Search,
|
|
1263
|
+
Section,
|
|
1264
|
+
Select,
|
|
1265
|
+
Span,
|
|
1266
|
+
Strong,
|
|
1267
|
+
Style,
|
|
1268
|
+
Svg,
|
|
1269
|
+
TBody,
|
|
1270
|
+
THead,
|
|
1271
|
+
Table,
|
|
1272
|
+
Td,
|
|
1273
|
+
Text,
|
|
1274
|
+
TextArea,
|
|
1275
|
+
Tfoot,
|
|
1276
|
+
Th,
|
|
1277
|
+
Time,
|
|
1278
|
+
Title,
|
|
1279
|
+
Tr,
|
|
1280
|
+
Ul,
|
|
1281
|
+
Use,
|
|
1282
|
+
Video
|
|
1283
|
+
};
|
|
1284
|
+
|
|
1094
1285
|
const Button$1 = 'event.button';
|
|
1095
1286
|
const ClientX = 'event.clientX';
|
|
1096
1287
|
const ClientY = 'event.clientY';
|
|
@@ -1119,7 +1310,7 @@ const SetPatches = 'Viewlet.setPatches';
|
|
|
1119
1310
|
const {
|
|
1120
1311
|
invoke: invoke$2,
|
|
1121
1312
|
set: set$4
|
|
1122
|
-
} = create$
|
|
1313
|
+
} = create$3(ExtensionHostWorker);
|
|
1123
1314
|
|
|
1124
1315
|
const ExtensionHost = {
|
|
1125
1316
|
__proto__: null,
|
|
@@ -1129,13 +1320,13 @@ const ExtensionHost = {
|
|
|
1129
1320
|
|
|
1130
1321
|
const {
|
|
1131
1322
|
set: set$3
|
|
1132
|
-
} = create$
|
|
1323
|
+
} = create$3(ExtensionManagementWorker);
|
|
1133
1324
|
|
|
1134
1325
|
const {
|
|
1135
1326
|
invoke: invoke$1,
|
|
1136
1327
|
invokeAndTransfer,
|
|
1137
1328
|
set: set$2
|
|
1138
|
-
} = create$
|
|
1329
|
+
} = create$3(RendererWorker);
|
|
1139
1330
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1140
1331
|
number(uid);
|
|
1141
1332
|
number(menuId);
|
|
@@ -1167,6 +1358,9 @@ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
|
1167
1358
|
const openUri$1 = async (uri, focus, options) => {
|
|
1168
1359
|
await invoke$1('Main.openUri', uri, focus, options);
|
|
1169
1360
|
};
|
|
1361
|
+
const showErrorDialog = async errorInfo => {
|
|
1362
|
+
await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
|
|
1363
|
+
};
|
|
1170
1364
|
const uninstallExtension = async id => {
|
|
1171
1365
|
return invoke$1('ExtensionManagement.uninstall', id);
|
|
1172
1366
|
};
|
|
@@ -1178,11 +1372,68 @@ const toCommandId = key => {
|
|
|
1178
1372
|
const dotIndex = key.indexOf('.');
|
|
1179
1373
|
return key.slice(dotIndex + 1);
|
|
1180
1374
|
};
|
|
1181
|
-
const create$
|
|
1375
|
+
const create$2 = () => {
|
|
1376
|
+
const commandQueues = new Map();
|
|
1377
|
+
const generations = Object.create(null);
|
|
1182
1378
|
const states = Object.create(null);
|
|
1183
1379
|
const commandMapRef = {};
|
|
1380
|
+
const getGeneration = uid => generations[uid] || 0;
|
|
1381
|
+
const isCurrentGeneration = (uid, generation) => {
|
|
1382
|
+
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
1383
|
+
};
|
|
1384
|
+
const updateState = (uid, generation, fallbackState, updater) => {
|
|
1385
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1386
|
+
return Promise.resolve(fallbackState);
|
|
1387
|
+
}
|
|
1388
|
+
const current = states[uid];
|
|
1389
|
+
const updatedState = updater(current.newState);
|
|
1390
|
+
if (updatedState !== current.newState) {
|
|
1391
|
+
states[uid] = {
|
|
1392
|
+
newState: updatedState,
|
|
1393
|
+
oldState: current.oldState,
|
|
1394
|
+
scheduledState: updatedState
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
return Promise.resolve(updatedState);
|
|
1398
|
+
};
|
|
1399
|
+
const createAsyncCommandContext = (uid, generation) => {
|
|
1400
|
+
let latestState = states[uid].newState;
|
|
1401
|
+
return {
|
|
1402
|
+
getState: () => {
|
|
1403
|
+
if (isCurrentGeneration(uid, generation)) {
|
|
1404
|
+
latestState = states[uid].newState;
|
|
1405
|
+
}
|
|
1406
|
+
return latestState;
|
|
1407
|
+
},
|
|
1408
|
+
updateState: async updater => {
|
|
1409
|
+
latestState = await updateState(uid, generation, latestState, updater);
|
|
1410
|
+
return latestState;
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
};
|
|
1414
|
+
const enqueueCommand = async (uid, command) => {
|
|
1415
|
+
const previous = commandQueues.get(uid) || Promise.resolve();
|
|
1416
|
+
const run = async () => {
|
|
1417
|
+
try {
|
|
1418
|
+
await previous;
|
|
1419
|
+
} catch {
|
|
1420
|
+
// The previous caller receives its error; later commands must still run.
|
|
1421
|
+
}
|
|
1422
|
+
await command();
|
|
1423
|
+
};
|
|
1424
|
+
const current = run();
|
|
1425
|
+
commandQueues.set(uid, current);
|
|
1426
|
+
try {
|
|
1427
|
+
await current;
|
|
1428
|
+
} finally {
|
|
1429
|
+
if (commandQueues.get(uid) === current) {
|
|
1430
|
+
commandQueues.delete(uid);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1184
1434
|
return {
|
|
1185
1435
|
clear() {
|
|
1436
|
+
commandQueues.clear();
|
|
1186
1437
|
for (const key of Object.keys(states)) {
|
|
1187
1438
|
delete states[key];
|
|
1188
1439
|
}
|
|
@@ -1202,6 +1453,7 @@ const create$1 = () => {
|
|
|
1202
1453
|
return diffResult;
|
|
1203
1454
|
},
|
|
1204
1455
|
dispose(uid) {
|
|
1456
|
+
commandQueues.delete(uid);
|
|
1205
1457
|
delete states[uid];
|
|
1206
1458
|
},
|
|
1207
1459
|
get(uid) {
|
|
@@ -1219,14 +1471,27 @@ const create$1 = () => {
|
|
|
1219
1471
|
Object.assign(commandMapRef, commandMap);
|
|
1220
1472
|
},
|
|
1221
1473
|
set(uid, oldState, newState, scheduledState) {
|
|
1474
|
+
const current = states[uid];
|
|
1475
|
+
if (!current || oldState === newState && newState !== current.newState) {
|
|
1476
|
+
generations[uid] = getGeneration(uid) + 1;
|
|
1477
|
+
}
|
|
1222
1478
|
states[uid] = {
|
|
1223
1479
|
newState,
|
|
1224
1480
|
oldState,
|
|
1225
1481
|
scheduledState: scheduledState ?? newState
|
|
1226
1482
|
};
|
|
1227
1483
|
},
|
|
1484
|
+
wrapAsyncCommand(fn) {
|
|
1485
|
+
const wrapped = async (uid, ...args) => {
|
|
1486
|
+
const generation = getGeneration(uid);
|
|
1487
|
+
const context = createAsyncCommandContext(uid, generation);
|
|
1488
|
+
await fn(context, ...args);
|
|
1489
|
+
};
|
|
1490
|
+
return wrapped;
|
|
1491
|
+
},
|
|
1228
1492
|
wrapCommand(fn) {
|
|
1229
1493
|
const wrapped = async (uid, ...args) => {
|
|
1494
|
+
const generation = getGeneration(uid);
|
|
1230
1495
|
const {
|
|
1231
1496
|
newState,
|
|
1232
1497
|
oldState
|
|
@@ -1235,6 +1500,9 @@ const create$1 = () => {
|
|
|
1235
1500
|
if (oldState === newerState || newState === newerState) {
|
|
1236
1501
|
return;
|
|
1237
1502
|
}
|
|
1503
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1238
1506
|
const latestOld = states[uid];
|
|
1239
1507
|
const latestNew = {
|
|
1240
1508
|
...latestOld.newState,
|
|
@@ -1259,6 +1527,7 @@ const create$1 = () => {
|
|
|
1259
1527
|
},
|
|
1260
1528
|
wrapLoadContent(fn) {
|
|
1261
1529
|
const wrapped = async (uid, ...args) => {
|
|
1530
|
+
const generation = getGeneration(uid);
|
|
1262
1531
|
const {
|
|
1263
1532
|
newState,
|
|
1264
1533
|
oldState
|
|
@@ -1273,6 +1542,11 @@ const create$1 = () => {
|
|
|
1273
1542
|
error
|
|
1274
1543
|
};
|
|
1275
1544
|
}
|
|
1545
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1546
|
+
return {
|
|
1547
|
+
error
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1276
1550
|
const latestOld = states[uid];
|
|
1277
1551
|
const latestNew = {
|
|
1278
1552
|
...latestOld.newState,
|
|
@@ -1288,6 +1562,51 @@ const create$1 = () => {
|
|
|
1288
1562
|
};
|
|
1289
1563
|
};
|
|
1290
1564
|
return wrapped;
|
|
1565
|
+
},
|
|
1566
|
+
wrapSerialAsyncCommand(fn) {
|
|
1567
|
+
const wrapped = async (uid, ...args) => {
|
|
1568
|
+
await enqueueCommand(uid, async () => {
|
|
1569
|
+
if (!states[uid]) {
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
const generation = getGeneration(uid);
|
|
1573
|
+
const context = createAsyncCommandContext(uid, generation);
|
|
1574
|
+
await fn(context, ...args);
|
|
1575
|
+
});
|
|
1576
|
+
};
|
|
1577
|
+
return wrapped;
|
|
1578
|
+
},
|
|
1579
|
+
wrapSerialCommand(fn) {
|
|
1580
|
+
const wrapped = async (uid, ...args) => {
|
|
1581
|
+
await enqueueCommand(uid, async () => {
|
|
1582
|
+
if (!states[uid]) {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
const generation = getGeneration(uid);
|
|
1586
|
+
const {
|
|
1587
|
+
newState,
|
|
1588
|
+
oldState
|
|
1589
|
+
} = states[uid];
|
|
1590
|
+
const newerState = await fn(newState, ...args);
|
|
1591
|
+
if (oldState === newerState || newState === newerState) {
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
const latestOld = states[uid];
|
|
1598
|
+
const latestNew = {
|
|
1599
|
+
...latestOld.newState,
|
|
1600
|
+
...newerState
|
|
1601
|
+
};
|
|
1602
|
+
states[uid] = {
|
|
1603
|
+
newState: latestNew,
|
|
1604
|
+
oldState: latestOld.oldState,
|
|
1605
|
+
scheduledState: latestNew
|
|
1606
|
+
};
|
|
1607
|
+
});
|
|
1608
|
+
};
|
|
1609
|
+
return wrapped;
|
|
1291
1610
|
}
|
|
1292
1611
|
};
|
|
1293
1612
|
};
|
|
@@ -1327,16 +1646,56 @@ const handleError = async (error, notify = true, prefix = '') => {
|
|
|
1327
1646
|
console.error(error);
|
|
1328
1647
|
};
|
|
1329
1648
|
|
|
1649
|
+
const loadStates = new Map();
|
|
1650
|
+
const tokenGenerator = {
|
|
1651
|
+
value: 0
|
|
1652
|
+
};
|
|
1653
|
+
const cancel = uid => {
|
|
1654
|
+
const loadState = loadStates.get(uid);
|
|
1655
|
+
if (!loadState) {
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
loadStates.delete(uid);
|
|
1659
|
+
loadState.resolve();
|
|
1660
|
+
};
|
|
1661
|
+
const create$1 = uid => {
|
|
1662
|
+
cancel(uid);
|
|
1663
|
+
const {
|
|
1664
|
+
promise,
|
|
1665
|
+
resolve
|
|
1666
|
+
} = Promise.withResolvers();
|
|
1667
|
+
const token = ++tokenGenerator.value;
|
|
1668
|
+
loadStates.set(uid, {
|
|
1669
|
+
promise,
|
|
1670
|
+
resolve,
|
|
1671
|
+
token
|
|
1672
|
+
});
|
|
1673
|
+
};
|
|
1674
|
+
const finish = (uid, token) => {
|
|
1675
|
+
const loadState = loadStates.get(uid);
|
|
1676
|
+
if (!loadState || loadState.token !== token) {
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
loadStates.delete(uid);
|
|
1680
|
+
loadState.resolve();
|
|
1681
|
+
};
|
|
1682
|
+
const getToken = uid => {
|
|
1683
|
+
return loadStates.get(uid)?.token;
|
|
1684
|
+
};
|
|
1685
|
+
const wait = uid => {
|
|
1686
|
+
return loadStates.get(uid)?.promise || Promise.resolve();
|
|
1687
|
+
};
|
|
1688
|
+
|
|
1330
1689
|
const emptyObject = {};
|
|
1331
|
-
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1332
1690
|
const i18nString = (key, placeholders = emptyObject) => {
|
|
1333
1691
|
if (placeholders === emptyObject) {
|
|
1334
1692
|
return key;
|
|
1335
1693
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1694
|
+
let result = key;
|
|
1695
|
+
for (const [placeholder, replacement] of Object.entries(placeholders)) {
|
|
1696
|
+
result = result.split(`{${placeholder}}`).join(String(replacement));
|
|
1697
|
+
}
|
|
1698
|
+
return result;
|
|
1340
1699
|
};
|
|
1341
1700
|
|
|
1342
1701
|
const NoExtensionsFound = 'No extensions found.';
|
|
@@ -1362,11 +1721,13 @@ const CopyExtensionId = 'Copy Extension Id';
|
|
|
1362
1721
|
const Name = 'Name';
|
|
1363
1722
|
const Id$1 = 'Id';
|
|
1364
1723
|
const Description = 'Description';
|
|
1724
|
+
const Downloads = 'Downloads';
|
|
1365
1725
|
const Version = 'Version';
|
|
1366
1726
|
const Publisher = 'Publisher';
|
|
1727
|
+
const Rating = 'Rating';
|
|
1367
1728
|
const MarketplaceLink = 'Marketplace Link';
|
|
1368
1729
|
const Category$1 = 'Category';
|
|
1369
|
-
const Disabled$
|
|
1730
|
+
const Disabled$3 = 'Disabled';
|
|
1370
1731
|
const Featured$1 = 'Featured';
|
|
1371
1732
|
const McpServers$1 = 'MCP Servers';
|
|
1372
1733
|
const MostPopular$1 = 'Most Popular';
|
|
@@ -1394,9 +1755,15 @@ const version = () => {
|
|
|
1394
1755
|
const description = () => {
|
|
1395
1756
|
return i18nString(Description);
|
|
1396
1757
|
};
|
|
1758
|
+
const downloads = () => {
|
|
1759
|
+
return i18nString(Downloads);
|
|
1760
|
+
};
|
|
1397
1761
|
const publisher = () => {
|
|
1398
1762
|
return i18nString(Publisher);
|
|
1399
1763
|
};
|
|
1764
|
+
const rating = () => {
|
|
1765
|
+
return i18nString(Rating);
|
|
1766
|
+
};
|
|
1400
1767
|
const marketplaceLink = () => {
|
|
1401
1768
|
return i18nString(MarketplaceLink);
|
|
1402
1769
|
};
|
|
@@ -1461,7 +1828,7 @@ const category = () => {
|
|
|
1461
1828
|
return i18nString(Category$1);
|
|
1462
1829
|
};
|
|
1463
1830
|
const disabled = () => {
|
|
1464
|
-
return i18nString(Disabled$
|
|
1831
|
+
return i18nString(Disabled$3);
|
|
1465
1832
|
};
|
|
1466
1833
|
const featured = () => {
|
|
1467
1834
|
return i18nString(Featured$1);
|
|
@@ -1585,7 +1952,7 @@ const getScrollBarY$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
|
1585
1952
|
|
|
1586
1953
|
const Installed = '@installed';
|
|
1587
1954
|
const Enabled$1 = '@enabled';
|
|
1588
|
-
const Disabled$
|
|
1955
|
+
const Disabled$2 = '@disabled';
|
|
1589
1956
|
const Builtin = '@builtin';
|
|
1590
1957
|
const Sort = '@sort';
|
|
1591
1958
|
const Id = '@id';
|
|
@@ -1593,13 +1960,13 @@ const Category = '@category';
|
|
|
1593
1960
|
const Outdated = '@outdated';
|
|
1594
1961
|
const Featured = '@featured';
|
|
1595
1962
|
const McpServers = '@mcpservers';
|
|
1596
|
-
const MostPopular = '@
|
|
1963
|
+
const MostPopular = '@most-popular';
|
|
1597
1964
|
const RecentlyPublished = '@recentlypublished';
|
|
1598
1965
|
const Recommended = '@recommended';
|
|
1599
1966
|
const WorkspaceUnsupported = '@workspaceunsupported';
|
|
1600
1967
|
const Deprecated = '@deprecated';
|
|
1601
1968
|
|
|
1602
|
-
const RE_PARAM =
|
|
1969
|
+
const RE_PARAM = /@[\w-]+(?::\w+)?/g;
|
|
1603
1970
|
const deserializeCategory = value => {
|
|
1604
1971
|
if (value.startsWith(':"') && value.endsWith('"')) {
|
|
1605
1972
|
return value.slice(2, -1);
|
|
@@ -1631,7 +1998,7 @@ const parseValue = value => {
|
|
|
1631
1998
|
if (match.startsWith(Enabled$1)) {
|
|
1632
1999
|
enabled = true;
|
|
1633
2000
|
}
|
|
1634
|
-
if (match.startsWith(Disabled$
|
|
2001
|
+
if (match.startsWith(Disabled$2)) {
|
|
1635
2002
|
disabled = true;
|
|
1636
2003
|
}
|
|
1637
2004
|
if (match.startsWith(Builtin)) {
|
|
@@ -1755,6 +2122,103 @@ const searchExtensions = async (extensions, value, platform, assetDir) => {
|
|
|
1755
2122
|
}
|
|
1756
2123
|
};
|
|
1757
2124
|
|
|
2125
|
+
const requestVersions = new Map();
|
|
2126
|
+
const requestVersionGenerator = {
|
|
2127
|
+
value: 0
|
|
2128
|
+
};
|
|
2129
|
+
const getSearchResult = async state => {
|
|
2130
|
+
const {
|
|
2131
|
+
allExtensions,
|
|
2132
|
+
headerHeight,
|
|
2133
|
+
height,
|
|
2134
|
+
itemHeight,
|
|
2135
|
+
minimumSliderSize,
|
|
2136
|
+
searchValue
|
|
2137
|
+
} = state;
|
|
2138
|
+
const value = searchValue.trim();
|
|
2139
|
+
const inputActions = getInputActions(value.length > 0);
|
|
2140
|
+
const items = await searchExtensions(allExtensions, value);
|
|
2141
|
+
if (items.length === 0) {
|
|
2142
|
+
return {
|
|
2143
|
+
deltaY: 0,
|
|
2144
|
+
finalDeltaY: 0,
|
|
2145
|
+
focus: Input,
|
|
2146
|
+
inputActions,
|
|
2147
|
+
items,
|
|
2148
|
+
maxLineY: 0,
|
|
2149
|
+
message: noExtensionsFound(),
|
|
2150
|
+
minLineY: 0,
|
|
2151
|
+
placeholder: searchExtensionsInMarketPlace(),
|
|
2152
|
+
scrollBarHeight: 0
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const total = items.length;
|
|
2156
|
+
const listHeight = getListHeight(total, itemHeight, height - headerHeight);
|
|
2157
|
+
const scrollBarHeight = getScrollBarSize(listHeight, total * itemHeight, minimumSliderSize);
|
|
2158
|
+
const maxLineY = Math.min(getNumberOfVisibleItems$1(listHeight, itemHeight), total);
|
|
2159
|
+
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
2160
|
+
const scrollBarY = getScrollBarY$1(0, finalDeltaY, listHeight, scrollBarHeight);
|
|
2161
|
+
return {
|
|
2162
|
+
deltaY: 0,
|
|
2163
|
+
finalDeltaY,
|
|
2164
|
+
focus: state.focus,
|
|
2165
|
+
inputActions,
|
|
2166
|
+
items,
|
|
2167
|
+
maxLineY,
|
|
2168
|
+
message: '',
|
|
2169
|
+
minLineY: 0,
|
|
2170
|
+
placeholder: searchExtensionsInMarketPlace(),
|
|
2171
|
+
scrollBarHeight,
|
|
2172
|
+
scrollBarY
|
|
2173
|
+
};
|
|
2174
|
+
};
|
|
2175
|
+
const handleChangeWithContext = async (context, update, waitForExtensions = true) => {
|
|
2176
|
+
const {
|
|
2177
|
+
uid
|
|
2178
|
+
} = context.getState();
|
|
2179
|
+
if (waitForExtensions) {
|
|
2180
|
+
await wait(uid);
|
|
2181
|
+
}
|
|
2182
|
+
const requestVersion = ++requestVersionGenerator.value;
|
|
2183
|
+
requestVersions.set(uid, requestVersion);
|
|
2184
|
+
const requestState = {
|
|
2185
|
+
...context.getState(),
|
|
2186
|
+
...update,
|
|
2187
|
+
initial: false
|
|
2188
|
+
};
|
|
2189
|
+
try {
|
|
2190
|
+
const result = await getSearchResult(requestState);
|
|
2191
|
+
await context.updateState(state => {
|
|
2192
|
+
if (requestVersions.get(state.uid) !== requestVersion) {
|
|
2193
|
+
return state;
|
|
2194
|
+
}
|
|
2195
|
+
return {
|
|
2196
|
+
...state,
|
|
2197
|
+
...update,
|
|
2198
|
+
initial: false,
|
|
2199
|
+
...result
|
|
2200
|
+
};
|
|
2201
|
+
});
|
|
2202
|
+
} catch (error) {
|
|
2203
|
+
await handleError(error);
|
|
2204
|
+
await context.updateState(state => {
|
|
2205
|
+
if (requestVersions.get(state.uid) !== requestVersion) {
|
|
2206
|
+
return state;
|
|
2207
|
+
}
|
|
2208
|
+
return {
|
|
2209
|
+
...state,
|
|
2210
|
+
...update,
|
|
2211
|
+
initial: false,
|
|
2212
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2213
|
+
};
|
|
2214
|
+
});
|
|
2215
|
+
} finally {
|
|
2216
|
+
if (requestVersions.get(uid) === requestVersion) {
|
|
2217
|
+
requestVersions.delete(uid);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2221
|
+
|
|
1758
2222
|
// TODO debounce
|
|
1759
2223
|
const handleChange = async (state, update) => {
|
|
1760
2224
|
const fullNewState = {
|
|
@@ -1762,71 +2226,11 @@ const handleChange = async (state, update) => {
|
|
|
1762
2226
|
...update
|
|
1763
2227
|
};
|
|
1764
2228
|
try {
|
|
1765
|
-
const
|
|
1766
|
-
inputSource,
|
|
1767
|
-
searchValue
|
|
1768
|
-
} = fullNewState;
|
|
1769
|
-
const value = searchValue.trim();
|
|
1770
|
-
const hasValue = value.length > 0;
|
|
1771
|
-
const inputActions = getInputActions(hasValue);
|
|
1772
|
-
const {
|
|
1773
|
-
allExtensions,
|
|
1774
|
-
assetDir,
|
|
1775
|
-
headerHeight,
|
|
1776
|
-
height,
|
|
1777
|
-
itemHeight,
|
|
1778
|
-
minimumSliderSize,
|
|
1779
|
-
platform
|
|
1780
|
-
} = state;
|
|
1781
|
-
// TODO cancel ongoing requests
|
|
1782
|
-
// TODO handle errors
|
|
1783
|
-
const items = await searchExtensions(allExtensions, value, platform, assetDir);
|
|
1784
|
-
if (items.length === 0) {
|
|
1785
|
-
return {
|
|
1786
|
-
...fullNewState,
|
|
1787
|
-
allExtensions,
|
|
1788
|
-
deltaY: 0,
|
|
1789
|
-
finalDeltaY: 0,
|
|
1790
|
-
focus: Input,
|
|
1791
|
-
inputActions,
|
|
1792
|
-
inputSource,
|
|
1793
|
-
items,
|
|
1794
|
-
maxLineY: 0,
|
|
1795
|
-
message: noExtensionsFound(),
|
|
1796
|
-
minLineY: 0,
|
|
1797
|
-
placeholder: searchExtensionsInMarketPlace(),
|
|
1798
|
-
scrollBarHeight: 0,
|
|
1799
|
-
searchValue
|
|
1800
|
-
};
|
|
1801
|
-
}
|
|
1802
|
-
const total = items.length;
|
|
1803
|
-
const availableHeight = height - headerHeight;
|
|
1804
|
-
const listHeight = getListHeight(total, itemHeight, availableHeight);
|
|
1805
|
-
const contentHeight = total * itemHeight;
|
|
1806
|
-
const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, minimumSliderSize);
|
|
1807
|
-
const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
1808
|
-
const maxLineY = Math.min(numberOfVisible, total);
|
|
1809
|
-
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
1810
|
-
const scrollBarY = getScrollBarY$1(0, finalDeltaY, listHeight, scrollBarHeight);
|
|
2229
|
+
const result = await getSearchResult(fullNewState);
|
|
1811
2230
|
return {
|
|
1812
2231
|
...fullNewState,
|
|
1813
|
-
|
|
1814
|
-
deltaY: 0,
|
|
1815
|
-
finalDeltaY,
|
|
1816
|
-
inputActions,
|
|
1817
|
-
inputSource,
|
|
1818
|
-
items,
|
|
1819
|
-
maxLineY,
|
|
1820
|
-
message: '',
|
|
1821
|
-
minLineY: 0,
|
|
1822
|
-
placeholder: searchExtensionsInMarketPlace(),
|
|
1823
|
-
scrollBarHeight,
|
|
1824
|
-
scrollBarY,
|
|
1825
|
-
searchValue
|
|
2232
|
+
...result
|
|
1826
2233
|
};
|
|
1827
|
-
|
|
1828
|
-
// TODO handle out of order responses (a bit complicated)
|
|
1829
|
-
// for now just assume everything comes back in order
|
|
1830
2234
|
} catch (error) {
|
|
1831
2235
|
// TODO send error to error worker
|
|
1832
2236
|
await handleError(error);
|
|
@@ -1840,6 +2244,27 @@ const handleChange = async (state, update) => {
|
|
|
1840
2244
|
const User = 1;
|
|
1841
2245
|
const Script = 2;
|
|
1842
2246
|
|
|
2247
|
+
const acceptCompletionWithContext = async (context, label) => {
|
|
2248
|
+
const state = context.getState();
|
|
2249
|
+
const completion = label || state.completionItems[state.completionFocusedIndex]?.label;
|
|
2250
|
+
if (!completion) {
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
const range = getCompletionRange(state.searchValue, state.cursorOffset);
|
|
2254
|
+
if (!range) {
|
|
2255
|
+
return;
|
|
2256
|
+
}
|
|
2257
|
+
const searchValue = `${state.searchValue.slice(0, range.start)}${completion}${state.searchValue.slice(range.end)}`;
|
|
2258
|
+
await handleChangeWithContext(context, {
|
|
2259
|
+
completionFocusedIndex: 0,
|
|
2260
|
+
completionItems: [],
|
|
2261
|
+
cursorOffset: range.start + completion.length,
|
|
2262
|
+
focus: Input,
|
|
2263
|
+
inputSource: Script,
|
|
2264
|
+
searchValue,
|
|
2265
|
+
suggestOpen: false
|
|
2266
|
+
});
|
|
2267
|
+
};
|
|
1843
2268
|
const acceptCompletion = async (state, label) => {
|
|
1844
2269
|
const completion = label || state.completionItems[state.completionFocusedIndex]?.label;
|
|
1845
2270
|
if (!completion) {
|
|
@@ -1861,9 +2286,8 @@ const acceptCompletion = async (state, label) => {
|
|
|
1861
2286
|
});
|
|
1862
2287
|
};
|
|
1863
2288
|
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1866
|
-
...state,
|
|
2289
|
+
const clearSearchResultsWithContext = async context => {
|
|
2290
|
+
await handleChangeWithContext(context, {
|
|
1867
2291
|
completionFocusedIndex: 0,
|
|
1868
2292
|
completionItems: [],
|
|
1869
2293
|
cursorOffset: 0,
|
|
@@ -1965,9 +2389,10 @@ const {
|
|
|
1965
2389
|
getCommandIds,
|
|
1966
2390
|
registerCommands,
|
|
1967
2391
|
set: set$1,
|
|
2392
|
+
wrapAsyncCommand,
|
|
1968
2393
|
wrapCommand,
|
|
1969
2394
|
wrapGetter
|
|
1970
|
-
} = create$
|
|
2395
|
+
} = create$2();
|
|
1971
2396
|
|
|
1972
2397
|
const create = (id, uri, x, y, width, height, platform, assetDir, parentUid) => {
|
|
1973
2398
|
const state = {
|
|
@@ -2009,6 +2434,7 @@ const create = (id, uri, x, y, width, height, platform, assetDir, parentUid) =>
|
|
|
2009
2434
|
x,
|
|
2010
2435
|
y
|
|
2011
2436
|
};
|
|
2437
|
+
create$1(id);
|
|
2012
2438
|
set$1(id, state, state);
|
|
2013
2439
|
};
|
|
2014
2440
|
|
|
@@ -2064,6 +2490,7 @@ const disableWorkspace = async (state, _id) => {
|
|
|
2064
2490
|
};
|
|
2065
2491
|
|
|
2066
2492
|
const dispose = uid => {
|
|
2493
|
+
cancel(uid);
|
|
2067
2494
|
dispose$1(uid);
|
|
2068
2495
|
};
|
|
2069
2496
|
|
|
@@ -2077,6 +2504,79 @@ const enableWorkspace = async (state, _id) => {
|
|
|
2077
2504
|
return state;
|
|
2078
2505
|
};
|
|
2079
2506
|
|
|
2507
|
+
const getFuzzyHighlights = (label, query) => {
|
|
2508
|
+
const lowerLabel = label.toLowerCase();
|
|
2509
|
+
const lowerQuery = query.toLowerCase();
|
|
2510
|
+
const matchedIndexes = [];
|
|
2511
|
+
let labelIndex = 0;
|
|
2512
|
+
for (const character of lowerQuery) {
|
|
2513
|
+
labelIndex = lowerLabel.indexOf(character, labelIndex);
|
|
2514
|
+
if (labelIndex === -1) {
|
|
2515
|
+
return undefined;
|
|
2516
|
+
}
|
|
2517
|
+
matchedIndexes.push(labelIndex);
|
|
2518
|
+
labelIndex++;
|
|
2519
|
+
}
|
|
2520
|
+
const highlights = [];
|
|
2521
|
+
for (const index of matchedIndexes) {
|
|
2522
|
+
const lastEnd = highlights.at(-1);
|
|
2523
|
+
if (lastEnd === index) {
|
|
2524
|
+
highlights[highlights.length - 1] = index + 1;
|
|
2525
|
+
} else {
|
|
2526
|
+
highlights.push(index, index + 1);
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
return highlights;
|
|
2530
|
+
};
|
|
2531
|
+
|
|
2532
|
+
const Suggestions = ['@builtin', '@category:', '@disabled', '@enabled', '@featured', '@id:', '@installed', '@mcpservers', '@most-popular', '@outdated', '@recentlypublished', '@recommended', '@sort:installs', '@workspaceunsupported'];
|
|
2533
|
+
|
|
2534
|
+
const getCompletionItems = (value, cursorOffset) => {
|
|
2535
|
+
const range = getCompletionRange(value, cursorOffset);
|
|
2536
|
+
if (!range) {
|
|
2537
|
+
return [];
|
|
2538
|
+
}
|
|
2539
|
+
const items = [];
|
|
2540
|
+
for (const label of Suggestions) {
|
|
2541
|
+
const highlights = getFuzzyHighlights(label, range.query);
|
|
2542
|
+
if (highlights) {
|
|
2543
|
+
items.push({
|
|
2544
|
+
highlights,
|
|
2545
|
+
label
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
return items;
|
|
2550
|
+
};
|
|
2551
|
+
|
|
2552
|
+
const handleInputWithContext = async (context, value, inputSource = User, cursorOffset = value.length) => {
|
|
2553
|
+
const completionItems = getCompletionItems(value, cursorOffset);
|
|
2554
|
+
await handleChangeWithContext(context, {
|
|
2555
|
+
completionFocusedIndex: 0,
|
|
2556
|
+
completionItems,
|
|
2557
|
+
cursorOffset,
|
|
2558
|
+
focus: Input,
|
|
2559
|
+
inputSource,
|
|
2560
|
+
searchValue: value,
|
|
2561
|
+
suggestOpen: inputSource === User && completionItems.length > 0
|
|
2562
|
+
});
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2565
|
+
const addFilter = (searchValue, filter) => {
|
|
2566
|
+
const values = searchValue.trim().split(/\s+/);
|
|
2567
|
+
if (values.includes(filter)) {
|
|
2568
|
+
return searchValue;
|
|
2569
|
+
}
|
|
2570
|
+
return `${searchValue.trim()} ${filter}`.trim();
|
|
2571
|
+
};
|
|
2572
|
+
const filterByMostPopularWithContext = async context => {
|
|
2573
|
+
const {
|
|
2574
|
+
searchValue
|
|
2575
|
+
} = context.getState();
|
|
2576
|
+
const value = addFilter(searchValue, MostPopular);
|
|
2577
|
+
await handleInputWithContext(context, value, Script);
|
|
2578
|
+
};
|
|
2579
|
+
|
|
2080
2580
|
// TODO optimize this function to return the minimum number
|
|
2081
2581
|
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2082
2582
|
// 20px fill 100px but when scrolled 6 items are needed
|
|
@@ -2091,31 +2591,31 @@ const getScrollBarY = getScrollBarOffset;
|
|
|
2091
2591
|
const focusIndexScrollDown = (state, index, listHeight, itemHeight, itemsLength) => {
|
|
2092
2592
|
const {
|
|
2093
2593
|
finalDeltaY,
|
|
2094
|
-
height,
|
|
2095
2594
|
headerHeight,
|
|
2595
|
+
height,
|
|
2096
2596
|
scrollBarHeight
|
|
2097
2597
|
} = state;
|
|
2098
|
-
const newMaxLineY = Math.min(index + 1, itemsLength);
|
|
2099
2598
|
const fittingItems = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
2100
|
-
const
|
|
2101
|
-
const
|
|
2599
|
+
const newDeltaY = Math.min(Math.max((index + 1) * itemHeight - listHeight, 0), finalDeltaY);
|
|
2600
|
+
const newMinLineY = Math.floor(newDeltaY / itemHeight);
|
|
2601
|
+
const newMaxLineY = Math.min(newMinLineY + fittingItems, itemsLength);
|
|
2102
2602
|
const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
2103
2603
|
return {
|
|
2104
2604
|
...state,
|
|
2605
|
+
deltaY: newDeltaY,
|
|
2606
|
+
focused: true,
|
|
2105
2607
|
focusedIndex: index,
|
|
2106
2608
|
listFocusedIndex: index,
|
|
2107
|
-
minLineY: newMinLineY,
|
|
2108
2609
|
maxLineY: newMaxLineY,
|
|
2109
|
-
|
|
2110
|
-
deltaY: newDeltaY,
|
|
2610
|
+
minLineY: newMinLineY,
|
|
2111
2611
|
scrollBarY
|
|
2112
2612
|
};
|
|
2113
2613
|
};
|
|
2114
2614
|
const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) => {
|
|
2115
2615
|
const {
|
|
2116
2616
|
finalDeltaY,
|
|
2117
|
-
height,
|
|
2118
2617
|
headerHeight,
|
|
2618
|
+
height,
|
|
2119
2619
|
scrollBarHeight
|
|
2120
2620
|
} = state;
|
|
2121
2621
|
const newMinLineY = index;
|
|
@@ -2125,23 +2625,23 @@ const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) =
|
|
|
2125
2625
|
const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
2126
2626
|
return {
|
|
2127
2627
|
...state,
|
|
2628
|
+
deltaY: newDeltaY,
|
|
2629
|
+
focused: true,
|
|
2128
2630
|
focusedIndex: index,
|
|
2129
2631
|
listFocusedIndex: index,
|
|
2130
|
-
minLineY: newMinLineY,
|
|
2131
2632
|
maxLineY: newMaxLineY,
|
|
2132
|
-
|
|
2133
|
-
deltaY: newDeltaY,
|
|
2633
|
+
minLineY: newMinLineY,
|
|
2134
2634
|
scrollBarY
|
|
2135
2635
|
};
|
|
2136
2636
|
};
|
|
2137
2637
|
const focusIndex = (state, index) => {
|
|
2138
2638
|
const {
|
|
2139
|
-
itemHeight,
|
|
2140
|
-
minLineY,
|
|
2141
|
-
maxLineY,
|
|
2142
2639
|
headerHeight,
|
|
2143
2640
|
height,
|
|
2144
|
-
|
|
2641
|
+
itemHeight,
|
|
2642
|
+
items,
|
|
2643
|
+
maxLineY,
|
|
2644
|
+
minLineY
|
|
2145
2645
|
} = state;
|
|
2146
2646
|
const itemsLength = items.length;
|
|
2147
2647
|
if (itemsLength === 0) {
|
|
@@ -2151,9 +2651,9 @@ const focusIndex = (state, index) => {
|
|
|
2151
2651
|
if (index === -1) {
|
|
2152
2652
|
return {
|
|
2153
2653
|
...state,
|
|
2654
|
+
focused: true,
|
|
2154
2655
|
focusedIndex: -1,
|
|
2155
|
-
listFocusedIndex: -1
|
|
2156
|
-
focused: true
|
|
2656
|
+
listFocusedIndex: -1
|
|
2157
2657
|
};
|
|
2158
2658
|
}
|
|
2159
2659
|
const listHeight = height - headerHeight;
|
|
@@ -2165,9 +2665,9 @@ const focusIndex = (state, index) => {
|
|
|
2165
2665
|
}
|
|
2166
2666
|
return {
|
|
2167
2667
|
...state,
|
|
2668
|
+
focused: true,
|
|
2168
2669
|
focusedIndex: index,
|
|
2169
|
-
listFocusedIndex: index
|
|
2170
|
-
focused: true
|
|
2670
|
+
listFocusedIndex: index
|
|
2171
2671
|
};
|
|
2172
2672
|
};
|
|
2173
2673
|
const first = () => {
|
|
@@ -2180,7 +2680,7 @@ const next = (items, index) => {
|
|
|
2180
2680
|
return (index + 1) % items.length;
|
|
2181
2681
|
};
|
|
2182
2682
|
const previous = (items, index) => {
|
|
2183
|
-
return index === 0 ? items.length
|
|
2683
|
+
return (index === 0 ? items.length : index) - 1;
|
|
2184
2684
|
};
|
|
2185
2685
|
const focusFirst = state => {
|
|
2186
2686
|
const firstIndex = first();
|
|
@@ -2237,8 +2737,8 @@ const focusPrevious = state => {
|
|
|
2237
2737
|
const focusPreviousPage = state => {
|
|
2238
2738
|
const {
|
|
2239
2739
|
focusedIndex,
|
|
2240
|
-
|
|
2241
|
-
|
|
2740
|
+
maxLineY,
|
|
2741
|
+
minLineY
|
|
2242
2742
|
} = state;
|
|
2243
2743
|
if (focusedIndex === 0 || focusedIndex === -1) {
|
|
2244
2744
|
return state;
|
|
@@ -2294,7 +2794,7 @@ const getKeyBindings = () => {
|
|
|
2294
2794
|
key: DownArrow,
|
|
2295
2795
|
when: FocusExtensionsInput
|
|
2296
2796
|
}, {
|
|
2297
|
-
command: 'Extensions.
|
|
2797
|
+
command: 'Extensions.openSuggest',
|
|
2298
2798
|
key: CtrlCmd | Space,
|
|
2299
2799
|
when: FocusExtensionsInput
|
|
2300
2800
|
}, {
|
|
@@ -2340,19 +2840,45 @@ const getKeyBindings = () => {
|
|
|
2340
2840
|
}];
|
|
2341
2841
|
};
|
|
2342
2842
|
|
|
2843
|
+
const Disabled$1 = 'disabled';
|
|
2844
|
+
const Enabled = 'enabled';
|
|
2845
|
+
const Installing = 'installing';
|
|
2846
|
+
const NotInstalled = 'not-installed';
|
|
2847
|
+
const Uninstalling = 'uninstalling';
|
|
2848
|
+
const statuses = [Disabled$1, Enabled, Installing, NotInstalled, Uninstalling];
|
|
2849
|
+
const isExtensionStatus = status => {
|
|
2850
|
+
return statuses.includes(status);
|
|
2851
|
+
};
|
|
2852
|
+
|
|
2343
2853
|
const Separator = 1;
|
|
2344
2854
|
const None$1 = 0;
|
|
2345
2855
|
const SubMenu = 4;
|
|
2856
|
+
const Disabled = 5;
|
|
2346
2857
|
|
|
2347
|
-
const
|
|
2858
|
+
const nonEnableableStatuses = [Installing, NotInstalled, Uninstalling];
|
|
2859
|
+
const getEnablementFlags = (disabled, status) => {
|
|
2860
|
+
if (status && nonEnableableStatuses.includes(status)) {
|
|
2861
|
+
return {
|
|
2862
|
+
disable: Disabled,
|
|
2863
|
+
enable: Disabled
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
const isDisabled = status === Disabled$1 || status === undefined && disabled;
|
|
2867
|
+
return {
|
|
2868
|
+
disable: isDisabled ? Disabled : None$1,
|
|
2869
|
+
enable: isDisabled ? None$1 : Disabled
|
|
2870
|
+
};
|
|
2871
|
+
};
|
|
2872
|
+
const getMenuEntriesList = (builtin, disabled = false, status) => {
|
|
2873
|
+
const enablementFlags = getEnablementFlags(disabled, status);
|
|
2348
2874
|
return [{
|
|
2349
2875
|
command: 'SearchExtensions.enable',
|
|
2350
|
-
flags:
|
|
2876
|
+
flags: enablementFlags.enable,
|
|
2351
2877
|
id: 'enable',
|
|
2352
2878
|
label: enable$2()
|
|
2353
2879
|
}, {
|
|
2354
2880
|
command: 'SearchExtensions.enableWorkspace',
|
|
2355
|
-
flags:
|
|
2881
|
+
flags: enablementFlags.enable,
|
|
2356
2882
|
id: 'enableWorkspace',
|
|
2357
2883
|
label: enableWorkspace$1()
|
|
2358
2884
|
}, {
|
|
@@ -2362,12 +2888,12 @@ const getMenuEntriesList = () => {
|
|
|
2362
2888
|
label: ''
|
|
2363
2889
|
}, {
|
|
2364
2890
|
command: 'SearchExtensions.disable',
|
|
2365
|
-
flags:
|
|
2891
|
+
flags: enablementFlags.disable,
|
|
2366
2892
|
id: 'disable',
|
|
2367
2893
|
label: disable$2()
|
|
2368
2894
|
}, {
|
|
2369
2895
|
command: 'SearchExtensions.disableWorkspace',
|
|
2370
|
-
flags:
|
|
2896
|
+
flags: enablementFlags.disable,
|
|
2371
2897
|
id: 'disableWorkspace',
|
|
2372
2898
|
label: disableWorkspace$1()
|
|
2373
2899
|
}, {
|
|
@@ -2377,7 +2903,7 @@ const getMenuEntriesList = () => {
|
|
|
2377
2903
|
label: ''
|
|
2378
2904
|
}, {
|
|
2379
2905
|
command: 'SearchExtensions.installAnotherVersion',
|
|
2380
|
-
flags: None$1,
|
|
2906
|
+
flags: builtin ? Disabled : None$1,
|
|
2381
2907
|
id: 'installAnotherVersion',
|
|
2382
2908
|
label: installAnotherVersion$1()
|
|
2383
2909
|
}, {
|
|
@@ -2405,7 +2931,7 @@ const getMenuEntriesFilter = () => {
|
|
|
2405
2931
|
id: 'filterByMcpServers',
|
|
2406
2932
|
label: mcpServers()
|
|
2407
2933
|
}, {
|
|
2408
|
-
command: '
|
|
2934
|
+
command: 'Extensions.filterByMostPopular',
|
|
2409
2935
|
flags: None$1,
|
|
2410
2936
|
id: 'filterByMostPopular',
|
|
2411
2937
|
label: mostPopular()
|
|
@@ -2480,7 +3006,7 @@ const getMenuEntries2 = (state, props) => {
|
|
|
2480
3006
|
case ExtensionSearchFilter:
|
|
2481
3007
|
return getMenuEntriesFilter();
|
|
2482
3008
|
default:
|
|
2483
|
-
return getMenuEntriesList();
|
|
3009
|
+
return getMenuEntriesList(props.builtin, props.disabled, props.status);
|
|
2484
3010
|
}
|
|
2485
3011
|
};
|
|
2486
3012
|
|
|
@@ -2504,6 +3030,13 @@ const openUri = async uri => {
|
|
|
2504
3030
|
return openUri$1(uri);
|
|
2505
3031
|
};
|
|
2506
3032
|
|
|
3033
|
+
const selectIndex = (state, index) => {
|
|
3034
|
+
return {
|
|
3035
|
+
...state,
|
|
3036
|
+
focusedIndex: index
|
|
3037
|
+
};
|
|
3038
|
+
};
|
|
3039
|
+
|
|
2507
3040
|
const handleClick = async (state, index) => {
|
|
2508
3041
|
const {
|
|
2509
3042
|
items,
|
|
@@ -2520,7 +3053,7 @@ const handleClick = async (state, index) => {
|
|
|
2520
3053
|
const extension = items[actualIndex];
|
|
2521
3054
|
const uri = getExtensionDetailUri(extension.id);
|
|
2522
3055
|
await openUri(uri);
|
|
2523
|
-
const partialNewState =
|
|
3056
|
+
const partialNewState = selectIndex(state, actualIndex);
|
|
2524
3057
|
const newState = {
|
|
2525
3058
|
...partialNewState,
|
|
2526
3059
|
focus: List$2
|
|
@@ -2540,6 +3073,8 @@ const text = data => {
|
|
|
2540
3073
|
};
|
|
2541
3074
|
};
|
|
2542
3075
|
|
|
3076
|
+
new Set(Object.values(VirtualDomElements));
|
|
3077
|
+
|
|
2543
3078
|
const SetText = 1;
|
|
2544
3079
|
const Replace = 2;
|
|
2545
3080
|
const SetAttribute = 3;
|
|
@@ -2819,6 +3354,9 @@ const handleClickAt = async (state, button, eventX, eventY, name = '') => {
|
|
|
2819
3354
|
if (name.startsWith('@')) {
|
|
2820
3355
|
return handleCompletionPointerDown(state, name);
|
|
2821
3356
|
}
|
|
3357
|
+
if (name) {
|
|
3358
|
+
return state;
|
|
3359
|
+
}
|
|
2822
3360
|
if (button !== LeftClick) {
|
|
2823
3361
|
return state;
|
|
2824
3362
|
}
|
|
@@ -2884,21 +3422,14 @@ const handleContextMenu = async (state, button, eventX, eventY) => {
|
|
|
2884
3422
|
return state;
|
|
2885
3423
|
}
|
|
2886
3424
|
await show2(uid, ManageExtension, eventX, eventY, {
|
|
2887
|
-
|
|
3425
|
+
builtin: items[index]?.builtin === true,
|
|
3426
|
+
disabled: items[index]?.disabled === true,
|
|
3427
|
+
menuId: ManageExtension,
|
|
3428
|
+
status: items[index]?.status
|
|
2888
3429
|
});
|
|
2889
3430
|
return state;
|
|
2890
3431
|
};
|
|
2891
3432
|
|
|
2892
|
-
const Disabled = 'disabled';
|
|
2893
|
-
const Enabled = 'enabled';
|
|
2894
|
-
const Installing = 'installing';
|
|
2895
|
-
const NotInstalled = 'not-installed';
|
|
2896
|
-
const Uninstalling = 'uninstalling';
|
|
2897
|
-
const statuses = [Disabled, Enabled, Installing, NotInstalled, Uninstalling];
|
|
2898
|
-
const isExtensionStatus = status => {
|
|
2899
|
-
return statuses.includes(status);
|
|
2900
|
-
};
|
|
2901
|
-
|
|
2902
3433
|
const updateStatus = (extension, id, status, builtin) => {
|
|
2903
3434
|
if (extension.id !== id) {
|
|
2904
3435
|
return extension;
|
|
@@ -2906,7 +3437,7 @@ const updateStatus = (extension, id, status, builtin) => {
|
|
|
2906
3437
|
return {
|
|
2907
3438
|
...extension,
|
|
2908
3439
|
builtin: builtin ?? extension.builtin,
|
|
2909
|
-
disabled: status === Disabled,
|
|
3440
|
+
disabled: status === Disabled$1,
|
|
2910
3441
|
status
|
|
2911
3442
|
};
|
|
2912
3443
|
};
|
|
@@ -2923,7 +3454,7 @@ const setExtensionStatus = (state, id, status, builtin) => {
|
|
|
2923
3454
|
|
|
2924
3455
|
const handleDisable = async (state, id) => {
|
|
2925
3456
|
const error = await disableExtension(id);
|
|
2926
|
-
return error ? state : setExtensionStatus(state, id, Disabled);
|
|
3457
|
+
return error ? state : setExtensionStatus(state, id, Disabled$1);
|
|
2927
3458
|
};
|
|
2928
3459
|
|
|
2929
3460
|
const handleDisableWorkspace = (state, id) => {
|
|
@@ -2950,64 +3481,6 @@ const handleHeaderContextMenu = async state => {
|
|
|
2950
3481
|
return state;
|
|
2951
3482
|
};
|
|
2952
3483
|
|
|
2953
|
-
const getFuzzyHighlights = (label, query) => {
|
|
2954
|
-
const lowerLabel = label.toLowerCase();
|
|
2955
|
-
const lowerQuery = query.toLowerCase();
|
|
2956
|
-
const matchedIndexes = [];
|
|
2957
|
-
let labelIndex = 0;
|
|
2958
|
-
for (const character of lowerQuery) {
|
|
2959
|
-
labelIndex = lowerLabel.indexOf(character, labelIndex);
|
|
2960
|
-
if (labelIndex === -1) {
|
|
2961
|
-
return undefined;
|
|
2962
|
-
}
|
|
2963
|
-
matchedIndexes.push(labelIndex);
|
|
2964
|
-
labelIndex++;
|
|
2965
|
-
}
|
|
2966
|
-
const highlights = [];
|
|
2967
|
-
for (const index of matchedIndexes) {
|
|
2968
|
-
const lastEnd = highlights.at(-1);
|
|
2969
|
-
if (lastEnd === index) {
|
|
2970
|
-
highlights[highlights.length - 1] = index + 1;
|
|
2971
|
-
} else {
|
|
2972
|
-
highlights.push(index, index + 1);
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
return highlights;
|
|
2976
|
-
};
|
|
2977
|
-
|
|
2978
|
-
const Suggestions = ['@builtin', '@category:', '@disabled', '@enabled', '@featured', '@id:', '@installed', '@mcpservers', '@mostpopular', '@outdated', '@recentlypublished', '@recommended', '@sort:installs', '@workspaceunsupported'];
|
|
2979
|
-
|
|
2980
|
-
const getCompletionItems = (value, cursorOffset) => {
|
|
2981
|
-
const range = getCompletionRange(value, cursorOffset);
|
|
2982
|
-
if (!range) {
|
|
2983
|
-
return [];
|
|
2984
|
-
}
|
|
2985
|
-
const items = [];
|
|
2986
|
-
for (const label of Suggestions) {
|
|
2987
|
-
const highlights = getFuzzyHighlights(label, range.query);
|
|
2988
|
-
if (highlights) {
|
|
2989
|
-
items.push({
|
|
2990
|
-
highlights,
|
|
2991
|
-
label
|
|
2992
|
-
});
|
|
2993
|
-
}
|
|
2994
|
-
}
|
|
2995
|
-
return items;
|
|
2996
|
-
};
|
|
2997
|
-
|
|
2998
|
-
const handleInput = async (state, value, inputSource = User, cursorOffset = value.length) => {
|
|
2999
|
-
const completionItems = getCompletionItems(value, cursorOffset);
|
|
3000
|
-
return handleChange(state, {
|
|
3001
|
-
completionFocusedIndex: 0,
|
|
3002
|
-
completionItems,
|
|
3003
|
-
cursorOffset,
|
|
3004
|
-
focus: Input,
|
|
3005
|
-
inputSource,
|
|
3006
|
-
searchValue: value,
|
|
3007
|
-
suggestOpen: inputSource === User && completionItems.length > 0
|
|
3008
|
-
});
|
|
3009
|
-
};
|
|
3010
|
-
|
|
3011
3484
|
const handleInputFocus = state => {
|
|
3012
3485
|
return {
|
|
3013
3486
|
...state,
|
|
@@ -3173,14 +3646,22 @@ const handleSettingsButtonClick = async (state, index) => {
|
|
|
3173
3646
|
const menuY = itemY + itemHeight - 10; // Position at the bottom of the extension item
|
|
3174
3647
|
|
|
3175
3648
|
await show2(uid, ManageExtension, menuX, menuY, {
|
|
3176
|
-
|
|
3649
|
+
builtin: items[actualIndex].builtin === true,
|
|
3650
|
+
disabled: items[actualIndex].disabled === true,
|
|
3651
|
+
menuId: ManageExtension,
|
|
3652
|
+
status: items[actualIndex].status
|
|
3177
3653
|
});
|
|
3178
3654
|
return state;
|
|
3179
3655
|
};
|
|
3180
3656
|
|
|
3181
3657
|
const handleUninstall = async (state, id) => {
|
|
3182
|
-
|
|
3183
|
-
|
|
3658
|
+
try {
|
|
3659
|
+
await uninstallExtension(id);
|
|
3660
|
+
return setExtensionStatus(state, id, NotInstalled);
|
|
3661
|
+
} catch (error) {
|
|
3662
|
+
await showErrorDialog(error);
|
|
3663
|
+
return state;
|
|
3664
|
+
}
|
|
3184
3665
|
};
|
|
3185
3666
|
|
|
3186
3667
|
const handleWheel = (state, deltaMode, deltaY) => {
|
|
@@ -3195,7 +3676,7 @@ const sendMessagePortToExtensionHostWorker = async port => {
|
|
|
3195
3676
|
|
|
3196
3677
|
const createExtensionHostWorkerRpc = async () => {
|
|
3197
3678
|
try {
|
|
3198
|
-
const rpc = await create$
|
|
3679
|
+
const rpc = await create$5({
|
|
3199
3680
|
commandMap: {},
|
|
3200
3681
|
send: sendMessagePortToExtensionHostWorker
|
|
3201
3682
|
});
|
|
@@ -3217,7 +3698,7 @@ const initializeExtensionHostWorker = async () => {
|
|
|
3217
3698
|
|
|
3218
3699
|
const createExtensionManagementWorkerRpc = async () => {
|
|
3219
3700
|
try {
|
|
3220
|
-
const rpc = await create$
|
|
3701
|
+
const rpc = await create$5({
|
|
3221
3702
|
commandMap: {},
|
|
3222
3703
|
send: port => sendMessagePortToExtensionManagementWorker(port, 0)
|
|
3223
3704
|
});
|
|
@@ -3330,6 +3811,28 @@ const getExtensionIcon = (extension, platform, assetDir) => {
|
|
|
3330
3811
|
return getRemoteUrl(extension, platform, assetDir);
|
|
3331
3812
|
};
|
|
3332
3813
|
|
|
3814
|
+
const getDownloadCountValue = extension => {
|
|
3815
|
+
return extension?.downloadCount ?? extension?.downloads ?? extension?.marketplace?.downloadCount ?? extension?.marketplace?.downloads ?? extension?.packageJSON?.downloadCount ?? extension?.packageJSON?.downloads;
|
|
3816
|
+
};
|
|
3817
|
+
const getDownloadCount = extension => {
|
|
3818
|
+
const downloadCount = getDownloadCountValue(extension);
|
|
3819
|
+
if (typeof downloadCount !== 'number') {
|
|
3820
|
+
return 'n/a';
|
|
3821
|
+
}
|
|
3822
|
+
return downloadCount.toLocaleString();
|
|
3823
|
+
};
|
|
3824
|
+
|
|
3825
|
+
const getRatingValue = extension => {
|
|
3826
|
+
return extension?.rating ?? extension?.averageRating ?? extension?.marketplace?.rating ?? extension?.marketplace?.averageRating ?? extension?.packageJSON?.rating ?? extension?.packageJSON?.averageRating;
|
|
3827
|
+
};
|
|
3828
|
+
const getRating = extension => {
|
|
3829
|
+
const rating = getRatingValue(extension);
|
|
3830
|
+
if (typeof rating !== 'number') {
|
|
3831
|
+
return 'n/a';
|
|
3832
|
+
}
|
|
3833
|
+
return rating.toFixed(1);
|
|
3834
|
+
};
|
|
3835
|
+
|
|
3333
3836
|
const getBuiltin = extension => {
|
|
3334
3837
|
return extension?.builtin === true;
|
|
3335
3838
|
};
|
|
@@ -3406,10 +3909,12 @@ const normalizeExtension = (extension, platform, assetDir) => {
|
|
|
3406
3909
|
categories: getCategories(extension),
|
|
3407
3910
|
description: getDescription(extension),
|
|
3408
3911
|
disabled: getDisabled(extension),
|
|
3912
|
+
downloadCount: getDownloadCount(extension),
|
|
3409
3913
|
icon: getIcon(extension, platform, assetDir),
|
|
3410
3914
|
id: getId$1(extension),
|
|
3411
3915
|
name: getName(extension),
|
|
3412
3916
|
publisher: getPublisher(extension),
|
|
3917
|
+
rating: getRating(extension),
|
|
3413
3918
|
size: getSize(extension),
|
|
3414
3919
|
status: getStatus(extension),
|
|
3415
3920
|
updatedDate: getUpdatedDate(extension),
|
|
@@ -3443,31 +3948,48 @@ const restoreState = savedState => {
|
|
|
3443
3948
|
};
|
|
3444
3949
|
};
|
|
3445
3950
|
|
|
3446
|
-
const
|
|
3951
|
+
const loadContentWithContext = async (context, savedState) => {
|
|
3447
3952
|
const {
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3953
|
+
uid
|
|
3954
|
+
} = context.getState();
|
|
3955
|
+
const loadToken = getToken(uid);
|
|
3956
|
+
try {
|
|
3957
|
+
const initialState = context.getState();
|
|
3958
|
+
const {
|
|
3959
|
+
assetDir,
|
|
3960
|
+
platform,
|
|
3961
|
+
width
|
|
3962
|
+
} = initialState;
|
|
3963
|
+
const {
|
|
3964
|
+
deltaY,
|
|
3965
|
+
searchValue: restoredSearchValue
|
|
3966
|
+
} = restoreState(savedState);
|
|
3967
|
+
const size = getViewletSize(width);
|
|
3968
|
+
const scrollSensitivity = getIsFirefox() ? 2.5 : 1;
|
|
3969
|
+
await context.updateState(state => {
|
|
3970
|
+
if (!state.initial) {
|
|
3971
|
+
return state;
|
|
3972
|
+
}
|
|
3973
|
+
return {
|
|
3974
|
+
...state,
|
|
3975
|
+
deltaY,
|
|
3976
|
+
initial: false,
|
|
3977
|
+
inputSource: Script,
|
|
3978
|
+
scrollSensitivity,
|
|
3979
|
+
searchValue: restoredSearchValue,
|
|
3980
|
+
size
|
|
3981
|
+
};
|
|
3982
|
+
});
|
|
3983
|
+
const allExtensions = await getAllExtensions(platform);
|
|
3984
|
+
const normalized = normalizeExtensions(allExtensions, platform, assetDir);
|
|
3985
|
+
await context.updateState(state => ({
|
|
3986
|
+
...state,
|
|
3987
|
+
allExtensions: normalized
|
|
3988
|
+
}));
|
|
3989
|
+
await handleChangeWithContext(context, {}, false);
|
|
3990
|
+
} finally {
|
|
3991
|
+
finish(uid, loadToken);
|
|
3992
|
+
}
|
|
3471
3993
|
};
|
|
3472
3994
|
|
|
3473
3995
|
const openSuggest = state => {
|
|
@@ -3527,6 +4049,24 @@ const getCss = state => {
|
|
|
3527
4049
|
z-index: 1;
|
|
3528
4050
|
}
|
|
3529
4051
|
|
|
4052
|
+
.ExtensionListItemFooter {
|
|
4053
|
+
justify-content: flex-end;
|
|
4054
|
+
padding-right: 2px;
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4057
|
+
.ExtensionListItemAuthorName {
|
|
4058
|
+
flex: 1;
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
.ExtensionActions {
|
|
4062
|
+
display: flex;
|
|
4063
|
+
gap: 6px;
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
.ExtensionActionButton {
|
|
4067
|
+
padding: 0 5px;
|
|
4068
|
+
}
|
|
4069
|
+
|
|
3530
4070
|
.ExtensionSearchCompletionWidget {
|
|
3531
4071
|
position: absolute;
|
|
3532
4072
|
left: ${completionLeft}px;
|
|
@@ -3641,9 +4181,13 @@ const ExtensionListItemActionInstall = 'ExtensionListItemActionInstall';
|
|
|
3641
4181
|
const ExtensionListItemAuthorName = 'ExtensionListItemAuthorName';
|
|
3642
4182
|
const ExtensionListItemDescription = 'ExtensionListItemDescription';
|
|
3643
4183
|
const ExtensionListItemDetail = 'ExtensionListItemDetail';
|
|
4184
|
+
const ExtensionListItemDownloadCount = 'ExtensionListItemDownloadCount';
|
|
3644
4185
|
const ExtensionListItemFooter = 'ExtensionListItemFooter';
|
|
3645
4186
|
const ExtensionListItemIcon = 'ExtensionListItemIcon';
|
|
4187
|
+
const ExtensionListItemMetadata = 'ExtensionListItemMetadata';
|
|
3646
4188
|
const ExtensionListItemName = 'ExtensionListItemName';
|
|
4189
|
+
const ExtensionListItemRating = 'ExtensionListItemRating';
|
|
4190
|
+
const ExtensionListItemStatistic = 'ExtensionListItemStatistic';
|
|
3647
4191
|
const ExtensionSearchCompletionHighlight = 'ExtensionSearchCompletionHighlight';
|
|
3648
4192
|
const ExtensionSearchCompletionItem = 'ExtensionSearchCompletionItem';
|
|
3649
4193
|
const ExtensionSearchCompletionItemFocused = 'ExtensionSearchCompletionItemFocused';
|
|
@@ -3733,6 +4277,8 @@ const getCompletionWidgetVirtualDom = (items, focusedIndex) => {
|
|
|
3733
4277
|
}, ...items.flatMap((item, index) => getCompletionItemVirtualDom(item, index, focusedIndex))];
|
|
3734
4278
|
};
|
|
3735
4279
|
|
|
4280
|
+
const Focusable = 0;
|
|
4281
|
+
|
|
3736
4282
|
const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldButtonDisabled);
|
|
3737
4283
|
const getClassName$1 = enabled => {
|
|
3738
4284
|
if (enabled) {
|
|
@@ -3751,7 +4297,7 @@ const getSearchFieldButtonVirtualDom = button => {
|
|
|
3751
4297
|
childCount: 1,
|
|
3752
4298
|
className: getClassName$1(enabled),
|
|
3753
4299
|
onClick,
|
|
3754
|
-
tabIndex:
|
|
4300
|
+
tabIndex: Focusable,
|
|
3755
4301
|
title,
|
|
3756
4302
|
type: Button$2
|
|
3757
4303
|
}, {
|
|
@@ -3761,14 +4307,15 @@ const getSearchFieldButtonVirtualDom = button => {
|
|
|
3761
4307
|
}];
|
|
3762
4308
|
};
|
|
3763
4309
|
|
|
4310
|
+
const searchFieldNode = {
|
|
4311
|
+
childCount: 2,
|
|
4312
|
+
className: SearchField,
|
|
4313
|
+
role: None,
|
|
4314
|
+
type: Div
|
|
4315
|
+
};
|
|
3764
4316
|
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '', onBlur = '', inputProperties = {}) => {
|
|
3765
4317
|
// TODO avoid mutation
|
|
3766
|
-
const dom = [{
|
|
3767
|
-
childCount: 2,
|
|
3768
|
-
className: SearchField,
|
|
3769
|
-
role: None,
|
|
3770
|
-
type: Div
|
|
3771
|
-
}, {
|
|
4318
|
+
const dom = [searchFieldNode, {
|
|
3772
4319
|
autocapitalize: 'off',
|
|
3773
4320
|
autocomplete: 'off',
|
|
3774
4321
|
autocorrect: 'off',
|
|
@@ -3870,7 +4417,7 @@ const getExtensionActions = (builtin, disabled, status) => {
|
|
|
3870
4417
|
if (status === Uninstalling) {
|
|
3871
4418
|
return builtin ? [] : [uninstalling];
|
|
3872
4419
|
}
|
|
3873
|
-
const enableOrDisable = status === Disabled || status === undefined && disabled ? enable : disable;
|
|
4420
|
+
const enableOrDisable = status === Disabled$1 || status === undefined && disabled ? enable : disable;
|
|
3874
4421
|
return builtin ? [enableOrDisable] : [enableOrDisable, uninstall];
|
|
3875
4422
|
};
|
|
3876
4423
|
|
|
@@ -3894,6 +4441,25 @@ const getExtensionActionsVirtualDom = (id, builtin, disabled, status) => {
|
|
|
3894
4441
|
}, ...actions.flatMap(action => getActionVirtualDom$1(action, id))];
|
|
3895
4442
|
};
|
|
3896
4443
|
|
|
4444
|
+
const extensionListItemMetadataNode = {
|
|
4445
|
+
childCount: 2,
|
|
4446
|
+
className: ExtensionListItemMetadata,
|
|
4447
|
+
type: Div
|
|
4448
|
+
};
|
|
4449
|
+
const getStatisticVirtualDom = (label, value, className) => {
|
|
4450
|
+
const accessibleLabel = `${label}: ${value}`;
|
|
4451
|
+
return [{
|
|
4452
|
+
ariaLabel: accessibleLabel,
|
|
4453
|
+
childCount: 1,
|
|
4454
|
+
className: mergeClassNames(ExtensionListItemStatistic, className),
|
|
4455
|
+
title: accessibleLabel,
|
|
4456
|
+
type: Span
|
|
4457
|
+
}, text(value)];
|
|
4458
|
+
};
|
|
4459
|
+
const getExtensionStatisticsVirtualDom = (downloadCount, rating$1) => {
|
|
4460
|
+
return [extensionListItemMetadataNode, ...getStatisticVirtualDom(downloads(), downloadCount, ExtensionListItemDownloadCount), ...getStatisticVirtualDom(rating(), rating$1, ExtensionListItemRating)];
|
|
4461
|
+
};
|
|
4462
|
+
|
|
3897
4463
|
const listItemDetail = {
|
|
3898
4464
|
childCount: 3,
|
|
3899
4465
|
className: ExtensionListItemDetail,
|
|
@@ -3910,7 +4476,7 @@ const listItemDescription = {
|
|
|
3910
4476
|
type: Div
|
|
3911
4477
|
};
|
|
3912
4478
|
const listItemFooter = {
|
|
3913
|
-
childCount:
|
|
4479
|
+
childCount: 3,
|
|
3914
4480
|
className: ExtensionListItemFooter,
|
|
3915
4481
|
type: Div
|
|
3916
4482
|
};
|
|
@@ -3936,12 +4502,14 @@ const getExtensionListItemVirtualDom = extension => {
|
|
|
3936
4502
|
builtin = false,
|
|
3937
4503
|
description,
|
|
3938
4504
|
disabled = false,
|
|
4505
|
+
downloadCount = 'n/a',
|
|
3939
4506
|
focused,
|
|
3940
4507
|
icon,
|
|
3941
4508
|
id,
|
|
3942
4509
|
name,
|
|
3943
4510
|
posInSet,
|
|
3944
4511
|
publisher,
|
|
4512
|
+
rating = 'n/a',
|
|
3945
4513
|
setSize,
|
|
3946
4514
|
status
|
|
3947
4515
|
} = extension;
|
|
@@ -3961,7 +4529,7 @@ const getExtensionListItemVirtualDom = extension => {
|
|
|
3961
4529
|
role: None,
|
|
3962
4530
|
src: icon,
|
|
3963
4531
|
type: Img
|
|
3964
|
-
}, listItemDetail, listItemName, text(name), listItemDescription, text(description), listItemFooter, listItemAuthorName, text(publisher), ...actionsDom];
|
|
4532
|
+
}, listItemDetail, listItemName, text(name), listItemDescription, text(description), listItemFooter, listItemAuthorName, text(publisher), ...getExtensionStatisticsVirtualDom(downloadCount, rating), ...actionsDom];
|
|
3965
4533
|
return dom;
|
|
3966
4534
|
};
|
|
3967
4535
|
|
|
@@ -3981,7 +4549,7 @@ const getExtensionsListVirtualDom = (visibleExtensions, focusOutline) => {
|
|
|
3981
4549
|
onTouchStart: HandleTouchStart,
|
|
3982
4550
|
onWheel: HandleWheel,
|
|
3983
4551
|
role: List$1,
|
|
3984
|
-
tabIndex:
|
|
4552
|
+
tabIndex: Focusable,
|
|
3985
4553
|
type: Div
|
|
3986
4554
|
}, ...visibleExtensions.flatMap(getExtensionListItemVirtualDom)];
|
|
3987
4555
|
return dom;
|
|
@@ -3993,14 +4561,20 @@ const getExtensionsVirtualDom = (visibleExtensions, focusOutline) => {
|
|
|
3993
4561
|
return dom;
|
|
3994
4562
|
};
|
|
3995
4563
|
|
|
4564
|
+
const noExtensionsFoundNode = {
|
|
4565
|
+
childCount: 1,
|
|
4566
|
+
className: NoExtensionsFoundMessage,
|
|
4567
|
+
type: Div
|
|
4568
|
+
};
|
|
3996
4569
|
const getNoExtensionsFoundVirtualDom = message => {
|
|
3997
|
-
return [
|
|
3998
|
-
childCount: 1,
|
|
3999
|
-
className: NoExtensionsFoundMessage,
|
|
4000
|
-
type: Div
|
|
4001
|
-
}, text(message)];
|
|
4570
|
+
return [noExtensionsFoundNode, text(message)];
|
|
4002
4571
|
};
|
|
4003
4572
|
|
|
4573
|
+
const scrollBarThumbNode = {
|
|
4574
|
+
childCount: 0,
|
|
4575
|
+
className: ScrollBarThumb,
|
|
4576
|
+
type: Div
|
|
4577
|
+
};
|
|
4004
4578
|
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
4005
4579
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
4006
4580
|
if (!shouldShowScrollbar) {
|
|
@@ -4012,11 +4586,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
|
4012
4586
|
onPointerDown: HandleScrollBarPointerDown,
|
|
4013
4587
|
// TODO support pointercapture event
|
|
4014
4588
|
type: Div
|
|
4015
|
-
},
|
|
4016
|
-
childCount: 0,
|
|
4017
|
-
className: ScrollBarThumb,
|
|
4018
|
-
type: Div
|
|
4019
|
-
}];
|
|
4589
|
+
}, scrollBarThumbNode];
|
|
4020
4590
|
};
|
|
4021
4591
|
|
|
4022
4592
|
const getVisibleItem = (item, setSize, itemHeight, minLineY, relative, i, focusedIndex) => {
|
|
@@ -4025,16 +4595,19 @@ const getVisibleItem = (item, setSize, itemHeight, minLineY, relative, i, focuse
|
|
|
4025
4595
|
builtin,
|
|
4026
4596
|
description,
|
|
4027
4597
|
disabled,
|
|
4598
|
+
downloadCount,
|
|
4028
4599
|
icon,
|
|
4029
4600
|
id,
|
|
4030
4601
|
name,
|
|
4031
4602
|
publisher,
|
|
4603
|
+
rating,
|
|
4032
4604
|
status
|
|
4033
4605
|
} = item;
|
|
4034
4606
|
return {
|
|
4035
4607
|
builtin,
|
|
4036
4608
|
description,
|
|
4037
4609
|
disabled,
|
|
4610
|
+
downloadCount,
|
|
4038
4611
|
focused: i === focusedIndex,
|
|
4039
4612
|
icon,
|
|
4040
4613
|
id,
|
|
@@ -4042,6 +4615,7 @@ const getVisibleItem = (item, setSize, itemHeight, minLineY, relative, i, focuse
|
|
|
4042
4615
|
name,
|
|
4043
4616
|
posInSet: i + 1,
|
|
4044
4617
|
publisher,
|
|
4618
|
+
rating,
|
|
4045
4619
|
setSize,
|
|
4046
4620
|
status,
|
|
4047
4621
|
top: (i - minLineY) * itemHeight - relative
|
|
@@ -4082,6 +4656,7 @@ const getExtensionsViewVirtualDom = state => {
|
|
|
4082
4656
|
const {
|
|
4083
4657
|
completionFocusedIndex,
|
|
4084
4658
|
completionItems,
|
|
4659
|
+
focus,
|
|
4085
4660
|
focusedIndex,
|
|
4086
4661
|
inputActions,
|
|
4087
4662
|
message,
|
|
@@ -4090,7 +4665,7 @@ const getExtensionsViewVirtualDom = state => {
|
|
|
4090
4665
|
scrollBarY,
|
|
4091
4666
|
suggestOpen
|
|
4092
4667
|
} = state;
|
|
4093
|
-
const focusOutline = focusedIndex === -1 &&
|
|
4668
|
+
const focusOutline = focusedIndex === -1 && focus === List$2;
|
|
4094
4669
|
return [{
|
|
4095
4670
|
ariaBusy: false,
|
|
4096
4671
|
ariaLive: 'polite',
|
|
@@ -4145,10 +4720,7 @@ const renderScrollBar = newState => {
|
|
|
4145
4720
|
const roundedScrollBarY = Math.round(scrollBarY);
|
|
4146
4721
|
const heightString = px(scrollBarHeight);
|
|
4147
4722
|
const translateString = position(0, roundedScrollBarY);
|
|
4148
|
-
|
|
4149
|
-
if (newState.scrollBarActive) {
|
|
4150
|
-
className += ' ' + ScrollBarThumbActive;
|
|
4151
|
-
}
|
|
4723
|
+
const className = mergeClassNames(ScrollBarThumb, newState.scrollBarActive ? ScrollBarThumbActive : '');
|
|
4152
4724
|
return [/* method */SetScrollBar, translateString, heightString, className];
|
|
4153
4725
|
};
|
|
4154
4726
|
|
|
@@ -4167,7 +4739,7 @@ const titleFilters = [{
|
|
|
4167
4739
|
value: Enabled$1
|
|
4168
4740
|
}, {
|
|
4169
4741
|
label: disabled,
|
|
4170
|
-
value: Disabled$
|
|
4742
|
+
value: Disabled$2
|
|
4171
4743
|
}, {
|
|
4172
4744
|
label: builtIn,
|
|
4173
4745
|
value: Builtin
|
|
@@ -4439,13 +5011,6 @@ const scrollDown = state => {
|
|
|
4439
5011
|
return setDeltaY(state, newDeltaY);
|
|
4440
5012
|
};
|
|
4441
5013
|
|
|
4442
|
-
const selectIndex = (state, index) => {
|
|
4443
|
-
return {
|
|
4444
|
-
...state,
|
|
4445
|
-
focusedIndex: index
|
|
4446
|
-
};
|
|
4447
|
-
};
|
|
4448
|
-
|
|
4449
5014
|
const selectNextCompletion = state => {
|
|
4450
5015
|
if (!state.suggestOpen || state.completionItems.length === 0) {
|
|
4451
5016
|
return state;
|
|
@@ -4473,8 +5038,8 @@ const toggleSuggest = state => {
|
|
|
4473
5038
|
const commandMap = {
|
|
4474
5039
|
'Extensions.copyExtensionId': wrapCommand(copyExtensionId),
|
|
4475
5040
|
'Extensions.copyExtensionInfo': wrapCommand(copyExtensionInfo),
|
|
4476
|
-
'SearchExtensions.acceptCompletion':
|
|
4477
|
-
'SearchExtensions.clearSearchResults':
|
|
5041
|
+
'SearchExtensions.acceptCompletion': wrapAsyncCommand(acceptCompletionWithContext),
|
|
5042
|
+
'SearchExtensions.clearSearchResults': wrapAsyncCommand(clearSearchResultsWithContext),
|
|
4478
5043
|
'SearchExtensions.closeSuggest': wrapCommand(closeSuggest),
|
|
4479
5044
|
'SearchExtensions.copyExtensionId': wrapCommand(copyExtensionId),
|
|
4480
5045
|
'SearchExtensions.copyExtensionInfo': wrapCommand(copyExtensionInfo),
|
|
@@ -4485,6 +5050,7 @@ const commandMap = {
|
|
|
4485
5050
|
'SearchExtensions.dispose': dispose,
|
|
4486
5051
|
'SearchExtensions.enable': wrapCommand(enable$1),
|
|
4487
5052
|
'SearchExtensions.enableWorkspace': wrapCommand(enableWorkspace),
|
|
5053
|
+
'SearchExtensions.filterByMostPopular': wrapAsyncCommand(filterByMostPopularWithContext),
|
|
4488
5054
|
'SearchExtensions.focusFirst': wrapCommand(focusFirst),
|
|
4489
5055
|
'SearchExtensions.focusIndex': wrapCommand(focusIndex),
|
|
4490
5056
|
'SearchExtensions.focusLast': wrapCommand(focusLast),
|
|
@@ -4512,7 +5078,7 @@ const commandMap = {
|
|
|
4512
5078
|
'SearchExtensions.handleEnableWorkspace': wrapCommand(handleEnableWorkspace),
|
|
4513
5079
|
'SearchExtensions.handleFocus': wrapCommand(handleFocus),
|
|
4514
5080
|
'SearchExtensions.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
|
|
4515
|
-
'SearchExtensions.handleInput':
|
|
5081
|
+
'SearchExtensions.handleInput': wrapAsyncCommand(handleInputWithContext),
|
|
4516
5082
|
'SearchExtensions.handleInputFocus': wrapCommand(handleInputFocus),
|
|
4517
5083
|
'SearchExtensions.handleInstall': wrapCommand(handleInstall),
|
|
4518
5084
|
'SearchExtensions.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
@@ -4524,7 +5090,7 @@ const commandMap = {
|
|
|
4524
5090
|
'SearchExtensions.handleWheel': wrapCommand(handleWheel),
|
|
4525
5091
|
'SearchExtensions.initialize': initialize,
|
|
4526
5092
|
'SearchExtensions.installAnotherVersion': wrapCommand(installAnotherVersion),
|
|
4527
|
-
'SearchExtensions.loadContent':
|
|
5093
|
+
'SearchExtensions.loadContent': wrapAsyncCommand(loadContentWithContext),
|
|
4528
5094
|
'SearchExtensions.openSuggest': wrapCommand(openSuggest),
|
|
4529
5095
|
'SearchExtensions.render3': render3,
|
|
4530
5096
|
'SearchExtensions.renderActions': renderActions,
|
|
@@ -4545,7 +5111,7 @@ const commandMap = {
|
|
|
4545
5111
|
|
|
4546
5112
|
const listen = async () => {
|
|
4547
5113
|
registerCommands(commandMap);
|
|
4548
|
-
const rpc = await create$
|
|
5114
|
+
const rpc = await create$4({
|
|
4549
5115
|
commandMap: commandMap
|
|
4550
5116
|
});
|
|
4551
5117
|
set$2(rpc);
|