Skip to content

Commit

Permalink
add node types to GenericDocumentUseCase
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Apr 12, 2024
1 parent 52b9ae9 commit 75bed53
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
16 changes: 12 additions & 4 deletions internal/handler/generic_document_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@ func (h *langHandler) NewGenericDocumentUseCase(params lsp.TextDocumentPositionP
if node == nil {
return languagefeatures.GenericDocumentUseCase{}, errors.New("Could not get node for: " + params.TextDocument.URI.Filename())
}
parentNode := node.Parent()
var parentNodeType string
if parentNode != nil {
parentNodeType = parentNode.Type()
}
return languagefeatures.GenericDocumentUseCase{
Document: doc,
DocumentStore: h.documents,
Chart: chart,
Node: node,
Document: doc,
DocumentStore: h.documents,
Chart: chart,
Node: node,
ParentNode: parentNode,
ParentNodeType: parentNodeType,
NodeType: node.Type(),
}, nil
}

Expand Down
11 changes: 7 additions & 4 deletions internal/language_features/generic_document_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import (
)

type GenericDocumentUseCase struct {
Document *lsplocal.Document
DocumentStore *lsplocal.DocumentStore
Chart *charts.Chart
Node *sitter.Node
Document *lsplocal.Document
DocumentStore *lsplocal.DocumentStore
Chart *charts.Chart
Node *sitter.Node
NodeType string
ParentNode *sitter.Node
ParentNodeType string
}

func (u *GenericDocumentUseCase) NodeContent() string {
Expand Down

0 comments on commit 75bed53

Please sign in to comment.