@lvce-editor/problems-view 1.33.0 → 1.34.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.
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -3295,7 +3320,7 @@ 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);
|