-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Formatter adds a space to start of block scope #2932
Comments
please assign me |
which file is this code in? |
The code can be found here; however, if you take a look at this issue and that code you will notice that there is no space because it has been manually removed. This is one example that you may use when trying to fix the issue in the sway formatter. Alternatively, the snippet has been posted in the issue as a minimal reproducible sample so you should be able to create a brand new |
Hey @Braqzen, is this issue still open? |
Hey @AliJafriETH, I can confirm that the issue still exists on the |
Hey @bingcicle, thank you so much 👍 |
@yash251 - are you still working on the issue? If so, do let us know if you encountered any blockers. @AliJafriETH since the issue was assigned to @yash251 initially, I'd like to first see if @yash251 would like to continue working on it first, so that we don't end up wasting your time doing duplicate work. :/ |
@AliJafriETH I see now that you're also assigned to #3474, perhaps you might want to focus on that first? |
Hey @bingcicle, would work on #3474 first 👍 |
Hey @bingcicle, just submitted the PR for #3474, is this issue still open? |
@AliJafriETH first of all, thanks for your PRs! With that said, I took a look at the PRs and it seemed like there are some misunderstandings about the requirements of the issue - please take a look at @eureka-cpu's comment here. Once the comments are resolved and if @yash251 hasn't responded, we can assign you this issue as well. Please feel free to ask questions! |
where can I find it's reference in the sway book? https://fuellabs.github.io/sway/v0.33.1/book/basics/variables.html |
Hmm, I'm assuming you misunderstood the issue - this issue isn't related to language implementation, rather its about formatting. You can take a look at the swayfmt CONTRIBUTING.md to get started :) |
Hey @yash251, following up from your forum question here: Firstly, please make sure you've read the CONTRIBUTING.md linked above before starting to work on this. Basically, in the original example posted in this issue, the code should not be changed at all, since the formatting is correct. However, the formatter is currently putting a space right before the 2nd opening curly brace, after the statement The diff (red is what we don't want, green is what we want - you can see there's an extra space inserted before the curly brace). library scope;
fn shadowing_by_scope() {
// ANCHOR: shadowing
let foo = 5;
- {
+ {
let foo = 42;
}
assert(foo == 5);
// ANCHOR_END: shadowing
} The entire formatter lives within To test out your changes, I'd recommend creating a test within Please feel free to ask follow-up questions here! |
## Description Closes #2932 ## Checklist - [x] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers.
The following code, when formatted, will add a space after the
foo
declaration line but right before the{
so that it becomes<space>{
.Post formatting:
The text was updated successfully, but these errors were encountered: