@@ -175,6 +175,9 @@ interface Settings {
175175 hover : boolean ;
176176 completion : boolean ;
177177 customTags : Array < String > ;
178+ schemaStore : {
179+ enable : boolean
180+ }
178181 } ;
179182 http : {
180183 proxy : string ;
@@ -203,6 +206,7 @@ let yamlShouldHover = true;
203206let yamlShouldCompletion = true ;
204207let schemaStoreSettings = [ ] ;
205208let customTags = [ ] ;
209+ let schemaStoreEnabled = true ;
206210
207211connection . onDidChangeConfiguration ( ( change ) => {
208212 var settings = < Settings > change . settings ;
@@ -215,6 +219,9 @@ connection.onDidChangeConfiguration((change) => {
215219 yamlShouldHover = settings . yaml . hover ;
216220 yamlShouldCompletion = settings . yaml . completion ;
217221 customTags = settings . yaml . customTags ? settings . yaml . customTags : [ ] ;
222+ if ( settings . yaml . schemaStore ) {
223+ schemaStoreEnabled = settings . yaml . schemaStore . enable ;
224+ }
218225 if ( settings . yaml . format ) {
219226 yamlFormatterSettings = {
220227 singleQuote : settings . yaml . format . singleQuote || false ,
@@ -241,12 +248,21 @@ connection.onDidChangeConfiguration((change) => {
241248 updateConfiguration ( ) ;
242249} ) ;
243250
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 ) {
246259 getSchemaStoreMatchingSchemas ( ) . then ( schemaStore => {
247260 schemaStoreSettings = schemaStore . schemas ;
248261 updateConfiguration ( ) ;
249262 } ) ;
263+ } else if ( ! schemaStoreEnabled ) {
264+ schemaStoreSettings = [ ] ;
265+ updateConfiguration ( ) ;
250266 }
251267}
252268
0 commit comments