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

puni-slurp-forward unexpected behavior for <> #28

Open
jiacai2050 opened this issue Apr 2, 2022 · 1 comment
Open

puni-slurp-forward unexpected behavior for <> #28

jiacai2050 opened this issue Apr 2, 2022 · 1 comment

Comments

@jiacai2050
Copy link

jiacai2050 commented Apr 2, 2022

This happens in rust-mode. | is where cursor is.

Option<|>Result<i64>
// puni-slurp-forward,expected
Option<|Result><i64>
// puni-slurp-forward,unexpected,it should be Option<|Result<i64>>
Option<|Result<>i64>
@AmaiKinono
Copy link
Owner

Looks like a rust-mode bug to me.

Option<Result>|<i64>
// `forward-sexp`
Option<Result><i64|>
// `backward-sexp`
Option<Result><|i64>

puni-strict-forward-sexp thinks the < after point is a balanced sexp, because it thinks it's just a punctuation. Puni does this because forward-sexp often flies over the following punctuation, see this (in text-mode):

Bar|. Foo bar.
// `forward-sexp`
Bar. Foo| bar.
// `backward-sexp`
Bar. |Foo bar.

And, puni does nothing wrong since it actually is a punctuation!

Option|<Result><i64>
// `describe-char` outputs:
// ... syntax: (>    which means: open, matches > ...
Option<Result>|<i64>
// `describe-char` outputs:
// ... syntax: .    which means: punctuation

My guess is it's a rust-mode bug, or the intermediate state Option<Result><i64> is not valid rust code so rust-mode can't parse it. If this is the case, currently I don't know how to fix it on Puni's side.

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

2 participants