Support for line directives
Would be nice to have support for go's line directives.
The simplest way I believe would be to avoid indenting line comments Decorations starting with //line
Thank you!
go/printer checks for line directive and skips indentation if comment pos is either invalid or points to column 1:
const linePrefix = "//line "
if strings.HasPrefix(text, linePrefix) && (!pos.IsValid() || pos.Column == 1) {
// Possibly a //-style line directive.
// Suspend indentation temporarily to keep line directive valid.
defer func(indent int) { p.indent = indent }(p.indent)
p.indent = 0
}
... but I failed to realise how to force r.cursor point to first column at applyDecorations ¯_(ツ)_/¯
Hi Alexey! I’m taking a break from open source and trekking across Nepal for five months... today is the first internet I’ve had in over a month. I won’t have my laptop until September but I’ll take a look at this when I can.
However from looking at your issue it looks like something I want to fix.
p.s. if you want to know more about the trek, check out my blog wildernessprime.com :)