@lvce-editor/problems-view 1.35.0 → 1.37.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/problemsViewWorkerMain.js +100 -227
- package/package.json +1 -1
|
@@ -6,7 +6,8 @@ const create$a = () => {
|
|
|
6
6
|
const commandQueues = new Map();
|
|
7
7
|
const generations = Object.create(null);
|
|
8
8
|
const states = Object.create(null);
|
|
9
|
-
const commandMapRef =
|
|
9
|
+
const commandMapRef = Object.create(null);
|
|
10
|
+
const commandsById = Object.create(null);
|
|
10
11
|
const getGeneration = uid => generations[uid] || 0;
|
|
11
12
|
const isCurrentGeneration = (uid, generation) => {
|
|
12
13
|
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
@@ -68,6 +69,18 @@ const create$a = () => {
|
|
|
68
69
|
delete states[key];
|
|
69
70
|
}
|
|
70
71
|
},
|
|
72
|
+
createDirectEventCommandMap(requestRender) {
|
|
73
|
+
return {
|
|
74
|
+
async 'Viewlet.executeViewletCommand'(uid, command, ...args) {
|
|
75
|
+
const fn = commandsById[command];
|
|
76
|
+
if (!fn) {
|
|
77
|
+
throw new Error(`Viewlet command not found: ${command}`);
|
|
78
|
+
}
|
|
79
|
+
await fn(uid, ...args);
|
|
80
|
+
await requestRender(uid);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
},
|
|
71
84
|
diff(uid, modules, numbers) {
|
|
72
85
|
const {
|
|
73
86
|
oldState,
|
|
@@ -99,6 +112,9 @@ const create$a = () => {
|
|
|
99
112
|
},
|
|
100
113
|
registerCommands(commandMap) {
|
|
101
114
|
Object.assign(commandMapRef, commandMap);
|
|
115
|
+
for (const [key, fn] of Object.entries(commandMap)) {
|
|
116
|
+
commandsById[toCommandId(key)] = fn;
|
|
117
|
+
}
|
|
102
118
|
},
|
|
103
119
|
set(uid, oldState, newState, scheduledState) {
|
|
104
120
|
const current = states[uid];
|
|
@@ -1437,179 +1453,18 @@ const create$1 = rpcId => {
|
|
|
1437
1453
|
};
|
|
1438
1454
|
};
|
|
1439
1455
|
|
|
1440
|
-
const None$
|
|
1456
|
+
const None$2 = 'none';
|
|
1441
1457
|
const ToolBar = 'toolbar';
|
|
1442
1458
|
const Tree = 'tree';
|
|
1443
1459
|
const TreeItem = 'treeitem';
|
|
1444
1460
|
|
|
1445
|
-
const Audio = 0;
|
|
1446
1461
|
const Button$1 = 1;
|
|
1447
|
-
const Col = 2;
|
|
1448
|
-
const ColGroup = 3;
|
|
1449
1462
|
const Div = 4;
|
|
1450
|
-
const H1 = 5;
|
|
1451
1463
|
const Input = 6;
|
|
1452
|
-
const Kbd = 7;
|
|
1453
1464
|
const Span = 8;
|
|
1454
|
-
const Table$1 = 9;
|
|
1455
|
-
const TBody = 10;
|
|
1456
|
-
const Td = 11;
|
|
1457
1465
|
const Text = 12;
|
|
1458
|
-
const Th = 13;
|
|
1459
|
-
const THead = 14;
|
|
1460
|
-
const Tr = 15;
|
|
1461
|
-
const I = 16;
|
|
1462
1466
|
const Img = 17;
|
|
1463
|
-
const Root = 0;
|
|
1464
|
-
const Ins = 20;
|
|
1465
|
-
const Del = 21;
|
|
1466
|
-
const H2 = 22;
|
|
1467
|
-
const H3 = 23;
|
|
1468
|
-
const H4 = 24;
|
|
1469
|
-
const H5 = 25;
|
|
1470
|
-
const H6 = 26;
|
|
1471
|
-
const Article = 27;
|
|
1472
|
-
const Aside = 28;
|
|
1473
|
-
const Footer = 29;
|
|
1474
|
-
const Header = 30;
|
|
1475
|
-
const Nav = 40;
|
|
1476
|
-
const Section = 41;
|
|
1477
|
-
const Search = 42;
|
|
1478
|
-
const Dd = 43;
|
|
1479
|
-
const Dl = 44;
|
|
1480
|
-
const Figcaption = 45;
|
|
1481
|
-
const Figure = 46;
|
|
1482
|
-
const Hr = 47;
|
|
1483
|
-
const Li = 48;
|
|
1484
|
-
const Ol = 49;
|
|
1485
|
-
const P = 50;
|
|
1486
|
-
const Pre = 51;
|
|
1487
1467
|
const A = 53;
|
|
1488
|
-
const Abbr = 54;
|
|
1489
|
-
const Br = 55;
|
|
1490
|
-
const Cite = 56;
|
|
1491
|
-
const Data = 57;
|
|
1492
|
-
const Time = 58;
|
|
1493
|
-
const Tfoot = 59;
|
|
1494
|
-
const Ul = 60;
|
|
1495
|
-
const Video = 61;
|
|
1496
|
-
const TextArea = 62;
|
|
1497
|
-
const Select = 63;
|
|
1498
|
-
const Option = 64;
|
|
1499
|
-
const Code$1 = 65;
|
|
1500
|
-
const Label$1 = 66;
|
|
1501
|
-
const Dt = 67;
|
|
1502
|
-
const Iframe = 68;
|
|
1503
|
-
const Main = 69;
|
|
1504
|
-
const Strong = 70;
|
|
1505
|
-
const Em = 71;
|
|
1506
|
-
const Style = 72;
|
|
1507
|
-
const Html = 73;
|
|
1508
|
-
const Head = 74;
|
|
1509
|
-
const Title = 75;
|
|
1510
|
-
const Meta = 76;
|
|
1511
|
-
const Canvas = 77;
|
|
1512
|
-
const Form = 78;
|
|
1513
|
-
const BlockQuote = 79;
|
|
1514
|
-
const Quote = 80;
|
|
1515
|
-
const Circle = 81;
|
|
1516
|
-
const Defs = 82;
|
|
1517
|
-
const Ellipse = 83;
|
|
1518
|
-
const G = 84;
|
|
1519
|
-
const Line = 85;
|
|
1520
|
-
const Path = 86;
|
|
1521
|
-
const Polygon = 87;
|
|
1522
|
-
const Polyline = 88;
|
|
1523
|
-
const Rect = 89;
|
|
1524
|
-
const Svg = 90;
|
|
1525
|
-
const Use = 91;
|
|
1526
|
-
const Reference = 100;
|
|
1527
|
-
|
|
1528
|
-
const VirtualDomElements = {
|
|
1529
|
-
__proto__: null,
|
|
1530
|
-
A,
|
|
1531
|
-
Abbr,
|
|
1532
|
-
Article,
|
|
1533
|
-
Aside,
|
|
1534
|
-
Audio,
|
|
1535
|
-
BlockQuote,
|
|
1536
|
-
Br,
|
|
1537
|
-
Button: Button$1,
|
|
1538
|
-
Canvas,
|
|
1539
|
-
Circle,
|
|
1540
|
-
Cite,
|
|
1541
|
-
Code: Code$1,
|
|
1542
|
-
Col,
|
|
1543
|
-
ColGroup,
|
|
1544
|
-
Data,
|
|
1545
|
-
Dd,
|
|
1546
|
-
Defs,
|
|
1547
|
-
Del,
|
|
1548
|
-
Div,
|
|
1549
|
-
Dl,
|
|
1550
|
-
Dt,
|
|
1551
|
-
Ellipse,
|
|
1552
|
-
Em,
|
|
1553
|
-
Figcaption,
|
|
1554
|
-
Figure,
|
|
1555
|
-
Footer,
|
|
1556
|
-
Form,
|
|
1557
|
-
G,
|
|
1558
|
-
H1,
|
|
1559
|
-
H2,
|
|
1560
|
-
H3,
|
|
1561
|
-
H4,
|
|
1562
|
-
H5,
|
|
1563
|
-
H6,
|
|
1564
|
-
Head,
|
|
1565
|
-
Header,
|
|
1566
|
-
Hr,
|
|
1567
|
-
Html,
|
|
1568
|
-
I,
|
|
1569
|
-
Iframe,
|
|
1570
|
-
Img,
|
|
1571
|
-
Input,
|
|
1572
|
-
Ins,
|
|
1573
|
-
Kbd,
|
|
1574
|
-
Label: Label$1,
|
|
1575
|
-
Li,
|
|
1576
|
-
Line,
|
|
1577
|
-
Main,
|
|
1578
|
-
Meta,
|
|
1579
|
-
Nav,
|
|
1580
|
-
Ol,
|
|
1581
|
-
Option,
|
|
1582
|
-
P,
|
|
1583
|
-
Path,
|
|
1584
|
-
Polygon,
|
|
1585
|
-
Polyline,
|
|
1586
|
-
Pre,
|
|
1587
|
-
Quote,
|
|
1588
|
-
Rect,
|
|
1589
|
-
Reference,
|
|
1590
|
-
Root,
|
|
1591
|
-
Search,
|
|
1592
|
-
Section,
|
|
1593
|
-
Select,
|
|
1594
|
-
Span,
|
|
1595
|
-
Strong,
|
|
1596
|
-
Style,
|
|
1597
|
-
Svg,
|
|
1598
|
-
TBody,
|
|
1599
|
-
THead,
|
|
1600
|
-
Table: Table$1,
|
|
1601
|
-
Td,
|
|
1602
|
-
Text,
|
|
1603
|
-
TextArea,
|
|
1604
|
-
Tfoot,
|
|
1605
|
-
Th,
|
|
1606
|
-
Time,
|
|
1607
|
-
Title,
|
|
1608
|
-
Tr,
|
|
1609
|
-
Ul,
|
|
1610
|
-
Use,
|
|
1611
|
-
Video
|
|
1612
|
-
};
|
|
1613
1468
|
|
|
1614
1469
|
const ClientX = 'event.clientX';
|
|
1615
1470
|
const ClientY = 'event.clientY';
|
|
@@ -1749,7 +1604,7 @@ const {
|
|
|
1749
1604
|
wrapGetter
|
|
1750
1605
|
} = create$a();
|
|
1751
1606
|
|
|
1752
|
-
const None = 0;
|
|
1607
|
+
const None$1 = 0;
|
|
1753
1608
|
const Table = 1;
|
|
1754
1609
|
const List = 2;
|
|
1755
1610
|
|
|
@@ -1780,7 +1635,7 @@ const create = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
1780
1635
|
showWarnings: true,
|
|
1781
1636
|
smallWidthBreakPoint: 650,
|
|
1782
1637
|
uid: id,
|
|
1783
|
-
viewMode: None,
|
|
1638
|
+
viewMode: None$1,
|
|
1784
1639
|
width,
|
|
1785
1640
|
workspaceUri,
|
|
1786
1641
|
x,
|
|
@@ -1833,7 +1688,7 @@ const diff = (oldState, newState) => {
|
|
|
1833
1688
|
const FilterHeight = 24;
|
|
1834
1689
|
const TableHeaderHeight = 22;
|
|
1835
1690
|
const getListTopOffset = (width, smallWidthBreakPoint, viewMode) => {
|
|
1836
|
-
const filterHeight = viewMode !== None && width <= smallWidthBreakPoint ? FilterHeight : 0;
|
|
1691
|
+
const filterHeight = viewMode !== None$1 && width <= smallWidthBreakPoint ? FilterHeight : 0;
|
|
1837
1692
|
const tableHeaderHeight = viewMode === Table ? TableHeaderHeight : 0;
|
|
1838
1693
|
return filterHeight + tableHeaderHeight;
|
|
1839
1694
|
};
|
|
@@ -1855,9 +1710,6 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
|
1855
1710
|
return Math.min(Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize), size);
|
|
1856
1711
|
};
|
|
1857
1712
|
|
|
1858
|
-
const Error$1 = 'error';
|
|
1859
|
-
const Warning = 'warning';
|
|
1860
|
-
|
|
1861
1713
|
const getListItemType = (listItemType, isCollapsed) => {
|
|
1862
1714
|
if (listItemType === Item) {
|
|
1863
1715
|
return Item;
|
|
@@ -1875,11 +1727,18 @@ const matchesFilterValue = (string, filterValueLower) => {
|
|
|
1875
1727
|
return 0;
|
|
1876
1728
|
};
|
|
1877
1729
|
|
|
1730
|
+
const None = 0;
|
|
1731
|
+
const Error$2 = 1;
|
|
1732
|
+
const Warning$1 = 2;
|
|
1733
|
+
const Spelling = 3;
|
|
1734
|
+
const Info = 4;
|
|
1735
|
+
const Other = 5;
|
|
1736
|
+
|
|
1878
1737
|
const matchesSeverity = (problem, showErrors, showWarnings, showInfos) => {
|
|
1879
1738
|
switch (problem.type) {
|
|
1880
|
-
case Error$
|
|
1739
|
+
case Error$2:
|
|
1881
1740
|
return showErrors;
|
|
1882
|
-
case Warning:
|
|
1741
|
+
case Warning$1:
|
|
1883
1742
|
return showWarnings;
|
|
1884
1743
|
default:
|
|
1885
1744
|
return showInfos;
|
|
@@ -2006,8 +1865,6 @@ const text = data => {
|
|
|
2006
1865
|
};
|
|
2007
1866
|
};
|
|
2008
1867
|
|
|
2009
|
-
new Set(Object.values(VirtualDomElements));
|
|
2010
|
-
|
|
2011
1868
|
const FocusProblems = 19;
|
|
2012
1869
|
|
|
2013
1870
|
const getKeyBindings = () => {
|
|
@@ -2189,6 +2046,9 @@ const getMenuIds = () => {
|
|
|
2189
2046
|
return [ProblemsFilter$1];
|
|
2190
2047
|
};
|
|
2191
2048
|
|
|
2049
|
+
const Error$1 = 'error';
|
|
2050
|
+
const Warning = 'warning';
|
|
2051
|
+
|
|
2192
2052
|
const {
|
|
2193
2053
|
getProblems: getProblems$1,
|
|
2194
2054
|
getUri} = EditorWorker;
|
|
@@ -2196,9 +2056,21 @@ const getDiagnostics = editorId => {
|
|
|
2196
2056
|
return invoke$3('Editor.getDiagnostics', editorId);
|
|
2197
2057
|
};
|
|
2198
2058
|
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2201
|
-
|
|
2059
|
+
const getProblemType = type => {
|
|
2060
|
+
switch (type) {
|
|
2061
|
+
case Error$1:
|
|
2062
|
+
return Error$2;
|
|
2063
|
+
case Warning:
|
|
2064
|
+
return Warning$1;
|
|
2065
|
+
case 'info':
|
|
2066
|
+
return Info;
|
|
2067
|
+
case 'spelling':
|
|
2068
|
+
return Spelling;
|
|
2069
|
+
default:
|
|
2070
|
+
return type ? Other : Error$2;
|
|
2071
|
+
}
|
|
2072
|
+
};
|
|
2073
|
+
|
|
2202
2074
|
const toProblem = (diagnostic, index) => {
|
|
2203
2075
|
const {
|
|
2204
2076
|
code,
|
|
@@ -2218,31 +2090,13 @@ const toProblem = (diagnostic, index) => {
|
|
|
2218
2090
|
listItemType: Item,
|
|
2219
2091
|
message: message || '',
|
|
2220
2092
|
posInSet: index,
|
|
2221
|
-
relativePath: '',
|
|
2222
2093
|
rowIndex: rowIndex || 0,
|
|
2223
2094
|
setSize: 1,
|
|
2224
2095
|
source: source || '',
|
|
2225
|
-
type: type
|
|
2096
|
+
type: getProblemType(type),
|
|
2226
2097
|
uri
|
|
2227
2098
|
};
|
|
2228
2099
|
};
|
|
2229
|
-
const normalizeFileUri = uri => {
|
|
2230
|
-
const normalizedUri = uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
|
|
2231
|
-
return windowsDrivePathRegex.test(normalizedUri) ? normalizedUri.slice(1) : normalizedUri;
|
|
2232
|
-
};
|
|
2233
|
-
const getRelativeParentUri = (uri, workspaceUri) => {
|
|
2234
|
-
const normalizedUri = normalizeFileUri(uri);
|
|
2235
|
-
const normalizedWorkspaceUri = normalizeFileUri(workspaceUri).replace(trailingSlashRegex, '');
|
|
2236
|
-
const slashIndex = normalizedUri.lastIndexOf('/');
|
|
2237
|
-
const parentUri = normalizedUri.slice(0, slashIndex);
|
|
2238
|
-
if (parentUri === normalizedWorkspaceUri) {
|
|
2239
|
-
return '';
|
|
2240
|
-
}
|
|
2241
|
-
if (normalizedWorkspaceUri && parentUri.startsWith(`${normalizedWorkspaceUri}/`)) {
|
|
2242
|
-
return parentUri.slice(normalizedWorkspaceUri.length + 1);
|
|
2243
|
-
}
|
|
2244
|
-
return parentUri.replace(leadingSlashesRegex, '');
|
|
2245
|
-
};
|
|
2246
2100
|
const getFileName = uri => {
|
|
2247
2101
|
const slashIndex = uri.lastIndexOf('/');
|
|
2248
2102
|
return uri.slice(slashIndex + 1);
|
|
@@ -2257,16 +2111,15 @@ const toRelatedProblem = (relatedInformation, diagnostic, index, setSize) => {
|
|
|
2257
2111
|
listItemType: Item,
|
|
2258
2112
|
message: relatedInformation.message || '',
|
|
2259
2113
|
posInSet: index,
|
|
2260
|
-
relativePath: '',
|
|
2261
2114
|
rowIndex: relatedInformation.rowIndex || 0,
|
|
2262
2115
|
setSize,
|
|
2263
2116
|
source: getFileName(relatedInformation.uri),
|
|
2264
2117
|
targetUri: relatedInformation.uri,
|
|
2265
|
-
type: diagnostic.type
|
|
2118
|
+
type: getProblemType(diagnostic.type),
|
|
2266
2119
|
uri: diagnostic.uri
|
|
2267
2120
|
};
|
|
2268
2121
|
};
|
|
2269
|
-
const toProblems =
|
|
2122
|
+
const toProblems = diagnostics => {
|
|
2270
2123
|
const problems = [];
|
|
2271
2124
|
let problem = {
|
|
2272
2125
|
code: '',
|
|
@@ -2277,11 +2130,10 @@ const toProblems = (diagnostics, workspaceUri = '') => {
|
|
|
2277
2130
|
listItemType: 0,
|
|
2278
2131
|
message: '',
|
|
2279
2132
|
posInSet: 0,
|
|
2280
|
-
relativePath: '',
|
|
2281
2133
|
rowIndex: 0,
|
|
2282
2134
|
setSize: 0,
|
|
2283
2135
|
source: '',
|
|
2284
|
-
type:
|
|
2136
|
+
type: None,
|
|
2285
2137
|
uri: ''
|
|
2286
2138
|
};
|
|
2287
2139
|
let relativeIndex = 0;
|
|
@@ -2300,11 +2152,10 @@ const toProblems = (diagnostics, workspaceUri = '') => {
|
|
|
2300
2152
|
listItemType: Expanded,
|
|
2301
2153
|
message: '',
|
|
2302
2154
|
posInSet: relativeIndex,
|
|
2303
|
-
relativePath: '',
|
|
2304
2155
|
rowIndex: 0,
|
|
2305
2156
|
setSize: 123,
|
|
2306
2157
|
source: '',
|
|
2307
|
-
type:
|
|
2158
|
+
type: None,
|
|
2308
2159
|
uri: diagnostic.uri
|
|
2309
2160
|
};
|
|
2310
2161
|
problems.push(problem);
|
|
@@ -2316,13 +2167,8 @@ const toProblems = (diagnostics, workspaceUri = '') => {
|
|
|
2316
2167
|
}
|
|
2317
2168
|
}
|
|
2318
2169
|
for (const problem of problems) {
|
|
2319
|
-
// TODO maybe rename property, this should be the relative path of the parent folder of the file
|
|
2320
|
-
// @ts-ignore
|
|
2321
2170
|
const displayUri = problem.targetUri || problem.uri;
|
|
2322
|
-
problem.relativePath = getRelativeParentUri(displayUri, workspaceUri);
|
|
2323
|
-
// @ts-ignore
|
|
2324
2171
|
problem.fileName = getFileName(displayUri);
|
|
2325
|
-
// problem.uri = problem.uri // TODO
|
|
2326
2172
|
}
|
|
2327
2173
|
return problems;
|
|
2328
2174
|
};
|
|
@@ -2339,7 +2185,7 @@ const getUniqueDiagnostics = diagnostics => {
|
|
|
2339
2185
|
return true;
|
|
2340
2186
|
});
|
|
2341
2187
|
};
|
|
2342
|
-
const getProblems = async
|
|
2188
|
+
const getProblems = async activeUri => {
|
|
2343
2189
|
if (!activeUri) {
|
|
2344
2190
|
return {
|
|
2345
2191
|
error: '',
|
|
@@ -2348,7 +2194,7 @@ const getProblems = async (workspaceUri, activeUri) => {
|
|
|
2348
2194
|
}
|
|
2349
2195
|
try {
|
|
2350
2196
|
const diagnostics = getUniqueDiagnostics(await getProblems$1());
|
|
2351
|
-
const problems = toProblems(diagnostics
|
|
2197
|
+
const problems = toProblems(diagnostics);
|
|
2352
2198
|
return {
|
|
2353
2199
|
error: '',
|
|
2354
2200
|
problems
|
|
@@ -2436,13 +2282,12 @@ const getFileIcons = async (problems, fileIconCache) => {
|
|
|
2436
2282
|
|
|
2437
2283
|
const refreshProblems = async (state, activeUri) => {
|
|
2438
2284
|
const {
|
|
2439
|
-
fileIconCache
|
|
2440
|
-
workspaceUri
|
|
2285
|
+
fileIconCache
|
|
2441
2286
|
} = state;
|
|
2442
2287
|
const {
|
|
2443
2288
|
error,
|
|
2444
2289
|
problems
|
|
2445
|
-
} = await getProblems(
|
|
2290
|
+
} = await getProblems(activeUri);
|
|
2446
2291
|
const newFileIconCache = await getFileIcons(problems, fileIconCache);
|
|
2447
2292
|
return {
|
|
2448
2293
|
...state,
|
|
@@ -2938,7 +2783,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2938
2783
|
const {
|
|
2939
2784
|
error,
|
|
2940
2785
|
problems
|
|
2941
|
-
} = await getProblems(
|
|
2786
|
+
} = await getProblems(activeUri);
|
|
2942
2787
|
if (error) {
|
|
2943
2788
|
return {
|
|
2944
2789
|
...state,
|
|
@@ -3136,7 +2981,7 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
3136
2981
|
return {
|
|
3137
2982
|
childCount: 0,
|
|
3138
2983
|
className: mergeClassNames('MaskIcon', `MaskIcon${icon}`),
|
|
3139
|
-
role: None$
|
|
2984
|
+
role: None$2,
|
|
3140
2985
|
type
|
|
3141
2986
|
};
|
|
3142
2987
|
};
|
|
@@ -3274,7 +3119,7 @@ const getFileIconVirtualDom = icon => {
|
|
|
3274
3119
|
alt: '',
|
|
3275
3120
|
childCount: 0,
|
|
3276
3121
|
className: FileIcon,
|
|
3277
|
-
role: None$
|
|
3122
|
+
role: None$2,
|
|
3278
3123
|
src: icon,
|
|
3279
3124
|
type: Img
|
|
3280
3125
|
};
|
|
@@ -3291,7 +3136,7 @@ const errorIconNode = {
|
|
|
3291
3136
|
type: Div
|
|
3292
3137
|
};
|
|
3293
3138
|
const getProblemsIconVirtualDom = type => {
|
|
3294
|
-
if (type === Warning) {
|
|
3139
|
+
if (type === Warning$1) {
|
|
3295
3140
|
return warningIconNode;
|
|
3296
3141
|
}
|
|
3297
3142
|
return errorIconNode;
|
|
@@ -3310,6 +3155,34 @@ const getProblemSourceDetail = (source, code) => {
|
|
|
3310
3155
|
return message;
|
|
3311
3156
|
};
|
|
3312
3157
|
|
|
3158
|
+
const leadingSlashesRegex = /^\/+/;
|
|
3159
|
+
const trailingSlashRegex = /\/$/;
|
|
3160
|
+
const schemeRootRegex = /^[a-z][a-z\d+.-]*:\/\/$/i;
|
|
3161
|
+
const windowsDrivePathRegex = /^\/[a-z]:\//i;
|
|
3162
|
+
const normalizeFileUri = uri => {
|
|
3163
|
+
const normalizedUri = uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
|
|
3164
|
+
return windowsDrivePathRegex.test(normalizedUri) ? normalizedUri.slice(1) : normalizedUri;
|
|
3165
|
+
};
|
|
3166
|
+
const getRelativeParentUri = (uri, workspaceUri) => {
|
|
3167
|
+
const normalizedUri = normalizeFileUri(uri);
|
|
3168
|
+
const normalizedWorkspaceUri = normalizeFileUri(workspaceUri).replace(trailingSlashRegex, '');
|
|
3169
|
+
const slashIndex = normalizedUri.lastIndexOf('/');
|
|
3170
|
+
if (slashIndex === -1) {
|
|
3171
|
+
return '';
|
|
3172
|
+
}
|
|
3173
|
+
const parentUri = normalizedUri.slice(0, slashIndex);
|
|
3174
|
+
if (schemeRootRegex.test(parentUri)) {
|
|
3175
|
+
return '';
|
|
3176
|
+
}
|
|
3177
|
+
if (parentUri === normalizedWorkspaceUri) {
|
|
3178
|
+
return '';
|
|
3179
|
+
}
|
|
3180
|
+
if (normalizedWorkspaceUri && parentUri.startsWith(`${normalizedWorkspaceUri}/`)) {
|
|
3181
|
+
return parentUri.slice(normalizedWorkspaceUri.length + 1);
|
|
3182
|
+
}
|
|
3183
|
+
return parentUri.replace(leadingSlashesRegex, '');
|
|
3184
|
+
};
|
|
3185
|
+
|
|
3313
3186
|
const labelNode = {
|
|
3314
3187
|
childCount: 1,
|
|
3315
3188
|
className: Label,
|
|
@@ -3330,7 +3203,7 @@ const problemAtNode = {
|
|
|
3330
3203
|
className: ProblemAt,
|
|
3331
3204
|
type: Span
|
|
3332
3205
|
};
|
|
3333
|
-
const getProblemVirtualDom = problem => {
|
|
3206
|
+
const getProblemVirtualDom = (problem, workspaceUri = '') => {
|
|
3334
3207
|
const {
|
|
3335
3208
|
code,
|
|
3336
3209
|
columnIndex,
|
|
@@ -3344,7 +3217,6 @@ const getProblemVirtualDom = problem => {
|
|
|
3344
3217
|
message,
|
|
3345
3218
|
messageMatchIndex,
|
|
3346
3219
|
posInSet,
|
|
3347
|
-
relativePath,
|
|
3348
3220
|
rowIndex,
|
|
3349
3221
|
setSize,
|
|
3350
3222
|
source,
|
|
@@ -3373,7 +3245,7 @@ const getProblemVirtualDom = problem => {
|
|
|
3373
3245
|
...labelNode,
|
|
3374
3246
|
'data-uri': uri,
|
|
3375
3247
|
onClick: HandleFileNameClick
|
|
3376
|
-
}, text(fileName), labelDetailNode, text(
|
|
3248
|
+
}, text(fileName), labelDetailNode, text(getRelativeParentUri(uri, workspaceUri)), ...getBadgeVirtualDom(ProblemBadge, problem.count)];
|
|
3377
3249
|
}
|
|
3378
3250
|
const lineColumn = atLineColumn(rowIndex + 1, columnIndex + 1);
|
|
3379
3251
|
const label = {
|
|
@@ -3407,7 +3279,7 @@ const getProblemVirtualDom = problem => {
|
|
|
3407
3279
|
return dom;
|
|
3408
3280
|
};
|
|
3409
3281
|
|
|
3410
|
-
const getProblemsListVirtualDom = problems => {
|
|
3282
|
+
const getProblemsListVirtualDom = (problems, workspaceUri = '') => {
|
|
3411
3283
|
const dom = [{
|
|
3412
3284
|
ariaLabel: 'Problems Tree',
|
|
3413
3285
|
// TODO use i18n string
|
|
@@ -3415,7 +3287,7 @@ const getProblemsListVirtualDom = problems => {
|
|
|
3415
3287
|
className: ProblemsList,
|
|
3416
3288
|
role: Tree,
|
|
3417
3289
|
type: Div
|
|
3418
|
-
}, ...problems.flatMap(getProblemVirtualDom)];
|
|
3290
|
+
}, ...problems.flatMap(problem => getProblemVirtualDom(problem, workspaceUri))];
|
|
3419
3291
|
return dom;
|
|
3420
3292
|
};
|
|
3421
3293
|
|
|
@@ -3514,7 +3386,7 @@ const messageNode = {
|
|
|
3514
3386
|
className: Message,
|
|
3515
3387
|
type: Div
|
|
3516
3388
|
};
|
|
3517
|
-
const getProblemsVirtualDom$1 = (viewMode, problems, filterValue, message, problemCount = problems.length) => {
|
|
3389
|
+
const getProblemsVirtualDom$1 = (viewMode, problems, filterValue, message, problemCount = problems.length, workspaceUri = '') => {
|
|
3518
3390
|
if (problemCount === 0 && message) {
|
|
3519
3391
|
return [messageNode, text(message)];
|
|
3520
3392
|
}
|
|
@@ -3527,7 +3399,7 @@ const getProblemsVirtualDom$1 = (viewMode, problems, filterValue, message, probl
|
|
|
3527
3399
|
if (viewMode === Table) {
|
|
3528
3400
|
return getProblemsTableVirtualDom(problems);
|
|
3529
3401
|
}
|
|
3530
|
-
return getProblemsListVirtualDom(problems);
|
|
3402
|
+
return getProblemsListVirtualDom(problems, workspaceUri);
|
|
3531
3403
|
};
|
|
3532
3404
|
|
|
3533
3405
|
const scrollBarNode = {
|
|
@@ -3549,7 +3421,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarActive) => {
|
|
|
3549
3421
|
|
|
3550
3422
|
const Focusable = 0;
|
|
3551
3423
|
|
|
3552
|
-
const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, inputSource, isSmall, message, scrollBarHeight = 0, scrollBarActive = false, problemCount = problems.length) => {
|
|
3424
|
+
const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, inputSource, isSmall, message, scrollBarHeight = 0, scrollBarActive = false, problemCount = problems.length, workspaceUri = '') => {
|
|
3553
3425
|
const baseDom = {
|
|
3554
3426
|
childCount: isSmall ? 2 : 1,
|
|
3555
3427
|
className: mergeClassNames(Viewlet, Problems),
|
|
@@ -3568,7 +3440,7 @@ const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, input
|
|
|
3568
3440
|
placeholder: filter(),
|
|
3569
3441
|
value: filterValue
|
|
3570
3442
|
}) : [];
|
|
3571
|
-
const itemsDom = getProblemsVirtualDom$1(viewMode, problems, filterValue, message, problemCount);
|
|
3443
|
+
const itemsDom = getProblemsVirtualDom$1(viewMode, problems, filterValue, message, problemCount, workspaceUri);
|
|
3572
3444
|
const scrollBarDom = getScrollBarVirtualDom(scrollBarHeight, scrollBarActive);
|
|
3573
3445
|
const contentClassName = viewMode === Table ? mergeClassNames(ProblemsContent, ProblemsContentTable) : ProblemsContent;
|
|
3574
3446
|
const contentDom = {
|
|
@@ -3598,12 +3470,13 @@ const renderItems = (oldState, newState) => {
|
|
|
3598
3470
|
showWarnings,
|
|
3599
3471
|
smallWidthBreakPoint,
|
|
3600
3472
|
viewMode,
|
|
3601
|
-
width
|
|
3473
|
+
width,
|
|
3474
|
+
workspaceUri
|
|
3602
3475
|
} = newState;
|
|
3603
3476
|
const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode, showErrors, showWarnings, showInfos);
|
|
3604
3477
|
const visible = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode, showErrors, showWarnings, showInfos);
|
|
3605
3478
|
const isSmall = width <= smallWidthBreakPoint;
|
|
3606
|
-
const dom = getProblemsVirtualDom(activeUri, viewMode, visible, filterValue, inputSource, isSmall, message, scrollBarHeight, scrollBarActive, problemCount);
|
|
3479
|
+
const dom = getProblemsVirtualDom(activeUri, viewMode, visible, filterValue, inputSource, isSmall, message, scrollBarHeight, scrollBarActive, problemCount, workspaceUri);
|
|
3607
3480
|
return ['Viewlet.setDom2', newState.uid, dom];
|
|
3608
3481
|
};
|
|
3609
3482
|
|