3
3
* Copyright (c) Microsoft Corporation. All rights reserved.
4
4
* Licensed under the MIT License. See License.txt in the project root for license information.
5
5
*--------------------------------------------------------------------------------------------*/
6
- import { JSONSchemaService } from './services/jsonSchemaService'
6
+ import { JSONSchemaService , CustomSchemaProvider } from './services/jsonSchemaService'
7
7
import { TextDocument , Position , CompletionList , FormattingOptions , Diagnostic } from 'vscode-languageserver-types' ;
8
8
import { JSONSchema } from './jsonSchema' ;
9
9
import { YAMLDocumentSymbols } from './services/documentSymbols' ;
@@ -92,6 +92,7 @@ export interface SchemaConfiguration {
92
92
93
93
export interface LanguageService {
94
94
configure ( settings ) : void ;
95
+ registerCustomSchemaProvider ( schemaProvider : CustomSchemaProvider ) : void ; // Register a custom schema provider
95
96
doComplete ( document : TextDocument , position : Position , doc ) : Thenable < CompletionList > ;
96
97
doValidation ( document : TextDocument , yamlDocument ) : Thenable < Diagnostic [ ] > ;
97
98
doHover ( document : TextDocument , position : Position , doc ) ;
@@ -101,10 +102,10 @@ export interface LanguageService {
101
102
doFormat ( document : TextDocument , options : FormattingOptions , customTags : Array < String > ) ;
102
103
}
103
104
104
- export function getLanguageService ( schemaRequestService , workspaceContext , contributions , customSchemaProvider , promiseConstructor ?) : LanguageService {
105
+ export function getLanguageService ( schemaRequestService , workspaceContext , contributions , promiseConstructor ?) : LanguageService {
105
106
let promise = promiseConstructor || Promise ;
106
107
107
- let schemaService = new JSONSchemaService ( schemaRequestService , workspaceContext , customSchemaProvider ) ;
108
+ let schemaService = new JSONSchemaService ( schemaRequestService , workspaceContext ) ;
108
109
109
110
let completer = new YAMLCompletion ( schemaService , contributions , promise ) ;
110
111
let hover = new YAMLHover ( schemaService , contributions , promise ) ;
@@ -123,6 +124,9 @@ export function getLanguageService(schemaRequestService, workspaceContext, contr
123
124
let customTagsSetting = settings && settings [ "customTags" ] ? settings [ "customTags" ] : [ ] ;
124
125
completer . configure ( customTagsSetting ) ;
125
126
} ,
127
+ registerCustomSchemaProvider : ( schemaProvider : CustomSchemaProvider ) => {
128
+ schemaService . registerCustomSchemaProvider ( schemaProvider ) ;
129
+ } ,
126
130
doComplete : completer . doComplete . bind ( completer ) ,
127
131
doResolve : completer . doResolve . bind ( completer ) ,
128
132
doValidation : yamlValidation . doValidation . bind ( yamlValidation ) ,
0 commit comments