Родитель
8d1525eb6d
Коммит
d39ac8ecc0
|
@ -4,8 +4,8 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as mode from './jsonMode';
|
import * as mode from './jsonMode';
|
||||||
import { Emitter, IEvent, languages, Uri } from '../../fillers/monaco-editor-core';
|
import { Emitter, IEvent, languages, Uri } from 'monaco-editor-core';
|
||||||
import type { JSONWorker } from './jsonWorker';
|
import * as jsonService from 'vscode-json-languageservice';
|
||||||
|
|
||||||
// --- JSON configuration and defaults ---------
|
// --- JSON configuration and defaults ---------
|
||||||
|
|
||||||
|
@ -198,9 +198,27 @@ export const jsonDefaults: LanguageServiceDefaults = new LanguageServiceDefaults
|
||||||
modeConfigurationDefault
|
modeConfigurationDefault
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getWorker = (): Promise<(...uris: Uri[]) => Promise<JSONWorker>> => {
|
export interface IJSONWorker {
|
||||||
return getMode().then((mode) => mode.getWorker());
|
findDocumentSymbols(uri: string): Promise<jsonService.SymbolInformation[]>;
|
||||||
};
|
getColorPresentations(
|
||||||
|
uri: string,
|
||||||
|
color: jsonService.Color,
|
||||||
|
range: jsonService.Range
|
||||||
|
): Promise<jsonService.ColorPresentation[]>;
|
||||||
|
getFoldingRanges(
|
||||||
|
uri: string,
|
||||||
|
context?: { rangeLimit?: number }
|
||||||
|
): Promise<jsonService.FoldingRange[]>;
|
||||||
|
getSelectionRanges(
|
||||||
|
uri: string,
|
||||||
|
positions: jsonService.Position[]
|
||||||
|
): Promise<jsonService.SelectionRange[]>;
|
||||||
|
parseJSONDocument(uri: string): Promise<jsonService.JSONDocument | null>;
|
||||||
|
getMatchingSchemas(uri: string): Promise<jsonService.MatchingSchema[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getWorker = (): Promise<(...uris: Uri[]) => Promise<IJSONWorker>> =>
|
||||||
|
getMode().then((mode) => mode.getWorker());
|
||||||
|
|
||||||
// export to the global based API
|
// export to the global based API
|
||||||
(<any>languages).json = { jsonDefaults, getWorker };
|
(<any>languages).json = { jsonDefaults, getWorker };
|
||||||
|
|
Загрузка…
Ссылка в новой задаче