@@ -363,22 +363,20 @@ type JSONSuggestedFix struct {
363
363
}
364
364
365
365
// A JSONDiagnostic describes the JSON schema of an analysis.Diagnostic.
366
- //
367
- // TODO(matloob): include End position if present.
368
366
type JSONDiagnostic struct {
369
367
Category string `json:"category,omitempty"`
370
368
Posn string `json:"posn"` // e.g. "file.go:line:column"
369
+ EndPosn string `json:"end_posn,omitempty"`
371
370
Message string `json:"message"`
372
371
SuggestedFixes []JSONSuggestedFix `json:"suggested_fixes,omitempty"`
373
372
Related []JSONRelatedInformation `json:"related,omitempty"`
374
373
}
375
374
376
375
// A JSONRelated describes a secondary position and message related to
377
376
// a primary diagnostic.
378
- //
379
- // TODO(adonovan): include End position if present.
380
377
type JSONRelatedInformation struct {
381
378
Posn string `json:"posn"` // e.g. "file.go:line:column"
379
+ EndPosn string `json:"end_posn,omitempty"`
382
380
Message string `json:"message"`
383
381
}
384
382
@@ -414,12 +412,14 @@ func (tree JSONTree) Add(fset *token.FileSet, id, name string, diags []analysis.
414
412
for _ , r := range f .Related {
415
413
related = append (related , JSONRelatedInformation {
416
414
Posn : fset .Position (r .Pos ).String (),
415
+ EndPosn : fset .Position (r .End ).String (),
417
416
Message : r .Message ,
418
417
})
419
418
}
420
419
jdiag := JSONDiagnostic {
421
420
Category : f .Category ,
422
421
Posn : fset .Position (f .Pos ).String (),
422
+ EndPosn : fset .Position (f .End ).String (),
423
423
Message : f .Message ,
424
424
SuggestedFixes : fixes ,
425
425
Related : related ,
0 commit comments