@lvce-editor/file-search-worker 4.6.0 → 5.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/fileSearchWorkerMain.js +1845 -1894
- package/package.json +1 -1
|
@@ -445,7 +445,7 @@ const callbacks = Object.create(null);
|
|
|
445
445
|
const set$2 = (id, fn) => {
|
|
446
446
|
callbacks[id] = fn;
|
|
447
447
|
};
|
|
448
|
-
const get$
|
|
448
|
+
const get$3 = id => {
|
|
449
449
|
return callbacks[id];
|
|
450
450
|
};
|
|
451
451
|
const remove$1 = id => {
|
|
@@ -618,7 +618,7 @@ const warn$1 = (...args) => {
|
|
|
618
618
|
console.warn(...args);
|
|
619
619
|
};
|
|
620
620
|
const resolve = (id, response) => {
|
|
621
|
-
const fn = get$
|
|
621
|
+
const fn = get$3(id);
|
|
622
622
|
if (!fn) {
|
|
623
623
|
console.log(response);
|
|
624
624
|
warn$1(`callback ${id} may already be disposed`);
|
|
@@ -786,7 +786,7 @@ const register$2 = commandMap => {
|
|
|
786
786
|
const getCommand = key => {
|
|
787
787
|
return commands[key];
|
|
788
788
|
};
|
|
789
|
-
const execute
|
|
789
|
+
const execute = (command, ...args) => {
|
|
790
790
|
const fn = getCommand(command);
|
|
791
791
|
if (!fn) {
|
|
792
792
|
throw new Error(`command not found ${command}`);
|
|
@@ -824,7 +824,7 @@ const logError = () => {
|
|
|
824
824
|
};
|
|
825
825
|
const handleMessage = event => {
|
|
826
826
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
827
|
-
const actualExecute = event?.target?.execute || execute
|
|
827
|
+
const actualExecute = event?.target?.execute || execute;
|
|
828
828
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
829
829
|
};
|
|
830
830
|
const handleIpc = ipc => {
|
|
@@ -864,12 +864,12 @@ const rpcs = Object.create(null);
|
|
|
864
864
|
const set$1 = (id, rpc) => {
|
|
865
865
|
rpcs[id] = rpc;
|
|
866
866
|
};
|
|
867
|
-
const get$
|
|
867
|
+
const get$2 = id => {
|
|
868
868
|
return rpcs[id];
|
|
869
869
|
};
|
|
870
870
|
|
|
871
871
|
const invoke$1 = (method, ...params) => {
|
|
872
|
-
const rpc = get$
|
|
872
|
+
const rpc = get$2(RendererWorker);
|
|
873
873
|
// @ts-ignore
|
|
874
874
|
return rpc.invoke(method, ...params);
|
|
875
875
|
};
|
|
@@ -891,7 +891,7 @@ const minimumSliderSize = 20;
|
|
|
891
891
|
const Command = '>';
|
|
892
892
|
const Symbol$1 = '@';
|
|
893
893
|
const WorkspaceSymbol$1 = '#';
|
|
894
|
-
const GoToLine = ':';
|
|
894
|
+
const GoToLine$1 = ':';
|
|
895
895
|
const View$1 = 'view ';
|
|
896
896
|
const None$2 = '';
|
|
897
897
|
|
|
@@ -905,8 +905,8 @@ const getQuickPickPrefix = value => {
|
|
|
905
905
|
if (value.startsWith(WorkspaceSymbol$1)) {
|
|
906
906
|
return WorkspaceSymbol$1;
|
|
907
907
|
}
|
|
908
|
-
if (value.startsWith(GoToLine)) {
|
|
909
|
-
return GoToLine;
|
|
908
|
+
if (value.startsWith(GoToLine$1)) {
|
|
909
|
+
return GoToLine$1;
|
|
910
910
|
}
|
|
911
911
|
if (value.startsWith(View$1)) {
|
|
912
912
|
return View$1;
|
|
@@ -914,34 +914,46 @@ const getQuickPickPrefix = value => {
|
|
|
914
914
|
return None$2;
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
stack,
|
|
929
|
-
name
|
|
930
|
-
};
|
|
931
|
-
await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
|
|
932
|
-
};
|
|
933
|
-
const warn = (...args) => {
|
|
934
|
-
console.warn(...args);
|
|
935
|
-
};
|
|
917
|
+
const CommandPalette = 'quickPick://commandPalette';
|
|
918
|
+
const Commands = 'quickPick://commands';
|
|
919
|
+
const File$2 = 'quickPick://file';
|
|
920
|
+
const EveryThing = 'quickPick://everything';
|
|
921
|
+
const Recent = 'quickPick://recent';
|
|
922
|
+
const ColorTheme = 'quickPick://color-theme';
|
|
923
|
+
const Symbol = 'quickPick://symbol';
|
|
924
|
+
const View = 'quickPick://view';
|
|
925
|
+
const WorkspaceSymbol = 'quickPick://workspace-symbol';
|
|
926
|
+
const Custom = 'quickPick://custom';
|
|
927
|
+
const GoToLine = 'quickPick://go-to-line';
|
|
936
928
|
|
|
937
|
-
|
|
938
|
-
|
|
929
|
+
// TODO use numeric enum for quickpick entry id
|
|
930
|
+
const getQuickPickProviderId = prefix => {
|
|
931
|
+
switch (prefix) {
|
|
932
|
+
case Command:
|
|
933
|
+
return Commands;
|
|
934
|
+
case Symbol$1:
|
|
935
|
+
return Symbol;
|
|
936
|
+
case WorkspaceSymbol$1:
|
|
937
|
+
return WorkspaceSymbol;
|
|
938
|
+
case GoToLine$1:
|
|
939
|
+
return GoToLine;
|
|
940
|
+
case View$1:
|
|
941
|
+
return View;
|
|
942
|
+
default:
|
|
943
|
+
return File$2;
|
|
944
|
+
}
|
|
939
945
|
};
|
|
940
|
-
|
|
941
|
-
|
|
946
|
+
|
|
947
|
+
const state$b = Object.create(null);
|
|
948
|
+
const register$1 = modules => {
|
|
949
|
+
Object.assign(state$b, modules);
|
|
942
950
|
};
|
|
943
|
-
const
|
|
944
|
-
|
|
951
|
+
const get$1 = moduleId => {
|
|
952
|
+
const module = state$b[moduleId];
|
|
953
|
+
if (!module) {
|
|
954
|
+
throw new Error(`unknown module "${moduleId}"`);
|
|
955
|
+
}
|
|
956
|
+
return module;
|
|
945
957
|
};
|
|
946
958
|
|
|
947
959
|
const Hide = 'hide';
|
|
@@ -1009,835 +1021,732 @@ const quickOpen = () => {
|
|
|
1009
1021
|
return i18nString(QuickOpen);
|
|
1010
1022
|
};
|
|
1011
1023
|
|
|
1012
|
-
const name$
|
|
1013
|
-
const getPlaceholder$
|
|
1014
|
-
return typeNameofCommandToRun();
|
|
1015
|
-
};
|
|
1016
|
-
const getLabel$5 = () => {
|
|
1024
|
+
const name$9 = 'noop';
|
|
1025
|
+
const getPlaceholder$9 = () => {
|
|
1017
1026
|
return '';
|
|
1018
1027
|
};
|
|
1019
|
-
const getNoResults$
|
|
1020
|
-
return
|
|
1021
|
-
label: noMatchingResults()
|
|
1022
|
-
};
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
// TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
|
|
1026
|
-
const getBuiltinPicks = async () => {
|
|
1027
|
-
const builtinPicks = getAll();
|
|
1028
|
-
return builtinPicks;
|
|
1029
|
-
};
|
|
1030
|
-
const prefixIdWithExt = item => {
|
|
1031
|
-
if (!item.label) {
|
|
1032
|
-
warn('[QuickPick] item has missing label', item);
|
|
1033
|
-
}
|
|
1034
|
-
if (!item.id) {
|
|
1035
|
-
warn('[QuickPick] item has missing id', item);
|
|
1036
|
-
}
|
|
1037
|
-
return {
|
|
1038
|
-
...item,
|
|
1039
|
-
id: `ext.${item.id}`,
|
|
1040
|
-
label: item.label || item.id
|
|
1041
|
-
};
|
|
1042
|
-
};
|
|
1043
|
-
const getExtensionPicks = async () => {
|
|
1044
|
-
try {
|
|
1045
|
-
// TODO don't call this every time
|
|
1046
|
-
const extensionPicks = await invoke$1('ExtensionHost.getCommands');
|
|
1047
|
-
if (!extensionPicks) {
|
|
1048
|
-
return [];
|
|
1049
|
-
}
|
|
1050
|
-
const mappedPicks = extensionPicks.map(prefixIdWithExt);
|
|
1051
|
-
return mappedPicks;
|
|
1052
|
-
} catch (error) {
|
|
1053
|
-
console.error(`Failed to get extension picks: ${error}`);
|
|
1054
|
-
return [];
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1057
|
-
|
|
1058
|
-
// TODO send strings to renderer process only once for next occurrence send uint16array of ids of strings
|
|
1059
|
-
|
|
1060
|
-
const getPicks$b = async () => {
|
|
1061
|
-
const builtinPicks = await getBuiltinPicks();
|
|
1062
|
-
const extensionPicks = await getExtensionPicks();
|
|
1063
|
-
const allPicks = [...builtinPicks, ...extensionPicks];
|
|
1064
|
-
return allPicks;
|
|
1065
|
-
};
|
|
1066
|
-
const shouldHide = item => {
|
|
1067
|
-
if (item.id === 'Viewlet.openWidget' && item.args[0] === 'QuickPick') {
|
|
1068
|
-
return false;
|
|
1069
|
-
}
|
|
1070
|
-
return true;
|
|
1028
|
+
const getNoResults$9 = () => {
|
|
1029
|
+
return noResults();
|
|
1071
1030
|
};
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
// TODO ids should be all numbers for efficiency -> also directly can call command
|
|
1075
|
-
await invoke$1(item.id, ...args);
|
|
1076
|
-
if (shouldHide(item)) {
|
|
1077
|
-
return {
|
|
1078
|
-
command: Hide
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
return {
|
|
1082
|
-
command: KeepOpen
|
|
1083
|
-
};
|
|
1031
|
+
const getPicks$9 = async value => {
|
|
1032
|
+
return [];
|
|
1084
1033
|
};
|
|
1085
|
-
const
|
|
1086
|
-
const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
|
|
1087
|
-
try {
|
|
1088
|
-
await invoke$1('ExtensionHost.executeCommand', id);
|
|
1089
|
-
} catch (error) {
|
|
1090
|
-
await handleError(error, false);
|
|
1091
|
-
await showErrorDialog(error);
|
|
1092
|
-
}
|
|
1034
|
+
const selectPick$9 = async item => {
|
|
1093
1035
|
return {
|
|
1094
1036
|
command: Hide
|
|
1095
1037
|
};
|
|
1096
1038
|
};
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
return selectPickExtension(item);
|
|
1100
|
-
}
|
|
1101
|
-
return selectPickBuiltin(item);
|
|
1102
|
-
};
|
|
1103
|
-
const getFilterValue$b = value => {
|
|
1104
|
-
return value.trim();
|
|
1039
|
+
const getFilterValue$9 = value => {
|
|
1040
|
+
return value;
|
|
1105
1041
|
};
|
|
1106
1042
|
const getPickFilterValue$9 = pick => {
|
|
1107
|
-
return pick
|
|
1108
|
-
};
|
|
1109
|
-
const getPickLabel$8 = pick => {
|
|
1110
|
-
return pick.label;
|
|
1043
|
+
return pick;
|
|
1111
1044
|
};
|
|
1112
|
-
const
|
|
1113
|
-
return
|
|
1045
|
+
const getVisibleItems$9 = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
|
|
1046
|
+
return [];
|
|
1114
1047
|
};
|
|
1115
1048
|
|
|
1116
|
-
const
|
|
1049
|
+
const QuickPickNoop = {
|
|
1117
1050
|
__proto__: null,
|
|
1118
|
-
getFilterValue: getFilterValue$
|
|
1119
|
-
|
|
1120
|
-
getNoResults: getNoResults$b,
|
|
1051
|
+
getFilterValue: getFilterValue$9,
|
|
1052
|
+
getNoResults: getNoResults$9,
|
|
1121
1053
|
getPickFilterValue: getPickFilterValue$9,
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
selectPick: selectPick$b
|
|
1054
|
+
getPicks: getPicks$9,
|
|
1055
|
+
getPlaceholder: getPlaceholder$9,
|
|
1056
|
+
getVisibleItems: getVisibleItems$9,
|
|
1057
|
+
name: name$9,
|
|
1058
|
+
selectPick: selectPick$9
|
|
1128
1059
|
};
|
|
1129
1060
|
|
|
1130
|
-
|
|
1131
|
-
const File$2 = 7;
|
|
1061
|
+
// TODO avoid global variable
|
|
1132
1062
|
|
|
1133
|
-
|
|
1134
|
-
const getProtocol = uri => {
|
|
1135
|
-
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
1136
|
-
if (protocolMatch) {
|
|
1137
|
-
return protocolMatch[1];
|
|
1138
|
-
}
|
|
1139
|
-
return '';
|
|
1140
|
-
};
|
|
1063
|
+
// TODO don't store provider in state, only serialized value like provider-id
|
|
1141
1064
|
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1065
|
+
const state$a = {
|
|
1066
|
+
// providerId: PROVIDER_NOOP,
|
|
1067
|
+
provider: QuickPickNoop,
|
|
1068
|
+
prefix: 'string-that-should-never-match-another-string'
|
|
1144
1069
|
};
|
|
1145
1070
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
const
|
|
1151
|
-
return state$
|
|
1071
|
+
/**
|
|
1072
|
+
* @type {string}
|
|
1073
|
+
*/
|
|
1074
|
+
const name$8 = 'everything';
|
|
1075
|
+
const getPlaceholder$8 = () => {
|
|
1076
|
+
return state$a.provider.getPlaceholder();
|
|
1152
1077
|
};
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
const protocol = getProtocol(path);
|
|
1156
|
-
// TODO call different providers depending on protocol
|
|
1157
|
-
const fn = getModule(protocol);
|
|
1158
|
-
const result = await fn(path, value, prepare, assetDir);
|
|
1159
|
-
return result;
|
|
1078
|
+
const getLabel$5 = () => {
|
|
1079
|
+
return '';
|
|
1160
1080
|
};
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
const pathBaseName = path => {
|
|
1164
|
-
return path.slice(path.lastIndexOf('/') + 1);
|
|
1081
|
+
const getNoResults$8 = () => {
|
|
1082
|
+
return state$a.provider.getNoResults();
|
|
1165
1083
|
};
|
|
1084
|
+
const getPicks$8 = async value => {
|
|
1085
|
+
const prefix = getQuickPickPrefix(value);
|
|
1166
1086
|
|
|
1167
|
-
// TODO
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1087
|
+
// TODO race condition
|
|
1088
|
+
if (state$a.prefix !== prefix) {
|
|
1089
|
+
state$a.prefix = prefix;
|
|
1090
|
+
const providerId = getQuickPickProviderId(prefix);
|
|
1091
|
+
const provider = get$1(providerId);
|
|
1092
|
+
state$a.provider = provider;
|
|
1173
1093
|
}
|
|
1174
|
-
|
|
1094
|
+
// TODO this line is a bit duplicated with getFilterValue
|
|
1095
|
+
const slicedValue = value.slice(prefix.length).trimStart();
|
|
1096
|
+
const picks = await state$a.provider.getPicks(slicedValue);
|
|
1097
|
+
return picks;
|
|
1175
1098
|
};
|
|
1176
|
-
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
return files;
|
|
1099
|
+
const selectPick$8 = item => {
|
|
1100
|
+
const {
|
|
1101
|
+
provider
|
|
1102
|
+
} = state$a;
|
|
1103
|
+
return provider.selectPick(item);
|
|
1182
1104
|
};
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
return '';
|
|
1105
|
+
const openCommandPalette = () => {
|
|
1106
|
+
// show('>')
|
|
1186
1107
|
};
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1108
|
+
const openView = () => {
|
|
1109
|
+
// show('view ')
|
|
1189
1110
|
};
|
|
1190
|
-
const
|
|
1191
|
-
return
|
|
1192
|
-
label: noMatchingResults()
|
|
1193
|
-
};
|
|
1111
|
+
const getFilterValue$8 = value => {
|
|
1112
|
+
return value.slice(state$a.prefix.length).trim();
|
|
1194
1113
|
};
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
}
|
|
1201
|
-
const files = await searchFile$4(workspace, searchValue);
|
|
1202
|
-
// const picks = files.map(toPick)
|
|
1203
|
-
return files;
|
|
1114
|
+
const getPickFilterValue$8 = pick => {
|
|
1115
|
+
const {
|
|
1116
|
+
provider
|
|
1117
|
+
} = state$a;
|
|
1118
|
+
return provider.getPickFilterValue(pick);
|
|
1204
1119
|
};
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1120
|
+
const getPickDescription$8 = pick => {
|
|
1121
|
+
const {
|
|
1122
|
+
provider
|
|
1123
|
+
} = state$a;
|
|
1124
|
+
// @ts-ignore
|
|
1125
|
+
if (provider.getPickDescription) {
|
|
1126
|
+
// @ts-ignore
|
|
1127
|
+
return provider.getPickDescription(pick);
|
|
1208
1128
|
}
|
|
1209
|
-
|
|
1210
|
-
const absolutePath = `${workspace}/${pick}`;
|
|
1211
|
-
await openUri(absolutePath);
|
|
1212
|
-
return {
|
|
1213
|
-
command: Hide
|
|
1214
|
-
};
|
|
1129
|
+
return '';
|
|
1215
1130
|
};
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1131
|
+
const getPickLabel$8 = pick => {
|
|
1132
|
+
const {
|
|
1133
|
+
provider
|
|
1134
|
+
} = state$a;
|
|
1135
|
+
// @ts-ignore
|
|
1136
|
+
return provider.getPickLabel(pick);
|
|
1218
1137
|
};
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
const getPickLabel$7 = pick => {
|
|
1226
|
-
if (typeof pick === 'object') {
|
|
1227
|
-
pick = pick.pick;
|
|
1228
|
-
}
|
|
1229
|
-
const baseName = pathBaseName(pick);
|
|
1230
|
-
return baseName;
|
|
1231
|
-
};
|
|
1232
|
-
const getPickDescription$8 = pick => {
|
|
1233
|
-
if (typeof pick === 'object') {
|
|
1234
|
-
pick = pick.pick;
|
|
1235
|
-
}
|
|
1236
|
-
const dirName = pathDirName(pick);
|
|
1237
|
-
return dirName;
|
|
1238
|
-
};
|
|
1239
|
-
const getPickIcon$7 = () => {
|
|
1240
|
-
return '';
|
|
1138
|
+
const getPickIcon$8 = pick => {
|
|
1139
|
+
const {
|
|
1140
|
+
provider
|
|
1141
|
+
} = state$a;
|
|
1142
|
+
// @ts-ignore
|
|
1143
|
+
return provider.getPickIcon(pick);
|
|
1241
1144
|
};
|
|
1242
1145
|
const getPickFileIcon$2 = pick => {
|
|
1243
|
-
|
|
1244
|
-
|
|
1146
|
+
const {
|
|
1147
|
+
provider
|
|
1148
|
+
} = state$a;
|
|
1149
|
+
// @ts-ignore
|
|
1150
|
+
if (provider.getPickFileIcon) {
|
|
1151
|
+
// @ts-ignore
|
|
1152
|
+
return provider.getPickFileIcon(pick);
|
|
1245
1153
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1154
|
+
return undefined;
|
|
1155
|
+
};
|
|
1156
|
+
const isPrepared$8 = () => {
|
|
1157
|
+
const {
|
|
1158
|
+
provider
|
|
1159
|
+
} = state$a;
|
|
1160
|
+
// @ts-ignore
|
|
1161
|
+
if (provider.isPrepared) {
|
|
1162
|
+
// @ts-ignore
|
|
1163
|
+
return provider.isPrepared();
|
|
1248
1164
|
}
|
|
1249
|
-
|
|
1250
|
-
return {
|
|
1251
|
-
type: File$2,
|
|
1252
|
-
name: baseName
|
|
1253
|
-
};
|
|
1165
|
+
return false;
|
|
1254
1166
|
};
|
|
1255
|
-
const
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
return !protocol;
|
|
1167
|
+
const getVisibleItems$8 = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
|
|
1168
|
+
const items = picks.map(pick => pick.pick);
|
|
1169
|
+
const visibleItems = state$a.provider.getVisibleItems(items, minLineY, maxLineY, focusedIndex, setSize, icons);
|
|
1170
|
+
return visibleItems;
|
|
1260
1171
|
};
|
|
1261
1172
|
|
|
1262
|
-
|
|
1173
|
+
// provider
|
|
1174
|
+
// - create
|
|
1175
|
+
// - loadcontent
|
|
1176
|
+
// - filter
|
|
1177
|
+
// - getVisible
|
|
1178
|
+
|
|
1179
|
+
// matches could be in loadcontent or getVisible
|
|
1180
|
+
|
|
1181
|
+
const QuickPickEntriesEverything = {
|
|
1263
1182
|
__proto__: null,
|
|
1264
|
-
getFilterValue: getFilterValue$
|
|
1265
|
-
getLabel: getLabel$
|
|
1266
|
-
getNoResults: getNoResults$
|
|
1183
|
+
getFilterValue: getFilterValue$8,
|
|
1184
|
+
getLabel: getLabel$5,
|
|
1185
|
+
getNoResults: getNoResults$8,
|
|
1267
1186
|
getPickDescription: getPickDescription$8,
|
|
1268
1187
|
getPickFileIcon: getPickFileIcon$2,
|
|
1269
1188
|
getPickFilterValue: getPickFilterValue$8,
|
|
1270
|
-
getPickIcon: getPickIcon$
|
|
1271
|
-
getPickLabel: getPickLabel$
|
|
1272
|
-
getPicks: getPicks$
|
|
1273
|
-
getPlaceholder: getPlaceholder$
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1189
|
+
getPickIcon: getPickIcon$8,
|
|
1190
|
+
getPickLabel: getPickLabel$8,
|
|
1191
|
+
getPicks: getPicks$8,
|
|
1192
|
+
getPlaceholder: getPlaceholder$8,
|
|
1193
|
+
getVisibleItems: getVisibleItems$8,
|
|
1194
|
+
isPrepared: isPrepared$8,
|
|
1195
|
+
name: name$8,
|
|
1196
|
+
openCommandPalette,
|
|
1197
|
+
openView,
|
|
1198
|
+
selectPick: selectPick$8,
|
|
1199
|
+
state: state$a
|
|
1277
1200
|
};
|
|
1278
1201
|
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
};
|
|
1202
|
+
const Default$1 = 0;
|
|
1203
|
+
const Finished = 2;
|
|
1282
1204
|
|
|
1283
|
-
const
|
|
1284
|
-
const
|
|
1285
|
-
return '';
|
|
1286
|
-
};
|
|
1287
|
-
const getHelpEntries$3 = () => {
|
|
1288
|
-
return [];
|
|
1289
|
-
};
|
|
1290
|
-
const getNoResults$9 = () => {
|
|
1291
|
-
return undefined;
|
|
1292
|
-
};
|
|
1293
|
-
const getPicks$9 = async () => {
|
|
1294
|
-
const picks = [{
|
|
1295
|
-
label: '1'
|
|
1296
|
-
}, {
|
|
1297
|
-
label: '2'
|
|
1298
|
-
}, {
|
|
1299
|
-
label: '3'
|
|
1300
|
-
}, {
|
|
1301
|
-
label: '4'
|
|
1302
|
-
}, {
|
|
1303
|
-
label: '5'
|
|
1304
|
-
}, {
|
|
1305
|
-
label: '6'
|
|
1306
|
-
}];
|
|
1307
|
-
return picks;
|
|
1308
|
-
};
|
|
1309
|
-
const selectPick$9 = async item => {
|
|
1310
|
-
const rowIndex = Number.parseInt(item.label);
|
|
1311
|
-
const position = {
|
|
1312
|
-
rowIndex,
|
|
1313
|
-
columnIndex: 5
|
|
1314
|
-
};
|
|
1315
|
-
await execute(/* EditorSetCursor.editorSetCursor */'TODO', /* position */position);
|
|
1316
|
-
// TODO put cursor onto that line
|
|
1205
|
+
const create$2 = () => {
|
|
1206
|
+
const states = Object.create(null);
|
|
1317
1207
|
return {
|
|
1318
|
-
|
|
1208
|
+
get(uid) {
|
|
1209
|
+
return states[uid];
|
|
1210
|
+
},
|
|
1211
|
+
set(uid, oldState, newState) {
|
|
1212
|
+
states[uid] = {
|
|
1213
|
+
oldState,
|
|
1214
|
+
newState
|
|
1215
|
+
};
|
|
1216
|
+
},
|
|
1217
|
+
remove(uid) {
|
|
1218
|
+
delete states[uid];
|
|
1219
|
+
}
|
|
1319
1220
|
};
|
|
1320
1221
|
};
|
|
1321
|
-
const getFilterValue$9 = value => {
|
|
1322
|
-
return value;
|
|
1323
|
-
};
|
|
1324
1222
|
|
|
1325
|
-
const
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
getPicks: getPicks$9,
|
|
1331
|
-
getPlaceholder: getPlaceholder$9,
|
|
1332
|
-
name: name$9,
|
|
1333
|
-
selectPick: selectPick$9
|
|
1334
|
-
};
|
|
1223
|
+
const {
|
|
1224
|
+
get,
|
|
1225
|
+
set,
|
|
1226
|
+
remove
|
|
1227
|
+
} = create$2();
|
|
1335
1228
|
|
|
1336
|
-
const
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1229
|
+
const create$1 = ({
|
|
1230
|
+
itemHeight,
|
|
1231
|
+
headerHeight = 0,
|
|
1232
|
+
minimumSliderSize = 20
|
|
1233
|
+
}) => {
|
|
1341
1234
|
return {
|
|
1342
|
-
|
|
1235
|
+
deltaY: 0,
|
|
1236
|
+
minLineY: 0,
|
|
1237
|
+
maxLineY: 0,
|
|
1238
|
+
finalDeltaY: 0,
|
|
1239
|
+
itemHeight,
|
|
1240
|
+
headerHeight,
|
|
1241
|
+
items: [],
|
|
1242
|
+
minimumSliderSize,
|
|
1243
|
+
focusedIndex: -1,
|
|
1244
|
+
touchOffsetY: 0,
|
|
1245
|
+
touchTimeStamp: 0,
|
|
1246
|
+
touchDifference: 0,
|
|
1247
|
+
scrollBarHeight: 0,
|
|
1248
|
+
scrollBarActive: false
|
|
1343
1249
|
};
|
|
1344
1250
|
};
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1347
|
-
|
|
1251
|
+
const getListHeight = (height, headerHeight) => {
|
|
1252
|
+
if (headerHeight) {
|
|
1253
|
+
return height - headerHeight;
|
|
1254
|
+
}
|
|
1255
|
+
return headerHeight;
|
|
1348
1256
|
};
|
|
1349
|
-
const
|
|
1257
|
+
const setDeltaY = (state, deltaY) => {
|
|
1258
|
+
object(state);
|
|
1259
|
+
number(deltaY);
|
|
1260
|
+
const {
|
|
1261
|
+
itemHeight,
|
|
1262
|
+
items,
|
|
1263
|
+
height,
|
|
1264
|
+
headerHeight
|
|
1265
|
+
} = state;
|
|
1266
|
+
const listHeight = getListHeight(height, headerHeight);
|
|
1267
|
+
const itemsLength = items.length;
|
|
1268
|
+
const finalDeltaY = itemsLength * itemHeight - listHeight;
|
|
1269
|
+
if (deltaY < 0) {
|
|
1270
|
+
deltaY = 0;
|
|
1271
|
+
} else if (deltaY > finalDeltaY) {
|
|
1272
|
+
deltaY = Math.max(finalDeltaY, 0);
|
|
1273
|
+
}
|
|
1274
|
+
if (state.deltaY === deltaY) {
|
|
1275
|
+
return state;
|
|
1276
|
+
}
|
|
1277
|
+
const minLineY = Math.round(deltaY / itemHeight);
|
|
1278
|
+
const maxLineY = minLineY + Math.round(listHeight / itemHeight);
|
|
1279
|
+
number(minLineY);
|
|
1280
|
+
number(maxLineY);
|
|
1350
1281
|
return {
|
|
1351
|
-
|
|
1282
|
+
...state,
|
|
1283
|
+
deltaY,
|
|
1284
|
+
minLineY,
|
|
1285
|
+
maxLineY
|
|
1352
1286
|
};
|
|
1353
1287
|
};
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1288
|
+
const handleWheel = (state, deltaMode, deltaY) => {
|
|
1289
|
+
object(state);
|
|
1290
|
+
number(deltaMode);
|
|
1291
|
+
number(deltaY);
|
|
1292
|
+
return setDeltaY(state, state.deltaY + deltaY);
|
|
1356
1293
|
};
|
|
1357
|
-
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1294
|
+
|
|
1295
|
+
const create = (uid, uri, listItemHeight, x, y, width, height, platform, args) => {
|
|
1296
|
+
const state = {
|
|
1297
|
+
uid,
|
|
1298
|
+
icons: [],
|
|
1299
|
+
state: Default$1,
|
|
1300
|
+
picks: [],
|
|
1301
|
+
recentPicks: [],
|
|
1302
|
+
recentPickIds: new Map(),
|
|
1303
|
+
// TODO use object.create(null) instead
|
|
1304
|
+
versionId: 0,
|
|
1305
|
+
provider: QuickPickEntriesEverything,
|
|
1306
|
+
// TODO make this dynamic again
|
|
1307
|
+
warned: [],
|
|
1308
|
+
maxVisibleItems: 10,
|
|
1309
|
+
uri,
|
|
1310
|
+
cursorOffset: 0,
|
|
1311
|
+
height: 300,
|
|
1312
|
+
top: 50,
|
|
1313
|
+
width: 600,
|
|
1314
|
+
...create$1({
|
|
1315
|
+
itemHeight: listItemHeight,
|
|
1316
|
+
headerHeight: 30,
|
|
1317
|
+
minimumSliderSize: minimumSliderSize
|
|
1318
|
+
}),
|
|
1319
|
+
inputSource: User,
|
|
1320
|
+
args,
|
|
1321
|
+
focused: false,
|
|
1322
|
+
platform,
|
|
1323
|
+
value: '',
|
|
1324
|
+
fileIconCache: Object.create(null)
|
|
1325
|
+
};
|
|
1326
|
+
set(uid, state, state);
|
|
1360
1327
|
};
|
|
1361
|
-
|
|
1362
|
-
|
|
1328
|
+
|
|
1329
|
+
const RenderItems = 1;
|
|
1330
|
+
const RenderFocus = 2;
|
|
1331
|
+
const RenderValue = 3;
|
|
1332
|
+
const RenderCursorOffset = 7;
|
|
1333
|
+
const RenderFocusedIndex = 8;
|
|
1334
|
+
const Height = 9;
|
|
1335
|
+
|
|
1336
|
+
const diffType$4 = RenderFocus;
|
|
1337
|
+
const isEqual$4 = (oldState, newState) => {
|
|
1338
|
+
return oldState.focused === newState.focused;
|
|
1363
1339
|
};
|
|
1364
|
-
|
|
1365
|
-
|
|
1340
|
+
|
|
1341
|
+
const diffType$3 = RenderFocusedIndex;
|
|
1342
|
+
const isEqual$3 = (oldState, newState) => {
|
|
1343
|
+
return oldState.focusedIndex === newState.focusedIndex;
|
|
1366
1344
|
};
|
|
1367
|
-
|
|
1368
|
-
|
|
1345
|
+
|
|
1346
|
+
const diffType$2 = Height;
|
|
1347
|
+
const isEqual$2 = (oldState, newState) => {
|
|
1348
|
+
return oldState.items.length === newState.items.length;
|
|
1369
1349
|
};
|
|
1370
|
-
|
|
1371
|
-
|
|
1350
|
+
|
|
1351
|
+
const diffType$1 = RenderItems;
|
|
1352
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1353
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex;
|
|
1372
1354
|
};
|
|
1373
1355
|
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
getNoResults: getNoResults$8,
|
|
1378
|
-
getPickDescription: getPickDescription$7,
|
|
1379
|
-
getPickFilterValue: getPickFilterValue$7,
|
|
1380
|
-
getPickIcon: getPickIcon$6,
|
|
1381
|
-
getPickLabel: getPickLabel$6,
|
|
1382
|
-
getPicks: getPicks$8,
|
|
1383
|
-
getPlaceholder: getPlaceholder$8,
|
|
1384
|
-
isPrepared: isPrepared$6,
|
|
1385
|
-
name: name$8,
|
|
1386
|
-
selectPick: selectPick$8,
|
|
1387
|
-
state: state$7
|
|
1356
|
+
const diffType = RenderValue;
|
|
1357
|
+
const isEqual = (oldState, newState) => {
|
|
1358
|
+
return newState.inputSource === User || oldState.value === newState.value;
|
|
1388
1359
|
};
|
|
1389
1360
|
|
|
1390
|
-
|
|
1361
|
+
const modules = [isEqual$2, isEqual$1, isEqual, isEqual$3, isEqual$4];
|
|
1362
|
+
const numbers = [diffType$2, diffType$1, diffType, diffType$3, diffType$4];
|
|
1391
1363
|
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
// return picks
|
|
1402
|
-
return [];
|
|
1403
|
-
};
|
|
1404
|
-
const selectPick$7 = async item => {
|
|
1405
|
-
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
1406
|
-
// return {
|
|
1407
|
-
// command: QuickPickReturnValue.Hide,
|
|
1408
|
-
// }
|
|
1409
|
-
};
|
|
1410
|
-
const getFilterValue$7 = value => {
|
|
1411
|
-
return value;
|
|
1412
|
-
};
|
|
1413
|
-
const getPickFilterValue$6 = value => {
|
|
1414
|
-
return value;
|
|
1415
|
-
};
|
|
1416
|
-
const getPickLabel$5 = value => {
|
|
1417
|
-
return value;
|
|
1364
|
+
const diff = (oldState, newState) => {
|
|
1365
|
+
const diffResult = [];
|
|
1366
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1367
|
+
const fn = modules[i];
|
|
1368
|
+
if (!fn(oldState, newState)) {
|
|
1369
|
+
diffResult.push(numbers[i]);
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
return diffResult;
|
|
1418
1373
|
};
|
|
1419
|
-
|
|
1420
|
-
|
|
1374
|
+
|
|
1375
|
+
const diff2 = uid => {
|
|
1376
|
+
const {
|
|
1377
|
+
oldState,
|
|
1378
|
+
newState
|
|
1379
|
+
} = get(uid);
|
|
1380
|
+
return diff(oldState, newState);
|
|
1421
1381
|
};
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1382
|
+
|
|
1383
|
+
const dispose = uid => {
|
|
1384
|
+
remove(uid);
|
|
1425
1385
|
};
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1386
|
+
|
|
1387
|
+
const emptyDirent = {
|
|
1388
|
+
name: '',
|
|
1389
|
+
path: '',
|
|
1390
|
+
type: 0
|
|
1429
1391
|
};
|
|
1430
|
-
|
|
1431
|
-
|
|
1392
|
+
|
|
1393
|
+
const getIconsCached = (paths, fileIconCache) => {
|
|
1394
|
+
return paths.map(path => fileIconCache[path]);
|
|
1432
1395
|
};
|
|
1433
1396
|
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1397
|
+
const Directory = 3;
|
|
1398
|
+
const File$1 = 7;
|
|
1399
|
+
|
|
1400
|
+
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1401
|
+
const missingRequests = [];
|
|
1402
|
+
for (const dirent of dirents) {
|
|
1403
|
+
if (!(dirent.path in fileIconCache)) {
|
|
1404
|
+
missingRequests.push({
|
|
1405
|
+
type: File$1,
|
|
1406
|
+
name: dirent.name,
|
|
1407
|
+
path: dirent.path
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return missingRequests;
|
|
1449
1412
|
};
|
|
1450
1413
|
|
|
1451
|
-
const
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1414
|
+
const requestFileIcons = async requests => {
|
|
1415
|
+
const promises = requests.map(request => {
|
|
1416
|
+
if (!request.name) {
|
|
1417
|
+
return '';
|
|
1418
|
+
}
|
|
1419
|
+
return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
|
|
1420
|
+
name: request.name
|
|
1421
|
+
}) : invoke$1('IconTheme.getFolderIcon', {
|
|
1422
|
+
name: request.name
|
|
1423
|
+
});
|
|
1424
|
+
});
|
|
1425
|
+
return Promise.all(promises);
|
|
1454
1426
|
};
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1427
|
+
|
|
1428
|
+
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
1429
|
+
if (missingRequests.length === 0) {
|
|
1430
|
+
return iconCache;
|
|
1431
|
+
}
|
|
1432
|
+
const newFileIconCache = {
|
|
1433
|
+
...iconCache
|
|
1458
1434
|
};
|
|
1435
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
1436
|
+
const request = missingRequests[i];
|
|
1437
|
+
const icon = newIcons[i];
|
|
1438
|
+
newFileIconCache[request.path] = icon;
|
|
1439
|
+
}
|
|
1440
|
+
return newFileIconCache;
|
|
1459
1441
|
};
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1442
|
+
|
|
1443
|
+
const getQuickPickFileIcons = async (provider, items, fileIconCache) => {
|
|
1444
|
+
const dirents = items.map(item => {
|
|
1445
|
+
const dirent = provider.getPickFileIcon?.(item) || emptyDirent;
|
|
1446
|
+
return dirent;
|
|
1447
|
+
});
|
|
1448
|
+
const missingRequests = getMissingIconRequests(dirents, fileIconCache);
|
|
1449
|
+
const newIcons = await requestFileIcons(missingRequests);
|
|
1450
|
+
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
1451
|
+
const paths = dirents.map(file => file.path);
|
|
1452
|
+
const icons = getIconsCached(paths, newFileIconCache);
|
|
1465
1453
|
return {
|
|
1466
|
-
|
|
1454
|
+
icons,
|
|
1455
|
+
newFileIconCache
|
|
1467
1456
|
};
|
|
1468
1457
|
};
|
|
1469
|
-
const getFilterValue$6 = value => {
|
|
1470
|
-
return value;
|
|
1471
|
-
};
|
|
1472
1458
|
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
};
|
|
1459
|
+
const focusIndex = async (state, index) => {
|
|
1460
|
+
const {
|
|
1461
|
+
provider,
|
|
1462
|
+
maxVisibleItems,
|
|
1463
|
+
items,
|
|
1464
|
+
minLineY,
|
|
1465
|
+
maxLineY,
|
|
1466
|
+
fileIconCache
|
|
1467
|
+
} = state;
|
|
1468
|
+
// TODO get types working
|
|
1469
|
+
// @ts-ignore
|
|
1470
|
+
if (provider.focusPick) {
|
|
1471
|
+
// @ts-ignore
|
|
1472
|
+
await provider.focusPick(items[index].pick);
|
|
1473
|
+
}
|
|
1474
|
+
if (index < minLineY + 1) {
|
|
1475
|
+
const minLineY = index;
|
|
1476
|
+
const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
|
|
1477
|
+
const sliced = items.slice(minLineY, maxLineY);
|
|
1478
|
+
const {
|
|
1479
|
+
newFileIconCache,
|
|
1480
|
+
icons
|
|
1481
|
+
} = await getQuickPickFileIcons(provider, sliced, fileIconCache);
|
|
1482
1482
|
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1483
|
+
// TODO need to scroll up
|
|
1484
|
+
return {
|
|
1485
|
+
...state,
|
|
1486
|
+
minLineY,
|
|
1487
|
+
maxLineY,
|
|
1488
|
+
focusedIndex: index,
|
|
1489
|
+
icons,
|
|
1490
|
+
fileIconCache: newFileIconCache
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
if (index >= maxLineY - 1) {
|
|
1494
|
+
// TODO need to scroll down
|
|
1495
|
+
const maxLineY = index + 1;
|
|
1496
|
+
const minLineY = Math.max(maxLineY - maxVisibleItems, 0);
|
|
1497
|
+
const sliced = items.slice(minLineY, maxLineY);
|
|
1498
|
+
const {
|
|
1499
|
+
newFileIconCache,
|
|
1500
|
+
icons
|
|
1501
|
+
} = await getQuickPickFileIcons(provider, sliced, fileIconCache);
|
|
1502
|
+
return {
|
|
1503
|
+
...state,
|
|
1504
|
+
minLineY,
|
|
1505
|
+
maxLineY,
|
|
1506
|
+
focusedIndex: index,
|
|
1507
|
+
fileIconCache: newFileIconCache,
|
|
1508
|
+
icons
|
|
1509
|
+
};
|
|
1500
1510
|
}
|
|
1511
|
+
const sliced = items.slice(minLineY, maxLineY);
|
|
1512
|
+
const {
|
|
1513
|
+
newFileIconCache,
|
|
1514
|
+
icons
|
|
1515
|
+
} = await getQuickPickFileIcons(provider, sliced, fileIconCache);
|
|
1516
|
+
return {
|
|
1517
|
+
...state,
|
|
1518
|
+
focusedIndex: index,
|
|
1519
|
+
fileIconCache: newFileIconCache,
|
|
1520
|
+
icons
|
|
1521
|
+
};
|
|
1501
1522
|
};
|
|
1502
1523
|
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1505
|
-
return '';
|
|
1506
|
-
};
|
|
1507
|
-
const getNoResults$5 = () => {
|
|
1508
|
-
return noResults();
|
|
1509
|
-
};
|
|
1510
|
-
const getPicks$5 = async value => {
|
|
1511
|
-
return [];
|
|
1524
|
+
const first = () => {
|
|
1525
|
+
return 0;
|
|
1512
1526
|
};
|
|
1513
|
-
const
|
|
1514
|
-
return
|
|
1515
|
-
command: Hide
|
|
1516
|
-
};
|
|
1527
|
+
const last = items => {
|
|
1528
|
+
return items.length - 1;
|
|
1517
1529
|
};
|
|
1518
|
-
const
|
|
1519
|
-
return
|
|
1530
|
+
const next = (items, index) => {
|
|
1531
|
+
return (index + 1) % items.length;
|
|
1520
1532
|
};
|
|
1521
|
-
const
|
|
1522
|
-
return
|
|
1533
|
+
const previous = (items, index) => {
|
|
1534
|
+
return index === 0 ? items.length - 1 : index - 1;
|
|
1523
1535
|
};
|
|
1524
1536
|
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1527
|
-
getFilterValue: getFilterValue$5,
|
|
1528
|
-
getNoResults: getNoResults$5,
|
|
1529
|
-
getPickFilterValue: getPickFilterValue$5,
|
|
1530
|
-
getPicks: getPicks$5,
|
|
1531
|
-
getPlaceholder: getPlaceholder$5,
|
|
1532
|
-
name: name$5,
|
|
1533
|
-
selectPick: selectPick$5
|
|
1537
|
+
const focusFirst = state => {
|
|
1538
|
+
return focusIndex(state, first());
|
|
1534
1539
|
};
|
|
1535
1540
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
prefix: 'string-that-should-never-match-another-string'
|
|
1541
|
+
const focusLast = state => {
|
|
1542
|
+
const {
|
|
1543
|
+
items
|
|
1544
|
+
} = state;
|
|
1545
|
+
return focusIndex(state, last(items));
|
|
1542
1546
|
};
|
|
1543
1547
|
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
const getLabel$3 = () => {
|
|
1552
|
-
return '';
|
|
1553
|
-
};
|
|
1554
|
-
const getNoResults$4 = () => {
|
|
1555
|
-
return state$5.provider.getNoResults();
|
|
1548
|
+
const focusNext = state => {
|
|
1549
|
+
const {
|
|
1550
|
+
items,
|
|
1551
|
+
focusedIndex
|
|
1552
|
+
} = state;
|
|
1553
|
+
const nextIndex = next(items, focusedIndex);
|
|
1554
|
+
return focusIndex(state, nextIndex);
|
|
1556
1555
|
};
|
|
1557
|
-
const getPicks$4 = async value => {
|
|
1558
|
-
const prefix = getQuickPickPrefix(value);
|
|
1559
1556
|
|
|
1560
|
-
|
|
1561
|
-
if (state$5.prefix !== prefix) {
|
|
1562
|
-
state$5.prefix = prefix;
|
|
1563
|
-
state$5.provider = await getQuickPickProvider(prefix);
|
|
1564
|
-
}
|
|
1565
|
-
// TODO this line is a bit duplicated with getFilterValue
|
|
1566
|
-
const slicedValue = value.slice(prefix.length).trimStart();
|
|
1567
|
-
const picks = await state$5.provider.getPicks(slicedValue);
|
|
1568
|
-
return picks;
|
|
1569
|
-
};
|
|
1570
|
-
const selectPick$4 = item => {
|
|
1557
|
+
const focusPrevious = state => {
|
|
1571
1558
|
const {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
// show('>')
|
|
1578
|
-
};
|
|
1579
|
-
const openView = () => {
|
|
1580
|
-
// show('view ')
|
|
1581
|
-
};
|
|
1582
|
-
const getFilterValue$4 = value => {
|
|
1583
|
-
return value.slice(state$5.prefix.length).trim();
|
|
1559
|
+
items,
|
|
1560
|
+
focusedIndex
|
|
1561
|
+
} = state;
|
|
1562
|
+
const previousIndex = previous(items, focusedIndex);
|
|
1563
|
+
return focusIndex(state, previousIndex);
|
|
1584
1564
|
};
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
return
|
|
1590
|
-
};
|
|
1591
|
-
const getPickDescription$5 = pick => {
|
|
1592
|
-
const {
|
|
1593
|
-
provider
|
|
1594
|
-
} = state$5;
|
|
1595
|
-
// @ts-ignore
|
|
1596
|
-
if (provider.getPickDescription) {
|
|
1597
|
-
// @ts-ignore
|
|
1598
|
-
return provider.getPickDescription(pick);
|
|
1599
|
-
}
|
|
1600
|
-
return '';
|
|
1601
|
-
};
|
|
1602
|
-
const getPickLabel$4 = pick => {
|
|
1603
|
-
const {
|
|
1604
|
-
provider
|
|
1605
|
-
} = state$5;
|
|
1606
|
-
// @ts-ignore
|
|
1607
|
-
return provider.getPickLabel(pick);
|
|
1608
|
-
};
|
|
1609
|
-
const getPickIcon$4 = pick => {
|
|
1610
|
-
const {
|
|
1611
|
-
provider
|
|
1612
|
-
} = state$5;
|
|
1613
|
-
// @ts-ignore
|
|
1614
|
-
return provider.getPickIcon(pick);
|
|
1615
|
-
};
|
|
1616
|
-
const getPickFileIcon$1 = pick => {
|
|
1617
|
-
const {
|
|
1618
|
-
provider
|
|
1619
|
-
} = state$5;
|
|
1620
|
-
// @ts-ignore
|
|
1621
|
-
if (provider.getPickFileIcon) {
|
|
1622
|
-
// @ts-ignore
|
|
1623
|
-
return provider.getPickFileIcon(pick);
|
|
1624
|
-
}
|
|
1625
|
-
return '';
|
|
1626
|
-
};
|
|
1627
|
-
const isPrepared$4 = () => {
|
|
1628
|
-
const {
|
|
1629
|
-
provider
|
|
1630
|
-
} = state$5;
|
|
1631
|
-
// @ts-ignore
|
|
1632
|
-
if (provider.isPrepared) {
|
|
1633
|
-
// @ts-ignore
|
|
1634
|
-
return provider.isPrepared();
|
|
1635
|
-
}
|
|
1636
|
-
return false;
|
|
1565
|
+
|
|
1566
|
+
const commandIds = ['close', 'dispose', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleBeforeInput', 'handleBlur', 'handleClickAt', 'diff2', 'handleFocus', 'handleInput', 'handleWheel', 'renderEventListeners', 'selectCurrentIndex', 'selectIndex', 'selectItem', 'setValue'];
|
|
1567
|
+
|
|
1568
|
+
const getCommandIds = () => {
|
|
1569
|
+
return commandIds;
|
|
1637
1570
|
};
|
|
1638
1571
|
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
getPickFileIcon: getPickFileIcon$1,
|
|
1646
|
-
getPickFilterValue: getPickFilterValue$4,
|
|
1647
|
-
getPickIcon: getPickIcon$4,
|
|
1648
|
-
getPickLabel: getPickLabel$4,
|
|
1649
|
-
getPicks: getPicks$4,
|
|
1650
|
-
getPlaceholder: getPlaceholder$4,
|
|
1651
|
-
isPrepared: isPrepared$4,
|
|
1652
|
-
name: name$4,
|
|
1653
|
-
openCommandPalette,
|
|
1654
|
-
openView,
|
|
1655
|
-
selectPick: selectPick$4,
|
|
1656
|
-
state: state$5
|
|
1657
|
-
};
|
|
1572
|
+
const Enter = 3;
|
|
1573
|
+
const Escape = 8;
|
|
1574
|
+
const PageUp = 10;
|
|
1575
|
+
const PageDown = 11;
|
|
1576
|
+
const UpArrow = 14;
|
|
1577
|
+
const DownArrow = 16;
|
|
1658
1578
|
|
|
1659
|
-
const
|
|
1660
|
-
const Finished = 2;
|
|
1579
|
+
const FocusQuickPickInput = 20;
|
|
1661
1580
|
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1581
|
+
const getKeyBindings = () => {
|
|
1582
|
+
return [{
|
|
1583
|
+
key: Escape,
|
|
1584
|
+
command: 'Viewlet.closeWidget',
|
|
1585
|
+
args: ['QuickPick'],
|
|
1586
|
+
when: FocusQuickPickInput
|
|
1587
|
+
}, {
|
|
1588
|
+
key: UpArrow,
|
|
1589
|
+
command: 'QuickPick.focusPrevious',
|
|
1590
|
+
when: FocusQuickPickInput
|
|
1591
|
+
}, {
|
|
1592
|
+
key: DownArrow,
|
|
1593
|
+
command: 'QuickPick.focusNext',
|
|
1594
|
+
when: FocusQuickPickInput
|
|
1595
|
+
}, {
|
|
1596
|
+
key: PageUp,
|
|
1597
|
+
command: 'QuickPick.focusFirst',
|
|
1598
|
+
when: FocusQuickPickInput
|
|
1599
|
+
}, {
|
|
1600
|
+
key: PageDown,
|
|
1601
|
+
command: 'QuickPick.focusLast',
|
|
1602
|
+
when: FocusQuickPickInput
|
|
1603
|
+
}, {
|
|
1604
|
+
key: Enter,
|
|
1605
|
+
command: 'QuickPick.selectCurrentIndex',
|
|
1606
|
+
when: FocusQuickPickInput
|
|
1607
|
+
}];
|
|
1678
1608
|
};
|
|
1679
1609
|
|
|
1680
|
-
const
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1610
|
+
const InsertText = 'insertText';
|
|
1611
|
+
const DeleteContentBackward = 'deleteContentBackward';
|
|
1612
|
+
const DeleteContentForward = 'deleteContentForward';
|
|
1613
|
+
const DeleteWordForward = 'deleteWordForward';
|
|
1614
|
+
const DeleteWordBackward = 'deleteWordBackward';
|
|
1615
|
+
const InsertLineBreak = 'insertLineBreak';
|
|
1616
|
+
const InsertCompositionText = 'insertCompositionText';
|
|
1617
|
+
const InsertFromPaste = 'insertFromPaste';
|
|
1685
1618
|
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1619
|
+
const RE_ALPHA_NUMERIC = /[a-z\d]/i;
|
|
1620
|
+
const isAlphaNumeric = character => {
|
|
1621
|
+
return RE_ALPHA_NUMERIC.test(character);
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
const getNewValueInsertText = (value, selectionStart, selectionEnd, data) => {
|
|
1625
|
+
if (selectionStart === value.length) {
|
|
1626
|
+
const newValue = value + data;
|
|
1627
|
+
return {
|
|
1628
|
+
newValue,
|
|
1629
|
+
cursorOffset: newValue.length
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
const before = value.slice(0, selectionStart);
|
|
1633
|
+
const after = value.slice(selectionEnd);
|
|
1634
|
+
const newValue = before + data + after;
|
|
1691
1635
|
return {
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
maxLineY: 0,
|
|
1695
|
-
finalDeltaY: 0,
|
|
1696
|
-
itemHeight,
|
|
1697
|
-
headerHeight,
|
|
1698
|
-
items: [],
|
|
1699
|
-
minimumSliderSize,
|
|
1700
|
-
focusedIndex: -1,
|
|
1701
|
-
touchOffsetY: 0,
|
|
1702
|
-
touchTimeStamp: 0,
|
|
1703
|
-
touchDifference: 0,
|
|
1704
|
-
scrollBarHeight: 0,
|
|
1705
|
-
scrollBarActive: false
|
|
1636
|
+
newValue,
|
|
1637
|
+
cursorOffset: selectionStart + data.length
|
|
1706
1638
|
};
|
|
1707
1639
|
};
|
|
1708
|
-
const
|
|
1709
|
-
|
|
1710
|
-
|
|
1640
|
+
const getNewValueDeleteContentBackward = (value, selectionStart, selectionEnd, data) => {
|
|
1641
|
+
const after = value.slice(selectionEnd);
|
|
1642
|
+
if (selectionStart === selectionEnd) {
|
|
1643
|
+
const before = value.slice(0, selectionStart - 1);
|
|
1644
|
+
const newValue = before + after;
|
|
1645
|
+
return {
|
|
1646
|
+
newValue,
|
|
1647
|
+
cursorOffset: before.length
|
|
1648
|
+
};
|
|
1711
1649
|
}
|
|
1712
|
-
|
|
1650
|
+
const before = value.slice(0, selectionStart);
|
|
1651
|
+
const newValue = before + after;
|
|
1652
|
+
return {
|
|
1653
|
+
newValue,
|
|
1654
|
+
cursorOffset: selectionStart
|
|
1655
|
+
};
|
|
1713
1656
|
};
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
deltaY = 0;
|
|
1728
|
-
} else if (deltaY > finalDeltaY) {
|
|
1729
|
-
deltaY = Math.max(finalDeltaY, 0);
|
|
1730
|
-
}
|
|
1731
|
-
if (state.deltaY === deltaY) {
|
|
1732
|
-
return state;
|
|
1657
|
+
const getNewValueDeleteWordBackward = (value, selectionStart, selectionEnd, data) => {
|
|
1658
|
+
const after = value.slice(selectionEnd);
|
|
1659
|
+
if (selectionStart === selectionEnd) {
|
|
1660
|
+
let startIndex = Math.max(selectionStart - 1, 0);
|
|
1661
|
+
while (startIndex > 0 && isAlphaNumeric(value[startIndex])) {
|
|
1662
|
+
startIndex--;
|
|
1663
|
+
}
|
|
1664
|
+
const before = value.slice(0, startIndex);
|
|
1665
|
+
const newValue = before + after;
|
|
1666
|
+
return {
|
|
1667
|
+
newValue,
|
|
1668
|
+
cursorOffset: before.length
|
|
1669
|
+
};
|
|
1733
1670
|
}
|
|
1734
|
-
const
|
|
1735
|
-
const
|
|
1736
|
-
number(minLineY);
|
|
1737
|
-
number(maxLineY);
|
|
1671
|
+
const before = value.slice(0, selectionStart);
|
|
1672
|
+
const newValue = before + after;
|
|
1738
1673
|
return {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
minLineY,
|
|
1742
|
-
maxLineY
|
|
1674
|
+
newValue,
|
|
1675
|
+
cursorOffset: selectionStart
|
|
1743
1676
|
};
|
|
1744
1677
|
};
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
versionId: 0,
|
|
1761
|
-
provider: QuickPickEntriesEverything,
|
|
1762
|
-
// TODO make this dynamic again
|
|
1763
|
-
warned: [],
|
|
1764
|
-
visiblePicks: [],
|
|
1765
|
-
maxVisibleItems: 10,
|
|
1766
|
-
uri,
|
|
1767
|
-
cursorOffset: 0,
|
|
1768
|
-
height: 300,
|
|
1769
|
-
top: 50,
|
|
1770
|
-
width: 600,
|
|
1771
|
-
...create$1({
|
|
1772
|
-
itemHeight: listItemHeight,
|
|
1773
|
-
headerHeight: 30,
|
|
1774
|
-
minimumSliderSize: minimumSliderSize
|
|
1775
|
-
}),
|
|
1776
|
-
inputSource: User,
|
|
1777
|
-
args,
|
|
1778
|
-
focused: false,
|
|
1779
|
-
platform,
|
|
1780
|
-
value: ''
|
|
1678
|
+
const getNewValueDeleteContentForward = (value, selectionStart, selectionEnd, data) => {
|
|
1679
|
+
const before = value.slice(0, selectionStart);
|
|
1680
|
+
if (selectionStart === selectionEnd) {
|
|
1681
|
+
const after = value.slice(selectionEnd + 1);
|
|
1682
|
+
const newValue = before + after;
|
|
1683
|
+
return {
|
|
1684
|
+
newValue,
|
|
1685
|
+
cursorOffset: selectionStart
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
const after = value.slice(selectionEnd);
|
|
1689
|
+
const newValue = before + after;
|
|
1690
|
+
return {
|
|
1691
|
+
newValue,
|
|
1692
|
+
cursorOffset: selectionStart
|
|
1781
1693
|
};
|
|
1782
|
-
set(uid, state, state);
|
|
1783
1694
|
};
|
|
1784
|
-
|
|
1785
|
-
const
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
return oldState.items.length === newState.items.length;
|
|
1695
|
+
const getNewValueDeleteWordForward = (value, selectionStart, selectionEnd, data) => {
|
|
1696
|
+
const before = value.slice(0, selectionStart);
|
|
1697
|
+
if (selectionStart === selectionEnd) {
|
|
1698
|
+
let startIndex = Math.min(selectionStart + 1, value.length - 1);
|
|
1699
|
+
while (startIndex < value.length && isAlphaNumeric(value[startIndex])) {
|
|
1700
|
+
startIndex++;
|
|
1701
|
+
}
|
|
1702
|
+
const after = value.slice(startIndex);
|
|
1703
|
+
const newValue = before + after;
|
|
1704
|
+
return {
|
|
1705
|
+
newValue,
|
|
1706
|
+
cursorOffset: before.length
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
const after = value.slice(selectionEnd);
|
|
1710
|
+
const newValue = before + after;
|
|
1711
|
+
return {
|
|
1712
|
+
newValue,
|
|
1713
|
+
cursorOffset: selectionStart
|
|
1714
|
+
};
|
|
1805
1715
|
};
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
const isEqual$1 = (oldState, newState) => {
|
|
1809
|
-
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex;
|
|
1716
|
+
const getNewValueInsertCompositionText = (value, selectionStart, selectionEnd, data) => {
|
|
1717
|
+
return getNewValueInsertText(value, selectionStart, selectionEnd, data);
|
|
1810
1718
|
};
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1719
|
+
const getNewValueInsertLineBreak = (value, selectionStart, selectionEnd, data) => {
|
|
1720
|
+
return {
|
|
1721
|
+
newValue: value,
|
|
1722
|
+
cursorOffset: selectionEnd
|
|
1723
|
+
};
|
|
1815
1724
|
};
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1725
|
+
const getNewValueFunction = inputType => {
|
|
1726
|
+
switch (inputType) {
|
|
1727
|
+
case InsertFromPaste:
|
|
1728
|
+
case InsertText:
|
|
1729
|
+
return getNewValueInsertText;
|
|
1730
|
+
case DeleteContentBackward:
|
|
1731
|
+
return getNewValueDeleteContentBackward;
|
|
1732
|
+
case DeleteContentForward:
|
|
1733
|
+
return getNewValueDeleteContentForward;
|
|
1734
|
+
case DeleteWordForward:
|
|
1735
|
+
return getNewValueDeleteWordForward;
|
|
1736
|
+
case DeleteWordBackward:
|
|
1737
|
+
return getNewValueDeleteWordBackward;
|
|
1738
|
+
case InsertLineBreak:
|
|
1739
|
+
return getNewValueInsertLineBreak;
|
|
1740
|
+
case InsertCompositionText:
|
|
1741
|
+
return getNewValueInsertCompositionText;
|
|
1742
|
+
default:
|
|
1743
|
+
throw new Error(`unsupported input type ${inputType}`);
|
|
1827
1744
|
}
|
|
1828
|
-
return diffResult;
|
|
1829
1745
|
};
|
|
1830
1746
|
|
|
1831
|
-
const
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
newState
|
|
1835
|
-
} = get(uid);
|
|
1836
|
-
return diff(oldState, newState);
|
|
1837
|
-
};
|
|
1838
|
-
|
|
1839
|
-
const dispose = uid => {
|
|
1840
|
-
remove(uid);
|
|
1747
|
+
const getNewValue = (value, inputType, data, selectionStart, selectionEnd) => {
|
|
1748
|
+
const fn = getNewValueFunction(inputType);
|
|
1749
|
+
return fn(value, selectionStart, selectionEnd, data);
|
|
1841
1750
|
};
|
|
1842
1751
|
|
|
1843
1752
|
const emptyMatches = [];
|
|
@@ -1999,1236 +1908,1304 @@ const fuzzySearch = (pattern, word) => {
|
|
|
1999
1908
|
if (!strongMatch) {
|
|
2000
1909
|
return EmptyMatches;
|
|
2001
1910
|
}
|
|
2002
|
-
const highlights = traceHighlights(table, arrows, patternLength, wordLength);
|
|
2003
|
-
return highlights;
|
|
1911
|
+
const highlights = traceHighlights(table, arrows, patternLength, wordLength);
|
|
1912
|
+
return highlights;
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1915
|
+
const filterQuickPickItem = (pattern, word) => {
|
|
1916
|
+
const matches = fuzzySearch(pattern, word);
|
|
1917
|
+
return matches;
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
// TODO this should be in FileSystem module
|
|
1921
|
+
const pathBaseName = path => {
|
|
1922
|
+
return path.slice(path.lastIndexOf('/') + 1);
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
// TODO this should be in FileSystem module
|
|
1926
|
+
const pathDirName = path => {
|
|
1927
|
+
const pathSeparator = '/';
|
|
1928
|
+
const index = path.lastIndexOf(pathSeparator);
|
|
1929
|
+
if (index === -1) {
|
|
1930
|
+
return '';
|
|
1931
|
+
}
|
|
1932
|
+
return path.slice(0, index);
|
|
1933
|
+
};
|
|
1934
|
+
|
|
1935
|
+
const filterQuickPickItems = (items, value, provider) => {
|
|
1936
|
+
if (!value) {
|
|
1937
|
+
return items.map(convertToPick);
|
|
1938
|
+
}
|
|
1939
|
+
const results = [];
|
|
1940
|
+
for (const item of items) {
|
|
1941
|
+
let filterValue = '';
|
|
1942
|
+
if (provider) {
|
|
1943
|
+
// @ts-ignore
|
|
1944
|
+
filterValue = provider.getPickLabel(item);
|
|
1945
|
+
} else {
|
|
1946
|
+
filterValue = pathBaseName(item);
|
|
1947
|
+
}
|
|
1948
|
+
const matches = filterQuickPickItem(value, filterValue);
|
|
1949
|
+
if (matches.length > 0) {
|
|
1950
|
+
results.push({
|
|
1951
|
+
pick: item,
|
|
1952
|
+
matches
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
return results;
|
|
1957
|
+
};
|
|
1958
|
+
|
|
1959
|
+
// TODO when user types letters -> no need to query provider again -> just filter existing results
|
|
1960
|
+
const setValue = async (state, newValue) => {
|
|
1961
|
+
const {
|
|
1962
|
+
value,
|
|
1963
|
+
provider,
|
|
1964
|
+
minLineY,
|
|
1965
|
+
maxLineY,
|
|
1966
|
+
fileIconCache
|
|
1967
|
+
} = state;
|
|
1968
|
+
if (value === newValue) {
|
|
1969
|
+
return state;
|
|
1970
|
+
}
|
|
1971
|
+
const newPicks = await provider.getPicks(newValue);
|
|
1972
|
+
const filterValue = provider.getFilterValue(newValue);
|
|
1973
|
+
const items = filterQuickPickItems(newPicks, filterValue, provider);
|
|
1974
|
+
const focusedIndex = items.length === 0 ? -1 : 0;
|
|
1975
|
+
const sliced = newPicks.slice(minLineY, maxLineY);
|
|
1976
|
+
const {
|
|
1977
|
+
newFileIconCache,
|
|
1978
|
+
icons
|
|
1979
|
+
} = await getQuickPickFileIcons(provider, sliced, fileIconCache);
|
|
1980
|
+
return {
|
|
1981
|
+
...state,
|
|
1982
|
+
picks: newPicks,
|
|
1983
|
+
items,
|
|
1984
|
+
focusedIndex,
|
|
1985
|
+
inputSource: Script,
|
|
1986
|
+
value: newValue,
|
|
1987
|
+
icons,
|
|
1988
|
+
fileIconCache: newFileIconCache
|
|
1989
|
+
};
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
// TODO when user types letters -> no need to query provider again -> just filter existing results
|
|
1993
|
+
const handleInput = async (state, newValue, cursorOffset, inputSource = Script) => {
|
|
1994
|
+
if (state.value === newValue) {
|
|
1995
|
+
return state;
|
|
1996
|
+
}
|
|
1997
|
+
const newState = await setValue(state, newValue);
|
|
1998
|
+
return {
|
|
1999
|
+
...newState,
|
|
2000
|
+
cursorOffset,
|
|
2001
|
+
inputSource
|
|
2002
|
+
};
|
|
2003
|
+
};
|
|
2004
|
+
|
|
2005
|
+
const handleBeforeInput = (state, inputType, data, selectionStart, selectionEnd) => {
|
|
2006
|
+
string(inputType);
|
|
2007
|
+
number(selectionStart);
|
|
2008
|
+
number(selectionEnd);
|
|
2009
|
+
const {
|
|
2010
|
+
value
|
|
2011
|
+
} = state;
|
|
2012
|
+
const {
|
|
2013
|
+
newValue,
|
|
2014
|
+
cursorOffset
|
|
2015
|
+
} = getNewValue(value, inputType, data, selectionStart, selectionEnd);
|
|
2016
|
+
return handleInput(state, newValue, cursorOffset, User);
|
|
2017
|
+
};
|
|
2018
|
+
|
|
2019
|
+
const handleBlur = async state => {
|
|
2020
|
+
// TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
|
|
2021
|
+
// await CloseWidget.closeWidget(state.uid)
|
|
2022
|
+
return state;
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
const getPick = (items, index) => {
|
|
2026
|
+
array(items);
|
|
2027
|
+
number(index);
|
|
2028
|
+
// if (index < state.recentPicks.length) {
|
|
2029
|
+
// return state.recentPicks[index]
|
|
2030
|
+
// }
|
|
2031
|
+
// index -= state.recentPicks.length
|
|
2032
|
+
if (index < items.length) {
|
|
2033
|
+
return items[index].pick;
|
|
2034
|
+
}
|
|
2035
|
+
console.warn('no pick matching index', index);
|
|
2036
|
+
};
|
|
2037
|
+
|
|
2038
|
+
const selectIndex = async (state, index, button = /* left */0) => {
|
|
2039
|
+
const {
|
|
2040
|
+
minLineY,
|
|
2041
|
+
provider,
|
|
2042
|
+
items
|
|
2043
|
+
} = state;
|
|
2044
|
+
const actualIndex = index + minLineY;
|
|
2045
|
+
const pick = getPick(items, actualIndex);
|
|
2046
|
+
// @ts-ignore
|
|
2047
|
+
const selectPickResult = await provider.selectPick(pick, actualIndex, button);
|
|
2048
|
+
object(selectPickResult);
|
|
2049
|
+
string(selectPickResult.command);
|
|
2050
|
+
const {
|
|
2051
|
+
command
|
|
2052
|
+
} = selectPickResult;
|
|
2053
|
+
switch (command) {
|
|
2054
|
+
case Hide:
|
|
2055
|
+
await closeWidget(state.uid);
|
|
2056
|
+
return state;
|
|
2057
|
+
default:
|
|
2058
|
+
return state;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
// TODO recent picks should be per provider
|
|
2062
|
+
// if (!state.recentPickIds.has(pick.id)) {
|
|
2063
|
+
// state.recentPicks.unshift(pick)
|
|
2064
|
+
// state.recentPickIds.add(pick.id)
|
|
2065
|
+
// }
|
|
2066
|
+
// if (state.recentPicks.length > RECENT_PICKS_MAX_SIZE) {
|
|
2067
|
+
// const last = state.recentPicks.pop()
|
|
2068
|
+
// state.recentPickIds.delete(last.id)
|
|
2069
|
+
// }
|
|
2004
2070
|
};
|
|
2005
2071
|
|
|
2006
|
-
const
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2072
|
+
const handleClickAt = (state, x, y) => {
|
|
2073
|
+
const {
|
|
2074
|
+
top,
|
|
2075
|
+
headerHeight,
|
|
2076
|
+
itemHeight
|
|
2077
|
+
} = state;
|
|
2078
|
+
const relativeY = y - top - headerHeight;
|
|
2079
|
+
const index = Math.floor(relativeY / itemHeight);
|
|
2080
|
+
return selectIndex(state, index);
|
|
2009
2081
|
};
|
|
2010
2082
|
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2083
|
+
const setFocus = async focusKey => {
|
|
2084
|
+
await invoke$1('Focus.setFocus', focusKey);
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
const handleFocus = async state => {
|
|
2088
|
+
// TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
|
|
2089
|
+
await setFocus(FocusQuickPickInput);
|
|
2090
|
+
// await CloseWidget.closeWidget(state.uid)
|
|
2091
|
+
return state;
|
|
2092
|
+
};
|
|
2093
|
+
|
|
2094
|
+
const getDefaultValue = uri => {
|
|
2095
|
+
switch (uri) {
|
|
2096
|
+
case 'quickPick://everything':
|
|
2097
|
+
return '>';
|
|
2098
|
+
default:
|
|
2099
|
+
return '';
|
|
2030
2100
|
}
|
|
2031
|
-
return results;
|
|
2032
2101
|
};
|
|
2033
2102
|
|
|
2034
|
-
const
|
|
2103
|
+
const loadContent = async state => {
|
|
2035
2104
|
const {
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
minLineY,
|
|
2040
|
-
maxLineY
|
|
2105
|
+
uri,
|
|
2106
|
+
args,
|
|
2107
|
+
fileIconCache
|
|
2041
2108
|
} = state;
|
|
2042
|
-
|
|
2109
|
+
const value = getDefaultValue(uri);
|
|
2110
|
+
const provider = get$1(uri);
|
|
2043
2111
|
// @ts-ignore
|
|
2044
|
-
if (provider.
|
|
2112
|
+
if (provider.setArgs) {
|
|
2045
2113
|
// @ts-ignore
|
|
2046
|
-
|
|
2047
|
-
}
|
|
2048
|
-
if (index < minLineY + 1) {
|
|
2049
|
-
const minLineY = index;
|
|
2050
|
-
const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
|
|
2051
|
-
// TODO need to scroll up
|
|
2052
|
-
return {
|
|
2053
|
-
...state,
|
|
2054
|
-
minLineY,
|
|
2055
|
-
maxLineY,
|
|
2056
|
-
focusedIndex: index
|
|
2057
|
-
};
|
|
2058
|
-
}
|
|
2059
|
-
if (index >= maxLineY - 1) {
|
|
2060
|
-
// TODO need to scroll down
|
|
2061
|
-
const maxLineY = index + 1;
|
|
2062
|
-
const minLineY = Math.max(maxLineY - maxVisibleItems, 0);
|
|
2063
|
-
return {
|
|
2064
|
-
...state,
|
|
2065
|
-
minLineY,
|
|
2066
|
-
maxLineY,
|
|
2067
|
-
focusedIndex: index
|
|
2068
|
-
};
|
|
2114
|
+
provider.setArgs(args);
|
|
2069
2115
|
}
|
|
2116
|
+
const newPicks = await provider.getPicks(value);
|
|
2117
|
+
array(newPicks);
|
|
2118
|
+
const filterValue = provider.getFilterValue(value);
|
|
2119
|
+
const items = filterQuickPickItems(newPicks, filterValue, provider);
|
|
2120
|
+
const minLineY = 0;
|
|
2121
|
+
const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
|
|
2122
|
+
const sliced = newPicks.slice(minLineY, maxLineY);
|
|
2123
|
+
const {
|
|
2124
|
+
newFileIconCache,
|
|
2125
|
+
icons
|
|
2126
|
+
} = await getQuickPickFileIcons(provider, sliced, fileIconCache);
|
|
2070
2127
|
return {
|
|
2071
2128
|
...state,
|
|
2072
|
-
|
|
2129
|
+
picks: newPicks,
|
|
2130
|
+
items,
|
|
2131
|
+
focusedIndex: 0,
|
|
2132
|
+
state: Finished,
|
|
2133
|
+
minLineY,
|
|
2134
|
+
maxLineY,
|
|
2135
|
+
value,
|
|
2136
|
+
cursorOffset: value.length,
|
|
2137
|
+
provider,
|
|
2138
|
+
inputSource: Script,
|
|
2139
|
+
focused: true,
|
|
2140
|
+
fileIconCache: newFileIconCache,
|
|
2141
|
+
icons
|
|
2073
2142
|
};
|
|
2074
2143
|
};
|
|
2075
2144
|
|
|
2076
|
-
const
|
|
2077
|
-
|
|
2078
|
-
};
|
|
2079
|
-
const last = items => {
|
|
2080
|
-
return items.length - 1;
|
|
2145
|
+
const state$9 = {
|
|
2146
|
+
menuEntries: []
|
|
2081
2147
|
};
|
|
2082
|
-
const
|
|
2083
|
-
return
|
|
2148
|
+
const getAll = () => {
|
|
2149
|
+
return state$9.menuEntries;
|
|
2084
2150
|
};
|
|
2085
|
-
const
|
|
2086
|
-
|
|
2151
|
+
const add = menuEntries => {
|
|
2152
|
+
state$9.menuEntries = [...state$9.menuEntries, ...menuEntries];
|
|
2087
2153
|
};
|
|
2088
2154
|
|
|
2089
|
-
const
|
|
2090
|
-
|
|
2155
|
+
const getVisible = (provider, items, minLineY, maxLineY, focusedIndex, icons) => {
|
|
2156
|
+
const setSize = items.length;
|
|
2157
|
+
const range = items.slice(minLineY, maxLineY);
|
|
2158
|
+
const visibleItems = provider.getVisibleItems(range, minLineY, maxLineY, focusedIndex, setSize, icons);
|
|
2159
|
+
return visibleItems;
|
|
2091
2160
|
};
|
|
2092
2161
|
|
|
2093
|
-
const
|
|
2094
|
-
const
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2162
|
+
const createQuickPickViewModel = (oldState, newState) => {
|
|
2163
|
+
const visibleItems = getVisible(newState.provider, newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex, newState.icons);
|
|
2164
|
+
const oldFocusedIndex = oldState.focusedIndex - oldState.minLineY;
|
|
2165
|
+
const newFocusedIndex = newState.focusedIndex - newState.minLineY;
|
|
2166
|
+
const maxLineY = Math.min(newState.maxLineY, newState.items.length);
|
|
2167
|
+
const itemCount = maxLineY - newState.minLineY;
|
|
2168
|
+
const height = itemCount * newState.itemHeight;
|
|
2169
|
+
return {
|
|
2170
|
+
visibleItems,
|
|
2171
|
+
value: newState.value,
|
|
2172
|
+
cursorOffset: newState.cursorOffset,
|
|
2173
|
+
focused: newState.focused,
|
|
2174
|
+
height,
|
|
2175
|
+
oldFocusedIndex,
|
|
2176
|
+
newFocusedIndex,
|
|
2177
|
+
uid: newState.uid
|
|
2178
|
+
};
|
|
2098
2179
|
};
|
|
2099
2180
|
|
|
2100
|
-
const
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
return
|
|
2181
|
+
const SetCursorOffset = 'setCursorOffset';
|
|
2182
|
+
const SetFocusedIndex = 'setFocusedIndex';
|
|
2183
|
+
const SetItemsHeight = 'setItemsHeight';
|
|
2184
|
+
const SetValue = 'setValue';
|
|
2185
|
+
|
|
2186
|
+
const renderCursorOffset = newState => {
|
|
2187
|
+
return ['Viewlet.send', newState.uid, /* method */SetCursorOffset, /* cursorOffset */newState.cursorOffset];
|
|
2107
2188
|
};
|
|
2108
2189
|
|
|
2109
|
-
const
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
} = state;
|
|
2114
|
-
const previousIndex = previous(items, focusedIndex);
|
|
2115
|
-
return focusIndex(state, previousIndex);
|
|
2190
|
+
const QuickPickInput = 'QuickPickInput';
|
|
2191
|
+
|
|
2192
|
+
const renderFocus = newState => {
|
|
2193
|
+
return ['Viewlet.focusElementByName', QuickPickInput];
|
|
2116
2194
|
};
|
|
2117
2195
|
|
|
2118
|
-
const
|
|
2196
|
+
const renderFocusedIndex = newState => {
|
|
2197
|
+
return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */newState.oldFocusedIndex, /* newFocusedIndex */newState.newFocusedIndex];
|
|
2198
|
+
};
|
|
2119
2199
|
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2200
|
+
const renderHeight = newState => {
|
|
2201
|
+
if (newState.height === 0) {
|
|
2202
|
+
return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */20];
|
|
2203
|
+
}
|
|
2204
|
+
return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
|
|
2122
2205
|
};
|
|
2123
2206
|
|
|
2124
|
-
const
|
|
2125
|
-
const
|
|
2126
|
-
const
|
|
2127
|
-
const
|
|
2128
|
-
const UpArrow = 14;
|
|
2129
|
-
const DownArrow = 16;
|
|
2207
|
+
const ComboBox = 'combobox';
|
|
2208
|
+
const ListBox = 'listbox';
|
|
2209
|
+
const None$1 = 'none';
|
|
2210
|
+
const Option = 'option';
|
|
2130
2211
|
|
|
2131
|
-
const
|
|
2212
|
+
const FileIcon = 'FileIcon';
|
|
2213
|
+
const InputBox = 'InputBox';
|
|
2214
|
+
const Label = 'Label';
|
|
2215
|
+
const QuickPick$1 = 'QuickPick';
|
|
2216
|
+
const QuickPickHeader = 'QuickPickHeader';
|
|
2217
|
+
const QuickPickHighlight = 'QuickPickHighlight';
|
|
2218
|
+
const QuickPickItem = 'QuickPickItem';
|
|
2219
|
+
const QuickPickItemActive$1 = 'QuickPickItemActive';
|
|
2220
|
+
const QuickPickItemDescription = 'QuickPickItemDescription';
|
|
2221
|
+
const QuickPickItemLabel = 'QuickPickItemLabel';
|
|
2222
|
+
const QuickPickItems$1 = 'QuickPickItems';
|
|
2223
|
+
const Viewlet = 'Viewlet';
|
|
2132
2224
|
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
}, {
|
|
2140
|
-
key: UpArrow,
|
|
2141
|
-
command: 'QuickPick.focusPrevious',
|
|
2142
|
-
when: FocusQuickPickInput
|
|
2143
|
-
}, {
|
|
2144
|
-
key: DownArrow,
|
|
2145
|
-
command: 'QuickPick.focusNext',
|
|
2146
|
-
when: FocusQuickPickInput
|
|
2147
|
-
}, {
|
|
2148
|
-
key: PageUp,
|
|
2149
|
-
command: 'QuickPick.focusFirst',
|
|
2150
|
-
when: FocusQuickPickInput
|
|
2151
|
-
}, {
|
|
2152
|
-
key: PageDown,
|
|
2153
|
-
command: 'QuickPick.focusLast',
|
|
2154
|
-
when: FocusQuickPickInput
|
|
2155
|
-
}, {
|
|
2156
|
-
key: Enter,
|
|
2157
|
-
command: 'QuickPick.selectCurrentIndex',
|
|
2158
|
-
when: FocusQuickPickInput
|
|
2159
|
-
}];
|
|
2160
|
-
};
|
|
2225
|
+
const HandleBeforeInput = 'handleBeforeInput';
|
|
2226
|
+
const HandleBlur = 'handleBlur';
|
|
2227
|
+
const HandleFocus = 'handleFocus';
|
|
2228
|
+
const HandleInput = 'handleInput';
|
|
2229
|
+
const HandlePointerDown = 'handlePointerDown';
|
|
2230
|
+
const HandleWheel = 'handleWheel';
|
|
2161
2231
|
|
|
2162
|
-
const
|
|
2163
|
-
const
|
|
2164
|
-
const
|
|
2165
|
-
const DeleteWordForward = 'deleteWordForward';
|
|
2166
|
-
const DeleteWordBackward = 'deleteWordBackward';
|
|
2167
|
-
const InsertLineBreak = 'insertLineBreak';
|
|
2168
|
-
const InsertCompositionText = 'insertCompositionText';
|
|
2169
|
-
const InsertFromPaste = 'insertFromPaste';
|
|
2232
|
+
const QuickPick = 'QuickPick';
|
|
2233
|
+
const QuickPickItems = 'QuickPickItems';
|
|
2234
|
+
const QuickPickItemActive = 'QuickPickItemActive';
|
|
2170
2235
|
|
|
2171
|
-
const
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2174
|
-
|
|
2236
|
+
const Div = 4;
|
|
2237
|
+
const Input = 6;
|
|
2238
|
+
const Span = 8;
|
|
2239
|
+
const Img = 17;
|
|
2175
2240
|
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2178
|
-
const newValue = value + data;
|
|
2179
|
-
return {
|
|
2180
|
-
newValue,
|
|
2181
|
-
cursorOffset: newValue.length
|
|
2182
|
-
};
|
|
2183
|
-
}
|
|
2184
|
-
const before = value.slice(0, selectionStart);
|
|
2185
|
-
const after = value.slice(selectionEnd);
|
|
2186
|
-
const newValue = before + data + after;
|
|
2187
|
-
return {
|
|
2188
|
-
newValue,
|
|
2189
|
-
cursorOffset: selectionStart + data.length
|
|
2190
|
-
};
|
|
2191
|
-
};
|
|
2192
|
-
const getNewValueDeleteContentBackward = (value, selectionStart, selectionEnd, data) => {
|
|
2193
|
-
const after = value.slice(selectionEnd);
|
|
2194
|
-
if (selectionStart === selectionEnd) {
|
|
2195
|
-
const before = value.slice(0, selectionStart - 1);
|
|
2196
|
-
const newValue = before + after;
|
|
2197
|
-
return {
|
|
2198
|
-
newValue,
|
|
2199
|
-
cursorOffset: before.length
|
|
2200
|
-
};
|
|
2201
|
-
}
|
|
2202
|
-
const before = value.slice(0, selectionStart);
|
|
2203
|
-
const newValue = before + after;
|
|
2241
|
+
const getQuickPickInputVirtualDom = () => {
|
|
2242
|
+
const ariaLabel = typeNameofCommandToRun();
|
|
2204
2243
|
return {
|
|
2205
|
-
|
|
2206
|
-
|
|
2244
|
+
type: Input,
|
|
2245
|
+
className: InputBox,
|
|
2246
|
+
spellcheck: false,
|
|
2247
|
+
autocapitalize: 'off',
|
|
2248
|
+
inputType: 'text',
|
|
2249
|
+
childCount: 0,
|
|
2250
|
+
role: ComboBox,
|
|
2251
|
+
name: QuickPickInput,
|
|
2252
|
+
onBeforeInput: HandleBeforeInput,
|
|
2253
|
+
onBlur: HandleBlur,
|
|
2254
|
+
onInput: HandleInput,
|
|
2255
|
+
onFocus: HandleFocus,
|
|
2256
|
+
ariaLabel: ariaLabel,
|
|
2257
|
+
ariaAutoComplete: 'list',
|
|
2258
|
+
ariaExpanded: true,
|
|
2259
|
+
autocomplete: 'off'
|
|
2207
2260
|
};
|
|
2208
2261
|
};
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
const before = value.slice(0, startIndex);
|
|
2217
|
-
const newValue = before + after;
|
|
2218
|
-
return {
|
|
2219
|
-
newValue,
|
|
2220
|
-
cursorOffset: before.length
|
|
2221
|
-
};
|
|
2222
|
-
}
|
|
2223
|
-
const before = value.slice(0, selectionStart);
|
|
2224
|
-
const newValue = before + after;
|
|
2225
|
-
return {
|
|
2226
|
-
newValue,
|
|
2227
|
-
cursorOffset: selectionStart
|
|
2228
|
-
};
|
|
2262
|
+
|
|
2263
|
+
const getQuickPickHeaderVirtualDom = () => {
|
|
2264
|
+
return [{
|
|
2265
|
+
type: Div,
|
|
2266
|
+
className: QuickPickHeader,
|
|
2267
|
+
childCount: 1
|
|
2268
|
+
}, getQuickPickInputVirtualDom()];
|
|
2229
2269
|
};
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
const after = value.slice(selectionEnd + 1);
|
|
2234
|
-
const newValue = before + after;
|
|
2235
|
-
return {
|
|
2236
|
-
newValue,
|
|
2237
|
-
cursorOffset: selectionStart
|
|
2238
|
-
};
|
|
2239
|
-
}
|
|
2240
|
-
const after = value.slice(selectionEnd);
|
|
2241
|
-
const newValue = before + after;
|
|
2242
|
-
return {
|
|
2243
|
-
newValue,
|
|
2244
|
-
cursorOffset: selectionStart
|
|
2245
|
-
};
|
|
2270
|
+
|
|
2271
|
+
const mergeClassNames = (...classNames) => {
|
|
2272
|
+
return classNames.filter(Boolean).join(' ');
|
|
2246
2273
|
};
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
if (selectionStart === selectionEnd) {
|
|
2250
|
-
let startIndex = Math.min(selectionStart + 1, value.length - 1);
|
|
2251
|
-
while (startIndex < value.length && isAlphaNumeric(value[startIndex])) {
|
|
2252
|
-
startIndex++;
|
|
2253
|
-
}
|
|
2254
|
-
const after = value.slice(startIndex);
|
|
2255
|
-
const newValue = before + after;
|
|
2256
|
-
return {
|
|
2257
|
-
newValue,
|
|
2258
|
-
cursorOffset: before.length
|
|
2259
|
-
};
|
|
2260
|
-
}
|
|
2261
|
-
const after = value.slice(selectionEnd);
|
|
2262
|
-
const newValue = before + after;
|
|
2274
|
+
const Text = 12;
|
|
2275
|
+
const text = data => {
|
|
2263
2276
|
return {
|
|
2264
|
-
|
|
2265
|
-
|
|
2277
|
+
type: Text,
|
|
2278
|
+
text: data,
|
|
2279
|
+
childCount: 0
|
|
2266
2280
|
};
|
|
2267
2281
|
};
|
|
2268
|
-
|
|
2269
|
-
|
|
2282
|
+
|
|
2283
|
+
const quickPickHighlight = {
|
|
2284
|
+
type: Span,
|
|
2285
|
+
className: QuickPickHighlight,
|
|
2286
|
+
childCount: 1
|
|
2270
2287
|
};
|
|
2271
|
-
const
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2288
|
+
const addHighlights = (dom, highlights, label) => {
|
|
2289
|
+
const labelDom = {
|
|
2290
|
+
type: Div,
|
|
2291
|
+
className: QuickPickItemLabel,
|
|
2292
|
+
childCount: 0
|
|
2275
2293
|
};
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
throw new Error(`unsupported input type ${inputType}`);
|
|
2294
|
+
dom.push(labelDom);
|
|
2295
|
+
let position = 0;
|
|
2296
|
+
for (let i = 0; i < highlights.length; i += 2) {
|
|
2297
|
+
const highlightStart = highlights[i];
|
|
2298
|
+
const highlightEnd = highlights[i + 1];
|
|
2299
|
+
if (position < highlightStart) {
|
|
2300
|
+
const beforeText = label.slice(position, highlightStart);
|
|
2301
|
+
labelDom.childCount++;
|
|
2302
|
+
dom.push(text(beforeText));
|
|
2303
|
+
}
|
|
2304
|
+
const highlightText = label.slice(highlightStart, highlightEnd);
|
|
2305
|
+
labelDom.childCount++;
|
|
2306
|
+
dom.push(quickPickHighlight, text(highlightText));
|
|
2307
|
+
position = highlightEnd;
|
|
2308
|
+
}
|
|
2309
|
+
if (position < label.length) {
|
|
2310
|
+
const afterText = label.slice(position);
|
|
2311
|
+
labelDom.childCount++;
|
|
2312
|
+
dom.push(text(afterText));
|
|
2296
2313
|
}
|
|
2297
2314
|
};
|
|
2298
2315
|
|
|
2299
|
-
const
|
|
2300
|
-
|
|
2301
|
-
|
|
2316
|
+
const getFileIconVirtualDom = icon => {
|
|
2317
|
+
return {
|
|
2318
|
+
type: Img,
|
|
2319
|
+
className: FileIcon,
|
|
2320
|
+
src: icon,
|
|
2321
|
+
role: None$1,
|
|
2322
|
+
childCount: 0
|
|
2323
|
+
};
|
|
2302
2324
|
};
|
|
2303
2325
|
|
|
2304
|
-
|
|
2305
|
-
const setValue = async (state, newValue) => {
|
|
2326
|
+
const getQuickPickItemVirtualDom = visibleItem => {
|
|
2306
2327
|
const {
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2328
|
+
posInSet,
|
|
2329
|
+
label,
|
|
2330
|
+
setSize,
|
|
2331
|
+
isActive,
|
|
2332
|
+
description,
|
|
2333
|
+
icon,
|
|
2334
|
+
matches,
|
|
2335
|
+
fileIcon
|
|
2336
|
+
} = visibleItem;
|
|
2337
|
+
const highlights = matches.slice(1);
|
|
2338
|
+
const dom = [];
|
|
2339
|
+
dom.push({
|
|
2340
|
+
type: Div,
|
|
2341
|
+
className: QuickPickItem,
|
|
2342
|
+
role: Option,
|
|
2343
|
+
ariaPosInSet: posInSet,
|
|
2344
|
+
ariaSetSize: setSize,
|
|
2345
|
+
childCount: 1
|
|
2346
|
+
});
|
|
2347
|
+
const parent = dom[0];
|
|
2348
|
+
if (isActive) {
|
|
2349
|
+
// @ts-ignore
|
|
2350
|
+
parent.id = 'QuickPickItemActive';
|
|
2351
|
+
parent.className += ' ' + QuickPickItemActive$1;
|
|
2312
2352
|
}
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2353
|
+
if (fileIcon) {
|
|
2354
|
+
parent.childCount++;
|
|
2355
|
+
dom.push(getFileIconVirtualDom(fileIcon));
|
|
2356
|
+
} else if (icon) {
|
|
2357
|
+
parent.childCount++;
|
|
2358
|
+
dom.push({
|
|
2359
|
+
type: Div,
|
|
2360
|
+
className: mergeClassNames(`QuickPickMaskIcon`, 'MaskIcon', `MaskIcon${icon}`),
|
|
2361
|
+
childCount: 0
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
addHighlights(dom, highlights, label);
|
|
2365
|
+
if (description) {
|
|
2366
|
+
parent.childCount++;
|
|
2367
|
+
dom.push({
|
|
2368
|
+
type: Div,
|
|
2369
|
+
className: QuickPickItemDescription,
|
|
2370
|
+
childCount: 1
|
|
2371
|
+
}, text(description));
|
|
2372
|
+
}
|
|
2373
|
+
return dom;
|
|
2374
|
+
};
|
|
2375
|
+
|
|
2376
|
+
const getQuickPickNoResultsVirtualDom = () => {
|
|
2377
|
+
const noResults$1 = noResults();
|
|
2378
|
+
return [{
|
|
2379
|
+
type: Div,
|
|
2380
|
+
className: 'QuickPickItem QuickPickItemActive QuickPickStatus',
|
|
2381
|
+
childCount: 1
|
|
2382
|
+
}, {
|
|
2383
|
+
type: Div,
|
|
2384
|
+
className: Label,
|
|
2385
|
+
childCount: 1
|
|
2386
|
+
}, text(noResults$1)];
|
|
2325
2387
|
};
|
|
2326
2388
|
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
return state;
|
|
2389
|
+
const getQuickPickItemsVirtualDom = visibleItems => {
|
|
2390
|
+
if (visibleItems.length === 0) {
|
|
2391
|
+
return getQuickPickNoResultsVirtualDom();
|
|
2331
2392
|
}
|
|
2332
|
-
const
|
|
2333
|
-
return
|
|
2334
|
-
...newState,
|
|
2335
|
-
cursorOffset,
|
|
2336
|
-
inputSource
|
|
2337
|
-
};
|
|
2393
|
+
const dom = visibleItems.flatMap(getQuickPickItemVirtualDom);
|
|
2394
|
+
return dom;
|
|
2338
2395
|
};
|
|
2339
2396
|
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2397
|
+
const getQuickPickVirtualDom = visibleItems => {
|
|
2398
|
+
const quickOpen$1 = quickOpen();
|
|
2399
|
+
return [{
|
|
2400
|
+
type: Div,
|
|
2401
|
+
className: mergeClassNames(Viewlet, QuickPick$1),
|
|
2402
|
+
childCount: 2,
|
|
2403
|
+
id: QuickPick,
|
|
2404
|
+
ariaLabel: quickOpen$1
|
|
2405
|
+
}, ...getQuickPickHeaderVirtualDom(), {
|
|
2406
|
+
type: Div,
|
|
2407
|
+
className: QuickPickItems$1,
|
|
2408
|
+
id: QuickPickItems,
|
|
2409
|
+
role: ListBox,
|
|
2410
|
+
ariaActivedescendant: QuickPickItemActive,
|
|
2411
|
+
onWheel: HandleWheel,
|
|
2412
|
+
childCount: visibleItems.length
|
|
2413
|
+
}, ...getQuickPickItemsVirtualDom(visibleItems)];
|
|
2352
2414
|
};
|
|
2353
2415
|
|
|
2354
|
-
const
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
return state;
|
|
2416
|
+
const renderItems = newState => {
|
|
2417
|
+
const dom = getQuickPickVirtualDom(newState.visibleItems);
|
|
2418
|
+
return ['Viewlet.setDom2', dom];
|
|
2358
2419
|
};
|
|
2359
2420
|
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2362
|
-
number(index);
|
|
2363
|
-
// if (index < state.recentPicks.length) {
|
|
2364
|
-
// return state.recentPicks[index]
|
|
2365
|
-
// }
|
|
2366
|
-
// index -= state.recentPicks.length
|
|
2367
|
-
if (index < items.length) {
|
|
2368
|
-
return items[index].pick;
|
|
2369
|
-
}
|
|
2370
|
-
console.warn('no pick matching index', index);
|
|
2421
|
+
const renderValue = newState => {
|
|
2422
|
+
return ['Viewlet.send', newState.uid, /* method */SetValue, /* value */newState.value];
|
|
2371
2423
|
};
|
|
2372
2424
|
|
|
2373
|
-
const
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
switch (command) {
|
|
2388
|
-
case Hide:
|
|
2389
|
-
await closeWidget(state.uid);
|
|
2390
|
-
return state;
|
|
2425
|
+
const getRenderer = diffType => {
|
|
2426
|
+
switch (diffType) {
|
|
2427
|
+
case RenderValue:
|
|
2428
|
+
return renderValue;
|
|
2429
|
+
case RenderCursorOffset:
|
|
2430
|
+
return renderCursorOffset;
|
|
2431
|
+
case RenderItems:
|
|
2432
|
+
return renderItems;
|
|
2433
|
+
case RenderFocusedIndex:
|
|
2434
|
+
return renderFocusedIndex;
|
|
2435
|
+
case Height:
|
|
2436
|
+
return renderHeight;
|
|
2437
|
+
case RenderFocus:
|
|
2438
|
+
return renderFocus;
|
|
2391
2439
|
default:
|
|
2392
|
-
|
|
2440
|
+
throw new Error('unknown renderer');
|
|
2393
2441
|
}
|
|
2442
|
+
};
|
|
2394
2443
|
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2444
|
+
const applyRender = (oldState, newState, diffResult) => {
|
|
2445
|
+
const commands = [];
|
|
2446
|
+
const viewModel = createQuickPickViewModel(oldState, newState);
|
|
2447
|
+
for (const item of diffResult) {
|
|
2448
|
+
if (item === Height) {
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
if (item === RenderFocusedIndex) {
|
|
2452
|
+
continue;
|
|
2453
|
+
}
|
|
2454
|
+
const fn = getRenderer(item);
|
|
2455
|
+
commands.push(fn(viewModel));
|
|
2456
|
+
}
|
|
2457
|
+
return commands;
|
|
2404
2458
|
};
|
|
2405
2459
|
|
|
2406
|
-
const
|
|
2460
|
+
const render2 = (uid, diffResult) => {
|
|
2407
2461
|
const {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2462
|
+
oldState,
|
|
2463
|
+
newState
|
|
2464
|
+
} = get(uid);
|
|
2465
|
+
if (oldState === newState) {
|
|
2466
|
+
return [];
|
|
2467
|
+
}
|
|
2468
|
+
set(uid, newState, newState);
|
|
2469
|
+
const commands = applyRender(oldState, newState, diffResult);
|
|
2470
|
+
return commands;
|
|
2415
2471
|
};
|
|
2416
2472
|
|
|
2417
|
-
const
|
|
2418
|
-
|
|
2473
|
+
const renderEventListeners = () => {
|
|
2474
|
+
return [{
|
|
2475
|
+
name: HandlePointerDown,
|
|
2476
|
+
params: ['handlePointerDown', 'event.clientX', 'event.clientY'],
|
|
2477
|
+
preventDefault: true
|
|
2478
|
+
}, {
|
|
2479
|
+
name: HandleWheel,
|
|
2480
|
+
params: ['handleWheel', 'event.deltaMode', 'event.deltaY']
|
|
2481
|
+
}, {
|
|
2482
|
+
name: HandleBlur,
|
|
2483
|
+
params: ['handleBlur']
|
|
2484
|
+
}, {
|
|
2485
|
+
name: HandleBeforeInput,
|
|
2486
|
+
params: ['handleBeforeInput']
|
|
2487
|
+
}, {
|
|
2488
|
+
name: HandleInput,
|
|
2489
|
+
params: ['handleInput', 'event.target.value']
|
|
2490
|
+
}, {
|
|
2491
|
+
name: HandleFocus,
|
|
2492
|
+
params: ['handleFocus']
|
|
2493
|
+
}];
|
|
2419
2494
|
};
|
|
2420
2495
|
|
|
2421
|
-
const
|
|
2422
|
-
|
|
2423
|
-
await setFocus(FocusQuickPickInput);
|
|
2424
|
-
// await CloseWidget.closeWidget(state.uid)
|
|
2425
|
-
return state;
|
|
2496
|
+
const selectCurrentIndex = state => {
|
|
2497
|
+
return selectIndex(state, state.focusedIndex);
|
|
2426
2498
|
};
|
|
2427
2499
|
|
|
2428
|
-
const
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
return
|
|
2432
|
-
|
|
2433
|
-
return '';
|
|
2500
|
+
const findLabelIndex = (items, label) => {
|
|
2501
|
+
for (let i = 0; i < items.length; i++) {
|
|
2502
|
+
if (items[i].pick.label === label) {
|
|
2503
|
+
return i;
|
|
2504
|
+
}
|
|
2434
2505
|
}
|
|
2506
|
+
return -1;
|
|
2435
2507
|
};
|
|
2436
2508
|
|
|
2437
|
-
const
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
const module = state$4[moduleId];
|
|
2443
|
-
if (!module) {
|
|
2444
|
-
throw new Error(`unknown module "${moduleId}"`);
|
|
2509
|
+
const selectItem = async (state, label) => {
|
|
2510
|
+
string(label);
|
|
2511
|
+
const index = findLabelIndex(state.items, label);
|
|
2512
|
+
if (index === -1) {
|
|
2513
|
+
return state;
|
|
2445
2514
|
}
|
|
2446
|
-
return
|
|
2515
|
+
return selectIndex(state, index);
|
|
2447
2516
|
};
|
|
2448
2517
|
|
|
2449
|
-
const
|
|
2450
|
-
const {
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
}
|
|
2461
|
-
const newPicks = await provider.getPicks(value);
|
|
2462
|
-
array(newPicks);
|
|
2463
|
-
const filterValue = provider.getFilterValue(value);
|
|
2464
|
-
const items = filterQuickPickItems(newPicks, filterValue, provider);
|
|
2465
|
-
// @ts-ignore
|
|
2466
|
-
provider.getLabel();
|
|
2467
|
-
const minLineY = 0;
|
|
2468
|
-
const maxLineY = Math.min(minLineY + state.maxVisibleItems, newPicks.length);
|
|
2469
|
-
return {
|
|
2470
|
-
...state,
|
|
2471
|
-
picks: newPicks,
|
|
2472
|
-
items,
|
|
2473
|
-
focusedIndex: 0,
|
|
2474
|
-
state: Finished,
|
|
2475
|
-
minLineY,
|
|
2476
|
-
maxLineY,
|
|
2477
|
-
value,
|
|
2478
|
-
cursorOffset: value.length,
|
|
2479
|
-
provider,
|
|
2480
|
-
inputSource: Script,
|
|
2481
|
-
focused: true
|
|
2518
|
+
const wrapCommand = fn => {
|
|
2519
|
+
const wrapped = async (uid, ...args) => {
|
|
2520
|
+
const {
|
|
2521
|
+
newState
|
|
2522
|
+
} = get(uid);
|
|
2523
|
+
const newerState = await fn(newState, ...args);
|
|
2524
|
+
if (newState === newerState) {
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
const latest = get(uid);
|
|
2528
|
+
set(uid, latest.oldState, newerState);
|
|
2482
2529
|
};
|
|
2530
|
+
return wrapped;
|
|
2531
|
+
};
|
|
2532
|
+
|
|
2533
|
+
const commandMap = {
|
|
2534
|
+
'QuickPick.addMenuEntries': add,
|
|
2535
|
+
'QuickPick.close': close,
|
|
2536
|
+
'QuickPick.create2': create,
|
|
2537
|
+
'QuickPick.diff2': diff2,
|
|
2538
|
+
'QuickPick.dispose': dispose,
|
|
2539
|
+
'QuickPick.focusFirst': wrapCommand(focusFirst),
|
|
2540
|
+
'QuickPick.focusIndex': wrapCommand(focusIndex),
|
|
2541
|
+
'QuickPick.focusLast': wrapCommand(focusLast),
|
|
2542
|
+
'QuickPick.focusNext': wrapCommand(focusNext),
|
|
2543
|
+
'QuickPick.focusPrevious': wrapCommand(focusPrevious),
|
|
2544
|
+
'QuickPick.getCommandIds': getCommandIds,
|
|
2545
|
+
'QuickPick.getKeyBindings': getKeyBindings,
|
|
2546
|
+
'QuickPick.handleBeforeInput': wrapCommand(handleBeforeInput),
|
|
2547
|
+
'QuickPick.handleBlur': wrapCommand(handleBlur),
|
|
2548
|
+
'QuickPick.handleClickAt': wrapCommand(handleClickAt),
|
|
2549
|
+
'QuickPick.handleFocus': wrapCommand(handleFocus),
|
|
2550
|
+
'QuickPick.handleInput': wrapCommand(handleInput),
|
|
2551
|
+
'QuickPick.handleWheel': wrapCommand(handleWheel),
|
|
2552
|
+
'QuickPick.loadContent': wrapCommand(loadContent),
|
|
2553
|
+
'QuickPick.render2': render2,
|
|
2554
|
+
'QuickPick.renderEventListeners': renderEventListeners,
|
|
2555
|
+
'QuickPick.selectCurrentIndex': wrapCommand(selectCurrentIndex),
|
|
2556
|
+
'QuickPick.selectIndex': wrapCommand(selectIndex),
|
|
2557
|
+
'QuickPick.selectItem': wrapCommand(selectItem),
|
|
2558
|
+
'QuickPick.setDeltaY': wrapCommand(setDeltaY),
|
|
2559
|
+
'QuickPick.setValue': wrapCommand(setValue),
|
|
2560
|
+
// deprecated
|
|
2561
|
+
'QuickPick.loadEntries2': get$1
|
|
2483
2562
|
};
|
|
2484
2563
|
|
|
2485
|
-
const
|
|
2486
|
-
return invoke$1(/*
|
|
2564
|
+
const getColorThemeNames = async () => {
|
|
2565
|
+
return invoke$1(/* Ajax.getJson */'ColorTheme.getColorThemeNames');
|
|
2487
2566
|
};
|
|
2488
|
-
|
|
2489
|
-
|
|
2567
|
+
|
|
2568
|
+
const setColorTheme = id => {
|
|
2569
|
+
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
2490
2570
|
};
|
|
2491
|
-
const getPlaceholder$
|
|
2492
|
-
return
|
|
2571
|
+
const getPlaceholder$7 = () => {
|
|
2572
|
+
return selectColorTheme();
|
|
2493
2573
|
};
|
|
2494
|
-
const getLabel$
|
|
2495
|
-
return
|
|
2574
|
+
const getLabel$4 = () => {
|
|
2575
|
+
return selectColorTheme();
|
|
2496
2576
|
};
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
};
|
|
2577
|
+
const getPicks$7 = async searchValue => {
|
|
2578
|
+
const colorThemeNames = await getColorThemeNames();
|
|
2579
|
+
return colorThemeNames;
|
|
2501
2580
|
};
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2581
|
+
const getVisibleItems$7 = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
|
|
2582
|
+
const visibleItems = picks.map((pick, index) => ({
|
|
2583
|
+
description: getPickDescription$7(),
|
|
2584
|
+
fileIcon: '',
|
|
2585
|
+
icon: getPickIcon$7(),
|
|
2586
|
+
isActive: index + minLineY === focusedIndex,
|
|
2587
|
+
label: getPickLabel$7(pick),
|
|
2588
|
+
matches: [],
|
|
2589
|
+
posInSet: index + minLineY + 1,
|
|
2590
|
+
setSize
|
|
2591
|
+
}));
|
|
2592
|
+
return visibleItems;
|
|
2511
2593
|
};
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
const selectPick$3 = async pick => {
|
|
2515
|
-
const path = pick;
|
|
2516
|
-
await openWorkspaceFolder(path);
|
|
2594
|
+
const selectPick$7 = async pick => {
|
|
2595
|
+
await setColorTheme(/* colorThemeId */pick);
|
|
2517
2596
|
return {
|
|
2518
2597
|
command: Hide
|
|
2519
2598
|
};
|
|
2520
2599
|
};
|
|
2521
|
-
const
|
|
2522
|
-
|
|
2600
|
+
const focusPick = async pick => {
|
|
2601
|
+
await setColorTheme(/* colorThemeId */pick);
|
|
2523
2602
|
};
|
|
2524
|
-
const
|
|
2525
|
-
return
|
|
2603
|
+
const getFilterValue$7 = value => {
|
|
2604
|
+
return value;
|
|
2526
2605
|
};
|
|
2527
|
-
const
|
|
2528
|
-
return
|
|
2606
|
+
const getNoResults$7 = () => {
|
|
2607
|
+
return {
|
|
2608
|
+
label: noMatchingColorThemesFound()
|
|
2609
|
+
};
|
|
2529
2610
|
};
|
|
2530
|
-
const
|
|
2531
|
-
return
|
|
2611
|
+
const getPickFilterValue$7 = pick => {
|
|
2612
|
+
return pick;
|
|
2532
2613
|
};
|
|
2533
|
-
const
|
|
2614
|
+
const getPickLabel$7 = pick => {
|
|
2615
|
+
return pick;
|
|
2616
|
+
};
|
|
2617
|
+
const getPickIcon$7 = pick => {
|
|
2534
2618
|
return '';
|
|
2535
2619
|
};
|
|
2536
|
-
const
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
}
|
|
2540
|
-
if (typeof pick === 'object') {
|
|
2541
|
-
pick = pick.pick;
|
|
2542
|
-
}
|
|
2543
|
-
return {
|
|
2544
|
-
type: Directory,
|
|
2545
|
-
name: pick
|
|
2546
|
-
};
|
|
2620
|
+
const state$8 = {};
|
|
2621
|
+
const getPickDescription$7 = value => {
|
|
2622
|
+
return '';
|
|
2547
2623
|
};
|
|
2548
|
-
const
|
|
2549
|
-
const isPrepared$3 = () => {
|
|
2624
|
+
const isPrepared$7 = () => {
|
|
2550
2625
|
return false;
|
|
2551
2626
|
};
|
|
2552
|
-
const name$
|
|
2627
|
+
const name$7 = '';
|
|
2628
|
+
const getHelpEntries$2 = () => {
|
|
2629
|
+
return [];
|
|
2630
|
+
};
|
|
2553
2631
|
|
|
2554
|
-
const
|
|
2632
|
+
const QuickPickEntriesColorTheme = {
|
|
2555
2633
|
__proto__: null,
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2634
|
+
focusPick,
|
|
2635
|
+
getFilterValue: getFilterValue$7,
|
|
2636
|
+
getHelpEntries: getHelpEntries$2,
|
|
2637
|
+
getLabel: getLabel$4,
|
|
2638
|
+
getNoResults: getNoResults$7,
|
|
2639
|
+
getPickDescription: getPickDescription$7,
|
|
2640
|
+
getPickFilterValue: getPickFilterValue$7,
|
|
2641
|
+
getPickIcon: getPickIcon$7,
|
|
2642
|
+
getPickLabel: getPickLabel$7,
|
|
2643
|
+
getPicks: getPicks$7,
|
|
2644
|
+
getPlaceholder: getPlaceholder$7,
|
|
2645
|
+
getVisibleItems: getVisibleItems$7,
|
|
2646
|
+
isPrepared: isPrepared$7,
|
|
2647
|
+
name: name$7,
|
|
2648
|
+
selectPick: selectPick$7,
|
|
2649
|
+
setColorTheme,
|
|
2650
|
+
state: state$8
|
|
2570
2651
|
};
|
|
2571
2652
|
|
|
2572
|
-
const
|
|
2573
|
-
|
|
2574
|
-
const File$1 = 'quickPick://file';
|
|
2575
|
-
const EveryThing = 'quickPick://everything';
|
|
2576
|
-
const Number$1 = 'quickPick://number';
|
|
2577
|
-
const Recent = 'quickPick://recent';
|
|
2578
|
-
const ColorTheme = 'quickPick://color-theme';
|
|
2579
|
-
const Symbol = 'quickPick://symbol';
|
|
2580
|
-
const View = 'quickPick://view';
|
|
2581
|
-
const WorkspaceSymbol = 'quickPick://workspace-symbol';
|
|
2582
|
-
const Custom = 'quickPick://custom';
|
|
2583
|
-
|
|
2584
|
-
const loadQuickPickEntries = moduleId => {
|
|
2585
|
-
switch (moduleId) {
|
|
2586
|
-
case Recent:
|
|
2587
|
-
return QuickPickEntriesOpenRecent;
|
|
2588
|
-
default:
|
|
2589
|
-
throw new Error(`unknown module "${moduleId}"`);
|
|
2590
|
-
}
|
|
2653
|
+
const handleError = async (error, notify = true, prefix = '') => {
|
|
2654
|
+
console.error(error);
|
|
2591
2655
|
};
|
|
2592
|
-
|
|
2593
|
-
const
|
|
2594
|
-
const
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2656
|
+
const showErrorDialog = async error => {
|
|
2657
|
+
const code = error.code;
|
|
2658
|
+
const message = error.message;
|
|
2659
|
+
const stack = error.stack;
|
|
2660
|
+
const name = error.name;
|
|
2661
|
+
const errorInfo = {
|
|
2662
|
+
code,
|
|
2663
|
+
message,
|
|
2664
|
+
stack,
|
|
2665
|
+
name
|
|
2666
|
+
};
|
|
2667
|
+
await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
|
|
2668
|
+
};
|
|
2669
|
+
const warn = (...args) => {
|
|
2670
|
+
console.warn(...args);
|
|
2605
2671
|
};
|
|
2606
2672
|
|
|
2607
|
-
const
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2673
|
+
const name$6 = 'command';
|
|
2674
|
+
const state$7 = {};
|
|
2675
|
+
const isPrepared$6 = () => {
|
|
2676
|
+
return false;
|
|
2677
|
+
};
|
|
2678
|
+
const getPickDescription$6 = () => {
|
|
2611
2679
|
return '';
|
|
2612
2680
|
};
|
|
2681
|
+
const getPlaceholder$6 = () => {
|
|
2682
|
+
return typeNameofCommandToRun();
|
|
2683
|
+
};
|
|
2684
|
+
const getLabel$3 = () => {
|
|
2685
|
+
return '';
|
|
2686
|
+
};
|
|
2687
|
+
const getNoResults$6 = () => {
|
|
2688
|
+
return {
|
|
2689
|
+
label: noMatchingResults()
|
|
2690
|
+
};
|
|
2691
|
+
};
|
|
2613
2692
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2693
|
+
// TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
|
|
2694
|
+
const getBuiltinPicks = async () => {
|
|
2695
|
+
const builtinPicks = getAll();
|
|
2696
|
+
return builtinPicks;
|
|
2697
|
+
};
|
|
2698
|
+
const prefixIdWithExt = item => {
|
|
2699
|
+
if (!item.label) {
|
|
2700
|
+
warn('[QuickPick] item has missing label', item);
|
|
2701
|
+
}
|
|
2702
|
+
if (!item.id) {
|
|
2703
|
+
warn('[QuickPick] item has missing id', item);
|
|
2704
|
+
}
|
|
2705
|
+
return {
|
|
2706
|
+
...item,
|
|
2707
|
+
id: `ext.${item.id}`,
|
|
2708
|
+
label: item.label || item.id
|
|
2709
|
+
};
|
|
2710
|
+
};
|
|
2711
|
+
const getExtensionPicks = async () => {
|
|
2712
|
+
try {
|
|
2713
|
+
// TODO don't call this every time
|
|
2714
|
+
const extensionPicks = await invoke$1('ExtensionHost.getCommands');
|
|
2715
|
+
if (!extensionPicks) {
|
|
2716
|
+
return [];
|
|
2618
2717
|
}
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
}
|
|
2625
|
-
return Promise.all(promises);
|
|
2718
|
+
const mappedPicks = extensionPicks.map(prefixIdWithExt);
|
|
2719
|
+
return mappedPicks;
|
|
2720
|
+
} catch (error) {
|
|
2721
|
+
console.error(`Failed to get extension picks: ${error}`);
|
|
2722
|
+
return [];
|
|
2723
|
+
}
|
|
2626
2724
|
};
|
|
2627
2725
|
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
const
|
|
2632
|
-
const
|
|
2633
|
-
const
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2726
|
+
// TODO send strings to renderer process only once for next occurrence send uint16array of ids of strings
|
|
2727
|
+
|
|
2728
|
+
const getPicks$6 = async () => {
|
|
2729
|
+
const builtinPicks = await getBuiltinPicks();
|
|
2730
|
+
const extensionPicks = await getExtensionPicks();
|
|
2731
|
+
const allPicks = [...builtinPicks, ...extensionPicks];
|
|
2732
|
+
return allPicks;
|
|
2733
|
+
};
|
|
2734
|
+
const getVisibleItems$6 = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
|
|
2735
|
+
const visibleItems = picks.map((pick, index) => ({
|
|
2736
|
+
description: pick.description || '',
|
|
2737
|
+
fileIcon: '',
|
|
2738
|
+
icon: getPickIcon$6(),
|
|
2739
|
+
isActive: index + minLineY === focusedIndex,
|
|
2740
|
+
label: getPickLabel$6(pick),
|
|
2741
|
+
matches: [],
|
|
2742
|
+
posInSet: index + minLineY + 1,
|
|
2743
|
+
setSize
|
|
2744
|
+
}));
|
|
2745
|
+
return visibleItems;
|
|
2746
|
+
};
|
|
2747
|
+
const shouldHide = item => {
|
|
2748
|
+
if (item.id === 'Viewlet.openWidget' && item.args[0] === 'QuickPick') {
|
|
2749
|
+
return false;
|
|
2750
|
+
}
|
|
2751
|
+
return true;
|
|
2752
|
+
};
|
|
2753
|
+
const selectPickBuiltin = async item => {
|
|
2754
|
+
const args = item.args || [];
|
|
2755
|
+
// TODO ids should be all numbers for efficiency -> also directly can call command
|
|
2756
|
+
await invoke$1(item.id, ...args);
|
|
2757
|
+
if (shouldHide(item)) {
|
|
2758
|
+
return {
|
|
2759
|
+
command: Hide
|
|
2760
|
+
};
|
|
2761
|
+
}
|
|
2762
|
+
return {
|
|
2763
|
+
command: KeepOpen
|
|
2764
|
+
};
|
|
2765
|
+
};
|
|
2766
|
+
const selectPickExtension = async item => {
|
|
2767
|
+
const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
|
|
2768
|
+
try {
|
|
2769
|
+
await invoke$1('ExtensionHost.executeCommand', id);
|
|
2770
|
+
} catch (error) {
|
|
2771
|
+
await handleError(error, false);
|
|
2772
|
+
await showErrorDialog(error);
|
|
2652
2773
|
}
|
|
2653
|
-
return visibleItems;
|
|
2654
|
-
};
|
|
2655
|
-
|
|
2656
|
-
const createQuickPickViewModel = async (oldState, newState) => {
|
|
2657
|
-
const visibleItems = await getVisible(newState.provider, newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex);
|
|
2658
|
-
const oldFocusedIndex = oldState.focusedIndex - oldState.minLineY;
|
|
2659
|
-
const newFocusedIndex = newState.focusedIndex - newState.minLineY;
|
|
2660
|
-
const maxLineY = Math.min(newState.maxLineY, newState.items.length);
|
|
2661
|
-
const itemCount = maxLineY - newState.minLineY;
|
|
2662
|
-
const height = itemCount * newState.itemHeight;
|
|
2663
2774
|
return {
|
|
2664
|
-
|
|
2665
|
-
value: newState.value,
|
|
2666
|
-
cursorOffset: newState.cursorOffset,
|
|
2667
|
-
focused: newState.focused,
|
|
2668
|
-
height,
|
|
2669
|
-
oldFocusedIndex,
|
|
2670
|
-
newFocusedIndex,
|
|
2671
|
-
uid: newState.uid
|
|
2775
|
+
command: Hide
|
|
2672
2776
|
};
|
|
2673
2777
|
};
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
const renderCursorOffset = newState => {
|
|
2681
|
-
return ['Viewlet.send', newState.uid, /* method */SetCursorOffset, /* cursorOffset */newState.cursorOffset];
|
|
2778
|
+
const selectPick$6 = async item => {
|
|
2779
|
+
if (item.id.startsWith('ext.')) {
|
|
2780
|
+
return selectPickExtension(item);
|
|
2781
|
+
}
|
|
2782
|
+
return selectPickBuiltin(item);
|
|
2682
2783
|
};
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
const renderFocus = newState => {
|
|
2687
|
-
return ['Viewlet.focusElementByName', QuickPickInput];
|
|
2784
|
+
const getFilterValue$6 = value => {
|
|
2785
|
+
return value.trim();
|
|
2688
2786
|
};
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */newState.oldFocusedIndex, /* newFocusedIndex */newState.newFocusedIndex];
|
|
2787
|
+
const getPickFilterValue$6 = pick => {
|
|
2788
|
+
return pick.label;
|
|
2692
2789
|
};
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
|
|
2790
|
+
const getPickLabel$6 = pick => {
|
|
2791
|
+
return pick.label;
|
|
2792
|
+
};
|
|
2793
|
+
const getPickIcon$6 = () => {
|
|
2794
|
+
return '';
|
|
2699
2795
|
};
|
|
2700
2796
|
|
|
2701
|
-
const
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
const HandleBeforeInput = 'handleBeforeInput';
|
|
2720
|
-
const HandleBlur = 'handleBlur';
|
|
2721
|
-
const HandleFocus = 'handleFocus';
|
|
2722
|
-
const HandleInput = 'handleInput';
|
|
2723
|
-
const HandlePointerDown = 'handlePointerDown';
|
|
2724
|
-
const HandleWheel = 'handleWheel';
|
|
2797
|
+
const QuickPickEntriesCommand = {
|
|
2798
|
+
__proto__: null,
|
|
2799
|
+
getFilterValue: getFilterValue$6,
|
|
2800
|
+
getLabel: getLabel$3,
|
|
2801
|
+
getNoResults: getNoResults$6,
|
|
2802
|
+
getPickDescription: getPickDescription$6,
|
|
2803
|
+
getPickFilterValue: getPickFilterValue$6,
|
|
2804
|
+
getPickIcon: getPickIcon$6,
|
|
2805
|
+
getPickLabel: getPickLabel$6,
|
|
2806
|
+
getPicks: getPicks$6,
|
|
2807
|
+
getPlaceholder: getPlaceholder$6,
|
|
2808
|
+
getVisibleItems: getVisibleItems$6,
|
|
2809
|
+
isPrepared: isPrepared$6,
|
|
2810
|
+
name: name$6,
|
|
2811
|
+
selectPick: selectPick$6,
|
|
2812
|
+
state: state$7
|
|
2813
|
+
};
|
|
2725
2814
|
|
|
2726
|
-
const
|
|
2727
|
-
const
|
|
2728
|
-
const
|
|
2815
|
+
const Tag$1 = 'Tag';
|
|
2816
|
+
const Cloud$1 = 'Cloud';
|
|
2817
|
+
const SourceControl$1 = 'SourceControl';
|
|
2818
|
+
const None = '';
|
|
2729
2819
|
|
|
2730
|
-
const
|
|
2731
|
-
const
|
|
2732
|
-
const
|
|
2733
|
-
const Img$1 = 17;
|
|
2820
|
+
const SourceControl = 1;
|
|
2821
|
+
const Cloud = 2;
|
|
2822
|
+
const Tag = 3;
|
|
2734
2823
|
|
|
2735
|
-
const
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
type: Input$1,
|
|
2739
|
-
className: InputBox,
|
|
2740
|
-
spellcheck: false,
|
|
2741
|
-
autocapitalize: 'off',
|
|
2742
|
-
inputType: 'text',
|
|
2743
|
-
childCount: 0,
|
|
2744
|
-
role: ComboBox,
|
|
2745
|
-
name: QuickPickInput,
|
|
2746
|
-
onBeforeInput: HandleBeforeInput,
|
|
2747
|
-
onBlur: HandleBlur,
|
|
2748
|
-
onInput: HandleInput,
|
|
2749
|
-
onFocus: HandleFocus,
|
|
2750
|
-
ariaLabel: ariaLabel,
|
|
2751
|
-
ariaAutoComplete: 'list',
|
|
2752
|
-
ariaExpanded: true,
|
|
2753
|
-
autocomplete: 'off'
|
|
2754
|
-
};
|
|
2824
|
+
const name$5 = 'custom';
|
|
2825
|
+
const state$6 = {
|
|
2826
|
+
args: []
|
|
2755
2827
|
};
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
return [{
|
|
2759
|
-
type: Div$1,
|
|
2760
|
-
className: QuickPickHeader,
|
|
2761
|
-
childCount: 1
|
|
2762
|
-
}, getQuickPickInputVirtualDom()];
|
|
2828
|
+
const setArgs = args => {
|
|
2829
|
+
state$6.args = args;
|
|
2763
2830
|
};
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
var __export = (target, all) => {
|
|
2767
|
-
for (var name in all) __defProp(target, name, {
|
|
2768
|
-
get: all[name],
|
|
2769
|
-
enumerable: true
|
|
2770
|
-
});
|
|
2831
|
+
const getPlaceholder$5 = () => {
|
|
2832
|
+
return '';
|
|
2771
2833
|
};
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
var mergeClassNames = (...classNames) => {
|
|
2775
|
-
return classNames.filter(Boolean).join(" ");
|
|
2776
|
-
};
|
|
2777
|
-
|
|
2778
|
-
// src/parts/VirtualDomElements/VirtualDomElements.ts
|
|
2779
|
-
var VirtualDomElements_exports = {};
|
|
2780
|
-
__export(VirtualDomElements_exports, {
|
|
2781
|
-
A: () => A,
|
|
2782
|
-
Abbr: () => Abbr,
|
|
2783
|
-
Article: () => Article,
|
|
2784
|
-
Aside: () => Aside,
|
|
2785
|
-
Audio: () => Audio,
|
|
2786
|
-
Br: () => Br,
|
|
2787
|
-
Button: () => Button,
|
|
2788
|
-
Cite: () => Cite,
|
|
2789
|
-
Col: () => Col,
|
|
2790
|
-
ColGroup: () => ColGroup,
|
|
2791
|
-
Data: () => Data,
|
|
2792
|
-
Dd: () => Dd,
|
|
2793
|
-
Del: () => Del,
|
|
2794
|
-
Div: () => Div,
|
|
2795
|
-
Dl: () => Dl,
|
|
2796
|
-
Figcaption: () => Figcaption,
|
|
2797
|
-
Figure: () => Figure,
|
|
2798
|
-
Footer: () => Footer,
|
|
2799
|
-
H1: () => H1,
|
|
2800
|
-
H2: () => H2,
|
|
2801
|
-
H3: () => H3,
|
|
2802
|
-
H4: () => H4,
|
|
2803
|
-
H5: () => H5,
|
|
2804
|
-
H6: () => H6,
|
|
2805
|
-
Header: () => Header,
|
|
2806
|
-
Hr: () => Hr,
|
|
2807
|
-
I: () => I,
|
|
2808
|
-
Img: () => Img,
|
|
2809
|
-
Input: () => Input,
|
|
2810
|
-
Ins: () => Ins,
|
|
2811
|
-
Kbd: () => Kbd,
|
|
2812
|
-
Li: () => Li,
|
|
2813
|
-
Nav: () => Nav,
|
|
2814
|
-
Ol: () => Ol,
|
|
2815
|
-
Option: () => Option,
|
|
2816
|
-
P: () => P,
|
|
2817
|
-
Pre: () => Pre,
|
|
2818
|
-
Root: () => Root,
|
|
2819
|
-
Search: () => Search,
|
|
2820
|
-
Section: () => Section,
|
|
2821
|
-
Select: () => Select,
|
|
2822
|
-
Span: () => Span,
|
|
2823
|
-
TBody: () => TBody,
|
|
2824
|
-
THead: () => THead,
|
|
2825
|
-
Table: () => Table,
|
|
2826
|
-
Td: () => Td,
|
|
2827
|
-
Text: () => Text,
|
|
2828
|
-
TextArea: () => TextArea,
|
|
2829
|
-
Tfoot: () => Tfoot,
|
|
2830
|
-
Th: () => Th,
|
|
2831
|
-
Time: () => Time,
|
|
2832
|
-
Tr: () => Tr,
|
|
2833
|
-
Ul: () => Ul,
|
|
2834
|
-
Video: () => Video
|
|
2835
|
-
});
|
|
2836
|
-
var Audio = 0;
|
|
2837
|
-
var Button = 1;
|
|
2838
|
-
var Col = 2;
|
|
2839
|
-
var ColGroup = 3;
|
|
2840
|
-
var Div = 4;
|
|
2841
|
-
var H1 = 5;
|
|
2842
|
-
var Input = 6;
|
|
2843
|
-
var Kbd = 7;
|
|
2844
|
-
var Span = 8;
|
|
2845
|
-
var Table = 9;
|
|
2846
|
-
var TBody = 10;
|
|
2847
|
-
var Td = 11;
|
|
2848
|
-
var Text = 12;
|
|
2849
|
-
var Th = 13;
|
|
2850
|
-
var THead = 14;
|
|
2851
|
-
var Tr = 15;
|
|
2852
|
-
var I = 16;
|
|
2853
|
-
var Img = 17;
|
|
2854
|
-
var Root = 0;
|
|
2855
|
-
var Ins = 20;
|
|
2856
|
-
var Del = 21;
|
|
2857
|
-
var H2 = 22;
|
|
2858
|
-
var H3 = 23;
|
|
2859
|
-
var H4 = 24;
|
|
2860
|
-
var H5 = 25;
|
|
2861
|
-
var H6 = 26;
|
|
2862
|
-
var Article = 27;
|
|
2863
|
-
var Aside = 28;
|
|
2864
|
-
var Footer = 29;
|
|
2865
|
-
var Header = 30;
|
|
2866
|
-
var Nav = 40;
|
|
2867
|
-
var Section = 41;
|
|
2868
|
-
var Search = 42;
|
|
2869
|
-
var Dd = 43;
|
|
2870
|
-
var Dl = 44;
|
|
2871
|
-
var Figcaption = 45;
|
|
2872
|
-
var Figure = 46;
|
|
2873
|
-
var Hr = 47;
|
|
2874
|
-
var Li = 48;
|
|
2875
|
-
var Ol = 49;
|
|
2876
|
-
var P = 50;
|
|
2877
|
-
var Pre = 51;
|
|
2878
|
-
var A = 53;
|
|
2879
|
-
var Abbr = 54;
|
|
2880
|
-
var Br = 55;
|
|
2881
|
-
var Cite = 56;
|
|
2882
|
-
var Data = 57;
|
|
2883
|
-
var Time = 58;
|
|
2884
|
-
var Tfoot = 59;
|
|
2885
|
-
var Ul = 60;
|
|
2886
|
-
var Video = 61;
|
|
2887
|
-
var TextArea = 62;
|
|
2888
|
-
var Select = 63;
|
|
2889
|
-
var Option = 64;
|
|
2890
|
-
|
|
2891
|
-
// src/parts/Text/Text.ts
|
|
2892
|
-
var text = data => {
|
|
2893
|
-
return {
|
|
2894
|
-
type: Text,
|
|
2895
|
-
text: data,
|
|
2896
|
-
childCount: 0
|
|
2897
|
-
};
|
|
2834
|
+
const getLabel$2 = () => {
|
|
2835
|
+
return 'Custom';
|
|
2898
2836
|
};
|
|
2899
2837
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
childCount: 1
|
|
2838
|
+
// TODO help entries should not be here
|
|
2839
|
+
const getHelpEntries$1 = () => {
|
|
2840
|
+
return [];
|
|
2904
2841
|
};
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
className: QuickPickItemLabel,
|
|
2909
|
-
childCount: 0
|
|
2842
|
+
const getNoResults$5 = () => {
|
|
2843
|
+
return {
|
|
2844
|
+
label: noMatchingResults()
|
|
2910
2845
|
};
|
|
2911
|
-
dom.push(labelDom);
|
|
2912
|
-
let position = 0;
|
|
2913
|
-
for (let i = 0; i < highlights.length; i += 2) {
|
|
2914
|
-
const highlightStart = highlights[i];
|
|
2915
|
-
const highlightEnd = highlights[i + 1];
|
|
2916
|
-
if (position < highlightStart) {
|
|
2917
|
-
const beforeText = label.slice(position, highlightStart);
|
|
2918
|
-
labelDom.childCount++;
|
|
2919
|
-
dom.push(text(beforeText));
|
|
2920
|
-
}
|
|
2921
|
-
const highlightText = label.slice(highlightStart, highlightEnd);
|
|
2922
|
-
labelDom.childCount++;
|
|
2923
|
-
dom.push(quickPickHighlight, text(highlightText));
|
|
2924
|
-
position = highlightEnd;
|
|
2925
|
-
}
|
|
2926
|
-
if (position < label.length) {
|
|
2927
|
-
const afterText = label.slice(position);
|
|
2928
|
-
labelDom.childCount++;
|
|
2929
|
-
dom.push(text(afterText));
|
|
2930
|
-
}
|
|
2931
2846
|
};
|
|
2932
|
-
|
|
2933
|
-
const
|
|
2847
|
+
const getPicks$5 = async searchValue => {
|
|
2848
|
+
const items = state$6.args[1] || [];
|
|
2849
|
+
return items;
|
|
2850
|
+
};
|
|
2851
|
+
const selectPick$5 = async pick => {
|
|
2852
|
+
const {
|
|
2853
|
+
args
|
|
2854
|
+
} = state$6;
|
|
2855
|
+
const resolve = args[2];
|
|
2856
|
+
resolve(pick);
|
|
2934
2857
|
return {
|
|
2935
|
-
|
|
2936
|
-
className: FileIcon,
|
|
2937
|
-
src: icon,
|
|
2938
|
-
role: None$1,
|
|
2939
|
-
childCount: 0
|
|
2858
|
+
command: Hide
|
|
2940
2859
|
};
|
|
2941
2860
|
};
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
const parent = dom[0];
|
|
2965
|
-
if (isActive) {
|
|
2966
|
-
// @ts-ignore
|
|
2967
|
-
parent.id = 'QuickPickItemActive';
|
|
2968
|
-
parent.className += ' ' + QuickPickItemActive$1;
|
|
2969
|
-
}
|
|
2970
|
-
if (fileIcon) {
|
|
2971
|
-
parent.childCount++;
|
|
2972
|
-
dom.push(getFileIconVirtualDom(fileIcon));
|
|
2973
|
-
} else if (icon) {
|
|
2974
|
-
parent.childCount++;
|
|
2975
|
-
dom.push({
|
|
2976
|
-
type: Div$1,
|
|
2977
|
-
className: mergeClassNames(`QuickPickMaskIcon`, 'MaskIcon', `MaskIcon${icon}`),
|
|
2978
|
-
childCount: 0
|
|
2979
|
-
});
|
|
2980
|
-
}
|
|
2981
|
-
addHighlights(dom, highlights, label);
|
|
2982
|
-
if (description) {
|
|
2983
|
-
parent.childCount++;
|
|
2984
|
-
dom.push({
|
|
2985
|
-
type: Div$1,
|
|
2986
|
-
className: QuickPickItemDescription,
|
|
2987
|
-
childCount: 1
|
|
2988
|
-
}, text(description));
|
|
2861
|
+
const getFilterValue$5 = value => {
|
|
2862
|
+
return value;
|
|
2863
|
+
};
|
|
2864
|
+
const getPickFilterValue$5 = pick => {
|
|
2865
|
+
return pick;
|
|
2866
|
+
};
|
|
2867
|
+
const getPickLabel$5 = pick => {
|
|
2868
|
+
return pick.label;
|
|
2869
|
+
};
|
|
2870
|
+
const getPickDescription$5 = pick => {
|
|
2871
|
+
return pick.description || '';
|
|
2872
|
+
};
|
|
2873
|
+
const convertIcon = icon => {
|
|
2874
|
+
switch (icon) {
|
|
2875
|
+
case SourceControl:
|
|
2876
|
+
return SourceControl$1;
|
|
2877
|
+
case Cloud:
|
|
2878
|
+
return Cloud$1;
|
|
2879
|
+
case Tag:
|
|
2880
|
+
return Tag$1;
|
|
2881
|
+
default:
|
|
2882
|
+
return None;
|
|
2989
2883
|
}
|
|
2990
|
-
|
|
2884
|
+
};
|
|
2885
|
+
const getPickIcon$5 = pick => {
|
|
2886
|
+
return convertIcon(pick.icon);
|
|
2887
|
+
};
|
|
2888
|
+
const isPrepared$5 = () => {
|
|
2889
|
+
return true;
|
|
2890
|
+
};
|
|
2891
|
+
const getVisibleItems$5 = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
|
|
2892
|
+
const visibleItems = picks.slice(minLineY, maxLineY + 1).map((pick, index) => ({
|
|
2893
|
+
description: getPickDescription$5(pick),
|
|
2894
|
+
fileIcon: '',
|
|
2895
|
+
icon: getPickIcon$5(pick),
|
|
2896
|
+
isActive: index + minLineY === focusedIndex,
|
|
2897
|
+
label: getPickLabel$5(pick),
|
|
2898
|
+
matches: [],
|
|
2899
|
+
posInSet: index + minLineY + 1,
|
|
2900
|
+
setSize
|
|
2901
|
+
}));
|
|
2902
|
+
return visibleItems;
|
|
2991
2903
|
};
|
|
2992
2904
|
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
2905
|
+
const QuickPickEntriesCustom = {
|
|
2906
|
+
__proto__: null,
|
|
2907
|
+
getFilterValue: getFilterValue$5,
|
|
2908
|
+
getHelpEntries: getHelpEntries$1,
|
|
2909
|
+
getLabel: getLabel$2,
|
|
2910
|
+
getNoResults: getNoResults$5,
|
|
2911
|
+
getPickDescription: getPickDescription$5,
|
|
2912
|
+
getPickFilterValue: getPickFilterValue$5,
|
|
2913
|
+
getPickIcon: getPickIcon$5,
|
|
2914
|
+
getPickLabel: getPickLabel$5,
|
|
2915
|
+
getPicks: getPicks$5,
|
|
2916
|
+
getPlaceholder: getPlaceholder$5,
|
|
2917
|
+
getVisibleItems: getVisibleItems$5,
|
|
2918
|
+
isPrepared: isPrepared$5,
|
|
2919
|
+
name: name$5,
|
|
2920
|
+
selectPick: selectPick$5,
|
|
2921
|
+
setArgs,
|
|
2922
|
+
state: state$6
|
|
3004
2923
|
};
|
|
3005
2924
|
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3008
|
-
|
|
2925
|
+
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
2926
|
+
const getProtocol = uri => {
|
|
2927
|
+
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
2928
|
+
if (protocolMatch) {
|
|
2929
|
+
return protocolMatch[1];
|
|
3009
2930
|
}
|
|
3010
|
-
|
|
3011
|
-
return dom;
|
|
2931
|
+
return '';
|
|
3012
2932
|
};
|
|
3013
2933
|
|
|
3014
|
-
const
|
|
3015
|
-
|
|
3016
|
-
return [{
|
|
3017
|
-
type: Div$1,
|
|
3018
|
-
className: mergeClassNames(Viewlet, QuickPick$1),
|
|
3019
|
-
childCount: 2,
|
|
3020
|
-
id: QuickPick,
|
|
3021
|
-
ariaLabel: quickOpen$1
|
|
3022
|
-
}, ...getQuickPickHeaderVirtualDom(), {
|
|
3023
|
-
type: Div$1,
|
|
3024
|
-
className: QuickPickItems$1,
|
|
3025
|
-
id: QuickPickItems,
|
|
3026
|
-
role: ListBox,
|
|
3027
|
-
ariaActivedescendant: QuickPickItemActive,
|
|
3028
|
-
onWheel: HandleWheel,
|
|
3029
|
-
childCount: visibleItems.length
|
|
3030
|
-
}, ...getQuickPickItemsVirtualDom(visibleItems)];
|
|
2934
|
+
const getWorkspacePath = async () => {
|
|
2935
|
+
return invoke$1('Workspace.getPath');
|
|
3031
2936
|
};
|
|
3032
2937
|
|
|
3033
|
-
const
|
|
3034
|
-
|
|
3035
|
-
return ['Viewlet.setDom2', dom];
|
|
2938
|
+
const openUri = async uri => {
|
|
2939
|
+
await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
|
|
3036
2940
|
};
|
|
3037
2941
|
|
|
3038
|
-
const
|
|
3039
|
-
|
|
2942
|
+
const state$5 = Object.create(null);
|
|
2943
|
+
const register = modules => {
|
|
2944
|
+
Object.assign(state$5, modules);
|
|
2945
|
+
};
|
|
2946
|
+
const getModule = protocol => {
|
|
2947
|
+
return state$5[protocol];
|
|
3040
2948
|
};
|
|
3041
2949
|
|
|
3042
|
-
const
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
case RenderItems:
|
|
3049
|
-
return renderItems;
|
|
3050
|
-
case RenderFocusedIndex:
|
|
3051
|
-
return renderFocusedIndex;
|
|
3052
|
-
case Height:
|
|
3053
|
-
return renderHeight;
|
|
3054
|
-
case RenderFocus:
|
|
3055
|
-
return renderFocus;
|
|
3056
|
-
default:
|
|
3057
|
-
throw new Error('unknown renderer');
|
|
3058
|
-
}
|
|
2950
|
+
const searchFile$5 = async (path, value, prepare, assetDir) => {
|
|
2951
|
+
const protocol = getProtocol(path);
|
|
2952
|
+
// TODO call different providers depending on protocol
|
|
2953
|
+
const fn = getModule(protocol);
|
|
2954
|
+
const result = await fn(path, value, prepare, assetDir);
|
|
2955
|
+
return result;
|
|
3059
2956
|
};
|
|
3060
2957
|
|
|
3061
|
-
const
|
|
3062
|
-
|
|
3063
|
-
const
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
2958
|
+
const state$4 = {};
|
|
2959
|
+
const searchFile$4 = async (path, value) => {
|
|
2960
|
+
const prepare = true;
|
|
2961
|
+
// @ts-ignore
|
|
2962
|
+
const files = await searchFile$5(/* path */path, /* searchTerm */value, prepare);
|
|
2963
|
+
return files;
|
|
2964
|
+
};
|
|
2965
|
+
const name$4 = 'file';
|
|
2966
|
+
const getPlaceholder$4 = () => {
|
|
2967
|
+
return '';
|
|
2968
|
+
};
|
|
2969
|
+
const getLabel$1 = () => {
|
|
2970
|
+
return files();
|
|
2971
|
+
};
|
|
2972
|
+
const getNoResults$4 = () => {
|
|
2973
|
+
return {
|
|
2974
|
+
label: noMatchingResults()
|
|
2975
|
+
};
|
|
2976
|
+
};
|
|
2977
|
+
const getPicks$4 = async searchValue => {
|
|
2978
|
+
// TODO cache workspace path
|
|
2979
|
+
const workspace = await getWorkspacePath();
|
|
2980
|
+
if (!workspace) {
|
|
2981
|
+
return [];
|
|
3073
2982
|
}
|
|
3074
|
-
|
|
2983
|
+
const files = await searchFile$4(workspace, searchValue);
|
|
2984
|
+
return files;
|
|
3075
2985
|
};
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
2986
|
+
const selectPick$4 = async pick => {
|
|
2987
|
+
if (typeof pick === 'object') {
|
|
2988
|
+
pick = pick.pick;
|
|
2989
|
+
}
|
|
2990
|
+
const workspace = await getWorkspacePath();
|
|
2991
|
+
const absolutePath = `${workspace}/${pick}`;
|
|
2992
|
+
await openUri(absolutePath);
|
|
2993
|
+
return {
|
|
2994
|
+
command: Hide
|
|
2995
|
+
};
|
|
3085
2996
|
};
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
const {
|
|
3089
|
-
oldState,
|
|
3090
|
-
newState
|
|
3091
|
-
} = get(uid);
|
|
3092
|
-
const diffResult = diff(oldState, newState);
|
|
3093
|
-
return applyRender(oldState, newState, diffResult);
|
|
2997
|
+
const getFilterValue$4 = value => {
|
|
2998
|
+
return value;
|
|
3094
2999
|
};
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
preventDefault: true
|
|
3101
|
-
}, {
|
|
3102
|
-
name: HandleWheel,
|
|
3103
|
-
params: ['handleWheel', 'event.deltaMode', 'event.deltaY']
|
|
3104
|
-
}, {
|
|
3105
|
-
name: HandleBlur,
|
|
3106
|
-
params: ['handleBlur']
|
|
3107
|
-
}, {
|
|
3108
|
-
name: HandleBeforeInput,
|
|
3109
|
-
params: ['handleBeforeInput']
|
|
3110
|
-
}, {
|
|
3111
|
-
name: HandleInput,
|
|
3112
|
-
params: ['handleInput', 'event.target.value']
|
|
3113
|
-
}, {
|
|
3114
|
-
name: HandleFocus,
|
|
3115
|
-
params: ['handleFocus']
|
|
3116
|
-
}];
|
|
3000
|
+
const getPickFilterValue$4 = pick => {
|
|
3001
|
+
if (typeof pick === 'object') {
|
|
3002
|
+
pick = pick.pick;
|
|
3003
|
+
}
|
|
3004
|
+
return pick;
|
|
3117
3005
|
};
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3006
|
+
const getPickLabel$4 = pick => {
|
|
3007
|
+
if (typeof pick === 'object') {
|
|
3008
|
+
pick = pick.pick;
|
|
3009
|
+
}
|
|
3010
|
+
const baseName = pathBaseName(pick);
|
|
3011
|
+
return baseName;
|
|
3121
3012
|
};
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
if (items[i].pick.label === label) {
|
|
3126
|
-
return i;
|
|
3127
|
-
}
|
|
3013
|
+
const getPickDescription$4 = pick => {
|
|
3014
|
+
if (typeof pick === 'object') {
|
|
3015
|
+
pick = pick.pick;
|
|
3128
3016
|
}
|
|
3129
|
-
|
|
3017
|
+
const dirName = pathDirName(pick);
|
|
3018
|
+
return dirName;
|
|
3130
3019
|
};
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
if (
|
|
3136
|
-
|
|
3020
|
+
const getPickIcon$4 = () => {
|
|
3021
|
+
return '';
|
|
3022
|
+
};
|
|
3023
|
+
const getPickFileIcon$1 = pick => {
|
|
3024
|
+
if (typeof pick === 'object') {
|
|
3025
|
+
pick = pick.pick;
|
|
3137
3026
|
}
|
|
3138
|
-
|
|
3027
|
+
if (typeof pick === 'object') {
|
|
3028
|
+
pick = pick.pick;
|
|
3029
|
+
}
|
|
3030
|
+
const baseName = pathBaseName(pick);
|
|
3031
|
+
return {
|
|
3032
|
+
type: File$1,
|
|
3033
|
+
name: baseName,
|
|
3034
|
+
path: pick
|
|
3035
|
+
};
|
|
3036
|
+
};
|
|
3037
|
+
const isPrepared$4 = () => {
|
|
3038
|
+
const workspace = '';
|
|
3039
|
+
// TODO protocol should always be defined. For files it should use file protocol
|
|
3040
|
+
const protocol = getProtocol(workspace);
|
|
3041
|
+
return !protocol;
|
|
3042
|
+
};
|
|
3043
|
+
const getVisibleItems$4 = (files, minLineY, maxLineY, focusedIndex, setSize, icons) => {
|
|
3044
|
+
const visibleItems = files.map((item, i) => {
|
|
3045
|
+
const pick = item.pick;
|
|
3046
|
+
const label = getPickLabel$4(pick);
|
|
3047
|
+
const description = getPickDescription$4(pick);
|
|
3048
|
+
const icon = getPickIcon$4();
|
|
3049
|
+
const fileIcon = icons[i];
|
|
3050
|
+
return {
|
|
3051
|
+
label,
|
|
3052
|
+
description,
|
|
3053
|
+
icon,
|
|
3054
|
+
fileIcon,
|
|
3055
|
+
posInSet: minLineY + i + 1,
|
|
3056
|
+
setSize,
|
|
3057
|
+
isActive: i === focusedIndex,
|
|
3058
|
+
matches: item.matches
|
|
3059
|
+
};
|
|
3060
|
+
});
|
|
3061
|
+
return visibleItems;
|
|
3139
3062
|
};
|
|
3140
3063
|
|
|
3141
|
-
const
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3064
|
+
const QuickPickEntriesFile = {
|
|
3065
|
+
__proto__: null,
|
|
3066
|
+
getFilterValue: getFilterValue$4,
|
|
3067
|
+
getLabel: getLabel$1,
|
|
3068
|
+
getNoResults: getNoResults$4,
|
|
3069
|
+
getPickDescription: getPickDescription$4,
|
|
3070
|
+
getPickFileIcon: getPickFileIcon$1,
|
|
3071
|
+
getPickFilterValue: getPickFilterValue$4,
|
|
3072
|
+
getPickIcon: getPickIcon$4,
|
|
3073
|
+
getPickLabel: getPickLabel$4,
|
|
3074
|
+
getPicks: getPicks$4,
|
|
3075
|
+
getPlaceholder: getPlaceholder$4,
|
|
3076
|
+
getVisibleItems: getVisibleItems$4,
|
|
3077
|
+
isPrepared: isPrepared$4,
|
|
3078
|
+
name: name$4,
|
|
3079
|
+
selectPick: selectPick$4,
|
|
3080
|
+
state: state$4
|
|
3081
|
+
};
|
|
3082
|
+
|
|
3083
|
+
const getRecentlyOpened = () => {
|
|
3084
|
+
return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
3085
|
+
};
|
|
3086
|
+
|
|
3087
|
+
const openWorkspaceFolder = uri => {
|
|
3088
|
+
return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
|
|
3153
3089
|
};
|
|
3154
3090
|
|
|
3155
|
-
const
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
'QuickPick.focusPrevious': wrapCommand(focusPrevious),
|
|
3166
|
-
'QuickPick.getCommandIds': getCommandIds,
|
|
3167
|
-
'QuickPick.getKeyBindings': getKeyBindings,
|
|
3168
|
-
'QuickPick.handleBeforeInput': wrapCommand(handleBeforeInput),
|
|
3169
|
-
'QuickPick.handleBlur': wrapCommand(handleBlur),
|
|
3170
|
-
'QuickPick.handleClickAt': wrapCommand(handleClickAt),
|
|
3171
|
-
'QuickPick.handleFocus': wrapCommand(handleFocus),
|
|
3172
|
-
'QuickPick.handleInput': wrapCommand(handleInput),
|
|
3173
|
-
'QuickPick.handleWheel': wrapCommand(handleWheel),
|
|
3174
|
-
'QuickPick.loadContent': wrapCommand(loadContent),
|
|
3175
|
-
'QuickPick.loadEntries2': load,
|
|
3176
|
-
'QuickPick.render2': render2,
|
|
3177
|
-
'QuickPick.renderEventListeners': renderEventListeners,
|
|
3178
|
-
'QuickPick.selectCurrentIndex': wrapCommand(selectCurrentIndex),
|
|
3179
|
-
'QuickPick.selectIndex': wrapCommand(selectIndex),
|
|
3180
|
-
'QuickPick.selectItem': wrapCommand(selectItem),
|
|
3181
|
-
'QuickPick.setDeltaY': wrapCommand(setDeltaY),
|
|
3182
|
-
'QuickPick.setValue': wrapCommand(setValue),
|
|
3183
|
-
// deprecated
|
|
3184
|
-
'QuickPick.render': doRender,
|
|
3185
|
-
'SearchFile.filter': filterQuickPickItems,
|
|
3186
|
-
'SearchFile.searchFile': searchFile$5,
|
|
3187
|
-
'QuickPick.loadEntries': loadQuickPickEntries
|
|
3091
|
+
const getPlaceholder$3 = () => {
|
|
3092
|
+
return selectToOpen();
|
|
3093
|
+
};
|
|
3094
|
+
const getLabel = () => {
|
|
3095
|
+
return openRecent();
|
|
3096
|
+
};
|
|
3097
|
+
const getNoResults$3 = () => {
|
|
3098
|
+
return {
|
|
3099
|
+
label: noRecentlyOpenedFoldersFound()
|
|
3100
|
+
};
|
|
3188
3101
|
};
|
|
3189
3102
|
|
|
3190
|
-
|
|
3191
|
-
|
|
3103
|
+
// TODO could also change api so that getPicks returns an array of anything
|
|
3104
|
+
// and the transformPick gets the label for each pick
|
|
3105
|
+
// This would make the code more module since the code for getting the picks
|
|
3106
|
+
// would be more independent of the specific data format of the quickpick provider
|
|
3107
|
+
|
|
3108
|
+
const getPicks$3 = async () => {
|
|
3109
|
+
const recentlyOpened = await getRecentlyOpened();
|
|
3110
|
+
return recentlyOpened;
|
|
3111
|
+
};
|
|
3112
|
+
const getVisibleItems$3 = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
|
|
3113
|
+
const visibleItems = picks.map((pick, index) => ({
|
|
3114
|
+
description: getPickDescription$3(pick),
|
|
3115
|
+
fileIcon: getPickFileIcon(pick),
|
|
3116
|
+
icon: getPickIcon$3(),
|
|
3117
|
+
isActive: index + minLineY === focusedIndex,
|
|
3118
|
+
label: getPickLabel$3(pick),
|
|
3119
|
+
matches: [],
|
|
3120
|
+
posInSet: index + minLineY + 1,
|
|
3121
|
+
setSize
|
|
3122
|
+
}));
|
|
3123
|
+
return visibleItems;
|
|
3192
3124
|
};
|
|
3193
3125
|
|
|
3194
|
-
|
|
3195
|
-
|
|
3126
|
+
// TODO selectPick should be independent of show/hide
|
|
3127
|
+
const selectPick$3 = async pick => {
|
|
3128
|
+
const path = pick;
|
|
3129
|
+
await openWorkspaceFolder(path);
|
|
3130
|
+
return {
|
|
3131
|
+
command: Hide
|
|
3132
|
+
};
|
|
3196
3133
|
};
|
|
3197
|
-
const
|
|
3198
|
-
return
|
|
3134
|
+
const getFilterValue$3 = value => {
|
|
3135
|
+
return pathBaseName(value);
|
|
3199
3136
|
};
|
|
3200
|
-
const
|
|
3201
|
-
return
|
|
3137
|
+
const getPickFilterValue$3 = pick => {
|
|
3138
|
+
return pathBaseName(pick);
|
|
3202
3139
|
};
|
|
3203
|
-
const
|
|
3204
|
-
|
|
3205
|
-
return colorThemeNames;
|
|
3140
|
+
const getPickLabel$3 = pick => {
|
|
3141
|
+
return pathBaseName(pick);
|
|
3206
3142
|
};
|
|
3207
|
-
const
|
|
3208
|
-
|
|
3143
|
+
const getPickDescription$3 = pick => {
|
|
3144
|
+
return pathDirName(pick);
|
|
3145
|
+
};
|
|
3146
|
+
const getPickIcon$3 = () => {
|
|
3147
|
+
return '';
|
|
3148
|
+
};
|
|
3149
|
+
const getPickFileIcon = pick => {
|
|
3150
|
+
if (typeof pick === 'object') {
|
|
3151
|
+
pick = pick.pick;
|
|
3152
|
+
}
|
|
3153
|
+
if (typeof pick === 'object') {
|
|
3154
|
+
pick = pick.pick;
|
|
3155
|
+
}
|
|
3209
3156
|
return {
|
|
3210
|
-
|
|
3157
|
+
type: Directory,
|
|
3158
|
+
name: pick
|
|
3211
3159
|
};
|
|
3212
3160
|
};
|
|
3213
|
-
const
|
|
3214
|
-
|
|
3161
|
+
const state$3 = {};
|
|
3162
|
+
const isPrepared$3 = () => {
|
|
3163
|
+
return false;
|
|
3215
3164
|
};
|
|
3216
|
-
const
|
|
3217
|
-
|
|
3165
|
+
const name$3 = '';
|
|
3166
|
+
|
|
3167
|
+
const QuickPickEntriesOpenRecent = {
|
|
3168
|
+
__proto__: null,
|
|
3169
|
+
getFilterValue: getFilterValue$3,
|
|
3170
|
+
getLabel,
|
|
3171
|
+
getNoResults: getNoResults$3,
|
|
3172
|
+
getPickDescription: getPickDescription$3,
|
|
3173
|
+
getPickFileIcon,
|
|
3174
|
+
getPickFilterValue: getPickFilterValue$3,
|
|
3175
|
+
getPickIcon: getPickIcon$3,
|
|
3176
|
+
getPickLabel: getPickLabel$3,
|
|
3177
|
+
getPicks: getPicks$3,
|
|
3178
|
+
getPlaceholder: getPlaceholder$3,
|
|
3179
|
+
getVisibleItems: getVisibleItems$3,
|
|
3180
|
+
isPrepared: isPrepared$3,
|
|
3181
|
+
name: name$3,
|
|
3182
|
+
selectPick: selectPick$3,
|
|
3183
|
+
state: state$3
|
|
3184
|
+
};
|
|
3185
|
+
|
|
3186
|
+
const name$2 = 'symbol';
|
|
3187
|
+
const getPlaceholder$2 = () => {
|
|
3188
|
+
return '';
|
|
3218
3189
|
};
|
|
3219
3190
|
const getNoResults$2 = () => {
|
|
3220
3191
|
return {
|
|
3221
|
-
label:
|
|
3192
|
+
label: noSymbolFound()
|
|
3222
3193
|
};
|
|
3223
3194
|
};
|
|
3224
|
-
const
|
|
3225
|
-
|
|
3195
|
+
const getPicks$2 = async () => {
|
|
3196
|
+
const picks = [];
|
|
3197
|
+
return picks;
|
|
3226
3198
|
};
|
|
3227
|
-
const
|
|
3228
|
-
return
|
|
3199
|
+
const getVisibleItems$2 = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
|
|
3200
|
+
return [];
|
|
3229
3201
|
};
|
|
3230
|
-
const
|
|
3231
|
-
return
|
|
3202
|
+
const selectPick$2 = async item => {
|
|
3203
|
+
return {
|
|
3204
|
+
command: Hide
|
|
3205
|
+
};
|
|
3206
|
+
};
|
|
3207
|
+
const getFilterValue$2 = value => {
|
|
3208
|
+
return value;
|
|
3232
3209
|
};
|
|
3233
3210
|
const state$2 = {};
|
|
3234
3211
|
const getPickDescription$2 = value => {
|
|
@@ -3237,17 +3214,19 @@ const getPickDescription$2 = value => {
|
|
|
3237
3214
|
const isPrepared$2 = () => {
|
|
3238
3215
|
return false;
|
|
3239
3216
|
};
|
|
3240
|
-
const
|
|
3241
|
-
|
|
3242
|
-
|
|
3217
|
+
const getPickFilterValue$2 = value => {
|
|
3218
|
+
return value;
|
|
3219
|
+
};
|
|
3220
|
+
const getPickLabel$2 = value => {
|
|
3221
|
+
return value;
|
|
3222
|
+
};
|
|
3223
|
+
const getPickIcon$2 = value => {
|
|
3224
|
+
return '';
|
|
3243
3225
|
};
|
|
3244
3226
|
|
|
3245
|
-
const
|
|
3227
|
+
const QuickPickEntriesSymbol = {
|
|
3246
3228
|
__proto__: null,
|
|
3247
|
-
focusPick,
|
|
3248
3229
|
getFilterValue: getFilterValue$2,
|
|
3249
|
-
getHelpEntries: getHelpEntries$1,
|
|
3250
|
-
getLabel: getLabel$1,
|
|
3251
3230
|
getNoResults: getNoResults$2,
|
|
3252
3231
|
getPickDescription: getPickDescription$2,
|
|
3253
3232
|
getPickFilterValue: getPickFilterValue$2,
|
|
@@ -3255,95 +3234,74 @@ const QuickPickEntriesColorTheme = {
|
|
|
3255
3234
|
getPickLabel: getPickLabel$2,
|
|
3256
3235
|
getPicks: getPicks$2,
|
|
3257
3236
|
getPlaceholder: getPlaceholder$2,
|
|
3237
|
+
getVisibleItems: getVisibleItems$2,
|
|
3258
3238
|
isPrepared: isPrepared$2,
|
|
3259
3239
|
name: name$2,
|
|
3260
3240
|
selectPick: selectPick$2,
|
|
3261
|
-
setColorTheme,
|
|
3262
3241
|
state: state$2
|
|
3263
3242
|
};
|
|
3264
3243
|
|
|
3265
|
-
|
|
3266
|
-
const Cloud$1 = 'Cloud';
|
|
3267
|
-
const SourceControl$1 = 'SourceControl';
|
|
3268
|
-
const None = '';
|
|
3269
|
-
|
|
3270
|
-
const SourceControl = 1;
|
|
3271
|
-
const Cloud = 2;
|
|
3272
|
-
const Tag = 3;
|
|
3244
|
+
// TODO probably not needed
|
|
3273
3245
|
|
|
3274
|
-
const name$1 = 'custom';
|
|
3275
|
-
const state$1 = {
|
|
3276
|
-
args: []
|
|
3277
|
-
};
|
|
3278
|
-
const setArgs = args => {
|
|
3279
|
-
state$1.args = args;
|
|
3280
|
-
};
|
|
3281
3246
|
const getPlaceholder$1 = () => {
|
|
3282
|
-
return
|
|
3283
|
-
};
|
|
3284
|
-
const getLabel = () => {
|
|
3285
|
-
return 'Custom';
|
|
3247
|
+
return typeNameofCommandToRun();
|
|
3286
3248
|
};
|
|
3287
|
-
|
|
3288
|
-
// TODO help entries should not be here
|
|
3289
3249
|
const getHelpEntries = () => {
|
|
3290
|
-
return
|
|
3291
|
-
};
|
|
3292
|
-
const getNoResults$1 = () => {
|
|
3293
|
-
return {
|
|
3294
|
-
label: noMatchingResults()
|
|
3295
|
-
};
|
|
3250
|
+
return undefined;
|
|
3296
3251
|
};
|
|
3297
|
-
const getPicks$1 = async
|
|
3298
|
-
const
|
|
3299
|
-
|
|
3252
|
+
const getPicks$1 = async () => {
|
|
3253
|
+
// const views = ViewService.getViews()
|
|
3254
|
+
// const picks = views.map(toPick)
|
|
3255
|
+
// return picks
|
|
3256
|
+
return [];
|
|
3300
3257
|
};
|
|
3301
|
-
const selectPick$1 = async
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
resolve(pick);
|
|
3307
|
-
return {
|
|
3308
|
-
command: Hide
|
|
3309
|
-
};
|
|
3258
|
+
const selectPick$1 = async item => {
|
|
3259
|
+
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
3260
|
+
// return {
|
|
3261
|
+
// command: QuickPickReturnValue.Hide,
|
|
3262
|
+
// }
|
|
3310
3263
|
};
|
|
3311
3264
|
const getFilterValue$1 = value => {
|
|
3312
3265
|
return value;
|
|
3313
3266
|
};
|
|
3314
|
-
const getPickFilterValue$1 =
|
|
3315
|
-
return
|
|
3316
|
-
};
|
|
3317
|
-
const getPickLabel$1 = pick => {
|
|
3318
|
-
return pick.label;
|
|
3267
|
+
const getPickFilterValue$1 = value => {
|
|
3268
|
+
return value;
|
|
3319
3269
|
};
|
|
3320
|
-
const
|
|
3321
|
-
return
|
|
3270
|
+
const getPickLabel$1 = value => {
|
|
3271
|
+
return value;
|
|
3322
3272
|
};
|
|
3323
|
-
const
|
|
3324
|
-
|
|
3325
|
-
case SourceControl:
|
|
3326
|
-
return SourceControl$1;
|
|
3327
|
-
case Cloud:
|
|
3328
|
-
return Cloud$1;
|
|
3329
|
-
case Tag:
|
|
3330
|
-
return Tag$1;
|
|
3331
|
-
default:
|
|
3332
|
-
return None;
|
|
3333
|
-
}
|
|
3273
|
+
const getPickIcon$1 = value => {
|
|
3274
|
+
return '';
|
|
3334
3275
|
};
|
|
3335
|
-
const
|
|
3336
|
-
|
|
3276
|
+
const state$1 = {};
|
|
3277
|
+
const getNoResults$1 = () => {
|
|
3278
|
+
return '';
|
|
3337
3279
|
};
|
|
3280
|
+
const name$1 = '';
|
|
3338
3281
|
const isPrepared$1 = () => {
|
|
3339
3282
|
return true;
|
|
3340
3283
|
};
|
|
3284
|
+
const getPickDescription$1 = () => {
|
|
3285
|
+
return '';
|
|
3286
|
+
};
|
|
3287
|
+
const getVisibleItems$1 = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
|
|
3288
|
+
const visibleItems = picks.map((pick, index) => ({
|
|
3289
|
+
description: getPickDescription$1(),
|
|
3290
|
+
fileIcon: '',
|
|
3291
|
+
icon: getPickIcon$1(),
|
|
3292
|
+
isActive: index + minLineY === focusedIndex,
|
|
3293
|
+
label: getPickLabel$1(pick),
|
|
3294
|
+
matches: [],
|
|
3295
|
+
posInSet: index + minLineY + 1,
|
|
3296
|
+
setSize
|
|
3297
|
+
}));
|
|
3298
|
+
return visibleItems;
|
|
3299
|
+
};
|
|
3341
3300
|
|
|
3342
|
-
const
|
|
3301
|
+
const QuickPickEntriesView = {
|
|
3343
3302
|
__proto__: null,
|
|
3344
3303
|
getFilterValue: getFilterValue$1,
|
|
3345
3304
|
getHelpEntries,
|
|
3346
|
-
getLabel,
|
|
3347
3305
|
getNoResults: getNoResults$1,
|
|
3348
3306
|
getPickDescription: getPickDescription$1,
|
|
3349
3307
|
getPickFilterValue: getPickFilterValue$1,
|
|
@@ -3351,44 +3309,40 @@ const QuickPickEntriesCustom = {
|
|
|
3351
3309
|
getPickLabel: getPickLabel$1,
|
|
3352
3310
|
getPicks: getPicks$1,
|
|
3353
3311
|
getPlaceholder: getPlaceholder$1,
|
|
3312
|
+
getVisibleItems: getVisibleItems$1,
|
|
3354
3313
|
isPrepared: isPrepared$1,
|
|
3355
3314
|
name: name$1,
|
|
3356
3315
|
selectPick: selectPick$1,
|
|
3357
|
-
setArgs,
|
|
3358
3316
|
state: state$1
|
|
3359
3317
|
};
|
|
3360
3318
|
|
|
3361
|
-
const name = '
|
|
3319
|
+
const name = 'workspace-symbol';
|
|
3362
3320
|
const getPlaceholder = () => {
|
|
3363
3321
|
return '';
|
|
3364
3322
|
};
|
|
3323
|
+
const state = {};
|
|
3324
|
+
const getPickIcon = () => {
|
|
3325
|
+
return '';
|
|
3326
|
+
};
|
|
3327
|
+
const isPrepared = () => {
|
|
3328
|
+
return false;
|
|
3329
|
+
};
|
|
3330
|
+
const getPickLabel = () => {
|
|
3331
|
+
return '';
|
|
3332
|
+
};
|
|
3333
|
+
const getPickFilterValue = () => {
|
|
3334
|
+
return '';
|
|
3335
|
+
};
|
|
3336
|
+
const getPickDescription = () => {
|
|
3337
|
+
return '';
|
|
3338
|
+
};
|
|
3365
3339
|
const getNoResults = () => {
|
|
3366
3340
|
return {
|
|
3367
|
-
label:
|
|
3341
|
+
label: noWorkspaceSymbolsFound()
|
|
3368
3342
|
};
|
|
3369
3343
|
};
|
|
3370
3344
|
const getPicks = async () => {
|
|
3371
|
-
const picks = [
|
|
3372
|
-
label: '1'
|
|
3373
|
-
}, {
|
|
3374
|
-
label: '2'
|
|
3375
|
-
}, {
|
|
3376
|
-
label: '3'
|
|
3377
|
-
}, {
|
|
3378
|
-
label: '4'
|
|
3379
|
-
}, {
|
|
3380
|
-
label: '5'
|
|
3381
|
-
}, {
|
|
3382
|
-
label: '6'
|
|
3383
|
-
}, {
|
|
3384
|
-
label: '7'
|
|
3385
|
-
}, {
|
|
3386
|
-
label: '8'
|
|
3387
|
-
}, {
|
|
3388
|
-
label: '9'
|
|
3389
|
-
}, {
|
|
3390
|
-
label: '10'
|
|
3391
|
-
}];
|
|
3345
|
+
const picks = [];
|
|
3392
3346
|
return picks;
|
|
3393
3347
|
};
|
|
3394
3348
|
const selectPick = async item => {
|
|
@@ -3396,27 +3350,24 @@ const selectPick = async item => {
|
|
|
3396
3350
|
command: Hide
|
|
3397
3351
|
};
|
|
3398
3352
|
};
|
|
3399
|
-
const state = {};
|
|
3400
|
-
const getPickFilterValue = value => {
|
|
3401
|
-
return value;
|
|
3402
|
-
};
|
|
3403
3353
|
const getFilterValue = value => {
|
|
3404
3354
|
return value;
|
|
3405
3355
|
};
|
|
3406
|
-
const
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3356
|
+
const getVisibleItems = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
|
|
3357
|
+
const visibleItems = picks.map((pick, index) => ({
|
|
3358
|
+
description: '',
|
|
3359
|
+
fileIcon: '',
|
|
3360
|
+
icon: '',
|
|
3361
|
+
isActive: index + minLineY === focusedIndex,
|
|
3362
|
+
label: pick.label || '',
|
|
3363
|
+
matches: [],
|
|
3364
|
+
posInSet: index + minLineY + 1,
|
|
3365
|
+
setSize
|
|
3366
|
+
}));
|
|
3367
|
+
return visibleItems;
|
|
3417
3368
|
};
|
|
3418
3369
|
|
|
3419
|
-
const
|
|
3370
|
+
const QuickPickEntriesWorkspaceSymbol = {
|
|
3420
3371
|
__proto__: null,
|
|
3421
3372
|
getFilterValue,
|
|
3422
3373
|
getNoResults,
|
|
@@ -3426,6 +3377,7 @@ const QuickPickEntriesNumber = {
|
|
|
3426
3377
|
getPickLabel,
|
|
3427
3378
|
getPicks,
|
|
3428
3379
|
getPlaceholder,
|
|
3380
|
+
getVisibleItems,
|
|
3429
3381
|
isPrepared,
|
|
3430
3382
|
name,
|
|
3431
3383
|
selectPick,
|
|
@@ -3433,17 +3385,16 @@ const QuickPickEntriesNumber = {
|
|
|
3433
3385
|
};
|
|
3434
3386
|
|
|
3435
3387
|
const quickPickEntriesModules = {
|
|
3388
|
+
[ColorTheme]: QuickPickEntriesColorTheme,
|
|
3436
3389
|
[CommandPalette]: QuickPickEntriesEverything,
|
|
3437
|
-
[Commands]:
|
|
3438
|
-
[
|
|
3390
|
+
[Commands]: QuickPickEntriesCommand,
|
|
3391
|
+
[Custom]: QuickPickEntriesCustom,
|
|
3439
3392
|
[EveryThing]: QuickPickEntriesEverything,
|
|
3440
|
-
[
|
|
3441
|
-
[Number$1]: QuickPickEntriesNumber,
|
|
3393
|
+
[File$2]: QuickPickEntriesFile,
|
|
3442
3394
|
[Recent]: QuickPickEntriesOpenRecent,
|
|
3443
|
-
[ColorTheme]: QuickPickEntriesColorTheme,
|
|
3444
3395
|
[Symbol]: QuickPickEntriesSymbol,
|
|
3445
3396
|
[View]: QuickPickEntriesView,
|
|
3446
|
-
[
|
|
3397
|
+
[WorkspaceSymbol]: QuickPickEntriesWorkspaceSymbol
|
|
3447
3398
|
};
|
|
3448
3399
|
|
|
3449
3400
|
const Memfs = 'memfs';
|
|
@@ -3510,8 +3461,8 @@ const searchModules = {
|
|
|
3510
3461
|
};
|
|
3511
3462
|
|
|
3512
3463
|
const listen = async () => {
|
|
3513
|
-
register
|
|
3514
|
-
register(quickPickEntriesModules);
|
|
3464
|
+
register(searchModules);
|
|
3465
|
+
register$1(quickPickEntriesModules);
|
|
3515
3466
|
const rpc = await WebWorkerRpcClient.create({
|
|
3516
3467
|
commandMap: commandMap
|
|
3517
3468
|
});
|