-
Notifications
You must be signed in to change notification settings - Fork 42
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
Change TAB to use the mode-specific indentation config #49
Conversation
@kevinmatthes Would you be so kind to review this PR? |
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.
The changes look good but they should also be mirrored in graphemes.rs
where the tab width still is assumed to be statically four.
Especially with languages like Haskell which require a width of eight by convention, the tree-sitters might be confused.
Is there a possibility to read out the currently recognised language in graphemes.rs
to use the width also there?
@kevinmatthes You make a very good point -- I did look at how
Obviously these are very close concerns from a end user pov, but are slightly different. Moving forward, some options about what we can do
3 is somewhat less uniform, but may be the behaviour users expect. What are your thoughts? |
I agree with you, possibility 3 would be the best solution. In summary, this would mirror the count of spaces to the visual appearance when changing the unit to tab characters, right? |
For what it is worth, I had a similar change to this in my now defunct 'working' branch in which I implemented option 3 since I interpreted the meaning of "width" to be "display width with a monospace font" so how wide a tab should appear as well as how many spaces to output to look the same as one tab of width "width". The grapheme changes were minor but I had done them by adding a method parameter which wasn't necessarily the cleanest solution (thus no PR). I also think there is value in making it mode specific since some languages, make and cmake for example, have vastly different defaults in many editors like Emacs. Make uses 8 character wide tabs where as cmake uses 2 spaces. |
I've pushed a commit that implements option 3 -- I must admit, using the |
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.
Okay, from my point of view, there are no problems with these changes.
But a more general question: how about override functionalities for these settings? Command line options and config variables in order to easily alter the indentation unit if required?
I don't think being able to override these settings form the command line is worth it. Some arguments against providing many override settings with command line arguments
In my mind command line arguments for the editor should be pretty limited and instead should be reserved for truly "global" behaviour that needs to be specified at startup -- e.g. where the config dir is, whether to build the parsers, whether you want a terminal or gui version etc. |
f7464c8
to
7012d8d
Compare
As one more datapoint on cmd line argument override, helix also doesn't support any |
I've added a changelog too in this PR -- it was high time |
#29 added mode-specific configuration for indentation, though it remained unused. See the
indentation
field for an example below. This PR changesTAB
to respect the indentation configuration.