-
Notifications
You must be signed in to change notification settings - Fork 720
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
Add default tabstop and max width for rust #3510
base: master
Are you sure you want to change the base?
Conversation
We don't want to have a dependency to the autowrap script, which defines As for the |
@lenormf Yes, I understand. The documentation does not enforce but recommends, I believe we should take that recommendation as a default rather than some random 8 values that come from nowhere and is more of a surprise to a new kakoune user using rust. Is there any way to only add |
Users can select which scripts will be loaded by creating an The only way to get around that (since there's no In any case, the values set in this PR are the result of your interpretation of recommendations which will override any user settings. Not good. |
@lenormf Is there any way for it to be the default but not to override any user settings? |
I also noticed that autowrap column on 100 means 99 in kakoune unlike 100 in vim. I think we can just make them the default according to the recommendations but still allow user to override them. Similarly, I find autowrap works quite badly, I need to manually wrap line by line for comments. |
The default should follow rust default style mentioned in https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/guide.md#indentation-and-line-width
I believe that is the less efficient way, I mean wiki is good (for advance stuff like inlay hints) but the reason why I looked into the wiki in the first place is because it is missing the default stuff. If stuff is in place (like what fish shell did), people don't need to look into the wiki for these kind of basic stuff. It is like vim retaining their default settings for ages but neovim tune those default settings back to normal. At least the normal users don't need to have a bunch of configuration to fix vim default config. |
Now we're back to square one. Recommendations are not standard defaults. Users can write valid Rust code with whatever indentation level they've set in their configuration, the editor should not try to second-guess them. The idiomatic way of writing code that follows a standard in Kakoune is to use a formatter, or eventually something like EditorConfig. |
But why standard defaults are set? These should be a reason right. I believe that is because people used to use 80 characters back then with tabs for C code, same goes for kakoune such that it made its way as the default. But say, if a new editor were to be written in rust, I bet there might be a high chance the default tabstop is 4 characters and uses space instead of tab, do you think it would be good to make that the default for all languages including Makefile? Say, Makefile have a hard requirement on tab but the editor people say they don't care. Wouldn't that be bad on Makefile people? Of course, I don't mean that the editor should randomly set the language recommendations, I mean only set it if the language have recommendations. I believe the recommendations are the same, they made it recommendation for this reason, people can override it but I think the editor should not override it. I believe the order of setting indentation boils down to:
In my humble opinion, the editor should not interfere with language recommendations. Linus torvalds even have a say on 80-column terminals https://lkml.org/lkml/2020/5/29/1038. (I don't really like what he said personally, like raspberry pi 4 slow compilation and 100+ widths) |
What can we do about this? I don't think recommending the users the editor's default is a good idea, the language's default should come which I think is a better choice. |
C.f. comment. |
C.f.? |
We can keep four as default. But I think this might affect other users? What if we parse the rustfmt configuration and editorconfig to know how many space do they prefer but still default back to 4? This allows a zero configuration method to use sensible default when no custom spacing is used.
Is it possible to detect whether the user loaded a specific plugin and does certain behavior based on that? Like if they don't select autowrap.kak then don't add that for them. |
The I find |
Yes, tab not able to insert space, kakoune tabbing and wrapping I say is very bad.
Kakoune rust indentation is smart and I think better rust.vim but the wrapping story of kakoune is really bad, almost useless. I find myself checking the line manually and do the counting myself, pipe to fmt is useless for rust. I wonder if we can use a kakoune function for formatting or we should write ourselves a partial formatter just for kakoune rust? |
The default should follow rust default style mentioned in
https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/guide.md#indentation-and-line-width