format

package
v0.5.43 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(src []byte) ([]byte, error)

func FormatSafe

func FormatSafe(src []byte, opts Options) []byte

func FormatWithOptions

func FormatWithOptions(src []byte, opts Options) ([]byte, error)

Types

type ArrayValue

type ArrayValue struct {
	Items []Value
}

type Comment

type Comment struct {
	Text        string
	Kind        CommentKind
	BlankBefore int
}

type CommentKind

type CommentKind uint8
const (
	LineComment CommentKind = iota
	BlockComment
)

type Document

type Document struct {
	Nodes []Node
}

func ParseDocument

func ParseDocument(src string) (*Document, error)

type Import

type Import struct {
	Spec        string
	BlankBefore int
	Trailing    string
}

Import is a top-level `import QtQuick 2.0` / `import "path"` statement. It is passed through verbatim.

type Node

type Node interface {
	// contains filtered or unexported methods
}

type Object

type Object struct {
	Type        string
	Body        []Node
	Inline      bool
	BlankBefore int
	Trailing    string
}

type ObjectValue

type ObjectValue struct {
	Type   string
	Body   []Node
	Inline bool
}

type Options

type Options struct {
	Indent          int
	MaxInlineLength int
}

func DefaultOptions

func DefaultOptions() Options

func ProjectOptions

func ProjectOptions() Options

ProjectOptions is the formatting style used by this repository's QML files (see examples/enterprise): two-space indent and a 100-column inline budget. cmd/tools/qmlfmt exposes the same values as --indent and --max-line; tests use them directly.

type Property

type Property struct {
	Name        string
	Value       Value
	Semicolon   bool
	Comma       bool
	BlankBefore int
	Trailing    string
}

type RawValue

type RawValue struct {
	Text string
}

type Value

type Value interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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