@lvce-editor/problems-view 1.33.0 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/problemsViewWorkerMain.js +38 -12
- package/package.json +1 -1
|
@@ -2243,6 +2243,25 @@ const getFileName = uri => {
|
|
|
2243
2243
|
const slashIndex = uri.lastIndexOf('/');
|
|
2244
2244
|
return uri.slice(slashIndex + 1);
|
|
2245
2245
|
};
|
|
2246
|
+
const toRelatedProblem = (relatedInformation, diagnostic, index, setSize) => {
|
|
2247
|
+
return {
|
|
2248
|
+
code: '',
|
|
2249
|
+
columnIndex: relatedInformation.columnIndex || 0,
|
|
2250
|
+
count: 0,
|
|
2251
|
+
fileName: '',
|
|
2252
|
+
level: 3,
|
|
2253
|
+
listItemType: Item,
|
|
2254
|
+
message: relatedInformation.message || '',
|
|
2255
|
+
posInSet: index,
|
|
2256
|
+
relativePath: '',
|
|
2257
|
+
rowIndex: relatedInformation.rowIndex || 0,
|
|
2258
|
+
setSize,
|
|
2259
|
+
source: getFileName(relatedInformation.uri),
|
|
2260
|
+
targetUri: relatedInformation.uri,
|
|
2261
|
+
type: diagnostic.type || 'error',
|
|
2262
|
+
uri: diagnostic.uri
|
|
2263
|
+
};
|
|
2264
|
+
};
|
|
2246
2265
|
const toProblems = (diagnostics, workspaceUri = '') => {
|
|
2247
2266
|
const problems = [];
|
|
2248
2267
|
let problem = {
|
|
@@ -2287,13 +2306,18 @@ const toProblems = (diagnostics, workspaceUri = '') => {
|
|
|
2287
2306
|
problems.push(problem);
|
|
2288
2307
|
}
|
|
2289
2308
|
problems.push(toProblem(diagnostic, relativeIndex));
|
|
2309
|
+
const relatedInformation = diagnostic.relatedInformation || [];
|
|
2310
|
+
for (let i = 0; i < relatedInformation.length; i++) {
|
|
2311
|
+
problems.push(toRelatedProblem(relatedInformation[i], diagnostic, i + 1, relatedInformation.length));
|
|
2312
|
+
}
|
|
2290
2313
|
}
|
|
2291
2314
|
for (const problem of problems) {
|
|
2292
2315
|
// TODO maybe rename property, this should be the relative path of the parent folder of the file
|
|
2293
2316
|
// @ts-ignore
|
|
2294
|
-
problem.
|
|
2317
|
+
const displayUri = problem.targetUri || problem.uri;
|
|
2318
|
+
problem.relativePath = getRelativeParentUri(displayUri, workspaceUri);
|
|
2295
2319
|
// @ts-ignore
|
|
2296
|
-
problem.fileName = getFileName(
|
|
2320
|
+
problem.fileName = getFileName(displayUri);
|
|
2297
2321
|
// problem.uri = problem.uri // TODO
|
|
2298
2322
|
}
|
|
2299
2323
|
return problems;
|
|
@@ -2327,7 +2351,7 @@ const getProblems = async (workspaceUri, activeUri) => {
|
|
|
2327
2351
|
};
|
|
2328
2352
|
} catch (error) {
|
|
2329
2353
|
return {
|
|
2330
|
-
error:
|
|
2354
|
+
error: String(error),
|
|
2331
2355
|
problems: []
|
|
2332
2356
|
};
|
|
2333
2357
|
}
|
|
@@ -2716,9 +2740,10 @@ const handleProblemClick = async (state, eventX, eventY) => {
|
|
|
2716
2740
|
const {
|
|
2717
2741
|
columnIndex,
|
|
2718
2742
|
rowIndex,
|
|
2743
|
+
targetUri,
|
|
2719
2744
|
uri
|
|
2720
2745
|
} = problem;
|
|
2721
|
-
await openUri(uri, true);
|
|
2746
|
+
await openUri(targetUri || uri, true);
|
|
2722
2747
|
await focusEditor();
|
|
2723
2748
|
await setEditorCursor(rowIndex, columnIndex);
|
|
2724
2749
|
return newState;
|
|
@@ -2924,16 +2949,16 @@ const getTreeItemIndent = depth => {
|
|
|
2924
2949
|
return `${depth * defaultIndent}rem`;
|
|
2925
2950
|
};
|
|
2926
2951
|
|
|
2927
|
-
const getProblemIndent = listItemType => {
|
|
2952
|
+
const getProblemIndent = (listItemType, level) => {
|
|
2928
2953
|
const isGroup = listItemType === Expanded || listItemType === Collapsed;
|
|
2929
|
-
const depth = isGroup ? 1 : 2;
|
|
2954
|
+
const depth = isGroup ? 1 : Math.max(2, level || 2);
|
|
2930
2955
|
return getTreeItemIndent(depth);
|
|
2931
2956
|
};
|
|
2932
2957
|
|
|
2933
2958
|
const getUniqueIndents = problems => {
|
|
2934
2959
|
const uniqueIndents = [];
|
|
2935
2960
|
for (const problem of problems) {
|
|
2936
|
-
const indent = getProblemIndent(problem.listItemType);
|
|
2961
|
+
const indent = getProblemIndent(problem.listItemType, problem.level);
|
|
2937
2962
|
if (!uniqueIndents.includes(indent)) {
|
|
2938
2963
|
uniqueIndents.push(indent);
|
|
2939
2964
|
}
|
|
@@ -3194,7 +3219,7 @@ const getBadgeVirtualDom = (className, count) => {
|
|
|
3194
3219
|
childCount: 1,
|
|
3195
3220
|
className: mergeClassNames('Badge', className) + (''),
|
|
3196
3221
|
type: Div
|
|
3197
|
-
}, text(
|
|
3222
|
+
}, text(String(count))];
|
|
3198
3223
|
};
|
|
3199
3224
|
|
|
3200
3225
|
const getChevronDownVirtualDom = (extraClassName = '') => {
|
|
@@ -3244,7 +3269,7 @@ const getProblemsIconVirtualDom = type => {
|
|
|
3244
3269
|
const getProblemSourceDetail = (source, code) => {
|
|
3245
3270
|
let message = '';
|
|
3246
3271
|
if (source) {
|
|
3247
|
-
message +=
|
|
3272
|
+
message += source;
|
|
3248
3273
|
}
|
|
3249
3274
|
if (code) {
|
|
3250
3275
|
message += `(${code})`;
|
|
@@ -3295,23 +3320,24 @@ const getProblemVirtualDom = problem => {
|
|
|
3295
3320
|
uri
|
|
3296
3321
|
} = problem;
|
|
3297
3322
|
let className = Problem;
|
|
3298
|
-
const indent = getProblemIndent(listItemType);
|
|
3323
|
+
const indent = getProblemIndent(listItemType, level);
|
|
3299
3324
|
className = mergeClassNames(className, `Indent-${indent}`);
|
|
3300
3325
|
if (isActive) {
|
|
3301
3326
|
className = mergeClassNames(className, ProblemSelected);
|
|
3302
3327
|
}
|
|
3303
3328
|
if (listItemType === Expanded || listItemType === Collapsed) {
|
|
3329
|
+
const fileIconDom = icon ? [getFileIconVirtualDom(icon)] : [];
|
|
3304
3330
|
return [{
|
|
3305
3331
|
ariaExpanded: !isCollapsed,
|
|
3306
3332
|
ariaLevel: level,
|
|
3307
3333
|
ariaPosInSet: posInSet,
|
|
3308
3334
|
ariaSelected: isActive,
|
|
3309
3335
|
ariaSetSize: setSize,
|
|
3310
|
-
childCount:
|
|
3336
|
+
childCount: 4 + fileIconDom.length,
|
|
3311
3337
|
className,
|
|
3312
3338
|
role: TreeItem,
|
|
3313
3339
|
type: Div
|
|
3314
|
-
}, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(),
|
|
3340
|
+
}, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(), ...fileIconDom, {
|
|
3315
3341
|
...labelNode,
|
|
3316
3342
|
'data-uri': uri,
|
|
3317
3343
|
onClick: HandleFileNameClick
|