title: Purpose for subscribing a command in vscode extension?
body: <p><strong>Why does the VSCode Extension tutorial recommend subscribing a registered command to the <code>context.subscriptions</code>?</strong></p>
  
  <p>It doesn't seem to be necessary or useful from what I can tell so far.  </p>
  
  <p>Here's a <a href="https://github.com/Microsoft/vscode-extension-samples/blob/master/helloworld-sample/src/extension.ts" rel="noreferrer">code snippet</a> from the VSCode extension <a href="https://code.visualstudio.com/api/get-started/your-first-extension" rel="noreferrer">official tutorial</a>:</p>
  
  <pre><code>let disposable = vscode.commands.registerCommand('extension.helloWorld', () =&gt; {
      // The code you place here will be executed every time your command is executed
  
      // Display a message box to the user
      vscode.window.showInformationMessage('Hello World!');
  });
  
  context.subscriptions.push(disposable);
  </code></pre>
  
  <p>but this by itself seems to work just fine:</p>
  
  <pre><code>vscode.commands.registerCommand('extension.helloWorld', () =&gt; {
      vscode.window.showInformationMessage('Hello World!');
  });
  </code></pre>
  
  <p>Also, I tried disabling extensions that do and don't add their registered commands to <code>context.subscriptions</code> -- commands were unavailable after disabling in both cases.</p>
  
  <p>The <a href="https://code.visualstudio.com/api/references/vscode-api" rel="noreferrer">VS Code Api Reference</a> defines <code>subscriptions</code> as:</p>
  
  <blockquote>
    <p>subscriptions: {dispose}[]</p>
    
    <p>An array to which disposables can be added. When this extension is deactivated the disposables will be disposed.</p>
  </blockquote>
  
  <p>Does this mean that if registered commands are NOT disposed of, then their listeners hang around somehow even after the extension is closed?</p>
  
  <p>TDLR - Should I subscribe my commands or not, and why?</p>
  
  <p>Any explanations or insights would be appreciated!</p>