@@ -51,7 +51,9 @@ import {
5151 removeCodeAnalysisProblems , RemoveCodeAnalysisProblemsParams
5252} from './codeAnalysis' ;
5353import { DebugProtocolParams , getDiagnosticsChannel , getOutputChannelLogger , logDebugProtocol , Logger , logLocalized , showWarning , ShowWarningParams } from '../logger' ;
54+ import _ = require( 'lodash' ) ;
5455
56+ const deepCopy = ( obj : any ) => _ . cloneDeep ( obj ) ;
5557nls . config ( { messageFormat : nls . MessageFormat . bundle , bundleFormat : nls . BundleFormat . standalone } ) ( ) ;
5658const localize : nls . LocalizeFunc = nls . loadMessageBundle ( ) ;
5759
@@ -2755,7 +2757,7 @@ export class DefaultClient implements Client {
27552757 // Clone each entry, as we make modifications before sending it, and don't
27562758 // want to add those modifications to the original objects.
27572759 configurations . forEach ( ( c ) => {
2758- const modifiedConfig : configs . Configuration = { ... c } ;
2760+ const modifiedConfig : configs . Configuration = deepCopy ( c ) ;
27592761 // Separate compiler path and args before sending to language client
27602762 const compilerPathAndArgs : util . CompilerPathAndArgs =
27612763 util . extractCompilerPathAndArgs ( ! ! settings . legacyCompilerArgsBehavior , c . compilerPath , c . compilerArgs ) ;
@@ -2868,7 +2870,7 @@ export class DefaultClient implements Client {
28682870 console . warn ( "custom include paths should not use recursive includes ('**')" ) ;
28692871 }
28702872 // Separate compiler path and args before sending to language client
2871- const itemConfig : util . Mutable < InternalSourceFileConfiguration > = { ... item . configuration } ;
2873+ const itemConfig : util . Mutable < InternalSourceFileConfiguration > = deepCopy ( item . configuration ) ;
28722874 if ( util . isString ( itemConfig . compilerPath ) ) {
28732875 const compilerPathAndArgs : util . CompilerPathAndArgs = util . extractCompilerPathAndArgs (
28742876 providerVersion < Version . v6 ,
@@ -2946,7 +2948,8 @@ export class DefaultClient implements Client {
29462948 return ;
29472949 }
29482950
2949- sanitized = { ...< InternalWorkspaceBrowseConfiguration > config } ;
2951+ const browseConfig : InternalWorkspaceBrowseConfiguration = < InternalWorkspaceBrowseConfiguration > config ;
2952+ sanitized = deepCopy ( browseConfig ) ;
29502953 if ( ! this . isWorkspaceBrowseConfiguration ( sanitized ) ) {
29512954 console . log ( "Received an invalid browse configuration from configuration provider: " + JSON . stringify ( sanitized ) ) ;
29522955 const configValue : WorkspaceBrowseConfiguration | undefined = this . lastCustomBrowseConfiguration . Value ;
0 commit comments