From c20d90f3c82309a883d63296b7e5728e57020339 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Sun, 28 Jul 2024 19:19:23 +0200 Subject: [PATCH] fix(yamlls): check if yamlls is enabled for symbol --- internal/adapter/yamlls/symbol.go | 2 +- internal/adapter/yamlls/symbol_integration_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/adapter/yamlls/symbol.go b/internal/adapter/yamlls/symbol.go index 3a3a0df..30a22d1 100644 --- a/internal/adapter/yamlls/symbol.go +++ b/internal/adapter/yamlls/symbol.go @@ -7,7 +7,7 @@ import ( ) func (yamllsConnector Connector) CallDocumentSymbol(ctx context.Context, params *lsp.DocumentSymbolParams) (result []interface{}, err error) { - if yamllsConnector.server == nil { + if !yamllsConnector.shouldRun(params.TextDocument.URI) { return []interface{}{}, nil } return yamllsConnector.server.DocumentSymbol(ctx, params) diff --git a/internal/adapter/yamlls/symbol_integration_test.go b/internal/adapter/yamlls/symbol_integration_test.go index f5040dc..ded8cd4 100644 --- a/internal/adapter/yamlls/symbol_integration_test.go +++ b/internal/adapter/yamlls/symbol_integration_test.go @@ -28,6 +28,10 @@ func TestYamllsDocumentSymoblIntegration(t *testing.T) { file: "../../../testdata/example/templates/ingress.yaml", expectedLen: 6, }, + { + file: "../../../testdata/example/templates/_helpers.tpl", + expectedLen: 0, + }, } for _, tt1 := range testCases { tt := tt1