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

Chained method indentation fails when ? operator is inline #223

Closed
j0ni opened this issue Feb 8, 2021 · 5 comments
Closed

Chained method indentation fails when ? operator is inline #223

j0ni opened this issue Feb 8, 2021 · 5 comments

Comments

@j0ni
Copy link

j0ni commented Feb 8, 2021

I have observed that something like this:

    ContextBuilder::new("Rain", 1024, 768)
        .quit_on_escape(true)
        .build()?
        .run(GameState::new)

is indented instead like this:

    ContextBuilder::new("Rain", 1024, 768)
        .quit_on_escape(true)
        .build()?
    .run(GameState::new)

I may try again to fix it (my attempt #222 here didn't work, because I didn't fully grok the function) but for now here's a bug report.

@j0ni
Copy link
Author

j0ni commented Feb 19, 2021

I just noticed that this problem doesn't exist in Doom's setup, which has rustic pinned at commit f7d5ac0, from December 2020. I haven't looked into its config and/or hacks yet so it may not be a regression per se. Interesting clue though.

@brotzeit
Copy link
Owner

Hmmm, I know that the doom-emacs people often apply fixes for packages to doom-emacs and not to the affected packages. I'll take a look.

@j0ni
Copy link
Author

j0ni commented Feb 19, 2021

BTW, By making this change in rustic-interaction.el I'm getting the correct behaviour in the case I've described:

   (let ((continue t))
     (while continue
       (let ((starting (point)))
-        (skip-chars-backward "[:space:]\n")
+        (skip-chars-backward "?[:space:]\n")
         (when (rustic-looking-back-str "*/")
           (backward-char))
         (when (rustic-in-str-or-cmnt)

but I have not spent any time doing anything else, so for all I know it might break something else.

@brotzeit
Copy link
Owner

I didn't add this code myself so I'm a little hesitant, as you mentioned we can't be sure if this doesn't introduce other bugs. I would have a better feeling applying this change if we had some tests.

@brotzeit
Copy link
Owner

brotzeit commented Jan 1, 2022

This is now a rust-mode issue since rustic is no longer a fork of rust-mode and requires it as dependency.

@brotzeit brotzeit closed this as completed Jan 1, 2022
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