dprint / dprint-intellij

A dprint plugin for Intellij.
https://plugins.jetbrains.com/plugin/18192-dprint
MIT License
13 stars 2 forks source link

"Dprint cannot format no path" log spam #56

Closed jonathanj closed 1 year ago

jonathanj commented 1 year ago

I happened to look at the Dprint logs in IntelliJ today (I was debugging a config issue), and noticed that this message is spammed a lot. Pretty much any interaction with IntelliJ (focusing the window, moving the cursor, etc.) triggers a cluster of these.

This code seems to be responsible for logging it, unfortunately it's not actually clear what "no path" is if it's not a valid virtual file. There is a comment above this code that indicates that scratch files (and possibly other types of files?) are ignored, so maybe it's one of these?

Is this anything to be concerned about from a performance point of view? I'm not even sure whether this is logged if the dprint logging window is not active, so maybe just a question for my own curiosity.

2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:31:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
2023 08 12 14:21:32:  Dprint cannot format no path, IntelliJ formatter will be used.
ryan-rushton commented 1 year ago

I thought this should only happen for cases like scratch files where it their usage is pretty infrequent. I haven't noticed the log spam myself and while I don't think it has any real performance impact I might remove the log into IJ logs to be safe. Thanks for the report.

ryan-rushton commented 1 year ago

Per this, it will now just spam the dprint tooling console and not the IJ logs as this could likely still be useful for people if they are debugging and cannot understand why it won't format a file that does not exist in the project on disk.

jonathanj commented 1 year ago

Thank you so much for taking the time to look at and improve this @ryan-rushton!