dprint / dprint-intellij

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

Cache can format values and tweak can format timeout in external formatter #31

Closed ryan-rushton closed 2 years ago

ryan-rushton commented 2 years ago

Since this syncronization issue is being such a pain to figure out I have decided to go nuclear and avoid running can format as much as possible.

This introduces caching of whether a file can be formatted, an action to clear that cache, priming of the cache when a file is opened and tweaks the timeout in the external formatter to be under a second since I think that is the threshold going off logging that is showing up.

ryan-rushton commented 2 years ago

I will try this out for a couple of days, if no issues I will merge and release

ryan-rushton commented 2 years ago

Been testing this for a bit. I think I am fairly happy now. I am a little worried about how v5 can send success and failure messages from the process listener but it is probably a rare and fast enough occurrence that we don't need to worry. For reference I am mainly worried about two threads writing a message to the input at the same time, one being a format or can format or something, and the other being the listener sending a failure or success message. In the event this happens I believe it should auto recover anyways.