11'use strict' ;
2- import { EDITOR_LOAD } from './common/telemetry/constants' ;
3-
42import * as os from 'os' ;
53import * as vscode from 'vscode' ;
4+ import { BannerService } from './banner' ;
65import * as settings from './common/configSettings' ;
7- import { Commands } from './common/constants' ;
86import { createDeferred } from './common/helpers' ;
9- import { sendTelemetryEvent } from './common/telemetry' ;
10- import { StopWatch } from './common/telemetry/stopWatch' ;
7+ import { PersistentStateFactory } from './common/persistentState' ;
118import { SimpleConfigurationProvider } from './debugger' ;
9+ import { FeedbackService } from './feedback' ;
1210import { InterpreterManager } from './interpreter' ;
1311import { SetInterpreterProvider } from './interpreter/configuration/setInterpreterProvider' ;
1412import { ShebangCodeLensProvider } from './interpreter/display/shebangCodeLensProvider' ;
@@ -33,6 +31,9 @@ import { activateSimplePythonRefactorProvider } from './providers/simpleRefactor
3331import { PythonSymbolProvider } from './providers/symbolProvider' ;
3432import { activateUpdateSparkLibraryProvider } from './providers/updateSparkLibraryProvider' ;
3533import * as sortImports from './sortImports' ;
34+ import { sendTelemetryEvent } from './telemetry' ;
35+ import { EDITOR_LOAD } from './telemetry/constants' ;
36+ import { StopWatch } from './telemetry/stopWatch' ;
3637import { BlockFormatProviders } from './typeFormatters/blockFormatProvider' ;
3738import * as tests from './unittests/main' ;
3839import { WorkspaceSymbols } from './workspaceSymbols/main' ;
@@ -47,6 +48,7 @@ export const activated = activationDeferred.promise;
4748// tslint:disable-next-line:max-func-body-length
4849export async function activate ( context : vscode . ExtensionContext ) {
4950 const pythonSettings = settings . PythonSettings . getInstance ( ) ;
51+ // tslint:disable-next-line:no-floating-promises
5052 sendStartupTelemetry ( activated ) ;
5153
5254 lintingOutChannel = vscode . window . createOutputChannel ( pythonSettings . linting . outputWindow ) ;
@@ -77,7 +79,8 @@ export async function activate(context: vscode.ExtensionContext) {
7779 context . subscriptions . push ( new ReplProvider ( ) ) ;
7880
7981 // Enable indentAction
80- vscode . languages . setLanguageConfiguration ( PYTHON . language , {
82+ // tslint:disable-next-line:no-non-null-assertion
83+ vscode . languages . setLanguageConfiguration ( PYTHON . language ! , {
8184 onEnterRules : [
8285 {
8386 beforeText : / ^ \s * (?: d e f | c l a s s | f o r | i f | e l i f | e l s e | w h i l e | t r y | w i t h | f i n a l l y | e x c e p t | a s y n c ) .* ?: \s * $ / ,
@@ -116,23 +119,29 @@ export async function activate(context: vscode.ExtensionContext) {
116119 }
117120
118121 const jupyterExtInstalled = vscode . extensions . getExtension ( 'donjayamanne.jupyter' ) ;
122+ // tslint:disable-next-line:promise-function-async
119123 const linterProvider = new LintProvider ( context , lintingOutChannel , ( a , b ) => Promise . resolve ( false ) ) ;
120124 context . subscriptions . push ( ) ;
121125 if ( jupyterExtInstalled ) {
122126 if ( jupyterExtInstalled . isActive ) {
127+ // tslint:disable-next-line:no-unsafe-any
123128 jupyterExtInstalled . exports . registerLanguageProvider ( PYTHON . language , new JupyterProvider ( ) ) ;
129+ // tslint:disable-next-line:no-unsafe-any
124130 linterProvider . documentHasJupyterCodeCells = jupyterExtInstalled . exports . hasCodeCells ;
125131 }
126132
127133 jupyterExtInstalled . activate ( ) . then ( ( ) => {
134+ // tslint:disable-next-line:no-unsafe-any
128135 jupyterExtInstalled . exports . registerLanguageProvider ( PYTHON . language , new JupyterProvider ( ) ) ;
136+ // tslint:disable-next-line:no-unsafe-any
129137 linterProvider . documentHasJupyterCodeCells = jupyterExtInstalled . exports . hasCodeCells ;
130138 } ) ;
131139 } else {
132140 jupMain = new jup . Jupyter ( lintingOutChannel ) ;
133141 const documentHasJupyterCodeCells = jupMain . hasCodeCells . bind ( jupMain ) ;
134142 jupMain . activate ( ) ;
135143 context . subscriptions . push ( jupMain ) ;
144+ // tslint:disable-next-line:no-unsafe-any
136145 linterProvider . documentHasJupyterCodeCells = documentHasJupyterCodeCells ;
137146 }
138147 tests . activate ( context , unitTestOutChannel , symbolProvider ) ;
@@ -146,17 +155,25 @@ export async function activate(context: vscode.ExtensionContext) {
146155
147156 context . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( 'python' , new SimpleConfigurationProvider ( ) ) ) ;
148157 activationDeferred . resolve ( ) ;
158+
159+ const persistentStateFactory = new PersistentStateFactory ( context . globalState , context . workspaceState ) ;
160+ const feedbackService = new FeedbackService ( persistentStateFactory ) ;
161+ context . subscriptions . push ( feedbackService ) ;
162+ // tslint:disable-next-line:no-unused-expression
163+ new BannerService ( persistentStateFactory ) ;
149164}
150165
151166async function sendStartupTelemetry ( activatedPromise : Promise < void > ) {
152167 const stopWatch = new StopWatch ( ) ;
168+ // tslint:disable-next-line:no-floating-promises
153169 activatedPromise . then ( async ( ) => {
154170 const duration = stopWatch . elapsedTime ;
155171 let condaVersion : string | undefined ;
156172 try {
157173 condaVersion = await getCondaVersion ( ) ;
158174 // tslint:disable-next-line:no-empty
159175 } catch { }
160- sendTelemetryEvent ( EDITOR_LOAD , duration , { condaVersion } ) ;
176+ const props = condaVersion ? { condaVersion } : undefined ;
177+ sendTelemetryEvent ( EDITOR_LOAD , duration , props ) ;
161178 } ) ;
162179}
0 commit comments