@@ -1803,6 +1803,9 @@ export class DefaultClient implements Client {
1803
1803
// If we are being called by a configuration provider other than the current one, ignore it.
1804
1804
return ;
1805
1805
}
1806
+ if ( ! currentProvider . isReady ) {
1807
+ return ;
1808
+ }
1806
1809
1807
1810
this . clearCustomConfigurations ( ) ;
1808
1811
if ( diagnosticsCollectionCodeAnalysis ) {
@@ -1821,7 +1824,7 @@ export class DefaultClient implements Client {
1821
1824
}
1822
1825
console . log ( "updateCustomBrowseConfiguration" ) ;
1823
1826
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 ) ) {
1825
1828
return ;
1826
1829
}
1827
1830
@@ -1950,14 +1953,10 @@ export class DefaultClient implements Client {
1950
1953
return ;
1951
1954
}
1952
1955
const provider : CustomConfigurationProvider1 | undefined = getCustomConfigProviders ( ) . get ( providerId ) ;
1953
- if ( ! provider ) {
1956
+ if ( ! provider || ! provider . isReady ) {
1954
1957
onFinished ( ) ;
1955
1958
return ;
1956
1959
}
1957
- if ( ! provider . isReady ) {
1958
- onFinished ( ) ;
1959
- throw new Error ( `${ this . configurationProvider } is not ready` ) ;
1960
- }
1961
1960
return this . queueBlockingTask ( async ( ) => {
1962
1961
const tokenSource : vscode . CancellationTokenSource = new vscode . CancellationTokenSource ( ) ;
1963
1962
console . log ( "provideCustomConfiguration" ) ;
@@ -1978,58 +1977,56 @@ export class DefaultClient implements Client {
1978
1977
// Need to loop through candidates, to see if we can get a custom configuration from any of them.
1979
1978
// Wrap all lookups in a single task, so we can apply a timeout to the entire duration.
1980
1979
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
+ }
1999
1997
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
+ }
2023
2009
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
+ } ) ;
2025
2020
}
2021
+
2022
+ return configs as SourceFileConfigurationItem [ ] ;
2026
2023
}
2027
- if ( tokenSource . token . isCancellationRequested ) {
2028
- return null ;
2029
- }
2030
- } catch ( err ) {
2031
- console . warn ( "Caught exception request configuration" ) ;
2032
2024
}
2025
+ if ( tokenSource . token . isCancellationRequested ) {
2026
+ return null ;
2027
+ }
2028
+ } catch ( err ) {
2029
+ console . warn ( "Caught exception request configuration" ) ;
2033
2030
}
2034
2031
}
2035
2032
} ;
0 commit comments