MCPcopy Create free account
hub / github.com/bytebase/bytebase / ConvertSyntaxErrorToDiagnostic

Function ConvertSyntaxErrorToDiagnostic

backend/plugin/parser/base/diagnose.go:69–88  ·  view source on GitHub ↗
(err *SyntaxError, statement string)

Source from the content-addressed store, hash-verified

67}
68
69func ConvertSyntaxErrorToDiagnostic(err *SyntaxError, statement string) Diagnostic {
70 start := *convertPositionToUTF16Position(err.Position, statement)
71 end := start
72 end.Character++
73 message := err.Message
74 if err.RawMessage != "" {
75 // Use RawMessage which created by antlr runtime, do not need our fine-tuned message
76 // because we had indicated the error position in the message.
77 message = err.RawMessage
78 }
79 return Diagnostic{
80 Range: lsp.Range{
81 Start: start,
82 End: end,
83 },
84 Severity: lsp.SeverityError,
85 Source: "Syntax check",
86 Message: message,
87 }
88}

Callers 13

DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92
DiagnoseFunction · 0.92

Calls 1

Tested by

no test coverage detected