document

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTemplateDocumentLangID

func IsTemplateDocumentLangID(langID lsp.LanguageIdentifier) bool

func IsYamllsEnabled

func IsYamllsEnabled(uri lsp.URI, yamllsConfiguration util.YamllsConfiguration) bool

Types

type DiagnosticsCache

type DiagnosticsCache struct {
	YamlDiagnostics []lsp.Diagnostic
	HelmDiagnostics []lsp.Diagnostic
	// contains filtered or unexported fields
}

func NewDiagnosticsCache

func NewDiagnosticsCache(helmlsConfig util.HelmlsConfiguration) DiagnosticsCache

func (DiagnosticsCache) GetMergedDiagnostics

func (d DiagnosticsCache) GetMergedDiagnostics() (merged []lsp.Diagnostic)

func (*DiagnosticsCache) SetYamlDiagnostics

func (d *DiagnosticsCache) SetYamlDiagnostics(diagnostics []lsp.Diagnostic)

func (*DiagnosticsCache) ShouldShowDiagnosticsOnNewYamlDiagnostics

func (d *DiagnosticsCache) ShouldShowDiagnosticsOnNewYamlDiagnostics() bool

type Document

type Document struct {
	URI     lsp.DocumentURI
	Path    string
	Content []byte

	IsOpen bool
	// contains filtered or unexported fields
}

func NewDocument

func NewDocument(fileURI uri.URI, content []byte, isOpen bool) *Document

func (*Document) ApplyChanges

func (d *Document) ApplyChanges(changes []lsp.TextDocumentContentChangeEvent)

ApplyChanges updates the content of the document from LSP textDocument/didChange events.

func (*Document) GetContent

func (d *Document) GetContent() []byte

GetContent implements PossibleDependencyFile.

func (*Document) GetPath

func (d *Document) GetPath() string

GetPath implements PossibleDependencyFile.

func (*Document) WordAt

func (d *Document) WordAt(pos lsp.Position) string

WordAt returns the word found at the given location.

type DocumentInterface

type DocumentInterface interface {
	GetDocumentType() DocumentType
	ApplyChanges([]lsp.TextDocumentContentChangeEvent)
}

type DocumentStore

type DocumentStore struct {
	// contains filtered or unexported fields
}

documentStore holds opened documents.

func NewDocumentStore

func NewDocumentStore() *DocumentStore

func (*DocumentStore) DidOpenTemplateDocument

func (s *DocumentStore) DidOpenTemplateDocument(
	params *lsp.DidOpenTextDocumentParams, helmlsConfig util.HelmlsConfiguration,
) (*TemplateDocument, error)

func (*DocumentStore) DidOpenYamlDocument

func (s *DocumentStore) DidOpenYamlDocument(
	params *lsp.DidOpenTextDocumentParams, helmlsConfig util.HelmlsConfiguration,
) (*YamlDocument, error)

func (*DocumentStore) GetAllTemplateDocs

func (s *DocumentStore) GetAllTemplateDocs() []*TemplateDocument

func (*DocumentStore) GetAllYamlDocs

func (s *DocumentStore) GetAllYamlDocs() []*YamlDocument

func (*DocumentStore) GetDocumentType

func (s *DocumentStore) GetDocumentType(uri uri.URI) (DocumentType, bool)

func (*DocumentStore) GetSyncDocument

func (s *DocumentStore) GetSyncDocument(uri uri.URI) (DocumentInterface, bool)

func (*DocumentStore) GetTemplateDoc

func (s *DocumentStore) GetTemplateDoc(docuri uri.URI) (*TemplateDocument, bool)

func (*DocumentStore) GetYamlDoc

func (s *DocumentStore) GetYamlDoc(docuri uri.URI) (*YamlDocument, bool)

func (*DocumentStore) LoadDocsOnNewChart

func (s *DocumentStore) LoadDocsOnNewChart(chart *charts.Chart, helmlsConfig util.HelmlsConfiguration)

func (*DocumentStore) StoreTemplateDocument

func (s *DocumentStore) StoreTemplateDocument(path string, content []byte, helmlsConfig util.HelmlsConfiguration)

type DocumentType

type DocumentType string

Document represents an opened file.

const (
	TemplateDocumentType DocumentType = "helm"
	YamlDocumentType     DocumentType = "yaml"
)

func TemplateDocumentTypeForLangID

func TemplateDocumentTypeForLangID(langID lsp.LanguageIdentifier) DocumentType

type TemplateDocument

type TemplateDocument struct {
	Document
	NeedsRefreshDiagnostics bool
	Ast                     *sitter.Tree
	DiagnosticsCache        DiagnosticsCache
	SymbolTable             *symboltable.SymbolTable
	IsYaml                  bool
}

TemplateDocument represents an helm template file.

func NewTemplateDocument

func NewTemplateDocument(fileURI uri.URI, content []byte, isOpen bool, helmlsConfig util.HelmlsConfiguration) *TemplateDocument

func (*TemplateDocument) ApplyChanges

func (d *TemplateDocument) ApplyChanges(changes []lsp.TextDocumentContentChangeEvent)

ApplyChanges updates the content of the document from LSP textDocument/didChange events.

func (*TemplateDocument) ApplyChangesToAst

func (d *TemplateDocument) ApplyChangesToAst(newContent []byte)

func (*TemplateDocument) GetDocumentType

func (d *TemplateDocument) GetDocumentType() DocumentType

type TextDocument

type TextDocument interface {
	ApplyChanges([]lsp.TextDocumentContentChangeEvent)
}

type YamlDocument

type YamlDocument struct {
	Document
	Node       yaml.Node
	ParsedYaml map[string]any
	ParseErr   error
}

TemplateDocument represents an helm template file.

func NewYamlDocument

func NewYamlDocument(fileURI uri.URI, content []byte, isOpen bool, helmlsConfig util.HelmlsConfiguration) *YamlDocument

func (*YamlDocument) ApplyChanges

func (d *YamlDocument) ApplyChanges(changes []lsp.TextDocumentContentChangeEvent)

ApplyChanges updates the content of the document from LSP textDocument/didChange events.

func (*YamlDocument) GetDocumentType

func (d *YamlDocument) GetDocumentType() DocumentType

Jump to

Keyboard shortcuts

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