@@ -16,22 +16,16 @@ import * as URL from 'url';
1616import { removeDuplicatesObj } from './languageservice/utils/arrUtils' ;
1717import { getLanguageService as getCustomLanguageService , LanguageSettings , CustomFormatterOptions , WorkspaceContextService } from './languageservice/yamlLanguageService' ;
1818import * as nls from 'vscode-nls' ;
19- import { CustomSchemaProvider , FilePatternAssociation } from './languageservice/services/yamlSchemaService' ;
19+ import { CustomSchemaProvider , FilePatternAssociation , SchemaDeletions , SchemaAdditions , MODIFICATION_ACTIONS } from './languageservice/services/yamlSchemaService' ;
2020import { JSONSchema } from './languageservice/jsonSchema04' ;
21- import { SchemaAssociationNotification , DynamicCustomSchemaRequestRegistration , CustomSchemaRequest } from './requestTypes' ;
21+ import { SchemaAssociationNotification , DynamicCustomSchemaRequestRegistration , CustomSchemaRequest , SchemaModificationNotification } from './requestTypes' ;
2222import { schemaRequestHandler } from './languageservice/services/schemaRequestHandler' ;
2323import { isRelativePath , relativeToAbsolutePath } from './languageservice/utils/paths' ;
2424import { URI } from 'vscode-uri' ;
2525import { KUBERNETES_SCHEMA_URL , JSON_SCHEMASTORE_URL } from './languageservice/utils/schemaUrls' ;
2626// tslint:disable-next-line: no-any
2727nls . config ( process . env [ 'VSCODE_NLS_CONFIG' ] as any ) ;
2828
29- /****************
30- * Constants
31- ****************/
32- const KUBERNETES_SCHEMA_URL = 'https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.17.0-standalone-strict/all.json' ;
33- const JSON_SCHEMASTORE_URL = 'http://schemastore.org/api/json/catalog.json' ;
34-
3529/**************************
3630 * Generic helper functions
3731 **************************/
@@ -570,5 +564,14 @@ connection.onDocumentFormatting(formatParams => {
570564 return customLanguageService . doFormat ( document , customFormatterSettings ) ;
571565} ) ;
572566
567+ connection . onRequest ( SchemaModificationNotification . type , ( modifications : SchemaAdditions | SchemaDeletions ) => {
568+ if ( modifications . action === MODIFICATION_ACTIONS . add ) {
569+ customLanguageService . modifySchemaContent ( modifications ) ;
570+ } else if ( modifications . action === MODIFICATION_ACTIONS . delete ) {
571+ customLanguageService . deleteSchemaContent ( modifications ) ;
572+ }
573+ return Promise . resolve ( ) ;
574+ } ) ;
575+
573576// Start listening for any messages from the client
574577connection . listen ( ) ;
0 commit comments