diff --git a/internal/adapter/yamlls/completion.go b/internal/adapter/yamlls/completion.go index bb173913..b3459259 100644 --- a/internal/adapter/yamlls/completion.go +++ b/internal/adapter/yamlls/completion.go @@ -6,7 +6,7 @@ import ( lsp "go.lsp.dev/protocol" ) -func (yamllsConnector *Connector) CallCompletion(ctx context.Context, params *lsp.CompletionParams) (*lsp.CompletionList, error) { +func (yamllsConnector Connector) CallCompletion(ctx context.Context, params *lsp.CompletionParams) (*lsp.CompletionList, error) { if yamllsConnector.server == nil { return &lsp.CompletionList{}, nil } diff --git a/internal/adapter/yamlls/hover_integration_test.go b/internal/adapter/yamlls/hover_integration_test.go index 82d27a3f..b00f2ba6 100644 --- a/internal/adapter/yamlls/hover_integration_test.go +++ b/internal/adapter/yamlls/hover_integration_test.go @@ -73,7 +73,7 @@ func TestYamllsHoverIntegration(t *testing.T) { }, }, tt.word) return err == nil && strings.Contains(result.Contents.Value, tt.expected) - }, time.Second*60, time.Second*5) + }, time.Second*10, time.Second*2) }) } } diff --git a/internal/charts/chart.go b/internal/charts/chart.go index 4e4f16b4..2ca97c9f 100644 --- a/internal/charts/chart.go +++ b/internal/charts/chart.go @@ -60,8 +60,9 @@ func (c *Chart) ResolveValueFiles(query []string, chartStore *ChartStore) []*Que } func (c *Chart) GetValueLocation(templateContext []string) (lsp.Location, error) { - modifyedVar := make([]string, 0) - // for Charts, we make the first letter lowercase + modifyedVar := make([]string, len(templateContext)) + // make the first letter lowercase since in the template the first letter is + // capitalized, but it is not in the Chart.yaml file for _, value := range templateContext { restOfString := "" if (len(value)) > 1 { diff --git a/internal/handler/generic_document_usecase.go b/internal/handler/generic_document_usecase.go index c3a88536..14e1ec61 100644 --- a/internal/handler/generic_document_usecase.go +++ b/internal/handler/generic_document_usecase.go @@ -27,11 +27,10 @@ func (h *langHandler) NewGenericDocumentUseCase( } var ( - parentNodeType string nodeType = node.Type() parentNode = node.Parent() + parentNodeType string ) - if parentNode != nil { parentNodeType = parentNode.Type() } diff --git a/internal/util/yaml_path.go b/internal/util/yaml_path.go deleted file mode 100644 index d07c4e84..00000000 --- a/internal/util/yaml_path.go +++ /dev/null @@ -1,59 +0,0 @@ -package util - -import ( - "fmt" - "strings" -) - -type YamlPath struct { - TableNames []string -} - -func NewYamlPath(yamlPathString string) (YamlPath, error) { - var ( - splitted = strings.Split(yamlPathString, ".") - variableSplitted = []string{} - ) - - // filter out empty strings, that were added by the split - for _, s := range splitted { - if s != "" { - variableSplitted = append(variableSplitted, s) - } - } - if len(variableSplitted) == 0 { - return YamlPath{}, fmt.Errorf("Could not parse yaml path: %s", yamlPathString) - } - // $ always points to the root context so we can safely remove it - // as long the LSP does not know about ranges - if variableSplitted[0] == "$" && len(variableSplitted) > 1 { - variableSplitted = variableSplitted[1:] - } - - return YamlPath{ - TableNames: variableSplitted, - }, nil -} - -func (path YamlPath) GetTail() []string { - return path.TableNames[1:] -} - -func (path YamlPath) IsValuesPath() bool { - return path.TableNames[0] == "Values" -} - -func (path YamlPath) IsChartPath() bool { - return path.TableNames[0] == "Chart" -} - -func (path YamlPath) IsReleasePath() bool { - return path.TableNames[0] == "Release" -} - -func (path YamlPath) IsFilesPath() bool { - return path.TableNames[0] == "Files" -} -func (path YamlPath) IsCapabilitiesPath() bool { - return path.TableNames[0] == "Capabilities" -}