Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActivationEvents should be a list of the commands #377

Closed
jasonwilliams opened this issue Sep 9, 2020 · 5 comments
Closed

ActivationEvents should be a list of the commands #377

jasonwilliams opened this issue Sep 9, 2020 · 5 comments
Assignees
Labels
backlog Requests that are closed for now, but may be re-opened in the future if more interest is expressed improvement An improvement to existing functionality

Comments

@jasonwilliams
Copy link

Hey, great extension!
Minor nitpick.

Using * here: https://github.com/mhutchie/vscode-git-graph/blob/develop/package.json#L39 isn’t great practise because it starts up the extension when it’s not needed, it can also block VSCode during start up.

It would be better to replace this with an array of the commands that trigger this extension. Similar to what I’ve done here: https://github.com/jasonwilliams/anki/blob/master/package.json#L18

If you really need the extension to be running when VSCode starts up you could switch to onStartupFinished.

https://code.visualstudio.com/api/references/activation-events#onStartupFinished

@jasonwilliams jasonwilliams added the improvement An improvement to existing functionality label Sep 9, 2020
@mhutchie mhutchie added the backlog Requests that are closed for now, but may be re-opened in the future if more interest is expressed label Sep 9, 2020
@mhutchie
Copy link
Owner

mhutchie commented Sep 9, 2020

Hi @jasonwilliams, Thanks for the feedback!

I'm well aware that using * as I currently am in Git Graph should only be used as a last resort, which is the reason I currently am doing so. This is mainly because the primary entry-point for users into Git Graph View is via Git Graph Status Bar Item, which can only be contributed after the extension is activated. Additionally, there are some start-up tasks (like scanning the workspace for repositories), that realistically needs to occur before the user has to interact with Git Graph (e.g. as it impacts whether the Status Bar Item is shown etc.). To compensate for this, I've been extremely cautious and careful to absolutely minimise any code that runs upon extension activation (in combination with asynchronous methods) - to have as little impact as possible.

As for the onStartupFinished activation event, when I first read about it in the Visual Studio Code 1.46 release notes back in May this year, I recognised that it would be worthwhile migrating to it as soon as feasible to do so. It appears to be introduced for exactly the use case I have in Git Graph. I've put this on hold so far, as not enough Git Graph users are using a compatible Visual Studio Code version (>=1.46.0). If I were to upgrade the minimum version requirement of Git Graph to Visual Studio Code 1.46 now, too many users would no longer receive the significant volume of new features I deliver in updates to Git Graph (1.26.0 is coming this weekend).

I'll move this improvement request to the backlog for now, and when enough Git Graph users use Visual Studio Code >= 1.46.0, I'll re-open it and migrate to use onStartupFinished instead of *.

@mhutchie mhutchie closed this as completed Sep 9, 2020
@jasonwilliams
Copy link
Author

That’s fair, thanks for the detailed reply.
Are you able to get stats on which users are on what version?

@mhutchie
Copy link
Owner

mhutchie commented Sep 9, 2020

Hi @jasonwilliams,

Microsoft doesn't provide the Visual Studio Code version distribution of an extension users - extensions have to implement it themselves if they want this information.

I implemented a custom mechanism myself in ./src/life-cycle/startup.ts, that generates an event when Git Graph is installed, updated or uninstalled. Each event only contains the Git Graph and Visual Studio Code version numbers, and a new 256 bit cryptographically strong pseudo-random nonce. Please read the comment at the start of the linked file, and the additionally linked URL at the end of the comments, to find out more about the design of this mechanism to provide me only this aggregate compatibility information (and nothing more), while also ensuring that it is completely anonymous, non-personal, and cannot be correlated (which was extremely important to me, and fundamental to my design choices).

I've found that having this basic Visual Studio Code version distribution has proved itself extremely valuable in coordinating the long-term delivery of new capabilities to Git Graph, without excluding too many users in the process.

@jasonwilliams
Copy link
Author

@mhutchie Gentle reminder about this issue.

If I were to upgrade the minimum version requirement of Git Graph to Visual Studio Code 1.46 now, too many users would no longer receive the significant volume of new features I deliver

Is this still the case today?
As version 1.46 is now a year & half old I think it would be safe to do this now, I can't imagine many users are left on a version below this.

@FALLAI-Denis
Copy link

Hi @mhutchie,

Our VS Code Development Workshop, using Git Graph extension, is becoming richer and richer by adding extensions from the marketplace or that we develop ourselves.

We are seeing increasingly long startup times and delays before being able to work with our Development Workshop...
We have analyzed the activation events associated with each VS Code extension.
The Git Graph extension uses the * event, so it is activated as soon as VS Code starts:

  • is this a requirement?
  • could the onStartupFinished event be sufficient?
2025-01-10 21:30:42.371 [info] ExtensionService#_doActivateExtension mhutchie.git-graph, startup: true, activationEvent: '*'

We are now on version 1.96.x.
Could you reconsider the situation and implement activation based on onStartupFinished?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Requests that are closed for now, but may be re-opened in the future if more interest is expressed improvement An improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants