@@ -1223,7 +1223,7 @@ export class DefaultClient implements Client {
12231223 // Resume parsing on either resolve or reject, only if parsing was not resumed due to timeout
12241224 let hasCompleted : boolean = false ;
12251225 task ( ) . then ( async config => {
1226- await this . sendCustomBrowseConfiguration ( config , currentProvider . extensionId ) ;
1226+ this . sendCustomBrowseConfiguration ( config , currentProvider . extensionId ) ;
12271227 if ( ! hasCompleted ) {
12281228 hasCompleted = true ;
12291229 if ( currentProvider . version >= Version . v2 ) {
@@ -1243,7 +1243,7 @@ export class DefaultClient implements Client {
12431243 global . setTimeout ( async ( ) => {
12441244 if ( ! hasCompleted ) {
12451245 hasCompleted = true ;
1246- await this . sendCustomBrowseConfiguration ( null , null , true ) ;
1246+ this . sendCustomBrowseConfiguration ( null , null , true ) ;
12471247 if ( currentProvider . version >= Version . v2 ) {
12481248 console . warn ( "Configuration Provider timed out in {0}ms." , configProviderTimeout ) ;
12491249 this . resumeParsing ( ) ;
@@ -1340,7 +1340,7 @@ export class DefaultClient implements Client {
13401340 return this . callTaskWithTimeout ( provideConfigurationAsync , configProviderTimeout , tokenSource ) . then (
13411341 ( configs : SourceFileConfigurationItem [ ] ) => {
13421342 if ( configs && configs . length > 0 ) {
1343- this . sendCustomConfigurations ( configs , false ) ;
1343+ this . sendCustomConfigurations ( configs ) ;
13441344 }
13451345 onFinished ( ) ;
13461346 } ,
@@ -1497,16 +1497,12 @@ export class DefaultClient implements Client {
14971497 return this . queueTask ( request ) ;
14981498 }
14991499
1500- public notifyWhenReady ( notify : ( ) => void , blockingTask ?: boolean ) : Thenable < void > {
1500+ public notifyWhenReady ( notify : ( ) => void ) : Thenable < void > {
15011501 let task : ( ) => Thenable < void > = ( ) => new Promise ( resolve => {
15021502 notify ( ) ;
15031503 resolve ( ) ;
15041504 } ) ;
1505- if ( blockingTask ) {
1506- return this . queueBlockingTask ( task ) ;
1507- } else {
1508- return this . queueTask ( task ) ;
1509- }
1505+ return this . queueTask ( task ) ;
15101506 }
15111507
15121508 /**
@@ -1941,30 +1937,27 @@ export class DefaultClient implements Client {
19411937 c . compilerPath = compilerPathAndArgs . compilerPath ;
19421938 c . compilerArgs = compilerPathAndArgs . additionalArgs ;
19431939 } ) ;
1944- this . notifyWhenReady ( ( ) => {
1945- if ( ! this . doneInitialCustomBrowseConfigurationCheck ) {
1946- // Send the last custom browse configuration we received from this provider.
1947- // This ensures we don't start tag parsing without it, and undo'ing work we have to re-do when the (likely same) browse config arrives
1948- // Should only execute on launch, for the initial delivery of configurations
1949- let lastCustomBrowseConfigurationProviderId : PersistentFolderState < string > = new PersistentFolderState < string > ( "CPP.lastCustomBrowseConfigurationProviderId" , null , this . RootPath ) ;
1950- if ( lastCustomBrowseConfigurationProviderId . Value === configurations [ params . currentConfiguration ] . configurationProvider ) {
1951- let lastCustomBrowseConfiguration : PersistentFolderState < WorkspaceBrowseConfiguration > = new PersistentFolderState < WorkspaceBrowseConfiguration > ( "CPP.lastCustomBrowseConfiguration" , null , this . RootPath ) ;
1952- if ( lastCustomBrowseConfiguration . Value ) {
1953- this . sendCustomBrowseConfiguration ( lastCustomBrowseConfiguration . Value , lastCustomBrowseConfigurationProviderId . Value ) ;
1954- }
1940+ if ( ! this . doneInitialCustomBrowseConfigurationCheck ) {
1941+ // Send the last custom browse configuration we received from this provider.
1942+ // This ensures we don't start tag parsing without it, and undo'ing work we have to re-do when the (likely same) browse config arrives
1943+ // Should only execute on launch, for the initial delivery of configurations
1944+ let lastCustomBrowseConfigurationProviderId : PersistentFolderState < string > = new PersistentFolderState < string > ( "CPP.lastCustomBrowseConfigurationProviderId" , null , this . RootPath ) ;
1945+ if ( isSameProviderExtensionId ( lastCustomBrowseConfigurationProviderId . Value , configurations [ params . currentConfiguration ] . configurationProvider ) ) {
1946+ let lastCustomBrowseConfiguration : PersistentFolderState < WorkspaceBrowseConfiguration > = new PersistentFolderState < WorkspaceBrowseConfiguration > ( "CPP.lastCustomBrowseConfiguration" , null , this . RootPath ) ;
1947+ if ( lastCustomBrowseConfiguration . Value ) {
1948+ this . sendCustomBrowseConfiguration ( lastCustomBrowseConfiguration . Value , lastCustomBrowseConfigurationProviderId . Value ) ;
19551949 }
1956- this . doneInitialCustomBrowseConfigurationCheck = true ;
19571950 }
1958- this . languageClient . sendNotification ( ChangeFolderSettingsNotification , params ) ;
1959- this . model . activeConfigName . Value = configurations [ params . currentConfiguration ] . name ;
1960- } ) . then ( ( ) => {
1961- let newProvider : string = this . configuration . CurrentConfigurationProvider ;
1962- if ( ! isSameProviderExtensionId ( newProvider , this . configurationProvider ) ) {
1963- this . configurationProvider = newProvider ;
1964- this . updateCustomBrowseConfiguration ( ) ;
1965- this . updateCustomConfigurations ( ) ;
1966- }
1967- } ) ;
1951+ this . doneInitialCustomBrowseConfigurationCheck = true ;
1952+ }
1953+ this . languageClient . sendNotification ( ChangeFolderSettingsNotification , params ) ;
1954+ this . model . activeConfigName . Value = configurations [ params . currentConfiguration ] . name ;
1955+ let newProvider : string = this . configuration . CurrentConfigurationProvider ;
1956+ if ( ! isSameProviderExtensionId ( newProvider , this . configurationProvider ) ) {
1957+ this . configurationProvider = newProvider ;
1958+ this . updateCustomBrowseConfiguration ( ) ;
1959+ this . updateCustomConfigurations ( ) ;
1960+ }
19681961 }
19691962
19701963 private onSelectedConfigurationChanged ( index : number ) : void {
@@ -1997,7 +1990,7 @@ export class DefaultClient implements Client {
19971990 util . isOptionalArrayOfString ( input . configuration . forcedInclude ) ) ;
19981991 }
19991992
2000- private sendCustomConfigurations ( configs : any , blockingTask ?: boolean ) : void {
1993+ private sendCustomConfigurations ( configs : any ) : void {
20011994 // configs is marked as 'any' because it is untrusted data coming from a 3rd-party. We need to sanitize it before sending it to the language server.
20021995 if ( ! configs || ! ( configs instanceof Array ) ) {
20031996 console . warn ( "discarding invalid SourceFileConfigurationItems[]: " + configs ) ;
@@ -2045,16 +2038,10 @@ export class DefaultClient implements Client {
20452038 configurationItems : sanitized
20462039 } ;
20472040
2048- if ( blockingTask ) {
2049- this . notifyWhenReady ( ( ) => {
2050- this . languageClient . sendNotification ( CustomConfigurationNotification , params ) ;
2051- } , blockingTask ) ;
2052- } else {
2053- this . languageClient . sendNotification ( CustomConfigurationNotification , params ) ;
2054- }
2041+ this . languageClient . sendNotification ( CustomConfigurationNotification , params ) ;
20552042 }
20562043
2057- private sendCustomBrowseConfiguration ( config : any , providerId : string , timeoutOccured ?: boolean ) : Thenable < void > {
2044+ private sendCustomBrowseConfiguration ( config : any , providerId : string , timeoutOccured ?: boolean ) : void {
20582045 let lastCustomBrowseConfiguration : PersistentFolderState < WorkspaceBrowseConfiguration > = new PersistentFolderState < WorkspaceBrowseConfiguration > ( "CPP.lastCustomBrowseConfiguration" , null , this . RootPath ) ;
20592046 let lastCustomBrowseConfigurationProviderId : PersistentFolderState < string > = new PersistentFolderState < string > ( "CPP.lastCustomBrowseConfigurationProviderId" , null , this . RootPath ) ;
20602047 let sanitized : util . Mutable < WorkspaceBrowseConfiguration > ;
@@ -2072,7 +2059,7 @@ export class DefaultClient implements Client {
20722059 break ;
20732060 }
20742061 console . log ( "No browse configuration is available." ) ;
2075- return Promise . resolve ( ) ;
2062+ return ;
20762063 }
20772064
20782065 sanitized = { ...< WorkspaceBrowseConfiguration > config } ;
@@ -2087,7 +2074,7 @@ export class DefaultClient implements Client {
20872074 console . log ( "Falling back to last received browse configuration: " , JSON . stringify ( sanitized , null , 2 ) ) ;
20882075 break ;
20892076 }
2090- return Promise . resolve ( ) ;
2077+ return ;
20912078 }
20922079
20932080 let settings : CppSettings = new CppSettings ( this . RootUri ) ;
@@ -2114,7 +2101,7 @@ export class DefaultClient implements Client {
21142101 browseConfiguration : sanitized
21152102 } ;
21162103
2117- return this . notifyWhenReady ( ( ) => this . languageClient . sendNotification ( CustomBrowseConfigurationNotification , params ) ) ;
2104+ this . languageClient . sendNotification ( CustomBrowseConfigurationNotification , params ) ;
21182105 }
21192106
21202107 private clearCustomConfigurations ( ) : void {
0 commit comments