-
Notifications
You must be signed in to change notification settings - Fork 642
Closed
Description
#639 introduced namespaced functions. While exploring what's required to support this in terraform-ls, I discovered that the NameRange for function call expressions with the new syntax seems to be off.
Test Code
package main
import (
"log"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hclsyntax"
)
func main() {
cfg := `attr = test::noop("noop")`
f, _ := hclsyntax.ParseConfig([]byte(cfg), "", hcl.InitialPos)
attrs, _ := f.Body.JustAttributes()
expr := attrs["attr"].Expr.(*hclsyntax.FunctionCallExpr)
log.Printf("Name Range: %#v", expr.NameRange)
}Output
Name Range: hcl.Range{Filename:"", Start:hcl.Pos{Line:1, Column:8, Byte:7}, End:hcl.Pos{Line:1, Column:12, Byte:11}}
Thus, the name range contains only the first part of a namespaced function call, rather than the entire expression up to the opening parenthesis.
attr = test::noop("noop")
^^^^ NameRangeReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels