@@ -1803,6 +1803,9 @@ export class DefaultClient implements Client {
18031803 // If we are being called by a configuration provider other than the current one, ignore it.
18041804 return ;
18051805 }
1806+ if ( ! currentProvider . isReady ) {
1807+ return ;
1808+ }
18061809
18071810 this . clearCustomConfigurations ( ) ;
18081811 if ( diagnosticsCollectionCodeAnalysis ) {
@@ -1821,7 +1824,7 @@ export class DefaultClient implements Client {
18211824 }
18221825 console . log ( "updateCustomBrowseConfiguration" ) ;
18231826 const currentProvider : CustomConfigurationProvider1 | undefined = getCustomConfigProviders ( ) . get ( this . configurationProvider ) ;
1824- if ( ! currentProvider || ( requestingProvider && requestingProvider . extensionId !== currentProvider . extensionId ) ) {
1827+ if ( ! currentProvider || ! currentProvider . isReady || ( requestingProvider && requestingProvider . extensionId !== currentProvider . extensionId ) ) {
18251828 return ;
18261829 }
18271830
@@ -1950,14 +1953,10 @@ export class DefaultClient implements Client {
19501953 return ;
19511954 }
19521955 const provider : CustomConfigurationProvider1 | undefined = getCustomConfigProviders ( ) . get ( providerId ) ;
1953- if ( ! provider ) {
1956+ if ( ! provider || ! provider . isReady ) {
19541957 onFinished ( ) ;
19551958 return ;
19561959 }
1957- if ( ! provider . isReady ) {
1958- onFinished ( ) ;
1959- throw new Error ( `${ this . configurationProvider } is not ready` ) ;
1960- }
19611960 return this . queueBlockingTask ( async ( ) => {
19621961 const tokenSource : vscode . CancellationTokenSource = new vscode . CancellationTokenSource ( ) ;
19631962 console . log ( "provideCustomConfiguration" ) ;
@@ -1978,58 +1977,56 @@ export class DefaultClient implements Client {
19781977 // Need to loop through candidates, to see if we can get a custom configuration from any of them.
19791978 // Wrap all lookups in a single task, so we can apply a timeout to the entire duration.
19801979 const provideConfigurationAsync : ( ) => Thenable < SourceFileConfigurationItem [ ] | null | undefined > = async ( ) => {
1981- if ( provider ) {
1982- for ( let i : number = 0 ; i < response . candidates . length ; ++ i ) {
1983- try {
1984- const candidate : string = response . candidates [ i ] ;
1985- const tuUri : vscode . Uri = vscode . Uri . parse ( candidate ) ;
1986- if ( await provider . canProvideConfiguration ( tuUri , tokenSource . token ) ) {
1987- const configs : util . Mutable < SourceFileConfigurationItem > [ ] = await provider . provideConfigurations ( [ tuUri ] , tokenSource . token ) ;
1988- if ( configs && configs . length > 0 && configs [ 0 ] ) {
1989- const fileConfiguration : configs . Configuration | undefined = this . configuration . CurrentConfiguration ;
1990- if ( fileConfiguration ?. mergeConfigurations ) {
1991- configs . forEach ( config => {
1992- if ( fileConfiguration . includePath ) {
1993- fileConfiguration . includePath . forEach ( p => {
1994- if ( ! config . configuration . includePath . includes ( p ) ) {
1995- config . configuration . includePath . push ( p ) ;
1996- }
1997- } ) ;
1998- }
1980+ for ( let i : number = 0 ; i < response . candidates . length ; ++ i ) {
1981+ try {
1982+ const candidate : string = response . candidates [ i ] ;
1983+ const tuUri : vscode . Uri = vscode . Uri . parse ( candidate ) ;
1984+ if ( await provider . canProvideConfiguration ( tuUri , tokenSource . token ) ) {
1985+ const configs : util . Mutable < SourceFileConfigurationItem > [ ] = await provider . provideConfigurations ( [ tuUri ] , tokenSource . token ) ;
1986+ if ( configs && configs . length > 0 && configs [ 0 ] ) {
1987+ const fileConfiguration : configs . Configuration | undefined = this . configuration . CurrentConfiguration ;
1988+ if ( fileConfiguration ?. mergeConfigurations ) {
1989+ configs . forEach ( config => {
1990+ if ( fileConfiguration . includePath ) {
1991+ fileConfiguration . includePath . forEach ( p => {
1992+ if ( ! config . configuration . includePath . includes ( p ) ) {
1993+ config . configuration . includePath . push ( p ) ;
1994+ }
1995+ } ) ;
1996+ }
19991997
2000- if ( fileConfiguration . defines ) {
2001- fileConfiguration . defines . forEach ( d => {
2002- if ( ! config . configuration . defines . includes ( d ) ) {
2003- config . configuration . defines . push ( d ) ;
2004- }
2005- } ) ;
2006- }
2007-
2008- if ( ! config . configuration . forcedInclude ) {
2009- config . configuration . forcedInclude = [ ] ;
2010- }
2011-
2012- if ( fileConfiguration . forcedInclude ) {
2013- fileConfiguration . forcedInclude . forEach ( i => {
2014- if ( config . configuration . forcedInclude ) {
2015- if ( ! config . configuration . forcedInclude . includes ( i ) ) {
2016- config . configuration . forcedInclude . push ( i ) ;
2017- }
2018- }
2019- } ) ;
2020- }
2021- } ) ;
2022- }
1998+ if ( fileConfiguration . defines ) {
1999+ fileConfiguration . defines . forEach ( d => {
2000+ if ( ! config . configuration . defines . includes ( d ) ) {
2001+ config . configuration . defines . push ( d ) ;
2002+ }
2003+ } ) ;
2004+ }
2005+
2006+ if ( ! config . configuration . forcedInclude ) {
2007+ config . configuration . forcedInclude = [ ] ;
2008+ }
20232009
2024- return configs as SourceFileConfigurationItem [ ] ;
2010+ if ( fileConfiguration . forcedInclude ) {
2011+ fileConfiguration . forcedInclude . forEach ( i => {
2012+ if ( config . configuration . forcedInclude ) {
2013+ if ( ! config . configuration . forcedInclude . includes ( i ) ) {
2014+ config . configuration . forcedInclude . push ( i ) ;
2015+ }
2016+ }
2017+ } ) ;
2018+ }
2019+ } ) ;
20252020 }
2021+
2022+ return configs as SourceFileConfigurationItem [ ] ;
20262023 }
2027- if ( tokenSource . token . isCancellationRequested ) {
2028- return null ;
2029- }
2030- } catch ( err ) {
2031- console . warn ( "Caught exception request configuration" ) ;
20322024 }
2025+ if ( tokenSource . token . isCancellationRequested ) {
2026+ return null ;
2027+ }
2028+ } catch ( err ) {
2029+ console . warn ( "Caught exception request configuration" ) ;
20332030 }
20342031 }
20352032 } ;
0 commit comments