@@ -26,6 +26,7 @@ import { parse } from 'yaml';
2626import * as path from 'path' ;
2727import { getSchemaFromModeline } from './modelineUtil' ;
2828import { JSONSchemaDescriptionExt } from '../../requestTypes' ;
29+ import { SchemaVersions } from '../yamlTypes' ;
2930
3031const localize = nls . loadMessageBundle ( ) ;
3132
@@ -84,7 +85,11 @@ export class FilePatternAssociation {
8485 return this . schemas ;
8586 }
8687}
87-
88+ interface SchemaStoreSchema {
89+ name : string ;
90+ description : string ;
91+ versions ?: SchemaVersions ;
92+ }
8893export class YAMLSchemaService extends JSONSchemaService {
8994 // To allow to use schemasById from super.
9095 // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -96,7 +101,7 @@ export class YAMLSchemaService extends JSONSchemaService {
96101 private requestService : SchemaRequestService ;
97102 public schemaPriorityMapping : Map < string , Set < SchemaPriority > > ;
98103
99- private schemaUriToNameAndDescription = new Map < string , [ string , string ] > ( ) ;
104+ private schemaUriToNameAndDescription = new Map < string , SchemaStoreSchema > ( ) ;
100105
101106 constructor (
102107 requestService : SchemaRequestService ,
@@ -129,10 +134,11 @@ export class YAMLSchemaService extends JSONSchemaService {
129134 } ;
130135
131136 if ( this . schemaUriToNameAndDescription . has ( schemaUri ) ) {
132- const [ name , description ] = this . schemaUriToNameAndDescription . get ( schemaUri ) ;
137+ const { name, description, versions } = this . schemaUriToNameAndDescription . get ( schemaUri ) ;
133138 schemaHandle . name = name ;
134139 schemaHandle . description = description ;
135140 schemaHandle . fromStore = true ;
141+ schemaHandle . versions = versions ;
136142 }
137143 result . push ( schemaHandle ) ;
138144 }
@@ -653,9 +659,10 @@ export class YAMLSchemaService extends JSONSchemaService {
653659 }
654660 unresolvedJsonSchema . uri = schemaUri ;
655661 if ( this . schemaUriToNameAndDescription . has ( schemaUri ) ) {
656- const [ name , description ] = this . schemaUriToNameAndDescription . get ( schemaUri ) ;
662+ const { name, description, versions } = this . schemaUriToNameAndDescription . get ( schemaUri ) ;
657663 unresolvedJsonSchema . schema . title = name ?? unresolvedJsonSchema . schema . title ;
658664 unresolvedJsonSchema . schema . description = description ?? unresolvedJsonSchema . schema . description ;
665+ unresolvedJsonSchema . schema . versions = versions ?? unresolvedJsonSchema . schema . versions ;
659666 }
660667 return unresolvedJsonSchema ;
661668 } ) ;
@@ -666,10 +673,11 @@ export class YAMLSchemaService extends JSONSchemaService {
666673 filePatterns ?: string [ ] ,
667674 unresolvedSchema ?: JSONSchema ,
668675 name ?: string ,
669- description ?: string
676+ description ?: string ,
677+ versions ?: SchemaVersions
670678 ) : SchemaHandle {
671679 if ( name || description ) {
672- this . schemaUriToNameAndDescription . set ( uri , [ name , description ] ) ;
680+ this . schemaUriToNameAndDescription . set ( uri , { name, description, versions } ) ;
673681 }
674682 return super . registerExternalSchema ( uri , filePatterns , unresolvedSchema ) ;
675683 }
0 commit comments