-
Notifications
You must be signed in to change notification settings - Fork 31.3k
/
Copy pathstandaloneCodeEditor.ts
579 lines (525 loc) · 23.1 KB
/
standaloneCodeEditor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as aria from 'vs/base/browser/ui/aria/aria';
import { Disposable, IDisposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { ICodeEditor, IDiffEditor, IDiffEditorConstructionOptions } from 'vs/editor/browser/editorBrowser';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { InternalEditorAction } from 'vs/editor/common/editorAction';
import { IModelChangedEvent } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { StandaloneKeybindingService, updateConfigurationService } from 'vs/editor/standalone/browser/standaloneServices';
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneTheme';
import { IMenuItem, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { CommandsRegistry, ICommandHandler, ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ContextKeyExpr, ContextKeyValue, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { StandaloneCodeEditorNLS } from 'vs/editor/common/standaloneStrings';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { StandaloneThemeService } from 'vs/editor/standalone/browser/standaloneThemeService';
import { IModelService } from 'vs/editor/common/services/model';
import { ILanguageSelection, ILanguageService } from 'vs/editor/common/languages/language';
import { URI } from 'vs/base/common/uri';
import { StandaloneCodeEditorService } from 'vs/editor/standalone/browser/standaloneCodeEditorService';
import { PLAINTEXT_LANGUAGE_ID } from 'vs/editor/common/languages/modesRegistry';
import { ILanguageConfigurationService } from 'vs/editor/common/languages/languageConfigurationRegistry';
import { IEditorConstructionOptions } from 'vs/editor/browser/config/editorConfiguration';
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
/**
* Description of an action contribution
*/
export interface IActionDescriptor {
/**
* An unique identifier of the contributed action.
*/
id: string;
/**
* A label of the action that will be presented to the user.
*/
label: string;
/**
* Precondition rule.
*/
precondition?: string;
/**
* An array of keybindings for the action.
*/
keybindings?: number[];
/**
* The keybinding rule (condition on top of precondition).
*/
keybindingContext?: string;
/**
* Control if the action should show up in the context menu and where.
* The context menu of the editor has these default:
* navigation - The navigation group comes first in all cases.
* 1_modification - This group comes next and contains commands that modify your code.
* 9_cutcopypaste - The last default group with the basic editing commands.
* You can also create your own group.
* Defaults to null (don't show in context menu).
*/
contextMenuGroupId?: string;
/**
* Control the order in the context menu group.
*/
contextMenuOrder?: number;
/**
* Method that will be executed when the action is triggered.
* @param editor The editor instance is passed in as a convenience
*/
run(editor: ICodeEditor, ...args: any[]): void | Promise<void>;
}
/**
* Options which apply for all editors.
*/
export interface IGlobalEditorOptions {
/**
* The number of spaces a tab is equal to.
* This setting is overridden based on the file contents when `detectIndentation` is on.
* Defaults to 4.
*/
tabSize?: number;
/**
* Insert spaces when pressing `Tab`.
* This setting is overridden based on the file contents when `detectIndentation` is on.
* Defaults to true.
*/
insertSpaces?: boolean;
/**
* Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents.
* Defaults to true.
*/
detectIndentation?: boolean;
/**
* Remove trailing auto inserted whitespace.
* Defaults to true.
*/
trimAutoWhitespace?: boolean;
/**
* Special handling for large files to disable certain memory intensive features.
* Defaults to true.
*/
largeFileOptimizations?: boolean;
/**
* Controls whether completions should be computed based on words in the document.
* Defaults to true.
*/
wordBasedSuggestions?: boolean;
/**
* Controls whether word based completions should be included from opened documents of the same language or any language.
*/
wordBasedSuggestionsOnlySameLanguage?: boolean;
/**
* Controls whether the semanticHighlighting is shown for the languages that support it.
* true: semanticHighlighting is enabled for all themes
* false: semanticHighlighting is disabled for all themes
* 'configuredByTheme': semanticHighlighting is controlled by the current color theme's semanticHighlighting setting.
* Defaults to 'byTheme'.
*/
'semanticHighlighting.enabled'?: true | false | 'configuredByTheme';
/**
* Keep peek editors open even when double-clicking their content or when hitting `Escape`.
* Defaults to false.
*/
stablePeek?: boolean;
/**
* Lines above this length will not be tokenized for performance reasons.
* Defaults to 20000.
*/
maxTokenizationLineLength?: number;
/**
* Theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`.
* **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
*/
theme?: string;
/**
* If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
* Defaults to true.
*/
autoDetectHighContrast?: boolean;
}
/**
* The options to create an editor.
*/
export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions {
/**
* The initial model associated with this code editor.
*/
model?: ITextModel | null;
/**
* The initial value of the auto created model in the editor.
* To not automatically create a model, use `model: null`.
*/
value?: string;
/**
* The initial language of the auto created model in the editor.
* To not automatically create a model, use `model: null`.
*/
language?: string;
/**
* Initial theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`.
* **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
*/
theme?: string;
/**
* If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
* Defaults to true.
*/
autoDetectHighContrast?: boolean;
/**
* An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in
* the accessibility help dialog in the editor.
*
* Defaults to "https://go.microsoft.com/fwlink/?linkid=852450"
*/
accessibilityHelpUrl?: string;
/**
* Container element to use for ARIA messages.
* Defaults to document.body.
*/
ariaContainerElement?: HTMLElement;
}
/**
* The options to create a diff editor.
*/
export interface IStandaloneDiffEditorConstructionOptions extends IDiffEditorConstructionOptions {
/**
* Initial theme to be used for rendering.
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light.
* You can create custom themes via `monaco.editor.defineTheme`.
* To switch a theme, use `monaco.editor.setTheme`.
* **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
*/
theme?: string;
/**
* If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
* Defaults to true.
*/
autoDetectHighContrast?: boolean;
}
export interface IStandaloneCodeEditor extends ICodeEditor {
updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void;
addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
createContextKey<T extends ContextKeyValue = ContextKeyValue>(key: string, defaultValue: T): IContextKey<T>;
addAction(descriptor: IActionDescriptor): IDisposable;
}
export interface IStandaloneDiffEditor extends IDiffEditor {
addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
createContextKey<T extends ContextKeyValue = ContextKeyValue>(key: string, defaultValue: T): IContextKey<T>;
addAction(descriptor: IActionDescriptor): IDisposable;
getOriginalEditor(): IStandaloneCodeEditor;
getModifiedEditor(): IStandaloneCodeEditor;
}
let LAST_GENERATED_COMMAND_ID = 0;
let ariaDomNodeCreated = false;
/**
* Create ARIA dom node inside parent,
* or only for the first editor instantiation inside document.body.
* @param parent container element for ARIA dom node
*/
function createAriaDomNode(parent: HTMLElement | undefined) {
if (!parent) {
if (ariaDomNodeCreated) {
return;
}
ariaDomNodeCreated = true;
}
aria.setARIAContainer(parent || document.body);
}
/**
* A code editor to be used both by the standalone editor and the standalone diff editor.
*/
export class StandaloneCodeEditor extends CodeEditorWidget implements IStandaloneCodeEditor {
private readonly _standaloneKeybindingService: StandaloneKeybindingService | null;
constructor(
domElement: HTMLElement,
_options: Readonly<IStandaloneEditorConstructionOptions>,
@IInstantiationService instantiationService: IInstantiationService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@ICommandService commandService: ICommandService,
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IThemeService themeService: IThemeService,
@INotificationService notificationService: INotificationService,
@IAccessibilityService accessibilityService: IAccessibilityService,
@ILanguageConfigurationService languageConfigurationService: ILanguageConfigurationService,
@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,
) {
const options = { ..._options };
options.ariaLabel = options.ariaLabel || StandaloneCodeEditorNLS.editorViewAccessibleLabel;
options.ariaLabel = options.ariaLabel + ';' + (StandaloneCodeEditorNLS.accessibilityHelpMessage);
super(domElement, options, {}, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
if (keybindingService instanceof StandaloneKeybindingService) {
this._standaloneKeybindingService = keybindingService;
} else {
this._standaloneKeybindingService = null;
}
createAriaDomNode(options.ariaContainerElement);
}
public addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null {
if (!this._standaloneKeybindingService) {
console.warn('Cannot add command because the editor is configured with an unrecognized KeybindingService');
return null;
}
const commandId = 'DYNAMIC_' + (++LAST_GENERATED_COMMAND_ID);
const whenExpression = ContextKeyExpr.deserialize(context);
this._standaloneKeybindingService.addDynamicKeybinding(commandId, keybinding, handler, whenExpression);
return commandId;
}
public createContextKey<T extends ContextKeyValue = ContextKeyValue>(key: string, defaultValue: T): IContextKey<T> {
return this._contextKeyService.createKey(key, defaultValue);
}
public addAction(_descriptor: IActionDescriptor): IDisposable {
if ((typeof _descriptor.id !== 'string') || (typeof _descriptor.label !== 'string') || (typeof _descriptor.run !== 'function')) {
throw new Error('Invalid action descriptor, `id`, `label` and `run` are required properties!');
}
if (!this._standaloneKeybindingService) {
console.warn('Cannot add keybinding because the editor is configured with an unrecognized KeybindingService');
return Disposable.None;
}
// Read descriptor options
const id = _descriptor.id;
const label = _descriptor.label;
const precondition = ContextKeyExpr.and(
ContextKeyExpr.equals('editorId', this.getId()),
ContextKeyExpr.deserialize(_descriptor.precondition)
);
const keybindings = _descriptor.keybindings;
const keybindingsWhen = ContextKeyExpr.and(
precondition,
ContextKeyExpr.deserialize(_descriptor.keybindingContext)
);
const contextMenuGroupId = _descriptor.contextMenuGroupId || null;
const contextMenuOrder = _descriptor.contextMenuOrder || 0;
const run = (_accessor?: ServicesAccessor, ...args: any[]): Promise<void> => {
return Promise.resolve(_descriptor.run(this, ...args));
};
const toDispose = new DisposableStore();
// Generate a unique id to allow the same descriptor.id across multiple editor instances
const uniqueId = this.getId() + ':' + id;
// Register the command
toDispose.add(CommandsRegistry.registerCommand(uniqueId, run));
// Register the context menu item
if (contextMenuGroupId) {
const menuItem: IMenuItem = {
command: {
id: uniqueId,
title: label
},
when: precondition,
group: contextMenuGroupId,
order: contextMenuOrder
};
toDispose.add(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));
}
// Register the keybindings
if (Array.isArray(keybindings)) {
for (const kb of keybindings) {
toDispose.add(this._standaloneKeybindingService.addDynamicKeybinding(uniqueId, kb, run, keybindingsWhen));
}
}
// Finally, register an internal editor action
const internalAction = new InternalEditorAction(
uniqueId,
label,
label,
precondition,
(...args: unknown[]) => Promise.resolve(_descriptor.run(this, ...args)),
this._contextKeyService
);
// Store it under the original id, such that trigger with the original id will work
this._actions.set(id, internalAction);
toDispose.add(toDisposable(() => {
this._actions.delete(id);
}));
return toDispose;
}
protected override _triggerCommand(handlerId: string, payload: any): void {
if (this._codeEditorService instanceof StandaloneCodeEditorService) {
// Help commands find this editor as the active editor
try {
this._codeEditorService.setActiveCodeEditor(this);
super._triggerCommand(handlerId, payload);
} finally {
this._codeEditorService.setActiveCodeEditor(null);
}
} else {
super._triggerCommand(handlerId, payload);
}
}
}
export class StandaloneEditor extends StandaloneCodeEditor implements IStandaloneCodeEditor {
private readonly _configurationService: IConfigurationService;
private readonly _standaloneThemeService: IStandaloneThemeService;
private _ownsModel: boolean;
constructor(
domElement: HTMLElement,
_options: Readonly<IStandaloneEditorConstructionOptions> | undefined,
@IInstantiationService instantiationService: IInstantiationService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@ICommandService commandService: ICommandService,
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IStandaloneThemeService themeService: IStandaloneThemeService,
@INotificationService notificationService: INotificationService,
@IConfigurationService configurationService: IConfigurationService,
@IAccessibilityService accessibilityService: IAccessibilityService,
@IModelService modelService: IModelService,
@ILanguageService languageService: ILanguageService,
@ILanguageConfigurationService languageConfigurationService: ILanguageConfigurationService,
@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,
) {
const options = { ..._options };
updateConfigurationService(configurationService, options, false);
const themeDomRegistration = (<StandaloneThemeService>themeService).registerEditorContainer(domElement);
if (typeof options.theme === 'string') {
themeService.setTheme(options.theme);
}
if (typeof options.autoDetectHighContrast !== 'undefined') {
themeService.setAutoDetectHighContrast(Boolean(options.autoDetectHighContrast));
}
const _model: ITextModel | null | undefined = options.model;
delete options.model;
super(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
this._configurationService = configurationService;
this._standaloneThemeService = themeService;
this._register(themeDomRegistration);
let model: ITextModel | null;
if (typeof _model === 'undefined') {
const languageId = languageService.getLanguageIdByMimeType(options.language) || options.language || PLAINTEXT_LANGUAGE_ID;
model = createTextModel(modelService, languageService, options.value || '', languageId, undefined);
this._ownsModel = true;
} else {
model = _model;
this._ownsModel = false;
}
this._attachModel(model);
if (model) {
const e: IModelChangedEvent = {
oldModelUrl: null,
newModelUrl: model.uri
};
this._onDidChangeModel.fire(e);
}
}
public override dispose(): void {
super.dispose();
}
public override updateOptions(newOptions: Readonly<IEditorOptions & IGlobalEditorOptions>): void {
updateConfigurationService(this._configurationService, newOptions, false);
if (typeof newOptions.theme === 'string') {
this._standaloneThemeService.setTheme(newOptions.theme);
}
if (typeof newOptions.autoDetectHighContrast !== 'undefined') {
this._standaloneThemeService.setAutoDetectHighContrast(Boolean(newOptions.autoDetectHighContrast));
}
super.updateOptions(newOptions);
}
protected override _postDetachModelCleanup(detachedModel: ITextModel): void {
super._postDetachModelCleanup(detachedModel);
if (detachedModel && this._ownsModel) {
detachedModel.dispose();
this._ownsModel = false;
}
}
}
export class StandaloneDiffEditor extends DiffEditorWidget implements IStandaloneDiffEditor {
private readonly _updatedConfigurationService: IConfigurationService;
private readonly _standaloneThemeService: IStandaloneThemeService;
constructor(
domElement: HTMLElement,
_options: Readonly<IStandaloneDiffEditorConstructionOptions> | undefined,
@IInstantiationService instantiationService: IInstantiationService,
@IContextKeyService contextKeyService: IContextKeyService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@IStandaloneThemeService themeService: IStandaloneThemeService,
@INotificationService notificationService: INotificationService,
@IConfigurationService configurationService: IConfigurationService,
@IContextMenuService contextMenuService: IContextMenuService,
@IEditorProgressService editorProgressService: IEditorProgressService,
@IClipboardService clipboardService: IClipboardService
) {
const options = { ..._options };
updateConfigurationService(configurationService, options, true);
const themeDomRegistration = (<StandaloneThemeService>themeService).registerEditorContainer(domElement);
if (typeof options.theme === 'string') {
themeService.setTheme(options.theme);
}
if (typeof options.autoDetectHighContrast !== 'undefined') {
themeService.setAutoDetectHighContrast(Boolean(options.autoDetectHighContrast));
}
super(domElement, options, {}, clipboardService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService, contextMenuService, editorProgressService, configurationService);
this._updatedConfigurationService = configurationService;
this._standaloneThemeService = themeService;
this._register(themeDomRegistration);
}
public override dispose(): void {
super.dispose();
}
public override updateOptions(newOptions: Readonly<IDiffEditorOptions & IGlobalEditorOptions>): void {
updateConfigurationService(this._updatedConfigurationService, newOptions, true);
if (typeof newOptions.theme === 'string') {
this._standaloneThemeService.setTheme(newOptions.theme);
}
if (typeof newOptions.autoDetectHighContrast !== 'undefined') {
this._standaloneThemeService.setAutoDetectHighContrast(Boolean(newOptions.autoDetectHighContrast));
}
super.updateOptions(newOptions);
}
protected override _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: Readonly<IEditorOptions>): CodeEditorWidget {
return instantiationService.createInstance(StandaloneCodeEditor, container, options);
}
public override getOriginalEditor(): IStandaloneCodeEditor {
return <StandaloneCodeEditor>super.getOriginalEditor();
}
public override getModifiedEditor(): IStandaloneCodeEditor {
return <StandaloneCodeEditor>super.getModifiedEditor();
}
public addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null {
return this.getModifiedEditor().addCommand(keybinding, handler, context);
}
public createContextKey<T extends ContextKeyValue = ContextKeyValue>(key: string, defaultValue: T): IContextKey<T> {
return this.getModifiedEditor().createContextKey(key, defaultValue);
}
public addAction(descriptor: IActionDescriptor): IDisposable {
return this.getModifiedEditor().addAction(descriptor);
}
}
/**
* @internal
*/
export function createTextModel(modelService: IModelService, languageService: ILanguageService, value: string, languageId: string | undefined, uri: URI | undefined): ITextModel {
value = value || '';
if (!languageId) {
const firstLF = value.indexOf('\n');
let firstLine = value;
if (firstLF !== -1) {
firstLine = value.substring(0, firstLF);
}
return doCreateModel(modelService, value, languageService.createByFilepathOrFirstLine(uri || null, firstLine), uri);
}
return doCreateModel(modelService, value, languageService.createById(languageId), uri);
}
/**
* @internal
*/
function doCreateModel(modelService: IModelService, value: string, languageSelection: ILanguageSelection, uri: URI | undefined): ITextModel {
return modelService.createModel(value, languageSelection, uri);
}