CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

✨ Move UI Workspace configuration from project `.codeedit/selection.json` to UserDefaults/AppStorage

Open austincondiff opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe.

We need to not clutter user project directories, so we need to move UI preferences to UserDefaults/AppStorage.

Describe the solution you'd like

We would store an object like this to allow for split layouts in Navigators, Inspectors, and Editors with tab order in each.

Note: Navigator and Inspector tab order will sync between open workspaces, while open editors and editor layout is workspace specific.

{
  "workspace-ui": {
    "navigator": {
      "panels": [
        {
          "size": 0.5,
          "items": ["project", "find", "source-control"]
        },
        {
          "size": 0.5,
          "items": ["packages", "symbols"]
        }
      ]
    },
    "inspector": {
      "panels": [
        {
          "size": 1,
          "items": ["file", "source-control", "quick-help"]
        }
      ]
    },
    "workspaces": [
      {
        "paths": ["~/repos/todo-list-app/"],
        "layout": {
          "direction": "horizontal",
          "groups": [
            {
              "size": 0.5,
              "editors": [
                "~/repos/todo-list-app/package.json",
                "~/repos/todo-list-app/src/index.js",
                "~/repos/todo-list-app/src/components/App.jsx",
              ]
            },
            {
              "size": 0.5,
              "layout": {
                "direction": "vertical",
                "groups": [
                  {
                    "size": 0.65,
                    "editors": [
                      "~/repos/todo-list-app/src/components/Checkbox.jsx",
                      "~/repos/todo-list-app/src/components/Input.jsx",
                    ]
                  },
                  {
                    "size": 0.35,
                    "editors": [
                      "~/repos/todo-list-app/src/init.js"
                    ]
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

This layout would produce a layout that looks something like this...

07-macOS-code-edit-split-editor-layout-config

Describe alternatives you've considered

n/a

Additional context

n/a

austincondiff avatar Apr 20 '22 19:04 austincondiff

I'll do that in the next few days!

lukepistrol avatar Apr 20 '22 19:04 lukepistrol

Now that I think of it, because a workspace can have multiple projects directories, we might alphabetize the project paths and create a hash from that concatenated string to use as the project id. Thoughts?

austincondiff avatar Apr 20 '22 20:04 austincondiff

@lukepistrol Currently there is no ability to split panes, so for now just add a groups with a single object in the array with a size of 1. Does that make sense?

austincondiff avatar Apr 22 '22 20:04 austincondiff

@Debdut @lukepistrol, can we close this issue now that #656 was closed? Was everything implemented that was specified in the issue description (not the UI issues - #338, #479)?

austincondiff avatar Jun 10 '22 19:06 austincondiff

@austincondiff nope not yet. Just everything that was implemented prior. Just moved from the .json file to UserDefaults

lukepistrol avatar Jun 10 '22 19:06 lukepistrol

@lukepistrol What is required for this to be closed?

austincondiff avatar Jul 30 '22 20:07 austincondiff