@lvce-editor/status-bar-worker 3.31.4 → 3.31.5
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/statusBarWorkerMain.js +158 -36
- package/package.json +5 -2
|
@@ -641,18 +641,18 @@ const getMatchingItem = (itemsLeft, itemsRight, name) => {
|
|
|
641
641
|
return getMatchingItemInternal(itemsLeft, name) ?? getMatchingItemInternal(itemsRight, name);
|
|
642
642
|
};
|
|
643
643
|
|
|
644
|
-
const EditorEncoding = 'EditorEncoding';
|
|
645
|
-
const EditorEndOfLine = 'EditorEndOfLine';
|
|
644
|
+
const EditorEncoding$1 = 'EditorEncoding';
|
|
645
|
+
const EditorEndOfLine$1 = 'EditorEndOfLine';
|
|
646
646
|
const EditorIndentation = 'EditorIndentation';
|
|
647
|
-
const EditorLanguage = 'EditorLanguage';
|
|
648
|
-
const EditorPosition = 'EditorPosition';
|
|
649
|
-
const Notifications = 'Notifications';
|
|
650
|
-
const Problems = 'Problems';
|
|
647
|
+
const EditorLanguage$1 = 'EditorLanguage';
|
|
648
|
+
const EditorPosition$1 = 'EditorPosition';
|
|
649
|
+
const Notifications$1 = 'Notifications';
|
|
650
|
+
const Problems$1 = 'Problems';
|
|
651
651
|
const isEditorStatus = name => {
|
|
652
|
-
return [EditorEncoding, EditorEndOfLine, EditorIndentation, EditorLanguage, EditorPosition].includes(name);
|
|
652
|
+
return [EditorEncoding$1, EditorEndOfLine$1, EditorIndentation, EditorLanguage$1, EditorPosition$1].includes(name);
|
|
653
653
|
};
|
|
654
654
|
const isRight = name => {
|
|
655
|
-
return name === Notifications || isEditorStatus(name);
|
|
655
|
+
return name === Notifications$1 || isEditorStatus(name);
|
|
656
656
|
};
|
|
657
657
|
|
|
658
658
|
const state$1 = {
|
|
@@ -673,16 +673,16 @@ const handleClickEditorStatus = async (name, status) => {
|
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
switch (name) {
|
|
676
|
-
case EditorEndOfLine:
|
|
676
|
+
case EditorEndOfLine$1:
|
|
677
677
|
await invoke$4('QuickPick.openStatusBarPicker', 'end-of-line');
|
|
678
678
|
return;
|
|
679
679
|
case EditorIndentation:
|
|
680
680
|
await invoke$4('QuickPick.openStatusBarPicker', 'indentation');
|
|
681
681
|
return;
|
|
682
|
-
case EditorLanguage:
|
|
682
|
+
case EditorLanguage$1:
|
|
683
683
|
await invoke$4('QuickPick.openStatusBarPicker', 'language-mode');
|
|
684
684
|
return;
|
|
685
|
-
case EditorPosition:
|
|
685
|
+
case EditorPosition$1:
|
|
686
686
|
await invoke$4('QuickPick.openStatusBarPicker', 'go-to-line', status.line, status.column);
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
@@ -1946,9 +1946,9 @@ const handleClick = async (state, name) => {
|
|
|
1946
1946
|
if (!item) {
|
|
1947
1947
|
return state;
|
|
1948
1948
|
}
|
|
1949
|
-
if (item.name === Notifications) {
|
|
1949
|
+
if (item.name === Notifications$1) {
|
|
1950
1950
|
await handleClickNotification();
|
|
1951
|
-
} else if (item.name === Problems) {
|
|
1951
|
+
} else if (item.name === Problems$1) {
|
|
1952
1952
|
await handleClickProblems();
|
|
1953
1953
|
} else if (isEditorStatus(item.name)) {
|
|
1954
1954
|
await handleClickEditorStatus(item.name, editorStatus);
|
|
@@ -2011,6 +2011,125 @@ const setVisible = value => {
|
|
|
2011
2011
|
visible = value;
|
|
2012
2012
|
};
|
|
2013
2013
|
|
|
2014
|
+
const emptyObject = {};
|
|
2015
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
2016
|
+
if (placeholders === emptyObject) {
|
|
2017
|
+
return key;
|
|
2018
|
+
}
|
|
2019
|
+
let result = key;
|
|
2020
|
+
for (const [placeholder, replacement] of Object.entries(placeholders)) {
|
|
2021
|
+
result = result.split(`{${placeholder}}`).join(String(replacement));
|
|
2022
|
+
}
|
|
2023
|
+
return result;
|
|
2024
|
+
};
|
|
2025
|
+
|
|
2026
|
+
const EditorPosition = 'Ln {PH1}, Col {PH2}';
|
|
2027
|
+
const EditorPositionWithSelection = 'Ln {PH1}, Col {PH2} ({PH3} selected)';
|
|
2028
|
+
const EditorPositionAriaLabel = 'Line {PH1}, Column {PH2}';
|
|
2029
|
+
const EditorPositionWithSelectionAriaLabel = 'Line {PH1}, Column {PH2}, {PH3} selected';
|
|
2030
|
+
const EditorIndentationSpaces = 'Spaces: {PH1}';
|
|
2031
|
+
const EditorIndentationTabs = 'Tab Size: {PH1}';
|
|
2032
|
+
const EditorEncoding = 'Encoding: {PH1}';
|
|
2033
|
+
const EditorEndOfLine = 'End of Line: {PH1}';
|
|
2034
|
+
const EditorLanguage = 'Language: {PH1}';
|
|
2035
|
+
const GoToLineColumn = 'Go to Line/Column';
|
|
2036
|
+
const SelectIndentation = 'Select Indentation';
|
|
2037
|
+
const SelectEncoding = 'Select Encoding';
|
|
2038
|
+
const SelectEndOfLineSequence = 'Select End of Line Sequence';
|
|
2039
|
+
const SelectLanguageMode = 'Select Language Mode';
|
|
2040
|
+
const Problem = '{PH1} Problem';
|
|
2041
|
+
const Problems = '{PH1} Problems';
|
|
2042
|
+
const Warning = '{PH1} Warning';
|
|
2043
|
+
const Warnings = '{PH1} Warnings';
|
|
2044
|
+
const ProblemsAriaLabel = '{PH1}, {PH2}';
|
|
2045
|
+
const NoProblems = 'No Problems';
|
|
2046
|
+
const ProblemsTooltip = 'Problems';
|
|
2047
|
+
const Notification = '{PH1} Notification';
|
|
2048
|
+
const Notifications = '{PH1} Notifications';
|
|
2049
|
+
const NoNotifications = 'No Notifications';
|
|
2050
|
+
|
|
2051
|
+
const editorPosition = (line, column) => {
|
|
2052
|
+
return i18nString(EditorPosition, {
|
|
2053
|
+
PH1: line,
|
|
2054
|
+
PH2: column
|
|
2055
|
+
});
|
|
2056
|
+
};
|
|
2057
|
+
const editorPositionWithSelection = (line, column, selectedChars) => {
|
|
2058
|
+
return i18nString(EditorPositionWithSelection, {
|
|
2059
|
+
PH1: line,
|
|
2060
|
+
PH2: column,
|
|
2061
|
+
PH3: selectedChars
|
|
2062
|
+
});
|
|
2063
|
+
};
|
|
2064
|
+
const editorPositionAriaLabel = (line, column) => {
|
|
2065
|
+
return i18nString(EditorPositionAriaLabel, {
|
|
2066
|
+
PH1: line,
|
|
2067
|
+
PH2: column
|
|
2068
|
+
});
|
|
2069
|
+
};
|
|
2070
|
+
const editorPositionWithSelectionAriaLabel = (line, column, selectedChars) => {
|
|
2071
|
+
return i18nString(EditorPositionWithSelectionAriaLabel, {
|
|
2072
|
+
PH1: line,
|
|
2073
|
+
PH2: column,
|
|
2074
|
+
PH3: selectedChars
|
|
2075
|
+
});
|
|
2076
|
+
};
|
|
2077
|
+
const editorIndentationSpaces = tabSize => {
|
|
2078
|
+
return i18nString(EditorIndentationSpaces, {
|
|
2079
|
+
PH1: tabSize
|
|
2080
|
+
});
|
|
2081
|
+
};
|
|
2082
|
+
const editorIndentationTabs = tabSize => {
|
|
2083
|
+
return i18nString(EditorIndentationTabs, {
|
|
2084
|
+
PH1: tabSize
|
|
2085
|
+
});
|
|
2086
|
+
};
|
|
2087
|
+
const editorEncoding = encoding => {
|
|
2088
|
+
return i18nString(EditorEncoding, {
|
|
2089
|
+
PH1: encoding
|
|
2090
|
+
});
|
|
2091
|
+
};
|
|
2092
|
+
const editorEndOfLine = endOfLine => {
|
|
2093
|
+
return i18nString(EditorEndOfLine, {
|
|
2094
|
+
PH1: endOfLine
|
|
2095
|
+
});
|
|
2096
|
+
};
|
|
2097
|
+
const editorLanguage = languageId => {
|
|
2098
|
+
return i18nString(EditorLanguage, {
|
|
2099
|
+
PH1: languageId
|
|
2100
|
+
});
|
|
2101
|
+
};
|
|
2102
|
+
const goToLineColumn = () => i18nString(GoToLineColumn);
|
|
2103
|
+
const selectIndentation = () => i18nString(SelectIndentation);
|
|
2104
|
+
const selectEncoding = () => i18nString(SelectEncoding);
|
|
2105
|
+
const selectEndOfLineSequence = () => i18nString(SelectEndOfLineSequence);
|
|
2106
|
+
const selectLanguageMode = () => i18nString(SelectLanguageMode);
|
|
2107
|
+
const problem = count => i18nString(Problem, {
|
|
2108
|
+
PH1: count
|
|
2109
|
+
});
|
|
2110
|
+
const problems = count => i18nString(Problems, {
|
|
2111
|
+
PH1: count
|
|
2112
|
+
});
|
|
2113
|
+
const warning = count => i18nString(Warning, {
|
|
2114
|
+
PH1: count
|
|
2115
|
+
});
|
|
2116
|
+
const warnings = count => i18nString(Warnings, {
|
|
2117
|
+
PH1: count
|
|
2118
|
+
});
|
|
2119
|
+
const problemsAriaLabel = (problemLabel, warningLabel) => i18nString(ProblemsAriaLabel, {
|
|
2120
|
+
PH1: problemLabel,
|
|
2121
|
+
PH2: warningLabel
|
|
2122
|
+
});
|
|
2123
|
+
const noProblems = () => i18nString(NoProblems);
|
|
2124
|
+
const problemsTooltip = () => i18nString(ProblemsTooltip);
|
|
2125
|
+
const notification = count => i18nString(Notification, {
|
|
2126
|
+
PH1: count
|
|
2127
|
+
});
|
|
2128
|
+
const notifications = count => i18nString(Notifications, {
|
|
2129
|
+
PH1: count
|
|
2130
|
+
});
|
|
2131
|
+
const noNotifications = () => i18nString(NoNotifications);
|
|
2132
|
+
|
|
2014
2133
|
const textItem = (name, text, ariaLabel, tooltip) => ({
|
|
2015
2134
|
ariaLabel,
|
|
2016
2135
|
command: '',
|
|
@@ -2036,19 +2155,19 @@ const getEditorStatusBarItems = status => {
|
|
|
2036
2155
|
tabSize
|
|
2037
2156
|
} = status;
|
|
2038
2157
|
const encodingLabel = encoding === 'utf8' ? ['UTF', '8'].join('-') : encoding;
|
|
2039
|
-
const indentationLabel = insertSpaces ?
|
|
2158
|
+
const indentationLabel = insertSpaces ? editorIndentationSpaces(tabSize) : editorIndentationTabs(tabSize);
|
|
2040
2159
|
const endOfLineLabel = endOfLine.toUpperCase();
|
|
2041
|
-
const positionLabel = selectedChars > 0 ?
|
|
2042
|
-
const positionAriaLabel = selectedChars > 0 ?
|
|
2043
|
-
return [textItem(EditorPosition, positionLabel, positionAriaLabel,
|
|
2160
|
+
const positionLabel = selectedChars > 0 ? editorPositionWithSelection(line, column, selectedChars) : editorPosition(line, column);
|
|
2161
|
+
const positionAriaLabel = selectedChars > 0 ? editorPositionWithSelectionAriaLabel(line, column, selectedChars) : editorPositionAriaLabel(line, column);
|
|
2162
|
+
return [textItem(EditorPosition$1, positionLabel, positionAriaLabel, goToLineColumn()), textItem(EditorIndentation, indentationLabel, indentationLabel, selectIndentation()), textItem(EditorEncoding$1, encodingLabel, editorEncoding(encodingLabel), selectEncoding()), textItem(EditorEndOfLine$1, endOfLineLabel, editorEndOfLine(endOfLineLabel), selectEndOfLineSequence()), textItem(EditorLanguage$1, languageId, editorLanguage(languageId), selectLanguageMode())];
|
|
2044
2163
|
};
|
|
2045
2164
|
|
|
2046
2165
|
const dependencies = {
|
|
2047
|
-
[EditorEncoding]: ['encoding'],
|
|
2048
|
-
[EditorEndOfLine]: ['endOfLine'],
|
|
2166
|
+
[EditorEncoding$1]: ['encoding'],
|
|
2167
|
+
[EditorEndOfLine$1]: ['endOfLine'],
|
|
2049
2168
|
[EditorIndentation]: ['insertSpaces', 'tabSize'],
|
|
2050
|
-
[EditorLanguage]: ['languageId'],
|
|
2051
|
-
[EditorPosition]: ['line', 'column', 'selectedChars']
|
|
2169
|
+
[EditorLanguage$1]: ['languageId'],
|
|
2170
|
+
[EditorPosition$1]: ['line', 'column', 'selectedChars']
|
|
2052
2171
|
};
|
|
2053
2172
|
const handleEditorStatusChanged = (state, editorStatus, previous = state) => {
|
|
2054
2173
|
const {
|
|
@@ -2079,7 +2198,7 @@ const handleEditorStatusChanged = (state, editorStatus, previous = state) => {
|
|
|
2079
2198
|
replacements.delete(item.name);
|
|
2080
2199
|
return replacement || item;
|
|
2081
2200
|
});
|
|
2082
|
-
const notificationIndex = updatedItems.findIndex(item => item.name === Notifications);
|
|
2201
|
+
const notificationIndex = updatedItems.findIndex(item => item.name === Notifications$1);
|
|
2083
2202
|
updatedItems.splice(notificationIndex === -1 ? updatedItems.length : notificationIndex, 0, ...replacements.values());
|
|
2084
2203
|
return {
|
|
2085
2204
|
...state,
|
|
@@ -2239,12 +2358,12 @@ const handleEditorStatusVisibilityChangedAll = async visible => {
|
|
|
2239
2358
|
|
|
2240
2359
|
const getAriaLabel = count => {
|
|
2241
2360
|
if (count === 0) {
|
|
2242
|
-
return
|
|
2361
|
+
return noNotifications();
|
|
2243
2362
|
}
|
|
2244
2363
|
if (count === 1) {
|
|
2245
|
-
return
|
|
2364
|
+
return notification(count);
|
|
2246
2365
|
}
|
|
2247
|
-
return
|
|
2366
|
+
return notifications(count);
|
|
2248
2367
|
};
|
|
2249
2368
|
const getNotificationsStatusBarItem = (enabled, count = 0) => {
|
|
2250
2369
|
if (!enabled) {
|
|
@@ -2260,7 +2379,7 @@ const getNotificationsStatusBarItem = (enabled, count = 0) => {
|
|
|
2260
2379
|
type: 'text',
|
|
2261
2380
|
value: String(count)
|
|
2262
2381
|
}] : [])],
|
|
2263
|
-
name: Notifications,
|
|
2382
|
+
name: Notifications$1,
|
|
2264
2383
|
tooltip: getAriaLabel(count)
|
|
2265
2384
|
}];
|
|
2266
2385
|
};
|
|
@@ -2268,15 +2387,18 @@ const getNotificationsStatusBarItem = (enabled, count = 0) => {
|
|
|
2268
2387
|
const getProblemsAriaLabel = (errorCount, warningCount) => {
|
|
2269
2388
|
const parts = [];
|
|
2270
2389
|
if (errorCount > 0) {
|
|
2271
|
-
parts.push(
|
|
2390
|
+
parts.push(errorCount === 1 ? problem(errorCount) : problems(errorCount));
|
|
2272
2391
|
}
|
|
2273
2392
|
if (warningCount > 0) {
|
|
2274
|
-
parts.push(
|
|
2393
|
+
parts.push(warningCount === 1 ? warning(warningCount) : warnings(warningCount));
|
|
2275
2394
|
}
|
|
2276
2395
|
if (parts.length === 0) {
|
|
2277
|
-
return
|
|
2396
|
+
return noProblems();
|
|
2397
|
+
}
|
|
2398
|
+
if (parts.length === 1) {
|
|
2399
|
+
return parts[0];
|
|
2278
2400
|
}
|
|
2279
|
-
return parts
|
|
2401
|
+
return problemsAriaLabel(parts[0], parts[1]);
|
|
2280
2402
|
};
|
|
2281
2403
|
|
|
2282
2404
|
const getProblemsStatusBarItem = (errorCount, warningCount, enabled) => {
|
|
@@ -2300,8 +2422,8 @@ const getProblemsStatusBarItem = (errorCount, warningCount, enabled) => {
|
|
|
2300
2422
|
type: 'text',
|
|
2301
2423
|
value: String(warningCount)
|
|
2302
2424
|
}],
|
|
2303
|
-
name: Problems,
|
|
2304
|
-
tooltip:
|
|
2425
|
+
name: Problems$1,
|
|
2426
|
+
tooltip: problemsTooltip()
|
|
2305
2427
|
}];
|
|
2306
2428
|
};
|
|
2307
2429
|
|
|
@@ -2449,7 +2571,7 @@ const handleExtensionsChanged = async state => {
|
|
|
2449
2571
|
if (refreshVersions[uid] !== refreshVersion) {
|
|
2450
2572
|
return state;
|
|
2451
2573
|
}
|
|
2452
|
-
const builtinProblemsItem = statusBarItemsLeft.find(item => item.name === Problems);
|
|
2574
|
+
const builtinProblemsItem = statusBarItemsLeft.find(item => item.name === Problems$1);
|
|
2453
2575
|
return {
|
|
2454
2576
|
...state,
|
|
2455
2577
|
statusBarItemsLeft: builtinProblemsItem ? [...statusBarItems, builtinProblemsItem] : [...statusBarItems]
|
|
@@ -2485,7 +2607,7 @@ const handleNotificationCountChanged = (state, count) => {
|
|
|
2485
2607
|
const {
|
|
2486
2608
|
statusBarItemsRight
|
|
2487
2609
|
} = state;
|
|
2488
|
-
const notificationsEnabled = statusBarItemsRight.some(item => item.name === Notifications);
|
|
2610
|
+
const notificationsEnabled = statusBarItemsRight.some(item => item.name === Notifications$1);
|
|
2489
2611
|
if (!notificationsEnabled) {
|
|
2490
2612
|
return state;
|
|
2491
2613
|
}
|
|
@@ -2495,7 +2617,7 @@ const handleNotificationCountChanged = (state, count) => {
|
|
|
2495
2617
|
}
|
|
2496
2618
|
return {
|
|
2497
2619
|
...state,
|
|
2498
|
-
statusBarItemsRight: statusBarItemsRight.map(item => item.name === Notifications ? notificationItem : item)
|
|
2620
|
+
statusBarItemsRight: statusBarItemsRight.map(item => item.name === Notifications$1 ? notificationItem : item)
|
|
2499
2621
|
};
|
|
2500
2622
|
};
|
|
2501
2623
|
|
|
@@ -2573,7 +2695,7 @@ const handleProblemsSummaryChange = (state, summary) => {
|
|
|
2573
2695
|
return state;
|
|
2574
2696
|
}
|
|
2575
2697
|
const problemsItem = getProblemsStatusBarItem(errorCount, warningCount, true)[0];
|
|
2576
|
-
const statusBarItemsLeft = oldStatusBarItemsLeft.map(item => item.name === Problems ? problemsItem : item);
|
|
2698
|
+
const statusBarItemsLeft = oldStatusBarItemsLeft.map(item => item.name === Problems$1 ? problemsItem : item);
|
|
2577
2699
|
return {
|
|
2578
2700
|
...state,
|
|
2579
2701
|
errorCount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/status-bar-worker",
|
|
3
|
-
"version": "3.31.
|
|
3
|
+
"version": "3.31.5",
|
|
4
4
|
"description": "Status Bar Worker",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,5 +9,8 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"author": "Lvce Editor",
|
|
11
11
|
"type": "module",
|
|
12
|
-
"main": "dist/statusBarWorkerMain.js"
|
|
12
|
+
"main": "dist/statusBarWorkerMain.js",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@lvce-editor/i18n": "^2.10.0"
|
|
15
|
+
}
|
|
13
16
|
}
|