MCPcopy Create free account
hub / github.com/microsoft/typescript-go / ProvideDiagnostics

Method ProvideDiagnostics

internal/ls/diagnostics.go:25–44  ·  view source on GitHub ↗
(ctx context.Context, uri lsproto.DocumentUri)

Source from the content-addressed store, hash-verified

23}
24
25func (l *LanguageService) ProvideDiagnostics(ctx context.Context, uri lsproto.DocumentUri) (lsproto.DocumentDiagnosticResponse, error) {
26 program, file := l.getProgramAndFile(uri)
27
28 if l.UserPreferences().EnableValidation.IsFalse() {
29 diagnostics := []*lsproto.Diagnostic{}
30 return lsproto.RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport{
31 FullDocumentDiagnosticReport: &lsproto.RelatedFullDocumentDiagnosticReport{
32 Items: diagnostics,
33 },
34 }, nil
35 }
36
37 diagnostics := getAllDiagnostics(ctx, program, file)
38
39 return lsproto.RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport{
40 FullDocumentDiagnosticReport: &lsproto.RelatedFullDocumentDiagnosticReport{
41 Items: l.toLSPDiagnostics(ctx, diagnostics),
42 },
43 }, nil
44}
45
46func (l *LanguageService) toLSPDiagnostics(ctx context.Context, diagnostics ...[]*ast.Diagnostic) []*lsproto.Diagnostic {
47 size := 0

Callers 2

TestPushDiagnosticsFunction · 0.80

Calls 5

getProgramAndFileMethod · 0.95
UserPreferencesMethod · 0.95
toLSPDiagnosticsMethod · 0.95
getAllDiagnosticsFunction · 0.85
IsFalseMethod · 0.80

Tested by 1

TestPushDiagnosticsFunction · 0.64