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

Method GetSyntacticDiagnostics

internal/compiler/program.go:604–615  ·  view source on GitHub ↗
(ctx context.Context, sourceFile *ast.SourceFile)

Source from the content-addressed store, hash-verified

602}
603
604func (p *Program) GetSyntacticDiagnostics(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic {
605 return p.collectDiagnostics(ctx, sourceFile, false /*concurrent*/, func(_ context.Context, file *ast.SourceFile) []*ast.Diagnostic {
606 diags := core.Concatenate(file.Diagnostics(), file.JSDiagnostics())
607 // For JS files that won't be checked by the checker (no checkJs/ts-check), we need
608 // program-level syntactic checks that require compiler options. This mirrors Strada's
609 // getJSSyntacticDiagnosticsForFile in program.ts.
610 if ast.IsSourceFileJS(file) && !ast.IsCheckJSEnabledForFile(file, p.Options()) {
611 diags = append(diags, getAdditionalJSSyntacticDiagnostics(file, p.Options())...)
612 }
613 return diags
614 })
615}
616
617// getAdditionalJSSyntacticDiagnostics produces option-dependent syntactic diagnostics for JS files
618// that aren't covered by the parser or the checker. In Strada, the equivalent logic lives in

Callers

nothing calls this directly

Calls 9

collectDiagnosticsMethod · 0.95
OptionsMethod · 0.95
ConcatenateFunction · 0.92
IsSourceFileJSFunction · 0.92
IsCheckJSEnabledForFileFunction · 0.92
DiagnosticsMethod · 0.80
JSDiagnosticsMethod · 0.80
appendFunction · 0.50

Tested by

no test coverage detected