Skip to content

Commit e2f29f7

Browse files
authored
1 parent 800d68a commit e2f29f7

File tree

18 files changed

+395
-270
lines changed

18 files changed

+395
-270
lines changed

src/vs/editor/standalone/browser/standaloneServices.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ import { getEditorFeatures } from 'vs/editor/common/editorFeatures';
9494
import { onUnexpectedError } from 'vs/base/common/errors';
9595
import { ExtensionKind, IEnvironmentService, IExtensionHostDebugParams } from 'vs/platform/environment/common/environment';
9696
import { mainWindow } from 'vs/base/browser/window';
97+
import { ResourceMap } from 'vs/base/common/map';
9798

9899
class SimpleModel implements IResolvedTextEditorModel {
99100

@@ -629,9 +630,22 @@ export class StandaloneConfigurationService implements IConfigurationService {
629630

630631
private readonly _configuration: Configuration;
631632

632-
constructor() {
633-
const defaultConfiguration = new DefaultConfiguration();
634-
this._configuration = new Configuration(defaultConfiguration.reload(), new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel());
633+
constructor(
634+
@ILogService private readonly logService: ILogService,
635+
) {
636+
const defaultConfiguration = new DefaultConfiguration(logService);
637+
this._configuration = new Configuration(
638+
defaultConfiguration.reload(),
639+
ConfigurationModel.createEmptyModel(logService),
640+
ConfigurationModel.createEmptyModel(logService),
641+
ConfigurationModel.createEmptyModel(logService),
642+
ConfigurationModel.createEmptyModel(logService),
643+
ConfigurationModel.createEmptyModel(logService),
644+
new ResourceMap<ConfigurationModel>(),
645+
ConfigurationModel.createEmptyModel(logService),
646+
new ResourceMap<ConfigurationModel>(),
647+
logService
648+
);
635649
defaultConfiguration.dispose();
636650
}
637651

@@ -660,7 +674,7 @@ export class StandaloneConfigurationService implements IConfigurationService {
660674
}
661675

662676
if (changedKeys.length > 0) {
663-
const configurationChangeEvent = new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration);
677+
const configurationChangeEvent = new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration, undefined, this.logService);
664678
configurationChangeEvent.source = ConfigurationTarget.MEMORY;
665679
this._onDidChangeConfiguration.fire(configurationChangeEvent);
666680
}
@@ -1092,6 +1106,7 @@ export interface IEditorOverrideServices {
10921106
[index: string]: any;
10931107
}
10941108

1109+
registerSingleton(ILogService, StandaloneLogService, InstantiationType.Eager);
10951110
registerSingleton(IConfigurationService, StandaloneConfigurationService, InstantiationType.Eager);
10961111
registerSingleton(ITextResourceConfigurationService, StandaloneResourceConfigurationService, InstantiationType.Eager);
10971112
registerSingleton(ITextResourcePropertiesService, StandaloneResourcePropertiesService, InstantiationType.Eager);
@@ -1104,7 +1119,6 @@ registerSingleton(INotificationService, StandaloneNotificationService, Instantia
11041119
registerSingleton(IMarkerService, MarkerService, InstantiationType.Eager);
11051120
registerSingleton(ILanguageService, StandaloneLanguageService, InstantiationType.Eager);
11061121
registerSingleton(IStandaloneThemeService, StandaloneThemeService, InstantiationType.Eager);
1107-
registerSingleton(ILogService, StandaloneLogService, InstantiationType.Eager);
11081122
registerSingleton(IModelService, ModelService, InstantiationType.Eager);
11091123
registerSingleton(IMarkerDecorationsService, MarkerDecorationsService, InstantiationType.Eager);
11101124
registerSingleton(IContextKeyService, ContextKeyService, InstantiationType.Eager);

src/vs/editor/standalone/test/browser/monarch.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { compile } from 'vs/editor/standalone/common/monarch/monarchCompile';
1414
import { MonarchTokenizer } from 'vs/editor/standalone/common/monarch/monarchLexer';
1515
import { IMonarchLanguage } from 'vs/editor/standalone/common/monarch/monarchTypes';
1616
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
17+
import { NullLogService } from 'vs/platform/log/common/log';
1718

1819
suite('Monarch', () => {
1920

@@ -37,7 +38,7 @@ suite('Monarch', () => {
3738
test('Ensure @rematch and nextEmbedded can be used together in Monarch grammar', () => {
3839
const disposables = new DisposableStore();
3940
const languageService = disposables.add(new LanguageService());
40-
const configurationService = new StandaloneConfigurationService();
41+
const configurationService = new StandaloneConfigurationService(new NullLogService());
4142
disposables.add(languageService.registerLanguage({ id: 'sql' }));
4243
disposables.add(TokenizationRegistry.register('sql', disposables.add(createMonarchTokenizer(languageService, 'sql', {
4344
tokenizer: {
@@ -113,7 +114,7 @@ suite('Monarch', () => {
113114

114115
test('microsoft/monaco-editor#1235: Empty Line Handling', () => {
115116
const disposables = new DisposableStore();
116-
const configurationService = new StandaloneConfigurationService();
117+
const configurationService = new StandaloneConfigurationService(new NullLogService());
117118
const languageService = disposables.add(new LanguageService());
118119
const tokenizer = disposables.add(createMonarchTokenizer(languageService, 'test', {
119120
tokenizer: {
@@ -172,7 +173,7 @@ suite('Monarch', () => {
172173

173174
test('microsoft/monaco-editor#2265: Exit a state at end of line', () => {
174175
const disposables = new DisposableStore();
175-
const configurationService = new StandaloneConfigurationService();
176+
const configurationService = new StandaloneConfigurationService(new NullLogService());
176177
const languageService = disposables.add(new LanguageService());
177178
const tokenizer = disposables.add(createMonarchTokenizer(languageService, 'test', {
178179
includeLF: true,
@@ -223,7 +224,7 @@ suite('Monarch', () => {
223224

224225
test('issue #115662: monarchCompile function need an extra option which can control replacement', () => {
225226
const disposables = new DisposableStore();
226-
const configurationService = new StandaloneConfigurationService();
227+
const configurationService = new StandaloneConfigurationService(new NullLogService());
227228
const languageService = disposables.add(new LanguageService());
228229

229230
const tokenizer1 = disposables.add(createMonarchTokenizer(languageService, 'test', {
@@ -280,7 +281,7 @@ suite('Monarch', () => {
280281

281282
test('microsoft/monaco-editor#2424: Allow to target @@', () => {
282283
const disposables = new DisposableStore();
283-
const configurationService = new StandaloneConfigurationService();
284+
const configurationService = new StandaloneConfigurationService(new NullLogService());
284285
const languageService = disposables.add(new LanguageService());
285286

286287
const tokenizer = disposables.add(createMonarchTokenizer(languageService, 'test', {
@@ -312,7 +313,7 @@ suite('Monarch', () => {
312313
test('microsoft/monaco-editor#3025: Check maxTokenizationLineLength before tokenizing', async () => {
313314
const disposables = new DisposableStore();
314315

315-
const configurationService = new StandaloneConfigurationService();
316+
const configurationService = new StandaloneConfigurationService(new NullLogService());
316317
const languageService = disposables.add(new LanguageService());
317318

318319
// Set maxTokenizationLineLength to 4 so that "ham" works but "hamham" would fail
@@ -348,7 +349,7 @@ suite('Monarch', () => {
348349

349350
test('microsoft/monaco-editor#3128: allow state access within rules', () => {
350351
const disposables = new DisposableStore();
351-
const configurationService = new StandaloneConfigurationService();
352+
const configurationService = new StandaloneConfigurationService(new NullLogService());
352353
const languageService = disposables.add(new LanguageService());
353354

354355
const tokenizer = disposables.add(createMonarchTokenizer(languageService, 'test', {

src/vs/editor/standalone/test/browser/standaloneServices.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ suite('StandaloneKeybindingService', () => {
3232
const disposables = new DisposableStore();
3333
const serviceCollection = new ServiceCollection();
3434
const instantiationService = new InstantiationService(serviceCollection, true);
35-
const configurationService = new StandaloneConfigurationService();
35+
const configurationService = new StandaloneConfigurationService(new NullLogService());
3636
const contextKeyService = disposables.add(new ContextKeyService(configurationService));
3737
const commandService = new StandaloneCommandService(instantiationService);
3838
const notificationService = new StandaloneNotificationService();

src/vs/platform/configuration/common/configuration.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ export function addToValueTree(settingsTreeRoot: any, key: string, value: any, c
229229
obj = curr[s] = Object.create(null);
230230
break;
231231
case 'object':
232+
if (obj === null) {
233+
conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is null`);
234+
return;
235+
}
232236
break;
233237
default:
234238
conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join('.')} is ${JSON.stringify(obj)}`);

0 commit comments

Comments
 (0)