formatter

package
v0.0.0-...-86b0a68 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Tokens []string

	TokenIDs = map[int]string{
				// contains filtered or unexported fields
	}
)

Functions

func Format

func Format(c Config, b []byte, w io.Writer) error

func StatementLength

func StatementLength(c *Config, st statement, p printer) (uint8, error)

Types

type Alignment

type Alignment struct {
	Table AlignmentTable `mapstructure:"table"`
}

type AlignmentTable

type AlignmentTable struct {
	// KeyValue = true
	// t = {
	//     key1   = value1,
	//     key10  = value10,
	//     key100 = value100,
	// }
	KeyValuePairs bool `mapstructure:"key-value-pairs"`

	// Comments = true
	// t = {
	//     key1 = value1,     -- comment
	//     key10 = value10,   -- comment
	//     key100 = value100, -- comment
	// }
	Comments bool `mapstructure:"comments"`
}

AlignmentTable formatting tables in code

type Around

type Around struct {
	UnaryOperator          bool
	MultiplicativeOperator bool
}

type Config

type Config struct {
	IndentSize    uint8 `mapstructure:"indent-size"`
	MaxLineLength uint8 `mapstructure:"max-line-length"`

	Highlight bool

	Spaces    Spaces
	Alignment Alignment `mapstructure:"alignment"`
}

func DefaultConfig

func DefaultConfig() Config

type Spaces

type Spaces struct {
	Around Around
}

Jump to

Keyboard shortcuts

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