File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed
Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ import * as l10n from '@vscode/l10n';
1010export const schemaContributions : ISchemaContributions = {
1111 schemaAssociations : [ ] ,
1212 schemas : {
13- // refer to the latest schema
14- 'http://json-schema.org/schema#' : {
15- $ref : 'http://json-schema.org/draft-07/schema#'
16- } ,
1713 // bundle the schema-schema to include (localized) descriptions
1814 'http://json-schema.org/draft-04/schema#' : {
1915 '$schema' : 'http://json-schema.org/draft-04/schema#' ,
Original file line number Diff line number Diff line change @@ -733,13 +733,18 @@ export class JSONCompletion {
733733
734734 private addDollarSchemaCompletions ( separatorAfter : string , collector : CompletionsCollector ) : void {
735735 const schemaIds = this . schemaService . getRegisteredSchemaIds ( schema => schema === 'http' || schema === 'https' ) ;
736- schemaIds . forEach ( schemaId => collector . add ( {
737- kind : CompletionItemKind . Module ,
738- label : this . getLabelForValue ( schemaId ) ,
739- filterText : this . getFilterTextForValue ( schemaId ) ,
740- insertText : this . getInsertTextForValue ( schemaId , separatorAfter ) ,
741- insertTextFormat : InsertTextFormat . Snippet , documentation : ''
742- } ) ) ;
736+ schemaIds . forEach ( schemaId => {
737+ if ( schemaId . startsWith ( 'http://json-schema.org/draft-' ) ) {
738+ schemaId = schemaId + '#' ;
739+ }
740+ collector . add ( {
741+ kind : CompletionItemKind . Module ,
742+ label : this . getLabelForValue ( schemaId ) ,
743+ filterText : this . getFilterTextForValue ( schemaId ) ,
744+ insertText : this . getInsertTextForValue ( schemaId , separatorAfter ) ,
745+ insertTextFormat : InsertTextFormat . Snippet , documentation : ''
746+ } ) ;
747+ } ) ;
743748 }
744749
745750 private getLabelForValue ( value : any ) : string {
Original file line number Diff line number Diff line change @@ -1078,7 +1078,9 @@ suite('JSON Completion', () => {
10781078 } ) ;
10791079 await testCompletionsFor ( '{ "$schema": | }' , schema , {
10801080 items : [
1081- { label : '"http://myschemastore/test1"' , resultText : '{ "$schema": "http://myschemastore/test1" }' }
1081+ { label : '"http://myschemastore/test1"' , resultText : '{ "$schema": "http://myschemastore/test1" }' } ,
1082+ { label : '"http://json-schema.org/draft-04/schema#"' , resultText : '{ "$schema": "http://json-schema.org/draft-04/schema#" }' } ,
1083+ { label : '"http://json-schema.org/draft-07/schema#"' , resultText : '{ "$schema": "http://json-schema.org/draft-07/schema#" }' }
10821084 ]
10831085 } ) ;
10841086 await testCompletionsFor ( '{ "$schema": "|' , schema , {
You can’t perform that action at this time.
0 commit comments