github.com/yoheimuta/protolint@v0.49.8-0.20240515023657-4ecaebb7575d/linter/autodisable/thisThenNextPlacementStrategy.go (about) 1 package autodisable 2 3 import "github.com/yoheimuta/go-protoparser/v4/parser" 4 5 type thisThenNextPlacementStrategy struct { 6 c *commentator 7 } 8 9 func newThisThenNextPlacementStrategy(c *commentator) *thisThenNextPlacementStrategy { 10 return &thisThenNextPlacementStrategy{ 11 c: c, 12 } 13 } 14 15 func (p *thisThenNextPlacementStrategy) Disable( 16 offset int, 17 comments []*parser.Comment, 18 inline *parser.Comment) { 19 if inline == nil { 20 p.c.insertInline(offset) 21 return 22 } 23 if p.c.tryMergeInline(inline) { 24 return 25 } 26 27 p.c.insertNewline(offset) 28 } 29 30 func (p *thisThenNextPlacementStrategy) Finalize() error { 31 return p.c.finalize() 32 }