@@ -72,23 +72,23 @@ export default {
72
72
textDocument = TextDocument . create ( uri , "json" , - 1 , instanceJson ) ;
73
73
}
74
74
75
- validateSchema ( textDocument ) ;
75
+ const schemaDocument = await getSchemaDocument ( connection , textDocument ) ;
76
+ validateSchema ( schemaDocument ) ;
76
77
}
77
78
78
79
reporter . done ( ) ;
79
80
} ) ;
80
81
81
- const validateSchema = async ( textDocument ) => {
82
- connection . console . log ( `Schema Validation: ${ textDocument . uri } ` ) ;
82
+ const validateSchema = async ( schemaDocument ) => {
83
+ connection . console . log ( `Schema Validation: ${ schemaDocument . textDocument . uri } ` ) ;
83
84
84
85
const diagnostics = [ ] ;
85
- const schemaDocument = await getSchemaDocument ( connection , textDocument ) ;
86
86
await publishAsync ( "diagnostics" , { schemaDocument, diagnostics } ) ;
87
87
88
88
connection . sendDiagnostics ( {
89
- uri : textDocument . uri ,
89
+ uri : schemaDocument . textDocument . uri ,
90
90
diagnostics : diagnostics . map ( ( { instance, message, severity, tags } ) => {
91
- return buildDiagnostic ( textDocument , instance , message , severity , tags ) ;
91
+ return buildDiagnostic ( schemaDocument . textDocument , instance , message , severity , tags ) ;
92
92
} )
93
93
} ) ;
94
94
} ;
@@ -137,7 +137,8 @@ export default {
137
137
const schemaFilePatterns = settings . schemaFilePatterns ;
138
138
const filePath = fileURLToPath ( document . uri ) ;
139
139
if ( isMatchedFile ( filePath , schemaFilePatterns ) ) {
140
- validateSchema ( document ) ;
140
+ const schemaDocument = await getSchemaDocument ( connection , document ) ;
141
+ validateSchema ( schemaDocument ) ;
141
142
}
142
143
} ) ;
143
144
0 commit comments