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

Eliminate "Containing expression ends prematurely" error #500

Merged
merged 1 commit into from
Aug 5, 2023

Conversation

micl2e2
Copy link
Contributor

@micl2e2 micl2e2 commented Aug 4, 2023

While #498 handles dbg! insertion for "empty line" cases, the original rust-insert-dbg remains unchanged. Though it can handle most cases where there is a valid s-expression ahead of current position, it cannot handle if there isn't, such as:

if let Ok(val) = a {}
____________________^ cursor is here 

, where it results in "Containing expression ends prematurely" error, and an incorrect insertion:

if let Ok(val) = a {(}

This patch attempts to fix this issue. And the result would be:

if let Ok(val) = a {dbg!()}

- Change rust-insert-dbg to ...-sexp
- Handle the cases where forwarding is impossible
- Add tests
@psibi psibi merged commit fac7d28 into rust-lang:master Aug 5, 2023
9 checks passed
@psibi
Copy link
Member

psibi commented Aug 5, 2023

Thank you!

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

Successfully merging this pull request may close these issues.

None yet

2 participants