Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for line directives #36

Open
growler opened this issue May 16, 2019 · 2 comments
Open

Support for line directives #36

growler opened this issue May 16, 2019 · 2 comments

Comments

@growler
Copy link

growler commented May 16, 2019

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!

@growler
Copy link
Author

growler commented May 16, 2019

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 ¯_(ツ)_/¯

@dave
Copy link
Owner

dave commented May 27, 2019

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants