@lvce-editor/status-bar-worker 3.20.3 → 3.22.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.
@@ -0,0 +1,26 @@
1
+ [
2
+ {
3
+ "category": "workbench",
4
+ "description": "Controls whether status bar items are visible.",
5
+ "heading": "Show Status Bar Items",
6
+ "id": "statusBar.itemsVisible",
7
+ "type": 3,
8
+ "value": "true"
9
+ },
10
+ {
11
+ "category": "workbench",
12
+ "description": "Controls whether the built-in notifications item is shown in the status bar.",
13
+ "heading": "Show Notifications Status",
14
+ "id": "statusBar.builtinNotificationsEnabled",
15
+ "type": 3,
16
+ "value": "true"
17
+ },
18
+ {
19
+ "category": "workbench",
20
+ "description": "Controls whether the built-in problems item is shown in the status bar.",
21
+ "heading": "Show Problems Status",
22
+ "id": "statusBar.builtinProblemsEnabled",
23
+ "type": 3,
24
+ "value": "true"
25
+ }
26
+ ]
@@ -1502,6 +1502,40 @@ const getPreference = async key => {
1502
1502
  return await invoke$1('Preferences.get', key);
1503
1503
  };
1504
1504
 
1505
+ const EditorEncoding = 'EditorEncoding';
1506
+ const EditorEndOfLine = 'EditorEndOfLine';
1507
+ const EditorIndentation = 'EditorIndentation';
1508
+ const EditorLanguage = 'EditorLanguage';
1509
+ const EditorPosition = 'EditorPosition';
1510
+ const Notifications = 'Notifications';
1511
+ const Problems = 'Problems';
1512
+ const isEditorStatus = name => {
1513
+ return [EditorEncoding, EditorEndOfLine, EditorIndentation, EditorLanguage, EditorPosition].includes(name);
1514
+ };
1515
+ const isRight = name => {
1516
+ return name === Notifications || isEditorStatus(name);
1517
+ };
1518
+
1519
+ const handleClickEditorStatus = async (name, status) => {
1520
+ if (!status) {
1521
+ return;
1522
+ }
1523
+ switch (name) {
1524
+ case EditorEndOfLine:
1525
+ await invoke$1('Viewlet.openWidget', 'QuickPick', 'end-of-line');
1526
+ return;
1527
+ case EditorIndentation:
1528
+ await invoke$1('Viewlet.openWidget', 'QuickPick', 'indentation');
1529
+ return;
1530
+ case EditorLanguage:
1531
+ await invoke$1('Viewlet.openWidget', 'QuickPick', 'language-mode');
1532
+ return;
1533
+ case EditorPosition:
1534
+ await invoke$1('Viewlet.openWidget', 'QuickPick', 'go-to-line', status.line, status.column);
1535
+ return;
1536
+ }
1537
+ };
1538
+
1505
1539
  const handleClickExtensionStatusBarItem = async name => {
1506
1540
  try {
1507
1541
  await invoke$3('Extensions.executeCommand', name);
@@ -1521,24 +1555,12 @@ const handleClickProblems = async () => {
1521
1555
  await invoke$1('Panel.toggleView', 'Problems');
1522
1556
  };
1523
1557
 
1524
- const EditorEncoding = 'EditorEncoding';
1525
- const EditorIndentation = 'EditorIndentation';
1526
- const EditorLanguage = 'EditorLanguage';
1527
- const EditorPosition = 'EditorPosition';
1528
- const Notifications = 'Notifications';
1529
- const Problems = 'Problems';
1530
- const isEditorStatus = name => {
1531
- return [EditorEncoding, EditorIndentation, EditorLanguage, EditorPosition].includes(name);
1532
- };
1533
- const isRight = name => {
1534
- return name === Notifications || isEditorStatus(name);
1535
- };
1536
-
1537
1558
  const handleClick = async (state, name) => {
1538
1559
  if (!name) {
1539
1560
  return state;
1540
1561
  }
1541
1562
  const {
1563
+ editorStatus,
1542
1564
  statusBarItemsLeft,
1543
1565
  statusBarItemsRight
1544
1566
  } = state;
@@ -1550,6 +1572,8 @@ const handleClick = async (state, name) => {
1550
1572
  await handleClickNotification();
1551
1573
  } else if (item.name === Problems) {
1552
1574
  await handleClickProblems();
1575
+ } else if (isEditorStatus(item.name)) {
1576
+ await handleClickEditorStatus(item.name, editorStatus);
1553
1577
  } else if (item.command && !isEditorStatus(item.name)) {
1554
1578
  await handleClickExtensionStatusBarItem(item.command);
1555
1579
  }
@@ -1588,12 +1612,16 @@ const getEditorStatusBarItems = status => {
1588
1612
  const {
1589
1613
  column,
1590
1614
  encoding,
1615
+ endOfLine = 'lf',
1616
+ insertSpaces = true,
1591
1617
  languageId,
1592
1618
  line,
1593
1619
  tabSize
1594
1620
  } = status;
1595
1621
  const encodingLabel = encoding === 'utf8' ? ['UTF', '8'].join('-') : encoding;
1596
- return [textItem(EditorPosition, `Ln ${line}, Col ${column}`, `Line ${line}, Column ${column}`, 'Go to Line/Column'), textItem(EditorIndentation, `Spaces: ${tabSize}`, `Spaces: ${tabSize}`, 'Select Indentation'), textItem(EditorEncoding, encodingLabel, `Encoding: ${encodingLabel}`, 'Select Encoding'), textItem(EditorLanguage, languageId, `Language: ${languageId}`, 'Select Language Mode')];
1622
+ const indentationLabel = insertSpaces ? `Spaces: ${tabSize}` : `Tab Size: ${tabSize}`;
1623
+ const endOfLineLabel = endOfLine.toUpperCase();
1624
+ return [textItem(EditorPosition, `Ln ${line}, Col ${column}`, `Line ${line}, Column ${column}`, 'Go to Line/Column'), textItem(EditorIndentation, indentationLabel, indentationLabel, 'Select Indentation'), textItem(EditorEncoding, encodingLabel, `Encoding: ${encodingLabel}`, 'Select Encoding'), textItem(EditorEndOfLine, endOfLineLabel, `End of Line: ${endOfLineLabel}`, 'Select End of Line Sequence'), textItem(EditorLanguage, languageId, `Language: ${languageId}`, 'Select Language Mode')];
1597
1625
  };
1598
1626
 
1599
1627
  const getAriaLabel = count => {
@@ -2087,7 +2115,7 @@ const equals = (oldStatus, newStatus) => {
2087
2115
  if (!oldStatus || !newStatus) {
2088
2116
  return oldStatus === newStatus;
2089
2117
  }
2090
- return oldStatus.column === newStatus.column && oldStatus.encoding === newStatus.encoding && oldStatus.languageId === newStatus.languageId && oldStatus.line === newStatus.line && oldStatus.tabSize === newStatus.tabSize;
2118
+ return oldStatus.column === newStatus.column && oldStatus.endOfLine === newStatus.endOfLine && oldStatus.encoding === newStatus.encoding && oldStatus.insertSpaces === newStatus.insertSpaces && oldStatus.languageId === newStatus.languageId && oldStatus.line === newStatus.line && oldStatus.tabSize === newStatus.tabSize;
2091
2119
  };
2092
2120
  const updateItems = (items, status) => {
2093
2121
  const remainingItems = items.filter(item => !isEditorStatus(item.name));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "3.20.3",
3
+ "version": "3.22.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",