Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
qvalentin committed Nov 27, 2024
1 parent 0ef253a commit 572dec3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions internal/lsp/symbol_table_template_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,14 @@ func (v *TemplateContextVisitor) Enter(node *sitter.Node) {
case gotemplate.NodeTypeDot:
v.symbolTable.AddTemplateContext(v.currentContext, GetRangeForNode(node))
case gotemplate.NodeTypeDotSymbol:
// DotSymbol appears inside a SelectorExpression or at the end of an UnfinishedSelectorExpression
v.symbolTable.AddTemplateContext(append(v.currentContext, ""), GetRangeForNode(node))
case gotemplate.NodeTypeFieldIdentifier:
content := node.Content(v.content)
v.symbolTable.AddTemplateContext(append(v.currentContext, content), GetRangeForNode(node))
case gotemplate.NodeTypeField:
content := node.ChildByFieldName("name").Content(v.content)
v.symbolTable.AddTemplateContext(append(v.currentContext, content), GetRangeForNode(node.ChildByFieldName("name")))
case gotemplate.NodeTypeUnfinishedSelectorExpression:
operandNode := node.ChildByFieldName("operand")
context := getContextForSelectorExpression(operandNode, v.content)
if !context.IsVariable() {
context = append(v.currentContext, context...)
}
dotNode := node.Child(int(node.ChildCount()) - 1)
v.symbolTable.AddTemplateContext(append(context, ""),
GetRangeForNode(dotNode))
case gotemplate.NodeTypeSelectorExpression:
operandNode := node.ChildByFieldName("operand")
if operandNode != nil && operandNode.Type() == gotemplate.NodeTypeVariable {
Expand Down

0 comments on commit 572dec3

Please sign in to comment.