gistpad icon indicating copy to clipboard operation
gistpad copied to clipboard

If possible, don't activate on onStartupFinished

Open TylerLeonhardt opened this issue 1 year ago • 3 comments

When you are onStartupFinished activated, you activate every single time, even if the user has no intention of using the extension. I don't exclusively work in Gists so all of those times I'm not working in Gists, GistPad is activated for nothing which does introduce memory pressure and slows down VS Code.

It's better to be reactive and only activate when the user interacts with your extension:

  • via a command
  • via a view being visible

To Reproduce Steps to reproduce the behavior:

  1. Go to vscode.dev
  2. install gistpad
  3. reload the window
  4. gistpad is activated

Expected behavior It shouldn't activate until needed.

Additional context The line in the package.json is here: https://github.com/lostintangent/gistpad/blob/master/package.json#L63

Activation events for your reference (even though I know you know where these are) https://code.visualstudio.com/api/references/activation-events

TylerLeonhardt avatar Jul 31 '22 05:07 TylerLeonhardt

Hey @TylerLeonhardt, please check this PR comment as to why we removed actication on * and added onStartupFinished. Do you have suggestions about how to display the status bar items without using onStartupFinished?

carlocardella avatar Aug 01 '22 02:08 carlocardella

I read the Wiki's section in the readme... it looks like these status bars are added when:

  • The folder is named foo-wiki
  • The folder contains a gistpad.json or a foam.json

The latter can be easily triggered with: "workspaceContains:**/gistpad.json" and "workspaceContains:**/foam.json" activation events.

The former isn't possible at this time... but IMO, if that is really the only thing keeping onStartupFinished... then it doesn't seem worth it. The user is likely to hit one of the other activation events.

a workaround would be to have a separate extension called GistPad Wiki's that is onStartupFinished activated that simply activates GistPad.

if there's an extension that will likely also be installed in this foo-wiki scenario and it contributes a view/webview, maybe you could use that activation event

TylerLeonhardt avatar Aug 01 '22 16:08 TylerLeonhardt

Actually I'm not sure... I think trying workspaceContains:*-wiki for the former case might be worth trying but I doubt it works.

TylerLeonhardt avatar Aug 01 '22 16:08 TylerLeonhardt