@lvce-editor/problems-view 1.26.2 → 1.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/problemsViewWorkerMain.js +75 -65
- package/package.json +1 -1
|
@@ -1266,6 +1266,34 @@ const listen$1 = async (module, options) => {
|
|
|
1266
1266
|
return ipc;
|
|
1267
1267
|
};
|
|
1268
1268
|
|
|
1269
|
+
const createSharedLazyRpc = factory => {
|
|
1270
|
+
let rpcPromise;
|
|
1271
|
+
const getOrCreate = () => {
|
|
1272
|
+
if (!rpcPromise) {
|
|
1273
|
+
rpcPromise = factory();
|
|
1274
|
+
}
|
|
1275
|
+
return rpcPromise;
|
|
1276
|
+
};
|
|
1277
|
+
return {
|
|
1278
|
+
async dispose() {
|
|
1279
|
+
const rpc = await getOrCreate();
|
|
1280
|
+
await rpc.dispose();
|
|
1281
|
+
},
|
|
1282
|
+
async invoke(method, ...params) {
|
|
1283
|
+
const rpc = await getOrCreate();
|
|
1284
|
+
return rpc.invoke(method, ...params);
|
|
1285
|
+
},
|
|
1286
|
+
async invokeAndTransfer(method, ...params) {
|
|
1287
|
+
const rpc = await getOrCreate();
|
|
1288
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1289
|
+
},
|
|
1290
|
+
async send(method, ...params) {
|
|
1291
|
+
const rpc = await getOrCreate();
|
|
1292
|
+
rpc.send(method, ...params);
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1269
1297
|
const create$5 = async ({
|
|
1270
1298
|
commandMap,
|
|
1271
1299
|
isMessagePortOpen = true,
|
|
@@ -1301,34 +1329,6 @@ const create$4 = async ({
|
|
|
1301
1329
|
});
|
|
1302
1330
|
};
|
|
1303
1331
|
|
|
1304
|
-
const createSharedLazyRpc = factory => {
|
|
1305
|
-
let rpcPromise;
|
|
1306
|
-
const getOrCreate = () => {
|
|
1307
|
-
if (!rpcPromise) {
|
|
1308
|
-
rpcPromise = factory();
|
|
1309
|
-
}
|
|
1310
|
-
return rpcPromise;
|
|
1311
|
-
};
|
|
1312
|
-
return {
|
|
1313
|
-
async dispose() {
|
|
1314
|
-
const rpc = await getOrCreate();
|
|
1315
|
-
await rpc.dispose();
|
|
1316
|
-
},
|
|
1317
|
-
async invoke(method, ...params) {
|
|
1318
|
-
const rpc = await getOrCreate();
|
|
1319
|
-
return rpc.invoke(method, ...params);
|
|
1320
|
-
},
|
|
1321
|
-
async invokeAndTransfer(method, ...params) {
|
|
1322
|
-
const rpc = await getOrCreate();
|
|
1323
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1324
|
-
},
|
|
1325
|
-
async send(method, ...params) {
|
|
1326
|
-
const rpc = await getOrCreate();
|
|
1327
|
-
rpc.send(method, ...params);
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
};
|
|
1331
|
-
|
|
1332
1332
|
const create$3 = async ({
|
|
1333
1333
|
commandMap,
|
|
1334
1334
|
isMessagePortOpen,
|
|
@@ -1808,13 +1808,6 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
|
1808
1808
|
return Math.min(Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize), size);
|
|
1809
1809
|
};
|
|
1810
1810
|
|
|
1811
|
-
const matchesFilterValue = (string, filterValueLower) => {
|
|
1812
|
-
if (filterValueLower) {
|
|
1813
|
-
return string.toLowerCase().indexOf(filterValueLower);
|
|
1814
|
-
}
|
|
1815
|
-
return 0;
|
|
1816
|
-
};
|
|
1817
|
-
|
|
1818
1811
|
const Item = 0;
|
|
1819
1812
|
const Expanded = 1;
|
|
1820
1813
|
const Collapsed = 2;
|
|
@@ -1828,8 +1821,17 @@ const getListItemType = (listItemType, isCollapsed) => {
|
|
|
1828
1821
|
}
|
|
1829
1822
|
return Expanded;
|
|
1830
1823
|
};
|
|
1824
|
+
|
|
1825
|
+
const matchesFilterValue = (string, filterValueLower) => {
|
|
1826
|
+
if (filterValueLower) {
|
|
1827
|
+
return string.toLowerCase().indexOf(filterValueLower);
|
|
1828
|
+
}
|
|
1829
|
+
return 0;
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1831
1832
|
const filterProblems = (problems, collapsedUris, filterValue) => {
|
|
1832
1833
|
const filterValueLower = filterValue.toLowerCase();
|
|
1834
|
+
const collapsedUriSet = new Set(collapsedUris);
|
|
1833
1835
|
const filtered = [];
|
|
1834
1836
|
for (const problem of problems) {
|
|
1835
1837
|
const uriMatchIndex = matchesFilterValue(problem.uri, filterValueLower);
|
|
@@ -1838,7 +1840,7 @@ const filterProblems = (problems, collapsedUris, filterValue) => {
|
|
|
1838
1840
|
if (uriMatchIndex === -1 && sourceMatchIndex === -1 && messageMatchIndex === -1) {
|
|
1839
1841
|
continue;
|
|
1840
1842
|
}
|
|
1841
|
-
const isCollapsed =
|
|
1843
|
+
const isCollapsed = collapsedUriSet.has(problem.uri);
|
|
1842
1844
|
if (isCollapsed && problem.listItemType === Item) {
|
|
1843
1845
|
continue;
|
|
1844
1846
|
}
|
|
@@ -2118,6 +2120,9 @@ const {
|
|
|
2118
2120
|
getProblems: getProblems$1,
|
|
2119
2121
|
getUri} = EditorWorker;
|
|
2120
2122
|
|
|
2123
|
+
const leadingSlashesRegex = /^\/+/;
|
|
2124
|
+
const trailingSlashRegex = /\/$/;
|
|
2125
|
+
const windowsDrivePathRegex = /^\/[a-z]:\//i;
|
|
2121
2126
|
const toProblem = (diagnostic, index) => {
|
|
2122
2127
|
const {
|
|
2123
2128
|
code,
|
|
@@ -2147,11 +2152,11 @@ const toProblem = (diagnostic, index) => {
|
|
|
2147
2152
|
};
|
|
2148
2153
|
const normalizeFileUri = uri => {
|
|
2149
2154
|
const normalizedUri = uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
|
|
2150
|
-
return
|
|
2155
|
+
return windowsDrivePathRegex.test(normalizedUri) ? normalizedUri.slice(1) : normalizedUri;
|
|
2151
2156
|
};
|
|
2152
2157
|
const getRelativeParentUri = (uri, workspaceUri) => {
|
|
2153
2158
|
const normalizedUri = normalizeFileUri(uri);
|
|
2154
|
-
const normalizedWorkspaceUri = normalizeFileUri(workspaceUri).replace(
|
|
2159
|
+
const normalizedWorkspaceUri = normalizeFileUri(workspaceUri).replace(trailingSlashRegex, '');
|
|
2155
2160
|
const slashIndex = normalizedUri.lastIndexOf('/');
|
|
2156
2161
|
const parentUri = normalizedUri.slice(0, slashIndex);
|
|
2157
2162
|
if (parentUri === normalizedWorkspaceUri) {
|
|
@@ -2160,7 +2165,7 @@ const getRelativeParentUri = (uri, workspaceUri) => {
|
|
|
2160
2165
|
if (normalizedWorkspaceUri && parentUri.startsWith(`${normalizedWorkspaceUri}/`)) {
|
|
2161
2166
|
return parentUri.slice(normalizedWorkspaceUri.length + 1);
|
|
2162
2167
|
}
|
|
2163
|
-
return parentUri.replace(
|
|
2168
|
+
return parentUri.replace(leadingSlashesRegex, '');
|
|
2164
2169
|
};
|
|
2165
2170
|
const getFileName = uri => {
|
|
2166
2171
|
const slashIndex = uri.lastIndexOf('/');
|
|
@@ -2289,7 +2294,7 @@ const getArrowLeftNewFocusedIndex = (problems, collapsedUris, focusedIndex) => {
|
|
|
2289
2294
|
if (problem.listItemType !== Item) {
|
|
2290
2295
|
return {
|
|
2291
2296
|
index: i,
|
|
2292
|
-
newCollapsedUris: [...collapsedUris, problem.uri]
|
|
2297
|
+
newCollapsedUris: collapsedUris.includes(problem.uri) ? collapsedUris : [...collapsedUris, problem.uri]
|
|
2293
2298
|
};
|
|
2294
2299
|
}
|
|
2295
2300
|
}
|
|
@@ -2315,17 +2320,9 @@ const handleArrowLeft = state => {
|
|
|
2315
2320
|
};
|
|
2316
2321
|
};
|
|
2317
2322
|
|
|
2318
|
-
const removeElement = (array, element) => {
|
|
2319
|
-
const index = array.indexOf(element);
|
|
2320
|
-
if (index === -1) {
|
|
2321
|
-
return array;
|
|
2322
|
-
}
|
|
2323
|
-
return [...array.slice(0, index), ...array.slice(index + 1)];
|
|
2324
|
-
};
|
|
2325
|
-
|
|
2326
2323
|
const getArrowRightNewFocusedIndex = (problems, collapsedUris, focusedIndex) => {
|
|
2327
2324
|
const problem = problems[focusedIndex];
|
|
2328
|
-
const newCollapsedUris =
|
|
2325
|
+
const newCollapsedUris = collapsedUris.includes(problem.uri) ? collapsedUris.filter(uri => uri !== problem.uri) : collapsedUris;
|
|
2329
2326
|
return {
|
|
2330
2327
|
index: focusedIndex,
|
|
2331
2328
|
newCollapsedUris
|
|
@@ -2553,27 +2550,32 @@ const getActiveUri = async () => {
|
|
|
2553
2550
|
return getUri(editorId);
|
|
2554
2551
|
};
|
|
2555
2552
|
|
|
2556
|
-
const
|
|
2557
|
-
|
|
2558
|
-
|
|
2553
|
+
const isString = value => {
|
|
2554
|
+
return typeof value === 'string';
|
|
2555
|
+
};
|
|
2556
|
+
|
|
2557
|
+
const getSavedCollapsedUris = savedState => {
|
|
2558
|
+
const collapsedUris = savedState?.collapsedUris;
|
|
2559
|
+
if (Array.isArray(collapsedUris) && collapsedUris.every(isString)) {
|
|
2560
|
+
return [...new Set(collapsedUris)];
|
|
2559
2561
|
}
|
|
2560
|
-
return
|
|
2562
|
+
return [];
|
|
2561
2563
|
};
|
|
2564
|
+
|
|
2562
2565
|
const getSavedFilterValue = savedState => {
|
|
2563
2566
|
if (savedState && typeof savedState.filterValue === 'string') {
|
|
2564
2567
|
return savedState.filterValue;
|
|
2565
2568
|
}
|
|
2566
2569
|
return '';
|
|
2567
2570
|
};
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
if (savedState && savedState.collapsedUris && Array.isArray(savedState.collapsedUris) && savedState.collapsedUris.every(isString)) {
|
|
2573
|
-
return savedState.collapsedUris;
|
|
2571
|
+
|
|
2572
|
+
const getSavedViewMode = savedState => {
|
|
2573
|
+
if (savedState && typeof savedState.viewMode === 'number') {
|
|
2574
|
+
return savedState.viewMode;
|
|
2574
2575
|
}
|
|
2575
|
-
return
|
|
2576
|
+
return List;
|
|
2576
2577
|
};
|
|
2578
|
+
|
|
2577
2579
|
const loadContent = async (state, savedState) => {
|
|
2578
2580
|
const {
|
|
2579
2581
|
workspaceUri
|
|
@@ -2826,16 +2828,21 @@ const getFilterBadgeDom = badgeText => {
|
|
|
2826
2828
|
return [filterBadgeNode, text(badgeText)];
|
|
2827
2829
|
};
|
|
2828
2830
|
|
|
2829
|
-
const getInputBoxVirtualDom = (name, onInput, placeholder) => {
|
|
2831
|
+
const getInputBoxVirtualDom = (name, onInput, placeholder, value) => {
|
|
2830
2832
|
return {
|
|
2833
|
+
ariaLabel: placeholder,
|
|
2831
2834
|
autocapitalize: 'off',
|
|
2832
2835
|
autocorrect: 'off',
|
|
2836
|
+
childCount: 0,
|
|
2833
2837
|
className: InputBox,
|
|
2834
2838
|
name,
|
|
2835
2839
|
onInput,
|
|
2836
2840
|
placeholder,
|
|
2837
2841
|
spellcheck: false,
|
|
2838
|
-
type: Input
|
|
2842
|
+
type: Input,
|
|
2843
|
+
...(value && {
|
|
2844
|
+
value
|
|
2845
|
+
})
|
|
2839
2846
|
};
|
|
2840
2847
|
};
|
|
2841
2848
|
|
|
@@ -2858,7 +2865,7 @@ const getProblemsFilterVirtualDom = action => {
|
|
|
2858
2865
|
childCount: getChildCount(action.badgeText),
|
|
2859
2866
|
className: Filter$1,
|
|
2860
2867
|
type: Div
|
|
2861
|
-
}, getInputBoxVirtualDom(Filter$2, action.command, action.placeholder || ''), ...getFilterBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
|
|
2868
|
+
}, getInputBoxVirtualDom(Filter$2, action.command, action.placeholder || '', action.value), ...getFilterBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
|
|
2862
2869
|
command: 'more filters',
|
|
2863
2870
|
icon: Filter,
|
|
2864
2871
|
id: 'more filters'})];
|
|
@@ -2908,6 +2915,7 @@ const getChevronRightVirtualDom = (extraClassName = '') => {
|
|
|
2908
2915
|
|
|
2909
2916
|
const getFileIconVirtualDom = icon => {
|
|
2910
2917
|
return {
|
|
2918
|
+
alt: '',
|
|
2911
2919
|
childCount: 0,
|
|
2912
2920
|
className: FileIcon,
|
|
2913
2921
|
role: None$1,
|
|
@@ -3026,7 +3034,7 @@ const getProblemVirtualDom = problem => {
|
|
|
3026
3034
|
role: TreeItem,
|
|
3027
3035
|
type: Div
|
|
3028
3036
|
}, getProblemsIconVirtualDom(type), label];
|
|
3029
|
-
if (filterValueLength) {
|
|
3037
|
+
if (filterValueLength && messageMatchIndex >= 0) {
|
|
3030
3038
|
const before = message.slice(0, messageMatchIndex);
|
|
3031
3039
|
const middle = message.slice(messageMatchIndex, messageMatchIndex + filterValueLength);
|
|
3032
3040
|
const after = message.slice(messageMatchIndex + filterValueLength);
|
|
@@ -3196,7 +3204,9 @@ const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, isSma
|
|
|
3196
3204
|
const filterDom = isSmall ? getProblemsFilterVirtualDom({
|
|
3197
3205
|
badgeText: '',
|
|
3198
3206
|
command: HandleFilterInput,
|
|
3199
|
-
placeholder: filter()
|
|
3207
|
+
placeholder: filter(),
|
|
3208
|
+
value: filterValue
|
|
3209
|
+
}) : [];
|
|
3200
3210
|
const itemsDom = getProblemsVirtualDom$1(viewMode, problems, filterValue, message, problemCount);
|
|
3201
3211
|
const scrollBarDom = getScrollBarVirtualDom(scrollBarHeight, scrollBarActive);
|
|
3202
3212
|
const contentClassName = viewMode === Table ? mergeClassNames(ProblemsContent, ProblemsContentTable) : ProblemsContent;
|