@lvce-editor/editor-worker 19.67.8 → 19.68.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.
@@ -1303,7 +1303,7 @@ const Editor$2 = 3;
1303
1303
  const SourceControl = 22;
1304
1304
 
1305
1305
  const Separator = 1;
1306
- const None = 0;
1306
+ const None$1 = 0;
1307
1307
 
1308
1308
  const Electron = 2;
1309
1309
 
@@ -4619,6 +4619,45 @@ const invoke$8 = async (applicationId, method, ...args) => {
4619
4619
  return applicationId === undefined ? invoke$g(method, ...args) : invoke$g('Extensions.invokeForApplication', applicationId, method, ...args);
4620
4620
  };
4621
4621
 
4622
+ const getTextDocument$3 = editor => ({
4623
+ documentId: editor.id || editor.uid,
4624
+ languageId: editor.languageId,
4625
+ text: getText$1(editor),
4626
+ uri: editor.uri
4627
+ });
4628
+ const execute = async ({
4629
+ args,
4630
+ editor,
4631
+ kind,
4632
+ method,
4633
+ noProviderFoundResult = undefined
4634
+ }) => {
4635
+ if (editor.largeFile) {
4636
+ return noProviderFoundResult;
4637
+ }
4638
+ const textDocument = getTextDocument$3(editor);
4639
+ const result = await invoke$8(editor.applicationId, 'Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
4640
+ if (!result.found) {
4641
+ return noProviderFoundResult;
4642
+ }
4643
+ return result.result;
4644
+ };
4645
+
4646
+ const getDocumentSymbols = async editor => {
4647
+ try {
4648
+ const result = await execute({
4649
+ args: [],
4650
+ editor,
4651
+ kind: 'document symbol',
4652
+ method: 'provideDocumentSymbols',
4653
+ noProviderFoundResult: []
4654
+ });
4655
+ return Array.isArray(result) ? result : [];
4656
+ } catch {
4657
+ return [];
4658
+ }
4659
+ };
4660
+
4622
4661
  const validTypes = new Set(['added', 'deleted', 'modified']);
4623
4662
  const isProviderDecoration$1 = value => {
4624
4663
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
@@ -5127,6 +5166,12 @@ const updateDerivedState = async (oldState, newState) => {
5127
5166
  incrementalEdits: emptyIncrementalEdits
5128
5167
  };
5129
5168
  let finalState = nextState;
5169
+ if (nextState.breadcrumbsEnabled && oldState.lines !== nextState.lines && oldState.documentSymbols === nextState.documentSymbols) {
5170
+ finalState = {
5171
+ ...finalState,
5172
+ documentSymbols: await getDocumentSymbols(nextState)
5173
+ };
5174
+ }
5130
5175
  if (shouldUpdateVisibleTextData(oldState, nextState)) {
5131
5176
  const syncIncremental = getEnabled();
5132
5177
  const {
@@ -5134,7 +5179,7 @@ const updateDerivedState = async (oldState, newState) => {
5134
5179
  textInfos
5135
5180
  } = await getVisible$1(nextState, syncIncremental);
5136
5181
  finalState = {
5137
- ...nextState,
5182
+ ...finalState,
5138
5183
  differences,
5139
5184
  textInfos
5140
5185
  };
@@ -5865,7 +5910,7 @@ const isEqual$3 = (oldState, newState) => {
5865
5910
  };
5866
5911
 
5867
5912
  const isEqual$2 = (oldState, newState) => {
5868
- return oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
5913
+ return oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
5869
5914
  };
5870
5915
 
5871
5916
  const isEqual$1 = (oldState, newState) => {
@@ -7245,30 +7290,6 @@ const handleBlur$1 = async editor => {
7245
7290
  return save(newEditor);
7246
7291
  };
7247
7292
 
7248
- const getTextDocument$3 = editor => ({
7249
- documentId: editor.id || editor.uid,
7250
- languageId: editor.languageId,
7251
- text: getText$1(editor),
7252
- uri: editor.uri
7253
- });
7254
- const execute = async ({
7255
- args,
7256
- editor,
7257
- kind,
7258
- method,
7259
- noProviderFoundResult = undefined
7260
- }) => {
7261
- if (editor.largeFile) {
7262
- return noProviderFoundResult;
7263
- }
7264
- const textDocument = getTextDocument$3(editor);
7265
- const result = await invoke$8(editor.applicationId, 'Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
7266
- if (!result.found) {
7267
- return noProviderFoundResult;
7268
- }
7269
- return result.result;
7270
- };
7271
-
7272
7293
  const replaceRange = (editor, ranges, replacement, origin) => {
7273
7294
  const changes = [];
7274
7295
  const columnDeltas = new Map();
@@ -13581,6 +13602,7 @@ const EditorLineDecoration = 'EditorLineDecoration';
13581
13602
  const EditorRow = 'EditorRow';
13582
13603
  const EditorRowHighlighted = 'EditorRowHighlighted';
13583
13604
  const EditorSelection = 'EditorSelection';
13605
+ const FileIcon = 'FileIcon';
13584
13606
  const HoverDisplayString = 'HoverDisplayString';
13585
13607
  const HoverDocumentation = 'HoverDocumentation';
13586
13608
  const HoverEditorRow = 'HoverEditorRow';
@@ -13625,6 +13647,7 @@ const Button$1 = 1;
13625
13647
  const Div = 4;
13626
13648
  const Input = 6;
13627
13649
  const Span = 8;
13650
+ const Img = 17;
13628
13651
  const Nav = 40;
13629
13652
  const TextArea = 62;
13630
13653
 
@@ -14753,54 +14776,54 @@ const menuEntrySeparator = {
14753
14776
  const getMenuEntries = () => {
14754
14777
  return [{
14755
14778
  command: 'Editor.goToDefinition',
14756
- flags: None,
14779
+ flags: None$1,
14757
14780
  id: 'go-to-definition',
14758
14781
  label: goToDefinition$1()
14759
14782
  }, {
14760
14783
  command: /* Editor.goToTypeDefinition */'Editor.goToTypeDefinition',
14761
- flags: None,
14784
+ flags: None$1,
14762
14785
  id: 'go-to-type-definition',
14763
14786
  label: goToTypeDefinition$1()
14764
14787
  }, menuEntrySeparator, {
14765
14788
  args: [/* id */'References', /* focus */true],
14766
14789
  command: /* ViewletSideBar.show */'SideBar.show',
14767
- flags: None,
14790
+ flags: None$1,
14768
14791
  id: 'find-all-references',
14769
14792
  label: findAllReferences()
14770
14793
  }, {
14771
14794
  args: [/* id */'Implementations', /* focus */true],
14772
14795
  command: /* ViewletSideBar.show */'SideBar.show',
14773
- flags: None,
14796
+ flags: None$1,
14774
14797
  id: 'find-all-implementations',
14775
14798
  label: findAllImplementations()
14776
14799
  }, menuEntrySeparator, {
14777
14800
  command: 'Editor.format',
14778
- flags: None,
14801
+ flags: None$1,
14779
14802
  id: 'format',
14780
14803
  label: formatDocument()
14781
14804
  }, {
14782
14805
  command: 'Editor.showSourceActions2',
14783
- flags: None,
14806
+ flags: None$1,
14784
14807
  id: SourceControl,
14785
14808
  label: sourceAction()
14786
14809
  }, menuEntrySeparator, {
14787
14810
  command: /* Editor.cut */'Editor.cut',
14788
- flags: None,
14811
+ flags: None$1,
14789
14812
  id: 'cut',
14790
14813
  label: cut()
14791
14814
  }, {
14792
14815
  command: /* Editor.copy */'Editor.copy',
14793
- flags: None,
14816
+ flags: None$1,
14794
14817
  id: 'copy',
14795
14818
  label: copy()
14796
14819
  }, {
14797
14820
  command: /* Editor.paste */'Editor.paste',
14798
- flags: None,
14821
+ flags: None$1,
14799
14822
  id: 'paste',
14800
14823
  label: paste$1()
14801
14824
  }, menuEntrySeparator, {
14802
14825
  command: 'QuickPick.showEverything',
14803
- flags: None,
14826
+ flags: None$1,
14804
14827
  id: 'commandPalette',
14805
14828
  label: commandPalette()
14806
14829
  }];
@@ -14976,18 +14999,14 @@ const handleMessagePort = async (port, rpcId) => {
14976
14999
  }
14977
15000
  };
14978
15001
 
14979
- const getDocumentSymbols = async editor => {
15002
+ const getBreadcrumbFileIcon = async (uri, applicationId) => {
14980
15003
  try {
14981
- const result = await execute({
14982
- args: [],
14983
- editor,
14984
- kind: 'document symbol',
14985
- method: 'provideDocumentSymbols',
14986
- noProviderFoundResult: []
15004
+ const icon = await invoke$9(applicationId, 'IconTheme.getFileIcon', {
15005
+ name: decodeURIComponent(uri.split('/').at(-1) || '')
14987
15006
  });
14988
- return Array.isArray(result) ? result : [];
15007
+ return typeof icon === 'string' ? icon : '';
14989
15008
  } catch {
14990
- return [];
15009
+ return '';
14991
15010
  }
14992
15011
  };
14993
15012
 
@@ -15162,14 +15181,20 @@ const handleSettingsChanged = async state => {
15162
15181
  }
15163
15182
  let documentSymbols = state.documentSymbols || [];
15164
15183
  let workspaceUri = state.workspaceUri || '';
15184
+ let breadcrumbFileIcon = state.breadcrumbFileIcon || '';
15165
15185
  if (!breadcrumbsEnabled) {
15166
15186
  documentSymbols = [];
15167
15187
  workspaceUri = '';
15188
+ breadcrumbFileIcon = '';
15168
15189
  } else if (!state.breadcrumbsEnabled) {
15169
15190
  [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1(state.applicationId)]);
15170
15191
  }
15192
+ if (breadcrumbsEnabled) {
15193
+ breadcrumbFileIcon = await getBreadcrumbFileIcon(state.uri, state.applicationId);
15194
+ }
15171
15195
  const resizedEditor = resize$2({
15172
15196
  ...editorWithUpdatedSettings,
15197
+ breadcrumbFileIcon,
15173
15198
  documentSymbols,
15174
15199
  workspaceUri
15175
15200
  }, {}, charWidth);
@@ -15593,11 +15618,14 @@ const loadContent = async (state, savedState, largeFile = false) => {
15593
15618
  };
15594
15619
  let documentSymbols = state.documentSymbols || [];
15595
15620
  let workspaceUri = state.workspaceUri || '';
15621
+ let breadcrumbFileIcon = state.breadcrumbFileIcon || '';
15596
15622
  if (effectiveEditor.breadcrumbsEnabled) {
15623
+ breadcrumbFileIcon = await getBreadcrumbFileIcon(uri, state.applicationId);
15597
15624
  [documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri(state.applicationId)]);
15598
15625
  }
15599
15626
  const newEditor3WithBreadcrumbs = {
15600
15627
  ...newEditor3WithLinks,
15628
+ breadcrumbFileIcon,
15601
15629
  documentSymbols,
15602
15630
  workspaceUri
15603
15631
  };
@@ -15893,6 +15921,7 @@ const True = 'true';
15893
15921
 
15894
15922
  const Button = 'button';
15895
15923
  const Code = 'code';
15924
+ const None = 'none';
15896
15925
  const TextBox = 'textbox';
15897
15926
 
15898
15927
  const combineWhitespaceTokens = tokens => {
@@ -15961,6 +15990,24 @@ const getEditorBreadcrumbs = state => {
15961
15990
  return [...getFileBreadcrumbs(uri, workspaceUri || ''), ...getSymbolBreadcrumbs(documentSymbols || [], offset)];
15962
15991
  };
15963
15992
 
15993
+ const getFileIconVirtualDom = icon => {
15994
+ return {
15995
+ childCount: 0,
15996
+ className: FileIcon,
15997
+ role: None,
15998
+ src: icon,
15999
+ type: Img
16000
+ };
16001
+ };
16002
+
16003
+ const symbolIcons = {
16004
+ 15: 'String',
16005
+ 16: 'Number',
16006
+ 17: 'Boolean',
16007
+ 18: 'Array',
16008
+ 19: 'Object',
16009
+ 21: 'Null'
16010
+ };
15964
16011
  const separator = {
15965
16012
  ariaHidden: True,
15966
16013
  childCount: 0,
@@ -15968,6 +16015,9 @@ const separator = {
15968
16015
  type: Span
15969
16016
  };
15970
16017
  const getEditorBreadcrumbsVirtualDom = state => {
16018
+ const {
16019
+ breadcrumbFileIcon
16020
+ } = state;
15971
16021
  const breadcrumbs = getEditorBreadcrumbs(state);
15972
16022
  const children = [];
15973
16023
  for (let index = 0; index < breadcrumbs.length; index++) {
@@ -15975,19 +16025,29 @@ const getEditorBreadcrumbsVirtualDom = state => {
15975
16025
  if (index > 0) {
15976
16026
  children.push(separator);
15977
16027
  }
16028
+ const isFile = breadcrumb.kind === 'file' && breadcrumbs[index + 1]?.kind !== 'file';
16029
+ const icon = breadcrumb.kind === 'symbol' ? {
16030
+ ariaHidden: True,
16031
+ childCount: 0,
16032
+ className: mergeClassNames('EditorBreadcrumbIcon', 'MaskIcon', `MaskIconSymbol${symbolIcons[String(breadcrumb.symbolKind)] || 'Default'}`),
16033
+ type: Span
16034
+ } : isFile && breadcrumbFileIcon ? {
16035
+ ...getFileIconVirtualDom(breadcrumbFileIcon),
16036
+ ariaHidden: True
16037
+ } : undefined;
15978
16038
  children.push({
15979
- childCount: 1,
16039
+ childCount: icon ? 2 : 1,
15980
16040
  className: mergeClassNames('EditorBreadcrumb', breadcrumb.kind === 'symbol' ? 'EditorBreadcrumbSymbol' : 'EditorBreadcrumbFile'),
15981
16041
  'data-kind': breadcrumb.kind,
15982
16042
  ...(breadcrumb.symbolKind !== undefined && {
15983
16043
  'data-symbolKind': breadcrumb.symbolKind
15984
16044
  }),
15985
16045
  type: Span
15986
- }, text(breadcrumb.label));
16046
+ }, ...(icon ? [icon] : []), text(breadcrumb.label));
15987
16047
  }
15988
16048
  return [{
15989
16049
  ariaLabel: 'Breadcrumbs',
15990
- childCount: children.length,
16050
+ childCount: breadcrumbs.length > 0 ? breadcrumbs.length * 2 - 1 : 0,
15991
16051
  className: 'EditorBreadcrumbs',
15992
16052
  type: Nav
15993
16053
  }, ...children];
@@ -16510,6 +16570,7 @@ const getMinimapVirtualDom = (minimapEnabled, minimapLines, minLineY, breadcrumb
16510
16570
  };
16511
16571
  const getEditorVirtualDom = ({
16512
16572
  bracketMatchInfos = [],
16573
+ breadcrumbFileIcon = '',
16513
16574
  breadcrumbsEnabled = false,
16514
16575
  breakPoints = [],
16515
16576
  combineWhitespaceTokens: combineWhitespaceTokens$1 = false,
@@ -16561,6 +16622,7 @@ const getEditorVirtualDom = ({
16561
16622
  const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos, activeLineNumber, breadcrumbsEnabled) : [];
16562
16623
  const minimapDom = getMinimapVirtualDom(minimapEnabled, minimapLines, minLineY, breadcrumbsEnabled);
16563
16624
  const breadcrumbsDom = breadcrumbsEnabled ? getEditorBreadcrumbsVirtualDom({
16625
+ breadcrumbFileIcon,
16564
16626
  breadcrumbsEnabled,
16565
16627
  documentSymbols,
16566
16628
  lines,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.67.8",
3
+ "version": "19.68.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"