Fixed
Status Update
Comments
ad...@google.com <ad...@google.com> #2
I remember we did some work to be smarter when there is only a newline/whitespace modification, and in the latest master build I can confirm it works. However for the comments it is not the case - seems like it goes through the regular workflow and calculates the file hashes as is (and those are impacted by the comments). Bradley, do you know if this can be quickly plugged into the same workflow as the whitespaces, or we will need some more fundamental design to ensure smarter sync?
[Deleted User] <[Deleted User]> #3
Free settings my account free. Admin google free internet verifiction_key my email rolandkrovetter@gmail.com
uc...@google.com <uc...@google.com>
xa...@google.com <xa...@google.com> #4
I think maybe we can do something for KTS but for Groovy it's likely going to be difficult. Christophe what do you think?
xo...@google.com <xo...@google.com> #5
At the moment, we install a listener to detect meaningful changes on the build files, by examining the changed PsiElements for a PsiTreeChangeEvent. I don't immediately see why handling comments similarly to whitespace there wouldn't work, but maybe there's something I'm missing. I'll give it a try anyway.
We might want to consider instead having a custom hash function for our Gradle build files, where we wouldn't have to track modifications at all, but could compute whether two build files were equivalent. That hash function would combine hashes of Psi elements, ignoring whitespace and comment psi elements and mixing in hashes related to the contents of other Psi.
We might want to consider instead having a custom hash function for our Gradle build files, where we wouldn't have to track modifications at all, but could compute whether two build files were equivalent. That hash function would combine hashes of Psi elements, ignoring whitespace and comment psi elements and mixing in hashes related to the contents of other Psi.
so...@google.com <so...@google.com> #6
And since we will need to do it when opening a project, I'd really prefer us not to do so. Parsing is expensive and error prone especially when files are not in a valid state for any reason.
We can consider, however, updating the stored hashes each time build files change in a way that does not require sync, but it still needs to handle at least the following situations correctly:
- intermediate invalid states
- changes made outside of the IDE or via
VirtualFile
directly
sm...@google.com <sm...@google.com> #7
It might be worth noting I did try and extend the current PsiListeners for Groovy is cover comments however that appeared to be tricky as I couldn't find a set of conditions on the psi events that would allow the ignoring of comments without ignoring meaningful changes.
I think it would be worth revisiting though, maybe intellijs method manages to detect these and we could leverage that.
I think it would be worth revisiting though, maybe intellijs method manages to detect these and we could leverage that.
so...@google.com <so...@google.com> #8
Maybe it is better to add an Skip these changes
action to the banner to take a fresh snapshot instead of trying to understand whether changes are essential or not. We won't be able to solve the problem of deciding whether a change effects the sync result in general anyway.
xo...@google.com <xo...@google.com> #9
#7: Hm, why is adding PsiComment to the set of elements that are ignored problematic? I've tried various combinations of editing and splitting comments, pasting them at the start, middle, end of lines, and so on: I can trigger "false" positives (just like I can by adding spaces) but I haven't yet been able to trigger a false negative...
#8: Agreed, adding a dismissal action to this banner is reasonable.
#8: Agreed, adding a dismissal action to this banner is reasonable.
xo...@google.com <xo...@google.com> #10
I've submitted two changes to master (which will eventually be released as Android Studio 4.1): one which ignores changes to comments in the same way that changes to whitespace are ignored; another, which adds a dismissal action to the banner. The dismissal is imperfect, in that it can reappear after minor edits (e.g. adding a non-comment character and deleting it again) because we do not update the hash values for the sync state - otherwise, we could end up with stale cached sync state after closing and re-opening the project.
I haven't been able to trigger any bad behaviour from ignoring comment changes, but that's not to say that there is no way to do so; if you encounter any cases when running Android Studio 4.1 canary builds (or later), particularly where you think the sync banner should be showing and it is not, please open another bug. Thank you for the report!
I haven't been able to trigger any bad behaviour from ignoring comment changes, but that's not to say that there is no way to do so; if you encounter any cases when running Android Studio 4.1 canary builds (or later), particularly where you think the sync banner should be showing and it is not, please open another bug. Thank you for the report!
Description
AI-191.8026.42.35.5977832, JRE 1.8.0_202-release-1483-b03x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 2048x1152
AS: 3.5.2; Android Gradle Plugin: 3.5.2; Gradle: 5.4.1; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)Source: user_sentiment_feedback
IMPORTANT: Please read