@@ -11,7 +11,7 @@ import Event from 'vs/base/common/event';
1111import { Registry } from 'vs/platform/registry/common/platform' ;
1212import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace' ;
1313import { createDecorator } from 'vs/platform/instantiation/common/instantiation' ;
14- import { IConfigurationRegistry , Extensions } from 'vs/platform/configuration/common/configurationRegistry' ;
14+ import { IConfigurationRegistry , Extensions , OVERRIDE_PROPERTY_PATTERN } from 'vs/platform/configuration/common/configurationRegistry' ;
1515import { StrictResourceMap } from 'vs/base/common/map' ;
1616
1717export const IConfigurationService = createDecorator < IConfigurationService > ( 'configurationService' ) ;
@@ -124,6 +124,26 @@ export function compare(from: IConfigurationModel, to: IConfigurationModel): { a
124124 return { added, removed, updated } ;
125125}
126126
127+ export function toOverrides ( raw : any , conflictReporter : ( message : string ) => void ) : IOverrides [ ] {
128+ const overrides : IOverrides [ ] = [ ] ;
129+ const configurationProperties = Registry . as < IConfigurationRegistry > ( Extensions . Configuration ) . getConfigurationProperties ( ) ;
130+ for ( const key of Object . keys ( raw ) ) {
131+ if ( OVERRIDE_PROPERTY_PATTERN . test ( key ) ) {
132+ const overrideRaw = { } ;
133+ for ( const keyInOverrideRaw in raw [ key ] ) {
134+ if ( configurationProperties [ keyInOverrideRaw ] && configurationProperties [ keyInOverrideRaw ] . overridable ) {
135+ overrideRaw [ keyInOverrideRaw ] = raw [ key ] [ keyInOverrideRaw ] ;
136+ }
137+ }
138+ overrides . push ( {
139+ identifiers : [ overrideIdentifierFromKey ( key ) . trim ( ) ] ,
140+ contents : toValuesTree ( overrideRaw , conflictReporter )
141+ } ) ;
142+ }
143+ }
144+ return overrides ;
145+ }
146+
127147export function toValuesTree ( properties : { [ qualifiedKey : string ] : any } , conflictReporter : ( message : string ) => void ) : any {
128148 const root = Object . create ( null ) ;
129149
0 commit comments