aboutsummaryrefslogtreecommitdiff
path: root/internal/config/dir.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/dir.go')
-rw-r--r--internal/config/dir.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/config/dir.go b/internal/config/dir.go
index 54ee35e..b82a0b3 100644
--- a/internal/config/dir.go
+++ b/internal/config/dir.go
@@ -28,6 +28,7 @@ type Dir struct {
// excluded when any one form matches it.
type Exclude struct {
Pos sexp.Pos
+ End sexp.Pos // just past the form's closing paren, for Splice
Text string // the form as written, whitespace collapsed, for check and explain
When []*sexp.Node // the conditions, all of which must hold
}
@@ -51,13 +52,14 @@ func parseExclude(n *sexp.Node, src []byte, d *diags) *Exclude {
return nil
}
text := strings.Join(strings.Fields(string(src[n.Pos.Offset:n.End.Offset])), " ")
- return &Exclude{Pos: n.Pos, Text: text, When: conds}
+ return &Exclude{Pos: n.Pos, End: n.End, Text: text, When: conds}
}
// Rule is a named condition with the actions it performs.
type Rule struct {
Name string
Pos sexp.Pos
+ End sexp.Pos // just past the form's closing paren, for Splice
When []*sexp.Node // the conditions, all of which must hold
HasWhen bool // false: the rule matches every file
Settings Settings // only case, fold and on-conflict
@@ -188,7 +190,7 @@ func parseRule(n *sexp.Node, d *diags) *Rule {
d.at(n, `rule names cannot start with "(": (review) marks choices made in review`)
return nil
}
- r := &Rule{Name: args[0].Text, Pos: n.Pos}
+ r := &Rule{Name: args[0].Text, Pos: n.Pos, End: n.End}
seen := map[string]*sexp.Node{}
var whenNode *sexp.Node
triedAction, deleted := false, false