@@ -175,3 +175,47 @@ export function asParameterInformation(parameterInformation: vscode.ParameterInf
175
175
documentation : parameterInformation . documentation ,
176
176
} ;
177
177
}
178
+
179
+ export function asMarkerData ( diagnostic : vscode . Diagnostic ) : monaco . editor . IMarkerData {
180
+ return {
181
+ code : diagnostic . code ?. toString ( ) ,
182
+ severity : asMarkerSeverity ( diagnostic . severity ) ,
183
+ message : diagnostic . message ,
184
+ source : diagnostic . source ,
185
+ ...asRange ( diagnostic . range ) ,
186
+ relatedInformation : diagnostic . relatedInformation ?. map ( asRelatedInformation ) ,
187
+ tags : diagnostic . tags ?. map ( asMarkerTag ) ,
188
+ } ;
189
+ }
190
+
191
+ export function asMarkerTag ( tag : vscode . DiagnosticTag ) : monaco . MarkerTag {
192
+ switch ( tag ) {
193
+ case vscode . DiagnosticTag . Unnecessary :
194
+ return monaco . MarkerTag . Unnecessary ;
195
+ case vscode . DiagnosticTag . Deprecated :
196
+ return monaco . MarkerTag . Deprecated ;
197
+ }
198
+ }
199
+
200
+ export function asRelatedInformation ( relatedInformation : vscode . DiagnosticRelatedInformation ) : monaco . editor . IRelatedInformation {
201
+ return {
202
+ resource : asUri ( relatedInformation . location . uri ) ,
203
+ message : relatedInformation . message ,
204
+ ...asRange ( relatedInformation . location . range ) ,
205
+ } ;
206
+ }
207
+
208
+ export function asMarkerSeverity ( severity : vscode . DiagnosticSeverity | undefined ) : monaco . MarkerSeverity {
209
+ switch ( severity ) {
210
+ case vscode . DiagnosticSeverity . Error :
211
+ return monaco . MarkerSeverity . Error ;
212
+ case vscode . DiagnosticSeverity . Warning :
213
+ return monaco . MarkerSeverity . Warning ;
214
+ case vscode . DiagnosticSeverity . Information :
215
+ return monaco . MarkerSeverity . Info ;
216
+ case vscode . DiagnosticSeverity . Hint :
217
+ return monaco . MarkerSeverity . Hint ;
218
+ default :
219
+ return monaco . MarkerSeverity . Info ;
220
+ }
221
+ }
0 commit comments