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

fix: Suppress extra indent after the end of field and function chains #13975

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

DropDemBits
Copy link
Contributor

(spurred on by #4182 (comment))

Caveat that this doesn't work for after tail expressions, although there shouldn't be anything after those anyways.

This also complicates when to reload the language configuration by nature of now always having a language configuration applicable.

Examples of indentation fixes:

fn main() {
    println!("Hello!"); // < enter here!
    // ... indents down here

    fs::read_to_string("soup") // < enter here!
    // ... still indents down here :(
        .map(|_| ())
        .map(|_| ()) // < enter here!
        // ... still indents down here :D
        .map_err(|_| ())
        .unwrap(); // < enter here!
    // ... indents down here :D

    // ... and subsequent enters stay at the same indent

    0.0f64
        .to_radians()
        .to_radians()
        .to_radians() // force semi on a new line
        ; // < enter here!
    // ... indents down here :D
}

fn tail_end() -> i32 {
    0i32.wrapping_abs()
        .wrapping_abs()
        .wrapping_abs()
        .wrapping_abs() // < enter here!
        // ... still indents here :shrug:
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 17, 2023
@DropDemBits DropDemBits force-pushed the on-enter-after-dot-chains branch from 92925c1 to 992bafa Compare January 17, 2023 21:51
@Veykril
Copy link
Member

Veykril commented Feb 7, 2023

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 7, 2023
@DropDemBits
Copy link
Contributor Author

Oh, I forgot to mention that I tried to add it in the language config file first, but because the onEnter rules are dynamically (re)loaded to include/exclude the comment onEnter rules, the static configuration file isn't used (or at least, that's my best guess as to what's happening).

Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable that this might override the static configuration there
@bors delegate+

editors/code/src/config.ts Outdated Show resolved Hide resolved
@Veykril
Copy link
Member

Veykril commented Feb 10, 2023

@bors delegate+

@bors
Copy link
Contributor

bors commented Feb 10, 2023

✌️ @DropDemBits can now approve this pull request

Configuration reload doesn't happen often anyway,
and there will always be a set of onEnter rules to load
@DropDemBits
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented Feb 10, 2023

📌 Commit c7bd3c6 has been approved by DropDemBits

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 10, 2023

⌛ Testing commit c7bd3c6 with merge 8011029...

@bors
Copy link
Contributor

bors commented Feb 10, 2023

☀️ Test successful - checks-actions
Approved by: DropDemBits
Pushing 8011029 to master...

@bors bors merged commit 8011029 into rust-lang:master Feb 10, 2023
bors added a commit that referenced this pull request Jul 7, 2023
fix: Indent after pressing enter on a blank line

Regressed after #13975 (whoops).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants