-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
182 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package yamlhandler | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/mrjosh/helm-ls/internal/util" | ||
"go.lsp.dev/protocol" | ||
) | ||
|
||
// DidChange implements handler.LangHandler. | ||
func (h *YamlHandler) DidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) (err error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// DidOpen implements handler.LangHandler. | ||
func (h *YamlHandler) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams, helmlsConfig util.HelmlsConfiguration) (err error) { | ||
_, err = h.documents.DidOpenTemplateDocument(params, helmlsConfig) | ||
if err != nil { | ||
logger.Error(err) | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
// DidSave implements handler.LangHandler. | ||
func (h *YamlHandler) DidSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) (err error) { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package yamlhandler | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/mrjosh/helm-ls/internal/adapter/yamlls" | ||
"github.com/mrjosh/helm-ls/internal/charts" | ||
"github.com/mrjosh/helm-ls/internal/log" | ||
lsplocal "github.com/mrjosh/helm-ls/internal/lsp" | ||
"github.com/mrjosh/helm-ls/internal/util" | ||
"go.lsp.dev/protocol" | ||
"go.lsp.dev/uri" | ||
) | ||
|
||
var logger = log.GetLogger() | ||
|
||
type YamlHandler struct { | ||
documents *lsplocal.DocumentStore | ||
chartStore *charts.ChartStore | ||
yamllsConnector *yamlls.Connector | ||
} | ||
|
||
// Completion implements handler.LangHandler. | ||
func (h *YamlHandler) Completion(ctx context.Context, params *protocol.CompletionParams) (result *protocol.CompletionList, err error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// Configure implements handler.LangHandler. | ||
func (h *YamlHandler) Configure(ctx context.Context, helmlsConfig util.HelmlsConfiguration) {} | ||
|
||
// Definition implements handler.LangHandler. | ||
func (h *YamlHandler) Definition(ctx context.Context, params *protocol.DefinitionParams) (result []protocol.Location, err error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// DocumentSymbol implements handler.LangHandler. | ||
func (h *YamlHandler) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) (result []interface{}, err error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// GetDiagnostics implements handler.LangHandler. | ||
func (h *YamlHandler) GetDiagnostics(uri uri.URI) []protocol.PublishDiagnosticsParams { | ||
panic("unimplemented") | ||
} | ||
|
||
// Hover implements handler.LangHandler. | ||
func (h *YamlHandler) Hover(ctx context.Context, params *protocol.HoverParams) (result *protocol.Hover, err error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// References implements handler.LangHandler. | ||
func (h *YamlHandler) References(ctx context.Context, params *protocol.ReferenceParams) (result []protocol.Location, err error) { | ||
panic("unimplemented") | ||
} | ||
|
||
// SetClient implements handler.LangHandler. | ||
func (h *YamlHandler) SetClient(client protocol.Client) {} | ||
|
||
func NewYamlHandler(client protocol.Client, documents *lsplocal.DocumentStore, chartStore *charts.ChartStore) *YamlHandler { | ||
return &YamlHandler{ | ||
documents: documents, | ||
chartStore: chartStore, | ||
yamllsConnector: &yamlls.Connector{}, | ||
} | ||
} | ||
|
||
func (h *YamlHandler) SetChartStore(chartStore *charts.ChartStore) { | ||
h.chartStore = chartStore | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package lsp | ||
|
||
import ( | ||
"github.com/mrjosh/helm-ls/internal/util" | ||
lsp "go.lsp.dev/protocol" | ||
"go.lsp.dev/uri" | ||
) | ||
|
||
// TemplateDocument represents an helm template file. | ||
type YamlDocument struct { | ||
Document | ||
} | ||
|
||
func (d *YamlDocument) GetDocumentType() DocumentType { | ||
return YamlDocumentType | ||
} | ||
|
||
func NewYamlDocument(fileURI uri.URI, content []byte, isOpen bool, helmlsConfig util.HelmlsConfiguration) *YamlDocument { | ||
return &YamlDocument{ | ||
Document: *NewDocument(fileURI, content, isOpen), | ||
} | ||
} | ||
|
||
// ApplyChanges updates the content of the document from LSP textDocument/didChange events. | ||
func (d *YamlDocument) ApplyChanges(changes []lsp.TextDocumentContentChangeEvent) { | ||
d.Document.ApplyChanges(changes) | ||
|
||
d.lines = nil | ||
} |