@@ -5,39 +5,43 @@ import type { DatatipService } from "atom-ide-base"
55export { default as config } from "./config.json"
66
77/** [subscriptions description] */
8- let subscriptions : CompositeDisposable
8+ const subscriptions : CompositeDisposable = new CompositeDisposable ( )
99/** [datatipManager description] */
10- let datatipManager : DataTipManager
10+ let datatipManager : DataTipManager | undefined
1111
1212/** Called by Atom when activating an extension */
1313export function activate ( ) {
1414 // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
15- subscriptions = new CompositeDisposable ( )
16- if ( ! datatipManager ) {
15+ if ( datatipManager === undefined ) {
1716 datatipManager = new DataTipManager ( )
1817 }
1918 subscriptions . add ( datatipManager )
2019
21- install_deps ( ) . then ( ( ) => {
22- datatipManager . initialize ( )
23- } )
20+ install_deps ( )
21+ . then ( ( ) => {
22+ datatipManager ! . initialize ( )
23+ } )
24+ . catch ( ( e ) => {
25+ console . error ( e )
26+ } )
2427}
2528
2629async function install_deps ( ) {
2730 // install package-deps if not loaded
2831 if ( ! atom . packages . isPackageLoaded ( "busy-signal" ) ) {
2932 // Dynamic import https://mariusschulz.com/blog/dynamic-import-expressions-in-typescript
30- await import ( "atom-package-deps" ) . then ( ( atom_package_deps ) => {
31- atom_package_deps . install ( "atom-ide-datatip" , true )
32- } )
33+ const atom_package_deps = await import ( "atom-package-deps" )
34+ try {
35+ await atom_package_deps . install ( "atom-ide-datatip" , true )
36+ } catch ( err ) {
37+ atom . notifications . addError ( err )
38+ }
3339 }
3440}
3541
3642/** Called by Atom when deactivating an extension */
3743export function deactivate ( ) {
38- if ( subscriptions ) {
39- subscriptions . dispose ( )
40- }
44+ subscriptions . dispose ( )
4145}
4246
4347/**
0 commit comments