33 * Copyright (c) Microsoft Corporation. All rights reserved.
44 * Licensed under the MIT License. See License.txt in the project root for license information.
55 *--------------------------------------------------------------------------------------------*/
6- import { JSONSchemaService } from './services/jsonSchemaService'
6+ import { JSONSchemaService , CustomSchemaProvider } from './services/jsonSchemaService'
77import { TextDocument , Position , CompletionList , FormattingOptions , Diagnostic } from 'vscode-languageserver-types' ;
88import { JSONSchema } from './jsonSchema' ;
99import { YAMLDocumentSymbols } from './services/documentSymbols' ;
@@ -92,6 +92,7 @@ export interface SchemaConfiguration {
9292
9393export interface LanguageService {
9494 configure ( settings ) : void ;
95+ registerCustomSchemaProvider ( schemaProvider : CustomSchemaProvider ) : void ; // Register a custom schema provider
9596 doComplete ( document : TextDocument , position : Position , doc ) : Thenable < CompletionList > ;
9697 doValidation ( document : TextDocument , yamlDocument ) : Thenable < Diagnostic [ ] > ;
9798 doHover ( document : TextDocument , position : Position , doc ) ;
@@ -101,10 +102,10 @@ export interface LanguageService {
101102 doFormat ( document : TextDocument , options : FormattingOptions , customTags : Array < String > ) ;
102103}
103104
104- export function getLanguageService ( schemaRequestService , workspaceContext , contributions , customSchemaProvider , promiseConstructor ?) : LanguageService {
105+ export function getLanguageService ( schemaRequestService , workspaceContext , contributions , promiseConstructor ?) : LanguageService {
105106 let promise = promiseConstructor || Promise ;
106107
107- let schemaService = new JSONSchemaService ( schemaRequestService , workspaceContext , customSchemaProvider ) ;
108+ let schemaService = new JSONSchemaService ( schemaRequestService , workspaceContext ) ;
108109
109110 let completer = new YAMLCompletion ( schemaService , contributions , promise ) ;
110111 let hover = new YAMLHover ( schemaService , contributions , promise ) ;
@@ -123,6 +124,9 @@ export function getLanguageService(schemaRequestService, workspaceContext, contr
123124 let customTagsSetting = settings && settings [ "customTags" ] ? settings [ "customTags" ] : [ ] ;
124125 completer . configure ( customTagsSetting ) ;
125126 } ,
127+ registerCustomSchemaProvider : ( schemaProvider : CustomSchemaProvider ) => {
128+ schemaService . registerCustomSchemaProvider ( schemaProvider ) ;
129+ } ,
126130 doComplete : completer . doComplete . bind ( completer ) ,
127131 doResolve : completer . doResolve . bind ( completer ) ,
128132 doValidation : yamlValidation . doValidation . bind ( yamlValidation ) ,
0 commit comments