@lvce-editor/explorer-view 5.2.0 → 5.3.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.
@@ -2650,7 +2650,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
2650
2650
  errorMessageTop: 0,
2651
2651
  visibleExplorerItems: [],
2652
2652
  errorMessageWidth: 0,
2653
- decorations: []
2653
+ decorations: [],
2654
+ sourceControlDecorations: false
2654
2655
  };
2655
2656
  set(state.uid, state, state);
2656
2657
  return state;
@@ -4635,18 +4636,17 @@ const getWorkspacePath = () => {
4635
4636
  return invoke$2('Workspace.getPath');
4636
4637
  };
4637
4638
 
4638
- const DecorationsEnabled = false;
4639
-
4640
- const getFileDecorations = async (scheme, root, maybeUris) => {
4639
+ const getFileDecorations = async (scheme, root, maybeUris, decorationsEnabled) => {
4641
4640
  try {
4642
- if (!DecorationsEnabled) {
4641
+ if (!decorationsEnabled) {
4643
4642
  return [];
4644
4643
  }
4645
4644
  const providerIds = await invoke$1('SourceControl.getEnabledProviderIds', scheme, root);
4646
4645
  if (providerIds.length === 0) {
4647
4646
  return [];
4648
4647
  }
4649
- const providerId = providerIds[0];
4648
+ // TODO how to handle multiple providers?
4649
+ const providerId = providerIds.at(-1);
4650
4650
  const uris = ensureUris(maybeUris);
4651
4651
  const decorations = await invoke$1('SourceControl.getFileDecorations', providerId, uris);
4652
4652
  return decorations;
@@ -4656,7 +4656,17 @@ const getFileDecorations = async (scheme, root, maybeUris) => {
4656
4656
  }
4657
4657
  };
4658
4658
 
4659
+ const RE_PROTOCOL = /^[a-z+]:\/\//;
4660
+ const getScheme = uri => {
4661
+ const match = uri.match(RE_PROTOCOL);
4662
+ if (!match) {
4663
+ return '';
4664
+ }
4665
+ return match[0];
4666
+ };
4667
+
4659
4668
  const getSettings = async () => {
4669
+ // TODO don't return false always
4660
4670
  // TODO get all settings at once
4661
4671
  const useChevronsRaw = await invoke$2('Preferences.get', 'explorer.useChevrons');
4662
4672
  const useChevrons = useChevronsRaw === false ? false : true;
@@ -4664,10 +4674,13 @@ const getSettings = async () => {
4664
4674
  const confirmDelete = confirmDeleteRaw === false ? false : false;
4665
4675
  const confirmPasteRaw = await invoke$2('Preferences.get', 'explorer.confirmpaste');
4666
4676
  const confirmPaste = confirmPasteRaw === false ? false : false;
4677
+ const sourceControlDecorationsRaw = await invoke$2('Preferences.get', 'explorer.sourceControlDecorations');
4678
+ const sourceControlDecorations = sourceControlDecorationsRaw === false ? false : true;
4667
4679
  return {
4668
4680
  useChevrons,
4669
4681
  confirmDelete,
4670
- confirmPaste
4682
+ confirmPaste,
4683
+ sourceControlDecorations
4671
4684
  };
4672
4685
  };
4673
4686
 
@@ -4780,18 +4793,11 @@ const getExcluded = () => {
4780
4793
  const getSavedRoot = (savedState, workspacePath) => {
4781
4794
  return workspacePath;
4782
4795
  };
4783
- const RE_PROTOCOL = /^[a-z+]:\/\//;
4784
- const getScheme = uri => {
4785
- const match = uri.match(RE_PROTOCOL);
4786
- if (!match) {
4787
- return '';
4788
- }
4789
- return match[0];
4790
- };
4791
4796
  const loadContent = async (state, savedState) => {
4792
4797
  const {
4793
4798
  useChevrons,
4794
- confirmDelete
4799
+ confirmDelete,
4800
+ sourceControlDecorations
4795
4801
  } = await getSettings();
4796
4802
  const workspacePath = await getWorkspacePath();
4797
4803
  const root = getSavedRoot(savedState, workspacePath);
@@ -4808,10 +4814,11 @@ const loadContent = async (state, savedState) => {
4808
4814
  deltaY = savedState.deltaY;
4809
4815
  }
4810
4816
  const scheme = getScheme(root);
4811
- const decorations = await getFileDecorations(scheme, root, restoredDirents.filter(item => item.depth === 1).map(item => item.path));
4817
+ const decorations = await getFileDecorations(scheme, root, restoredDirents.filter(item => item.depth === 1).map(item => item.path), sourceControlDecorations);
4812
4818
  return {
4813
4819
  ...state,
4814
4820
  confirmDelete,
4821
+ decorations,
4815
4822
  deltaY,
4816
4823
  excluded,
4817
4824
  items: restoredDirents,
@@ -4819,8 +4826,7 @@ const loadContent = async (state, savedState) => {
4819
4826
  minLineY,
4820
4827
  pathSeparator,
4821
4828
  root,
4822
- useChevrons,
4823
- decorations
4829
+ useChevrons
4824
4830
  };
4825
4831
  };
4826
4832
 
@@ -4893,9 +4899,6 @@ const createSourceControlWorkerRpc = async () => {
4893
4899
 
4894
4900
  const initializeSourceControlWorker = async () => {
4895
4901
  try {
4896
- if (!DecorationsEnabled) {
4897
- return;
4898
- }
4899
4902
  const rpc = await createSourceControlWorkerRpc();
4900
4903
  // TODO
4901
4904
  set$2(rpc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",