Skip to content

Commit

Permalink
fix: make node dump stable
Browse files Browse the repository at this point in the history
  • Loading branch information
didroe committed Sep 13, 2023
1 parent 014df4a commit f332ca7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ children:
alias_of:
- 20
queries:
- 3
- 0
- 3
children:
- type: '"{"'
id: 19
Expand Down
3 changes: 3 additions & 0 deletions internal/scanner/ast/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

sitter "github.com/smacker/go-tree-sitter"
"golang.org/x/exp/slices"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -165,6 +166,7 @@ func (node *Node) dumpValue() nodeDump {
for queryID := range node.queryResults {
queries = append(queries, queryID)
}
slices.Sort(queries)

contentRange := fmt.Sprintf(
"%d:%d - %d:%d",
Expand Down Expand Up @@ -198,6 +200,7 @@ func nodeListToID(nodes []*Node) []int {
result[i] = node.ID
}

slices.Sort(result)
return result
}

Expand Down

0 comments on commit f332ca7

Please sign in to comment.