Skip to content

indentation misaligned due to where in comment #151

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

Closed
nikomatsakis opened this issue Apr 17, 2016 · 5 comments
Closed

indentation misaligned due to where in comment #151

nikomatsakis opened this issue Apr 17, 2016 · 5 comments

Comments

@nikomatsakis
Copy link
Contributor

This example indents as shown:

/// - there must not exist an edge U->V in the graph where:
#[derive(Clone, PartialEq, Eq)]
    pub struct Region {
    entry: BasicBlockIndex,
    leaves: BTreeMap<BasicBlockIndex, usize>,
}

But I would expect:

/// - there must not exist an edge U->V in the graph where:
#[derive(Clone, PartialEq, Eq)]
pub struct Region { // <-- this should be flush with left margin!
    entry: BasicBlockIndex,
    leaves: BTreeMap<BasicBlockIndex, usize>,
}

Presumably the angle-bracket matching code is going a bit awry here.

cc @MicahChalmer

@nikomatsakis
Copy link
Contributor Author

Interestingly, removing the #[derive] makes things work.

@MicahChalmer
Copy link
Contributor

It's got nothing to do with the > this time. You can try removing it--the problem doesn't go away. The trigger is actually the word "where" in the comment. The code that looks for where clauses isn't checking that the word isn't part of a string or comment.

@MicahChalmer MicahChalmer changed the title indentation misaligned due to > in comment indentation misaligned due to where in comment Apr 24, 2016
@MicahChalmer
Copy link
Contributor

I changed the title of the issue to reflect the actual trigger...(title said it was due to the > but it's actually due to the where)

@mrBliss
Copy link
Contributor

mrBliss commented Apr 24, 2016

I'll fix this, I think I introduced this in b76e803.

mrBliss added a commit to mrBliss/rust-mode that referenced this issue Apr 24, 2016
When looking for a `where` in
`rust-rewind-to-beginning-of-current-level-expr`, check that is not part
of a string or comment.
mrBliss added a commit to mrBliss/rust-mode that referenced this issue Apr 25, 2016
Always check whether we're not in a string or comment when looking for
the `where` keyword. Use two helpers for this: `rust-looking-at-where`
and `rust-rewind-to-where`.
MicahChalmer added a commit that referenced this issue Apr 26, 2016
@nikomatsakis
Copy link
Contributor Author

thanks! 👍

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

3 participants