diagnostics

package
v0.19.1237 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityError   = "error"
	SeverityWarning = "warning"
)

Variables

This section is empty.

Functions

func DetectSchemaType

func DetectSchemaType(text string) string

DetectSchemaType returns the schema type from the first comment line.

func DetectSchemaTypeForDocument

func DetectSchemaTypeForDocument(text, uri string) string

DetectSchemaTypeForDocument uses the leading comment, then branch.toml.

func ExtractRawValues

func ExtractRawValues(text string, doc *tomlparser.TomlDocument) map[string]any

extractRawValues extracts raw value strings from TOML text when strict parsing fails This allows type checking even for invalid TOML syntax like "terraform_version = 1.2.3"

func PropertyExists

func PropertyExists(doc *tomlparser.TomlDocument, tablePath []string, keyName string) bool

func ResolveSchema

func ResolveSchema(root *jsonschema.Schema, path []string, defs map[string]*jsonschema.Schema) *jsonschema.Schema

func TomlTypeOf

func TomlTypeOf(value any) string

func Values

func Values(text string, doc *tomlparser.TomlDocument) map[string]any

Values fills parsed values, falling back to raw text when strict parse fails.

Types

type Diagnostic

type Diagnostic struct {
	Severity  string
	Message   string
	StartLine int
	StartChar int
	EndLine   int
	EndChar   int
}

Diagnostic is a per-file schema finding. Line and character are zero-based, matching the TOML parser and the language server.

func Diagnose

func Diagnose(doc *tomlparser.TomlDocument, rootSchema *jsonschema.Schema) []Diagnostic

DiagnoseDocument generates diagnostics for a TOML document

func DiagnoseFile

func DiagnoseFile(filename, text string) []Diagnostic

DiagnoseFile runs the same per-file checks as the language server. A file with no schema comment returns no diagnostics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL