@@ -169,6 +169,50 @@ export async function activate(): Promise<void> {
169169 }
170170 }
171171
172+ if ( new CppSettings ( ( vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders . length > 0 ) ? vscode . workspace . workspaceFolders [ 0 ] ?. uri : undefined ) . intelliSenseEngine === "Disabled" ) {
173+ throw new Error ( intelliSenseDisabledError ) ;
174+ } else {
175+ console . log ( "activating extension" ) ;
176+ sendActivationTelemetry ( ) ;
177+ const checkForConflictingExtensions : PersistentState < boolean > = new PersistentState < boolean > ( "CPP." + util . packageJson . version + ".checkForConflictingExtensions" , true ) ;
178+ if ( checkForConflictingExtensions . Value ) {
179+ checkForConflictingExtensions . Value = false ;
180+ const clangCommandAdapterActive : boolean = vscode . extensions . all . some ( ( extension : vscode . Extension < any > , index : number , array : Readonly < vscode . Extension < any > [ ] > ) : boolean =>
181+ extension . isActive && extension . id === "mitaki28.vscode-clang" ) ;
182+ if ( clangCommandAdapterActive ) {
183+ telemetry . logLanguageServerEvent ( "conflictingExtension" ) ;
184+ }
185+ }
186+ }
187+
188+ console . log ( "starting language server" ) ;
189+ clients = new ClientCollection ( ) ;
190+ ui = getUI ( ) ;
191+
192+ // There may have already been registered CustomConfigurationProviders.
193+ // Request for configurations from those providers.
194+ clients . forEach ( client => {
195+ getCustomConfigProviders ( ) . forEach ( provider => client . onRegisterCustomConfigurationProvider ( provider ) ) ;
196+ } ) ;
197+
198+ disposables . push ( vscode . workspace . onDidChangeConfiguration ( onDidChangeSettings ) ) ;
199+ disposables . push ( vscode . window . onDidChangeActiveTextEditor ( onDidChangeActiveTextEditor ) ) ;
200+ ui . activeDocumentChanged ( ) ; // Handle already active documents (for non-cpp files that we don't register didOpen).
201+ disposables . push ( vscode . window . onDidChangeTextEditorSelection ( onDidChangeTextEditorSelection ) ) ;
202+ disposables . push ( vscode . window . onDidChangeVisibleTextEditors ( onDidChangeVisibleTextEditors ) ) ;
203+
204+ updateLanguageConfigurations ( ) ;
205+
206+ reportMacCrashes ( ) ;
207+
208+ vcpkgDbPromise = initVcpkgDatabase ( ) ;
209+
210+ clients . ActiveClient . notifyWhenLanguageClientReady ( ( ) => {
211+ intervalTimer = global . setInterval ( onInterval , 2500 ) ;
212+ } ) ;
213+
214+ registerCommands ( ) ;
215+
172216 taskProvider = vscode . tasks . registerTaskProvider ( CppBuildTaskProvider . CppBuildScriptType , cppBuildTaskProvider ) ;
173217
174218 vscode . tasks . onDidStartTask ( event => {
@@ -229,55 +273,11 @@ export async function activate(): Promise<void> {
229273 }
230274 } ) ;
231275
232- if ( new CppSettings ( ( vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders . length > 0 ) ? vscode . workspace . workspaceFolders [ 0 ] ?. uri : undefined ) . intelliSenseEngine === "Disabled" ) {
233- throw new Error ( intelliSenseDisabledError ) ;
234- } else {
235- console . log ( "activating extension" ) ;
236- sendActivationTelemetry ( ) ;
237- const checkForConflictingExtensions : PersistentState < boolean > = new PersistentState < boolean > ( "CPP." + util . packageJson . version + ".checkForConflictingExtensions" , true ) ;
238- if ( checkForConflictingExtensions . Value ) {
239- checkForConflictingExtensions . Value = false ;
240- const clangCommandAdapterActive : boolean = vscode . extensions . all . some ( ( extension : vscode . Extension < any > , index : number , array : Readonly < vscode . Extension < any > [ ] > ) : boolean =>
241- extension . isActive && extension . id === "mitaki28.vscode-clang" ) ;
242- if ( clangCommandAdapterActive ) {
243- telemetry . logLanguageServerEvent ( "conflictingExtension" ) ;
244- }
245- }
246- }
247-
248- console . log ( "starting language server" ) ;
249- clients = new ClientCollection ( ) ;
250- ui = getUI ( ) ;
251-
252276 // Log cold start.
253277 const activeEditor : vscode . TextEditor | undefined = vscode . window . activeTextEditor ;
254278 if ( activeEditor ) {
255279 clients . timeTelemetryCollector . setFirstFile ( activeEditor . document . uri ) ;
256280 }
257-
258- // There may have already been registered CustomConfigurationProviders.
259- // Request for configurations from those providers.
260- clients . forEach ( client => {
261- getCustomConfigProviders ( ) . forEach ( provider => client . onRegisterCustomConfigurationProvider ( provider ) ) ;
262- } ) ;
263-
264- disposables . push ( vscode . workspace . onDidChangeConfiguration ( onDidChangeSettings ) ) ;
265- disposables . push ( vscode . window . onDidChangeActiveTextEditor ( onDidChangeActiveTextEditor ) ) ;
266- ui . activeDocumentChanged ( ) ; // Handle already active documents (for non-cpp files that we don't register didOpen).
267- disposables . push ( vscode . window . onDidChangeTextEditorSelection ( onDidChangeTextEditorSelection ) ) ;
268- disposables . push ( vscode . window . onDidChangeVisibleTextEditors ( onDidChangeVisibleTextEditors ) ) ;
269-
270- updateLanguageConfigurations ( ) ;
271-
272- reportMacCrashes ( ) ;
273-
274- vcpkgDbPromise = initVcpkgDatabase ( ) ;
275-
276- clients . ActiveClient . notifyWhenLanguageClientReady ( ( ) => {
277- intervalTimer = global . setInterval ( onInterval , 2500 ) ;
278- } ) ;
279-
280- registerCommands ( ) ;
281281}
282282
283283export function updateLanguageConfigurations ( ) : void {
0 commit comments