Files icon indicating copy to clipboard operation
Files copied to clipboard

Code Quality: Use seperate json file for tabs list

Open yaira2 opened this issue 1 year ago • 8 comments

Description

We currently update the settings file whenever there is a change to the tab list. We do this to preserve the list of tabs in the event of an improper shutdown. At the same time, this requires serializing the list of settings into json when all we need is to save the list of tabs.

Concerned code

AppLifecycleHelper.SaveSessionTabs();

Gains

  • Better performance

Requirements

  • save the tabs list to its own json file

Comments

No response

yaira2 avatar Mar 01 '24 02:03 yaira2

The only challenging bit of this issue is migrating existing tabs to the new format

d2dyno1 avatar Mar 01 '24 21:03 d2dyno1

The only challenging bit of this issue is migrating existing tabs to the new format

How about checking if there is an existing list and copying them to the new format, once the existing list is empty we can ignore the check moving forward.

yaira2 avatar Mar 03 '24 00:03 yaira2

Hello, I think I could do it.

From what I can see you share singleton instance of UserSettingsService across all classes of settings by passing ISettingsSharingContext to them. This means that property userSettingsService.GeneralSettingsService.LastSessionTabList uses the same UserSettingsService singleton which saves data through CachingJsonSettingsDatabase. I could register a new service just like FileTagsSettingsService to save to its own file, right?

If my understanding is correct then I can attempt to do it :)

saikotek avatar Mar 07 '24 20:03 saikotek

@d2dyno1 is that right?

yaira2 avatar Mar 07 '24 20:03 yaira2

Yes, correct.

0x5bfa avatar May 09 '24 09:05 0x5bfa

In order to avoid using left and right wording, we might as well use a list instead.

[
  {
    "ShellPanes":
    [
      "C:\\Users",
      "C:\\Windows",
    ]
    "ShellPaneArrangement": 0
  },
  {
    "ShellPanes":
    [
      "C:\\Windows\\System32",
      "C:\\Program Files (x86)",
    ]
    "ShellPaneArrangement": 1
  },
  {
    "ShellPanes":
    [
      "C:\\Users\\0x5BFA\\Desktop",
      "C:\\Users\\0x5BFA\\AppData\\Local",
    ]
    "ShellPaneArrangement": 0
  }
]

0x5bfa avatar Jul 01 '24 17:07 0x5bfa

Something like that 👍

yaira2 avatar Jul 01 '24 18:07 yaira2

You will always find "arat" in separate 😄

Lamparter avatar Oct 17 '24 12:10 Lamparter