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

[Feature Request] Add noindent annotation #60

Open
efaulhaber opened this issue Sep 10, 2024 · 3 comments
Open

[Feature Request] Add noindent annotation #60

efaulhaber opened this issue Sep 10, 2024 · 3 comments

Comments

@efaulhaber
Copy link

It would be very useful to have something like this:
https://domluna.github.io/JuliaFormatter.jl/stable/#Stopping-a-block-of-code-from-indenting

@fredrikekre
Copy link
Owner

I am a bit hesitant to add something like this. It seems like a very niche usecase if applying a macro to a complete file is the main motivation.

I would find it important to know that the code I am reading is inside a macro. In the linked package it would be impossible to tell that what I am reading will be transformed with a macro from 100s if not 1000s of lines above. The indent that Runic adds at least hints to that the code I see is inside something. To me it would be so much clearer to apply the macro locally instead. I looked at one of the files (where you commented) and it was something like 700 lines of code and only 4 or 5 places where the macro would have an affect. Perhaps it isn't my place to comment on this style, but to me it seems strange to blindly wrap a whole just for the macro to be usefule in a few places.

Would you consider rewriting to use it locally? Alternatively apply it on the function level (like e.g. @inline) or use the include(mapexpr, filename) API?

@ranocha
Copy link

ranocha commented Sep 11, 2024

Would you consider rewriting to use it locally? Alternatively apply it on the function level (like e.g. @inline)

We had several discussions about this. One range of thoughts argued like you (and like I would prefer in several places for code clarity), and another line of thought wanted to keep most parts of the code as "clean" as possible to make it easier to read for students working on the mathematics and not the CS aspects. I don't want to re-init this discussion right now.

or use the include(mapexpr, filename) API?

This does not work well with Reevise.jl, see timholy/Revise.jl#634

@KristofferC
Copy link
Contributor

My opinion is that putting the macro close to the use sites is clearly correct and it is good that Runic indents it to make the code clearer that an (arbitrary) transformation of the code is taking place.

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

4 participants