util

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 7 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",
	},
	YamllsConfiguration: YamllsConfiguration{
		Enabled:                 true,
		Path:                    "yaml-language-server",
		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 BuildHoverResponse added in v0.0.8

func BuildHoverResponse(value string, wordRange lsp.Range) *lsp.Hover

func ConcatMultipleSlices added in v0.0.4

func ConcatMultipleSlices[T any](slices [][]T) []T

func GetPositionOfNode added in v0.0.6

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

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 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 HelmlsConfiguration added in v0.0.8

type HelmlsConfiguration struct {
	YamllsConfiguration YamllsConfiguration `json:"yamlls,omitempty"`
	ValuesFilesConfig   ValuesFilesConfig   `json:"valuesFiles,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 YamlPath added in v0.0.6

type YamlPath struct {
	TableNames []string
}

func NewYamlPath added in v0.0.6

func NewYamlPath(yamlPathString string) (YamlPath, error)

func (YamlPath) GetTail added in v0.0.6

func (path YamlPath) GetTail() []string

func (YamlPath) IsCapabilitiesPath added in v0.0.6

func (path YamlPath) IsCapabilitiesPath() bool

func (YamlPath) IsChartPath added in v0.0.6

func (path YamlPath) IsChartPath() bool

func (YamlPath) IsFilesPath added in v0.0.6

func (path YamlPath) IsFilesPath() bool

func (YamlPath) IsReleasePath added in v0.0.6

func (path YamlPath) IsReleasePath() bool

func (YamlPath) IsValuesPath added in v0.0.6

func (path YamlPath) IsValuesPath() bool

type YamllsConfiguration added in v0.0.8

type YamllsConfiguration struct {
	Enabled bool   `json:"enabled,omitempty"`
	Path    string `json:"path,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          interface{} `json:"config,omitempty"`
}

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