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

Highlight break statements #2033

Closed
m0sth8 opened this Issue Nov 23, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@m0sth8
Member

m0sth8 commented Nov 23, 2015

In such scenarios:

    for i = 0; i < n; i++ {
        for j = 0; j < m; j++ {
            switch a[i][j] {
            case nil:
                state = Error
                break
            case item:
                state = Found
                break
            }
        }
    }

somebody (newbie) might think that a "break" statement terminates execution of "FOR" statement.
It will be great if we highlight somehow what block is terminated by BREAK statement.

According to spec https://golang.org/ref/spec#Break_statements A "break" statement terminates execution of the innermost "for", "switch", or "select" statement within the same function.
But break also might have a LABEL, so in this case we can highlight this LABEL.

@ilinum

This comment has been minimized.

Show comment
Hide comment
@ilinum

ilinum Nov 23, 2015

Contributor

How do you think that should be highlighted?

Should we highlight switch keyword when cursor is on break? (and vice versa)
Do you think this will be enough?

Contributor

ilinum commented Nov 23, 2015

How do you think that should be highlighted?

Should we highlight switch keyword when cursor is on break? (and vice versa)
Do you think this will be enough?

@zolotov

This comment has been minimized.

Show comment
Hide comment
@zolotov

zolotov Nov 23, 2015

Contributor

Should we highlight switch keyword when cursor is on break? (and vice versa)
Do you think this will be enough?

I imagine it in exactly that way.

Contributor

zolotov commented Nov 23, 2015

Should we highlight switch keyword when cursor is on break? (and vice versa)
Do you think this will be enough?

I imagine it in exactly that way.

@ilinum

This comment has been minimized.

Show comment
Hide comment
@ilinum

ilinum Nov 23, 2015

Contributor

I'll implement this sometime soon (this week)

Contributor

ilinum commented Nov 23, 2015

I'll implement this sometime soon (this week)

ilinum added a commit to ilinum/go-lang-idea-plugin that referenced this issue Nov 26, 2015

@zolotov zolotov closed this in 6dcdfa4 Nov 26, 2015

@dlsniper dlsniper modified the milestones: 1.0 maybe?, 1.0.0 Nov 28, 2015

ignatov added a commit that referenced this issue Dec 25, 2015

@zolotov zolotov modified the milestones: 1.0.0, next alpha Jan 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment