Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lorentz15191134dyou have a syntax error or a macro which makes it impossible to assert that formatting is isomorphic
-
lorentz15191134dI agree though that the comment formatting rules are weird and almost never intuitive. My suspicion is that it's because comments aren't really recognized as an AST node but rather as attachments to other AST nodes and they are often associated with a different node from the one you expected
-
lorentz15191134d@jestdotty That's strange. all syntactically correct code outside macro calls, including the enclosing call tokens themselves and optionally even template macro definitions but not the tokens inside the macro call, should be formatted by rustfmt. The only other things I can think of are either
- you haven't saved all your files so rustfmt sees a different project from the language server
- the code isn't referenced into the workspace
- you're running rustfmt inside a different project. In workspaces, most cargo commands implicitly target the project and not the workspace if they're run inside a project folder. -
lorentz15191134d@jestdotty that is really strange. Another thought, I think in VSCode the format command is actually issued by the rust-analyzer extension, and I ran into several bugs in rust-analyzer and the extension in the past. Either way, you can probably look at the final command being issued in the extension's output and try to run it and variations by hand to determine where the issue lies. Although as I said, RA is pretty buggy so if that's your problem I don't expect it to be fixed.
Related Rants
rust, where pressing autoformat won't format your code but will format your comments which are just there because you're trying to keep track of the data you're going to parse and now that shit is off the page motherfucker can you not
rant
autoformat
rust