Skip to content

Commit

Permalink
Remove custom Ref stringer (#1359)
Browse files Browse the repository at this point in the history
I can't remember why we have this in the first place,
but in case some new issue reminds us, we can deal with
it then.

Signed-off-by: Anders Eknert <[email protected]>
  • Loading branch information
anderseknert authored Jan 23, 2025
1 parent 2b25493 commit 6880526
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 112 deletions.
32 changes: 0 additions & 32 deletions internal/ast/ref.go

This file was deleted.

75 changes: 0 additions & 75 deletions internal/ast/ref_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions internal/lsp/completions/refs/defined.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func DefinedInModule(module *ast.Module, builtins map[string]*ast.Builtin) map[s

// first, create a reference for the package using the metadata
// if present
packagePrettyName := strings.TrimPrefix(rast.RefToString(module.Package.Path), "data.")
packagePrettyName := strings.TrimPrefix(module.Package.Path.String(), "data.")
packageDescription := defaultDescription(packagePrettyName)

packageAnnotation, ok := findAnnotationForPackage(module)
Expand All @@ -43,7 +43,7 @@ func DefinedInModule(module *ast.Module, builtins map[string]*ast.Builtin) map[s
ruleGroups := make(map[string][]*ast.Rule, len(module.Rules))

for _, rule := range module.Rules {
name := rast.RefToString(rule.Head.Ref())
name := rule.Head.Ref().String()

if strings.HasPrefix(name, "test_") {
continue
Expand Down
6 changes: 3 additions & 3 deletions internal/lsp/documentsymbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func documentSymbols(
ruleGroups := make(map[string][]*ast.Rule, len(module.Rules))

for _, rule := range module.Rules {
name := rast.RefToString(rule.Head.Ref())
name := rule.Head.Ref().String()
ruleGroups[name] = append(ruleGroups[name], rule)
}

Expand All @@ -58,7 +58,7 @@ func documentSymbols(

ruleRange := locationToRange(rule.Location)
ruleSymbol := types.DocumentSymbol{
Name: rast.RefToString(rule.Head.Ref()),
Name: rule.Head.Ref().String(),
Kind: kind,
Range: ruleRange,
SelectionRange: ruleRange,
Expand All @@ -84,7 +84,7 @@ func documentSymbols(
}

groupSymbol := types.DocumentSymbol{
Name: rast.RefToString(rules[0].Head.Ref()),
Name: rules[0].Head.Ref().String(),
Kind: kind,
Range: groupRange,
SelectionRange: groupRange,
Expand Down

0 comments on commit 6880526

Please sign in to comment.