mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
more polish
This commit is contained in:
parent
de8bd2ba4f
commit
6ca4958538
2 changed files with 10 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ import { createTokenizationSupport } from './tokenization';
|
|||
import Uri = monaco.Uri;
|
||||
import IDisposable = monaco.IDisposable;
|
||||
|
||||
export function setupMode(defaults: LanguageServiceDefaultsImpl): void {
|
||||
export function setupMode(defaults: LanguageServiceDefaultsImpl): IDisposable {
|
||||
|
||||
const disposables: IDisposable[] = [];
|
||||
const providers: IDisposable[] = [];
|
||||
|
|
@ -72,7 +72,13 @@ export function setupMode(defaults: LanguageServiceDefaultsImpl): void {
|
|||
}
|
||||
});
|
||||
|
||||
disposables.push({ dispose: () => disposeAll(providers) });
|
||||
disposables.push(asDisposable(providers));
|
||||
|
||||
return asDisposable(disposables);
|
||||
}
|
||||
|
||||
function asDisposable(disposables: IDisposable[]): IDisposable {
|
||||
return { dispose: () => disposeAll(disposables) };
|
||||
}
|
||||
|
||||
function disposeAll(disposables: IDisposable[]) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import * as mode from './jsonMode';
|
|||
|
||||
import Emitter = monaco.Emitter;
|
||||
import IEvent = monaco.IEvent;
|
||||
import IDisposable = monaco.IDisposable;
|
||||
|
||||
// --- JSON configuration and defaults ---------
|
||||
|
||||
|
|
@ -58,7 +57,7 @@ const diagnosticDefault: monaco.languages.json.DiagnosticsOptions = {
|
|||
enableSchemaRequest: false
|
||||
};
|
||||
|
||||
const providersDefault: monaco.languages.json.ModeConfiguration = {
|
||||
const modeConfigurationDefault: monaco.languages.json.ModeConfiguration = {
|
||||
documentFormattingEdits: true,
|
||||
documentRangeFormattingEdits: true,
|
||||
completionItems: true,
|
||||
|
|
@ -70,7 +69,7 @@ const providersDefault: monaco.languages.json.ModeConfiguration = {
|
|||
diagnostics: true
|
||||
}
|
||||
|
||||
const jsonDefaults = new LanguageServiceDefaultsImpl('json', diagnosticDefault, providersDefault);
|
||||
const jsonDefaults = new LanguageServiceDefaultsImpl('json', diagnosticDefault, modeConfigurationDefault);
|
||||
|
||||
// Export API
|
||||
function createAPI(): typeof monaco.languages.json {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue