You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you put your cursor at the end of line 2, then press enter, you'd expect the next line to be indented at the same level, however this happens:
fnmain(){let _ = 0. < 1.;// It's indented to here}
Also, if you do the same with the last line:
fnmain(){let _ = 0. < 1.;}// Indented to here
This is because of the 0. < bit. If you change it to 0.0 < or 0. >, indentation works perfectly fine, so it's likely due to the combination of missing the decimal part and having the < character, which is also used as a bracket in rust.
I may have narrowed it down via a few hours of trial and error to this regex:
Which does not match with the original code, but does with the fixed code.
I don't believe that this is the cause of the issue though, since I also found that in that match, for the working code it will match an empty string $ (expected, since the cursor is at the end of the line). For the original code however, it matches 1\.;$, and it's the exact same if I increase the line's length. This means that something has moved the cursor to just after the <.
I confirmed this by changing the < to [, the same thing happens.
Commenting that out means it only indents by one extra level, which is bearable. Unfortunately, this is a hack, and probably breaks another indentation feature.
The thing that confuses me is that backward-up-list only goes back to the < if the decimal part is left out. It's probably due to this regex:
Which matches the ., assuming it's an operator. I managed to get the regex to work as intended for a few minutes, then I broke it again ([-=!%&*/:<>[{(|^;}]\\|[^[:digit:]]\\.). If somebody else more versed with lisp could help that would be great since I've run out of ideas.
If anyone else has this problem, a temporary solution is to replace rust-is-lt-char-operator:
Consider the following 3 lines of code:
If you put your cursor at the end of line 2, then press enter, you'd expect the next line to be indented at the same level, however this happens:
Also, if you do the same with the last line:
This is because of the
0. <
bit. If you change it to0.0 <
or0. >
, indentation works perfectly fine, so it's likely due to the combination of missing the decimal part and having the<
character, which is also used as a bracket in rust.I may have narrowed it down via a few hours of trial and error to this regex:
rust-mode/rust-mode.el
Line 629 in 22fff6a
Which does not match with the original code, but does with the fixed code.
I don't believe that this is the cause of the issue though, since I also found that in that match, for the working code it will match an empty string
$
(expected, since the cursor is at the end of the line). For the original code however, it matches1\.;$
, and it's the exact same if I increase the line's length. This means that something has moved the cursor to just after the<
.I confirmed this by changing the
<
to[
, the same thing happens.It looks like this is done by this line:
rust-mode/rust-mode.el
Line 827 in 22fff6a
Commenting that out means it only indents by one extra level, which is bearable. Unfortunately, this is a hack, and probably breaks another indentation feature.
The thing that confuses me is that
backward-up-list
only goes back to the<
if the decimal part is left out. It's probably due to this regex:rust-mode/rust-mode.el
Line 620 in 22fff6a
Which matches the
.
, assuming it's an operator. I managed to get the regex to work as intended for a few minutes, then I broke it again ([-=!%&*/:<>[{(|^;}]\\|[^[:digit:]]\\.
). If somebody else more versed with lisp could help that would be great since I've run out of ideas.If anyone else has this problem, a temporary solution is to replace
rust-is-lt-char-operator
:rust-mode/rust-mode.el
Lines 1216 to 1262 in 22fff6a
with:
The text was updated successfully, but these errors were encountered: