| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Oh, this is great, thank you so much for fixing this!
Sorry, something went wrong.
There was a problem hiding this comment.
I got asked if I had the power to un-block this. I'm not actually sure if I do, but one question before I try:
We read the document text at line 62. If we later find that the document is blocked, we perform and postponed operations, and then we write output that was based on the document text we read earlier. Does that mean that we could undo the effects of any of the operations that we'd just postponed? If so, should we be reading the document text again (maybe retrying the whole of processFile) and operating on that? If that's difficult, would it be better to simply do nothing? I see some other formatter implementations that choose to do nothing, e.g., this code in ktfmt.
Sorry, something went wrong.
|
Yeah, that's a good spot. I've changed it to unblock and apply if the document text hasn't changed (not sure how likely that is), otherwise do nothing. Intellij's own ImportOptimizers do all their work in the returned Runnable (i.e. on the Swing thread, i assume), but I'm not sure how much more heavyweight google-java-format is compared to that, so I guess we'll just give up and wait for the next run if there is a mismatch. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks. Let's see if I can in fact get this converted into a change in our internal repo, and then we'll see if anyone with permissions is up for getting it submitted.
Sorry, something went wrong.
|
i changed the import optimizer to not set document.text if
|
Sorry, something went wrong.
I see this warning that getText() may be expensive. Now, presumably it doesn't add a lot to the cost of setting the text when we're modifying the imports. And even if there is nothing to set (and so we're paying only the cost of getting the text), you make a good point that IntelliJ's own import optimizer does what looks like lots of stuff (implementation?) on the main thread, so How Bad Can It Be? Still, do you think we could get most of the value by including only the first of your two new checks, the one that happens in whatever background thread does the work, since that one uses the result of the getText() call that we already had to make? |
Sorry, something went wrong.
|
it seems to suggest using getCharsSequence() instead, i can take a look at whether it's possible instead of getText(). as far as the checks go
|
Sorry, something went wrong.
…f formatter results are unchanged, or if `document.text` has changed This seemed to be responsible for some of the issues with the formatter seemingly not formatting a file.
|
Oh, right, sorry, I'd somehow been thinking that the second check was a new thing and not the fix you'd previously explained. getCharSequence looks like it makes a nice, easy optimization in any case. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Also update to google-java-format 1.17.0