diff --git a/internal/lsp/template/parse.go b/internal/lsp/template/parse.go index 8077bfc2c2..0853612a70 100644 --- a/internal/lsp/template/parse.go +++ b/internal/lsp/template/parse.go @@ -86,6 +86,7 @@ func parseBuffer(buf []byte) *Parsed { ans := &Parsed{ buf: buf, check: -1, + nls: []int{-1}, } if len(buf) == 0 { ans.ParseErr = errors.New("empty buffer") @@ -103,7 +104,6 @@ func parseBuffer(buf []byte) *Parsed { } // at the cost of complexity we could fold this into the allAscii loop ans.lines = bytes.Split(buf, []byte{'\n'}) - ans.nls = []int{-1} for i, p := range ans.buf { if p == '\n' { ans.nls = append(ans.nls, i)