@@ -184,6 +184,7 @@ interface Settings {
184184 hover : boolean ;
185185 completion : boolean ;
186186 customTags : Array < String > ;
187+ schemaStore : boolean ;
187188 } ;
188189 http : {
189190 proxy : string ;
@@ -212,6 +213,7 @@ let yamlShouldHover = true;
212213let yamlShouldCompletion = true ;
213214let schemaStoreSettings = [ ] ;
214215let customTags = [ ] ;
216+ let schemaStoreEnabled = true ;
215217
216218connection . onDidChangeConfiguration ( ( change ) => {
217219 var settings = < Settings > change . settings ;
@@ -224,6 +226,7 @@ connection.onDidChangeConfiguration((change) => {
224226 yamlShouldHover = settings . yaml . hover ;
225227 yamlShouldCompletion = settings . yaml . completion ;
226228 customTags = settings . yaml . customTags ? settings . yaml . customTags : [ ] ;
229+ schemaStoreEnabled = settings . yaml . schemaStore ;
227230 if ( settings . yaml . format ) {
228231 yamlFormatterSettings = {
229232 singleQuote : settings . yaml . format . singleQuote || false ,
@@ -263,12 +266,21 @@ connection.onDidChangeConfiguration((change) => {
263266 }
264267} ) ;
265268
266- function setSchemaStoreSettingsIfNotSet ( ) {
267- if ( schemaStoreSettings . length === 0 ) {
269+ /**
270+ * This function helps set the schema store if it hasn't already been set
271+ * AND the schema store setting is enabled. If the schema store setting
272+ * is not enabled we need to clear the schemas.
273+ */
274+ function setSchemaStoreSettingsIfNotSet ( ) {
275+ const schemaStoreIsSet = ( schemaStoreSettings . length !== 0 ) ;
276+ if ( schemaStoreEnabled && ! schemaStoreIsSet ) {
268277 getSchemaStoreMatchingSchemas ( ) . then ( schemaStore => {
269278 schemaStoreSettings = schemaStore . schemas ;
270279 updateConfiguration ( ) ;
271280 } ) ;
281+ } else if ( ! schemaStoreEnabled ) {
282+ schemaStoreSettings = [ ] ;
283+ updateConfiguration ( ) ;
272284 }
273285}
274286
0 commit comments