visual-studio-codesettings

How do I make VS Code always show the outline view?


I cannot figure out how to not have to go to View>Open View... and click outline secondary sidebar every time I open VS Code. I've tried saving on close, searching the preferences, searching the docs, and searching Stack Overflow. All I ever find is how to manually open the view every time - never anything about defaulting to that view always opening. What am I missing? What am I doing wrong in searching for a solution to this issue? I'm surprised I cannot find it.


Solution

  • I learned that the problem is not that I have to open the outline view every time. VS Code remembers that the outline view is in the secondary sidebar just fine. The problem is that there's no way to tell VS Code to remember that the secondary outline view should default to visible upon launch.

    I was able to implement a work-around using osascript, the keyboard shortcut for toggling the secondary sidebar (commandoptionb) and VSCode's tasks.json. Basically, I set it to issue an osascript call to toggle the secondary sidebar:

    ./.vscode/tasks.json

    {
      // See https://go.microsoft.com/fwlink/?LinkId=733558
      // for the documentation about the tasks.json format
      // See https://code.visualstudio.com/docs/debugtest/tasks
      "version": "2.0.0",
      "tasks": [
        {
          "label": "Open Outline View",
          "type": "shell",
          "command": "osascript -e 'tell application \"System Events\" to keystroke \"b\" using {command down, option down}'",
          "group": "none",
          "presentation": {
            "reveal": "never",
            "panel": "new"
          },
          "isBackground": true,
          "runOptions": {
            "runOn": "default",
            "instanceLimit": 1,
            "reevaluateOnRerun": false
          }
        }
      ]
    }
    

    Now, when I launch VS Code, the secondary sidebar is displayed with the outline view in it.