diff --git a/src/language/json/monaco.contribution.ts b/src/language/json/monaco.contribution.ts index 663aa1d1a1..9db5923db7 100644 --- a/src/language/json/monaco.contribution.ts +++ b/src/language/json/monaco.contribution.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as mode from './jsonMode'; -import { Emitter, IEvent, languages, Uri } from '../../fillers/monaco-editor-core'; -import type { JSONWorker } from './jsonWorker'; +import { Emitter, IEvent, languages, Uri } from 'monaco-editor-core'; +import * as jsonService from 'vscode-json-languageservice'; // --- JSON configuration and defaults --------- @@ -198,9 +198,27 @@ export const jsonDefaults: LanguageServiceDefaults = new LanguageServiceDefaults modeConfigurationDefault ); -export const getWorker = (): Promise<(...uris: Uri[]) => Promise> => { - return getMode().then((mode) => mode.getWorker()); -}; +export interface IJSONWorker { + findDocumentSymbols(uri: string): Promise; + getColorPresentations( + uri: string, + color: jsonService.Color, + range: jsonService.Range + ): Promise; + getFoldingRanges( + uri: string, + context?: { rangeLimit?: number } + ): Promise; + getSelectionRanges( + uri: string, + positions: jsonService.Position[] + ): Promise; + parseJSONDocument(uri: string): Promise; + getMatchingSchemas(uri: string): Promise; +} + +export const getWorker = (): Promise<(...uris: Uri[]) => Promise> => + getMode().then((mode) => mode.getWorker()); // export to the global based API (languages).json = { jsonDefaults, getWorker };