util

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = HelmlsConfiguration{
	LogLevel: "info",
	ValuesFilesConfig: ValuesFilesConfig{
		MainValuesFileName:               "values.yaml",
		LintOverlayValuesFileName:        "values.lint.yaml",
		AdditionalValuesFilesGlobPattern: "values*.yaml",
	},
	HelmLintConfig: HelmLintConfig{
		Enabled:         true,
		IgnoredMessages: []string{},
	},
	YamllsConfiguration: YamllsConfiguration{
		Enabled:                   true,
		EnabledForFilesGlob:       "*.{yaml,yml}",
		EnabledForFilesGlobObject: glob.MustCompile("*.{yaml,yml}"),
		Path:                      "yaml-language-server",
		InitTimeoutSeconds:        3,
		DiagnosticsEnabled:        true,
		DiagnosticsLimit:          50,
		ShowDiagnosticsDirectly:   false,
		YamllsSettings:            DefaultYamllsSettings,
	},
}
View Source
var DefaultYamllsSettings = YamllsSettings{
	Schemas:    map[string]string{"kubernetes": "templates/**"},
	Completion: true,
	Hover:      true,
	YamllsSchemaStoreSettings: YamllsSchemaStoreSettings{
		Enable: true,
		URL:    "https://www.schemastore.org/api/json/catalog.json",
	},
}

Functions

func AfterStrings

func AfterStrings(value string, a string) string

AfterStrings gets the substring after a string.

func BetweenStrings

func BetweenStrings(value string, a string, b string) string

BetweenStrings gets the substring between two strings.

func FormatToYAML added in v0.0.16

func FormatToYAML(field reflect.Value, fieldName string) string

func GetBoolType added in v0.0.16

func GetBoolType(value interface{}) string

func GetNodeForPosition added in v0.3.0

func GetNodeForPosition(node *yamlv3.Node, position lsp.Position) *yamlv3.Node

func GetPositionOfNode added in v0.0.6

func GetPositionOfNode(node *yamlv3.Node, query []string) (lsp.Position, error)

func GetSubValuesForSelector added in v0.3.0

func GetSubValuesForSelector(values chartutil.Values, selector []string) (map[string]any, error)

func GetTableOrValueForSelector added in v0.0.16

func GetTableOrValueForSelector(values chartutil.Values, selector []string) (string, error)

func GetValueCompletion added in v0.0.16

func GetValueCompletion(values chartutil.Values, splittedVar []string) []lsp.CompletionItem

func IndexToPosition added in v0.0.8

func IndexToPosition(index int, content []byte) protocol.Position

func PointToPosition added in v0.0.6

func PointToPosition(point sitter.Point) lsp.Position

func PositionToIndex added in v0.0.8

func PositionToIndex(pos protocol.Position, content []byte) int

func PositionToPoint added in v0.0.6

func PositionToPoint(position lsp.Position) sitter.Point

func RangeContainsRange added in v0.0.18

func RangeContainsRange(surrounding, including sitter.Range) bool

func RangeToLocation added in v0.0.16

func RangeToLocation(URI uri.URI, range_ sitter.Range) lsp.Location

func RangesToLocations added in v0.3.0

func RangesToLocations(URI uri.URI, ranges []sitter.Range) (locations []lsp.Location)

func ReadYamlToNode added in v0.1.0

func ReadYamlToNode(data []byte) (node yamlv3.Node, err error)

ReadYamlToNode will parse a YAML file into a yaml Node.

func RemoveQuotes added in v0.0.16

func RemoveQuotes(s string) string

func WordAt

func WordAt(str string, index int) string

WordAt returns the word found at the given character position. Credit https://github.com/aca/neuron-language-server/blob/450a7cff71c14e291ee85ff8a0614fa9d4dd5145/utils.go#L13

Types

type ErrEmpytArray added in v0.0.17

type ErrEmpytArray struct {
	Key string
}

func (ErrEmpytArray) Error added in v0.0.17

func (e ErrEmpytArray) Error() string

type ErrEmpytMapping added in v0.0.18

type ErrEmpytMapping struct {
	Key string
}

func (ErrEmpytMapping) Error added in v0.0.18

func (e ErrEmpytMapping) Error() string

type HelmLintConfig added in v0.4.0

type HelmLintConfig struct {
	Enabled         bool     `json:"enabled,omitempty"`
	IgnoredMessages []string `json:"ignoredMessages,omitempty"`
}

type HelmlsConfiguration added in v0.0.8

type HelmlsConfiguration struct {
	YamllsConfiguration YamllsConfiguration `json:"yamlls,omitempty"`
	ValuesFilesConfig   ValuesFilesConfig   `json:"valuesFiles,omitempty"`
	HelmLintConfig      HelmLintConfig      `json:"helmLint,omitempty"`
	LogLevel            string              `json:"logLevel,omitempty"`
}

type ValuesFilesConfig added in v0.0.10

type ValuesFilesConfig struct {
	MainValuesFileName               string `json:"mainValuesFile,omitempty"`
	LintOverlayValuesFileName        string `json:"lintOverlayValuesFile,omitempty"`
	AdditionalValuesFilesGlobPattern string `json:"additionalValuesFilesGlobPattern,omitempty"`
}

type YamllsConfiguration added in v0.0.8

type YamllsConfiguration struct {
	Enabled                   bool   `json:"enabled,omitempty"`
	EnabledForFilesGlob       string `json:"enabledForFilesGlob,omitempty"`
	EnabledForFilesGlobObject glob.Glob
	Path                      string `json:"path,omitempty"`
	InitTimeoutSeconds        int    `json:"initTimeoutSeconds,omitempty"`
	DiagnosticsEnabled        bool   `json:"diagnosticsEnabled,omitempty"`
	// max diagnostics from yamlls that are shown for a single file
	DiagnosticsLimit int `json:"diagnosticsLimit,omitempty"`
	// if set to false diagnostics will only be shown after saving the file
	// otherwise writing a template will cause a lot of diagnostics to be shown because
	// the structure of the document is broken during typing
	ShowDiagnosticsDirectly bool `json:"showDiagnosticsDirectly,omitempty"`
	YamllsSettings          any  `json:"config,omitempty"`
}

func (*YamllsConfiguration) CompileEnabledForFilesGlobObject added in v0.3.0

func (y *YamllsConfiguration) CompileEnabledForFilesGlobObject()

type YamllsSchemaStoreSettings added in v0.0.11

type YamllsSchemaStoreSettings struct {
	Enable bool   `json:"enable"`
	URL    string `json:"url"`
}

type YamllsSettings added in v0.0.8

type YamllsSettings struct {
	Schemas                   map[string]string         `json:"schemas"`
	Completion                bool                      `json:"completion"`
	Hover                     bool                      `json:"hover"`
	YamllsSchemaStoreSettings YamllsSchemaStoreSettings `json:"schemaStore"`
}

Jump to

Keyboard shortcuts

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