@@ -175,6 +175,9 @@ interface Settings {
175
175
hover : boolean ;
176
176
completion : boolean ;
177
177
customTags : Array < String > ;
178
+ schemaStore : {
179
+ enable : boolean
180
+ }
178
181
} ;
179
182
http : {
180
183
proxy : string ;
@@ -203,6 +206,7 @@ let yamlShouldHover = true;
203
206
let yamlShouldCompletion = true ;
204
207
let schemaStoreSettings = [ ] ;
205
208
let customTags = [ ] ;
209
+ let schemaStoreEnabled = true ;
206
210
207
211
connection . onDidChangeConfiguration ( ( change ) => {
208
212
var settings = < Settings > change . settings ;
@@ -215,6 +219,9 @@ connection.onDidChangeConfiguration((change) => {
215
219
yamlShouldHover = settings . yaml . hover ;
216
220
yamlShouldCompletion = settings . yaml . completion ;
217
221
customTags = settings . yaml . customTags ? settings . yaml . customTags : [ ] ;
222
+ if ( settings . yaml . schemaStore ) {
223
+ schemaStoreEnabled = settings . yaml . schemaStore . enable ;
224
+ }
218
225
if ( settings . yaml . format ) {
219
226
yamlFormatterSettings = {
220
227
singleQuote : settings . yaml . format . singleQuote || false ,
@@ -241,12 +248,21 @@ connection.onDidChangeConfiguration((change) => {
241
248
updateConfiguration ( ) ;
242
249
} ) ;
243
250
244
- function setSchemaStoreSettingsIfNotSet ( ) {
245
- if ( schemaStoreSettings . length === 0 ) {
251
+ /**
252
+ * This function helps set the schema store if it hasn't already been set
253
+ * AND the schema store setting is enabled. If the schema store setting
254
+ * is not enabled we need to clear the schemas.
255
+ */
256
+ function setSchemaStoreSettingsIfNotSet ( ) {
257
+ const schemaStoreIsSet = ( schemaStoreSettings . length !== 0 ) ;
258
+ if ( schemaStoreEnabled && ! schemaStoreIsSet ) {
246
259
getSchemaStoreMatchingSchemas ( ) . then ( schemaStore => {
247
260
schemaStoreSettings = schemaStore . schemas ;
248
261
updateConfiguration ( ) ;
249
262
} ) ;
263
+ } else if ( ! schemaStoreEnabled ) {
264
+ schemaStoreSettings = [ ] ;
265
+ updateConfiguration ( ) ;
250
266
}
251
267
}
252
268
0 commit comments