-
Notifications
You must be signed in to change notification settings - Fork 137
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
[Request for Feedback] Add ontype formatting support #980
base: main
Are you sure you want to change the base?
[Request for Feedback] Add ontype formatting support #980
Conversation
Hi @onno-vos-dev sorry for the late reply. Personally I don't have a problem merging this, especially if it's disabled by default initially. So, if you get a basic test in place and squash, I think we're good! Unless @gomoripeti, @alanz or others have a different opinion... |
very nice! |
9f0a78c
to
284ec99
Compare
Co-authored-by: Andreas Hasselberg <[email protected]> Delete iostr.erl Fix linter complaints Fix proper error Fix typespec Maybe make Dialyzer happy? Temp fixes to get dialyzer to run Add spec Better fix for dialyzer errors Add config to enable on type formatting, defaulting to false Skip formatting if . is on a commented out line
284ec99
to
b97266f
Compare
Opened: AdRoll/rebar3_format#295 as that's the biggest bug that exists as of now. I haven't forgotten about this PR... Now let me go back and hide in a corner ashamed that this PR has been rotting away for so long... |
FWIW I think much bigger issue with |
Yeah I noticed that issue as well when trying to find if my issue was already reported but since the formatter currently doesn't support |
The issue is not in defines, but in any usages of -define(MUL(A, B), A * B).
test() -> ?MUL((1 + 2), (3 + 4)). the formatter will produce: -define(MUL(A, B), A * B).
test() -> ?MUL(1 + 2, 3 + 4). changing the result of And while this example is fairly convoluted, there are frequently "guard-safe" macros using |
Seems to me that |
[Request for Feedback]
Description
This PR adds on-type formatting support. The way this works is that it is triggered by adding a
.
. This PR is a DRAFT PR which means we @anha0825 and myself are looking for feedback on this work.The feature is disabled by default but can be enabled by adding
format_on_type: true
to yourerlang_ls.config
.No tests have been added as of yet as I'm not sure how tests for this sort of feature can be written? Considering that BSP will take care of formatting going forward, this should be more or less an "interim" solution anyway.