-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix postfix completion indentation compensation #21324
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
base: master
Are you sure you want to change the base?
Conversation
Editor adds the current indentation to the content of the code snippet
This PR dedentation is used to offset the editor snippet indentation
Example
---
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
x
.and(y)
.map(|it| it+2)
.$0
};
}
```
**Before this PR**
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
let $0 = x
.and(y)
.map(|it| it+2);
};
}
```
**After this PR**
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
let $0 = x
.and(y)
.map(|it| it+2);
};
}
```
ChayimFriedman2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit wrong to change the indentation of existing code, and it's not a severe issue since formatting will fix that anyway... Are all editors indenting like that?
The language server protocol can adjust this behavior
A dedentation is the least disruptive implementation
Frequent formatting greatly affects the user experience, |
|
Small note that this would fixup #13370, thanks!
I'd rather go for the route for using |
I didn't look at the entire file, I only extracted the indentation of the current line |
|
I meant needing to pull the file text, which I realized is something that we already do 😅 |
Editor adds the current indentation to the content of the code snippet
This PR dedentation is used to offset the editor snippet indentation
Fixes #13370
Example
Before this PR
After this PR