title: How to access workspace state from VS Code commands?
body: <p>I'm new to VS Code extension building and ran into a problem. I'm having trouble accessing objects I create and store in the <a href="https://code.visualstudio.com/api/references/vscode-api#ExtensionContext" rel="nofollow noreferrer">workspaceState</a> property in ExtensionContext.</p>
  <pre><code>export async function activate(context: vscode.ExtensionContext) {
  
      // Some code
  
      const linksToDisplay = await initalizeLinks(context.workspaceState); // Initializes and saves all objects 
  
      // Some other code
  
      let visualizer = vscode.commands.registerCommand('codePlumber.visualize', displayLinksCommand);
  
      context.subscriptions.push(visualizer);
  }
  
  function displayLinksCommand() {
      // How can I access workspace state here?
  }
  </code></pre>
  <p>Basically I'm creating objects at Launch time for my extension and then I want my commands to interact with those created objects.</p>
  <p>I've tried passing context.workspaceState into the registerCommand function as an argument like</p>
  <pre><code>let visualizer = vscode.commands.registerCommand('codePlumber.visualize', displayLinksCommand, context.workspaceState);
  </code></pre>
  <p>but that didn't work.</p>
  <p>Here are a couple of questions I have:</p>
  <p>Is there a way to access workspaceState from my commands? If so, what does that code look like?</p>
  <p>Is my approach to saving objects in ExtensionContext wrong? If so, are there other alternatives I could be using?</p>