| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import '../../editor/editor.api.js';
- /*---------------------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
- import { Emitter, languages } from './fillers/monaco-editor-core.js';
- var LanguageServiceDefaultsImpl = /** @class */ (function () {
- function LanguageServiceDefaultsImpl(languageId, diagnosticsOptions, modeConfiguration) {
- this._onDidChange = new Emitter();
- this._languageId = languageId;
- this.setDiagnosticsOptions(diagnosticsOptions);
- this.setModeConfiguration(modeConfiguration);
- }
- Object.defineProperty(LanguageServiceDefaultsImpl.prototype, "onDidChange", {
- get: function () {
- return this._onDidChange.event;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(LanguageServiceDefaultsImpl.prototype, "languageId", {
- get: function () {
- return this._languageId;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(LanguageServiceDefaultsImpl.prototype, "modeConfiguration", {
- get: function () {
- return this._modeConfiguration;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(LanguageServiceDefaultsImpl.prototype, "diagnosticsOptions", {
- get: function () {
- return this._diagnosticsOptions;
- },
- enumerable: false,
- configurable: true
- });
- LanguageServiceDefaultsImpl.prototype.setDiagnosticsOptions = function (options) {
- this._diagnosticsOptions = options || Object.create(null);
- this._onDidChange.fire(this);
- };
- LanguageServiceDefaultsImpl.prototype.setModeConfiguration = function (modeConfiguration) {
- this._modeConfiguration = modeConfiguration || Object.create(null);
- this._onDidChange.fire(this);
- };
- return LanguageServiceDefaultsImpl;
- }());
- var diagnosticDefault = {
- validate: true,
- allowComments: true,
- schemas: [],
- enableSchemaRequest: false,
- schemaRequest: 'warning',
- schemaValidation: 'warning',
- comments: 'error',
- trailingCommas: 'error'
- };
- var modeConfigurationDefault = {
- documentFormattingEdits: true,
- documentRangeFormattingEdits: true,
- completionItems: true,
- hovers: true,
- documentSymbols: true,
- tokens: true,
- colors: true,
- foldingRanges: true,
- diagnostics: true,
- selectionRanges: true
- };
- export var jsonDefaults = new LanguageServiceDefaultsImpl('json', diagnosticDefault, modeConfigurationDefault);
- // export to the global based API
- languages.json = { jsonDefaults: jsonDefaults };
- // --- Registration to monaco editor ---
- function getMode() {
- return import('./jsonMode.js');
- }
- languages.register({
- id: 'json',
- extensions: ['.json', '.bowerrc', '.jshintrc', '.jscsrc', '.eslintrc', '.babelrc', '.har'],
- aliases: ['JSON', 'json'],
- mimetypes: ['application/json']
- });
- languages.onLanguage('json', function () {
- getMode().then(function (mode) { return mode.setupMode(jsonDefaults); });
- });
|