Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a VSCode extension activate method be async?

Can a VSCode extension activate method be async?

It seems to work.

I can't find anything that says not to do this.

None of the extension samples that I checked have async activate methods.

The code in VSCode extension Installation Dependency activation order does do it and the author says it works.

Is there any reason not to do this?

The reason I hope that I can have an async activate method is my extension activates on "*" because printing applies to all files. Some people are getting high extension CPU warnings. The official advice is to bundle with webpack but it seems to me this just turns the problem into an up-front cost.

Personally I never experience slow loading but that may be due to use of an SSD which would ameliorate the cost of lots of small files.

like image 237
Peter Wone Avatar asked Mar 13 '26 21:03

Peter Wone


1 Answers

Some extension examples do it. Here are two for example:

https://github.com/microsoft/vscode-extension-samples/blob/master/github-authentication-sample/src/extension.ts

https://github.com/microsoft/vscode-extension-samples/blob/master/source-control-sample/src/extension.ts

like image 132
boocs Avatar answered Mar 17 '26 04:03

boocs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!