@@ -1804,57 +1804,67 @@ export class DefaultClient implements Client {
1804
1804
// Need to loop through candidates, to see if we can get a custom configuration from any of them.
1805
1805
// Wrap all lookups in a single task, so we can apply a timeout to the entire duration.
1806
1806
const provideConfigurationAsync : ( ) => Thenable < SourceFileConfigurationItem [ ] | null | undefined > = async ( ) => {
1807
+ const uris : vscode . Uri [ ] = [ ] ;
1807
1808
for ( let i : number = 0 ; i < response . candidates . length ; ++ i ) {
1809
+ const candidate : string = response . candidates [ i ] ;
1810
+ const tuUri : vscode . Uri = vscode . Uri . parse ( candidate ) ;
1808
1811
try {
1809
- const candidate : string = response . candidates [ i ] ;
1810
- const tuUri : vscode . Uri = vscode . Uri . parse ( candidate ) ;
1811
1812
if ( await provider . canProvideConfiguration ( tuUri , tokenSource . token ) ) {
1812
- const configs : util . Mutable < SourceFileConfigurationItem > [ ] = await provider . provideConfigurations ( [ tuUri ] , tokenSource . token ) ;
1813
- if ( configs && configs . length > 0 && configs [ 0 ] ) {
1814
- const fileConfiguration : configs . Configuration | undefined = this . configuration . CurrentConfiguration ;
1815
- if ( fileConfiguration ?. mergeConfigurations ) {
1816
- configs . forEach ( config => {
1817
- if ( fileConfiguration . includePath ) {
1818
- fileConfiguration . includePath . forEach ( p => {
1819
- if ( ! config . configuration . includePath . includes ( p ) ) {
1820
- config . configuration . includePath . push ( p ) ;
1821
- }
1822
- } ) ;
1823
- }
1813
+ uris . push ( tuUri ) ;
1814
+ }
1815
+ } catch ( err ) {
1816
+ console . warn ( "Caught exception from canProvideConfiguration" ) ;
1817
+ }
1818
+ }
1819
+ if ( ! uris . length ) {
1820
+ return [ ] ;
1821
+ }
1822
+ let configs : util . Mutable < SourceFileConfigurationItem > [ ] = [ ] ;
1823
+ try {
1824
+ configs = await provider . provideConfigurations ( uris , tokenSource . token ) ;
1825
+ } catch ( err ) {
1826
+ console . warn ( "Caught exception from provideConfigurations" ) ;
1827
+ }
1824
1828
1825
- if ( fileConfiguration . defines ) {
1826
- fileConfiguration . defines . forEach ( d => {
1827
- if ( ! config . configuration . defines . includes ( d ) ) {
1828
- config . configuration . defines . push ( d ) ;
1829
- }
1830
- } ) ;
1831
- }
1829
+ if ( configs && configs . length > 0 && configs [ 0 ] ) {
1830
+ const fileConfiguration : configs . Configuration | undefined = this . configuration . CurrentConfiguration ;
1831
+ if ( fileConfiguration ?. mergeConfigurations ) {
1832
+ configs . forEach ( config => {
1833
+ if ( fileConfiguration . includePath ) {
1834
+ fileConfiguration . includePath . forEach ( p => {
1835
+ if ( ! config . configuration . includePath . includes ( p ) ) {
1836
+ config . configuration . includePath . push ( p ) ;
1837
+ }
1838
+ } ) ;
1839
+ }
1832
1840
1833
- if ( ! config . configuration . forcedInclude ) {
1834
- config . configuration . forcedInclude = [ ] ;
1835
- }
1841
+ if ( fileConfiguration . defines ) {
1842
+ fileConfiguration . defines . forEach ( d => {
1843
+ if ( ! config . configuration . defines . includes ( d ) ) {
1844
+ config . configuration . defines . push ( d ) ;
1845
+ }
1846
+ } ) ;
1847
+ }
1836
1848
1837
- if ( fileConfiguration . forcedInclude ) {
1838
- fileConfiguration . forcedInclude . forEach ( i => {
1839
- if ( config . configuration . forcedInclude ) {
1840
- if ( ! config . configuration . forcedInclude . includes ( i ) ) {
1841
- config . configuration . forcedInclude . push ( i ) ;
1842
- }
1843
- }
1844
- } ) ;
1845
- }
1846
- } ) ;
1847
- }
1849
+ if ( ! config . configuration . forcedInclude ) {
1850
+ config . configuration . forcedInclude = [ ] ;
1851
+ }
1848
1852
1849
- return configs as SourceFileConfigurationItem [ ] ;
1853
+ if ( fileConfiguration . forcedInclude ) {
1854
+ fileConfiguration . forcedInclude . forEach ( i => {
1855
+ if ( config . configuration . forcedInclude ) {
1856
+ if ( ! config . configuration . forcedInclude . includes ( i ) ) {
1857
+ config . configuration . forcedInclude . push ( i ) ;
1858
+ }
1859
+ }
1860
+ } ) ;
1850
1861
}
1851
- }
1852
- if ( tokenSource . token . isCancellationRequested ) {
1853
- return null ;
1854
- }
1855
- } catch ( err ) {
1856
- console . warn ( "Caught exception request configuration" ) ;
1862
+ } ) ;
1857
1863
}
1864
+ return configs as SourceFileConfigurationItem [ ] ;
1865
+ }
1866
+ if ( tokenSource . token . isCancellationRequested ) {
1867
+ return null ;
1858
1868
}
1859
1869
} ;
1860
1870
const configs : SourceFileConfigurationItem [ ] | null | undefined = await this . callTaskWithTimeout ( provideConfigurationAsync , configProviderTimeout , tokenSource ) ;
0 commit comments