PSI_ELEMENT.getData returns an outdated PSI element
if called in-place in the same EDT event the selection changes.
Fix by postponing the update using a state flow.
(cherry picked from commit e8568cdadbb2ee1332a2aedfd60a20c072840537)
IJ-CR-169482
GitOrigin-RevId: 1d4ddecba8c44dee25bcfe31b24518eedde2f7fd
The Switcher preferred size used to be computed
in the monolith using the number of files,
through the visibleRowCount property.
It was lost at some point when splitting the feature.
Bring it back.
There were some other UI code next to this line
that was also lost, that part is to be investigated
and discussed. But this line alone fixes the regression.
(cherry picked from commit 61eaa52e0742f6c450d35a2fdfe65cfa69b2894c)
IJ-CR-167210
GitOrigin-RevId: 8a16f3718a217db8583e22d9ae3cff29e715ac9f
Since the rename events occur really frequently and often without explicit user action (e.g. regenerated resource files - hello bazel!), they should not be added to the model after the rename itself.
(cherry picked from commit ded078a8592f34712f84678bdc801cd1a2c88853)
IJ-CR-166394
GitOrigin-RevId: 6c1416fe6675c45e8c159d3ab69f436b2d2c4d5e
Since virtual files can be invalidated after it is added to the model (e.g. add file -> invoke recent files -> remove file and immediately invoke recent files before buld VFS listener gets notified about the change), outdated files might be visible in the list. Same applies to external changes reflected in the VFS snapshot after a while.
Additional explicit validity check is needed when the model gets updated.
GitOrigin-RevId: fb391dcb364cc7c8acdbfc52365a0370bdd70c17
Also, support force pushing frontend-initiated updates to the backend model. This is needed to avoid relying on the backend editor to be opened - if at some point there will be no backend editor, the logic will still work as expected
GitOrigin-RevId: 03b76f8a0fffebcc1755aad2d9cba359efd55902
Assuming that selection changed might happen only for already existing editors, we want to make sure that if an event contains file that has not been opened, it does not get added to the model. The assumtion is based on a report from the issue that unrelated files appear in the switcher. From the logs it seems that files initially appear on the frontend side among the `frontendRecentFiles` list. The list in its turn gets assembled either from frontend editor selection history, or from a few events. Events like editor is opened/closed are not suspicious, but the selection update is. Thus, we are going to avoid adding files from the event to the model, only update those already present in it
GitOrigin-RevId: 567fa110273a17ec947696e6bb26897dc36ce9b6
Currently there is a mirroring state of recent files model on FE and BE, so when a change with uncertain scope happens, it is enough to tell backend to update presentations for its known state instead of asking frontend for this state as it was implemented before
GitOrigin-RevId: 4d22c3f23848225249da959ccda0d383ab8e7376
Recently changed files model was previously subsribed to VFS changes and did consume any file added to the VFS snapshot. This is incorrect behaviour, since in our understanding the recently changed files list must only contain files edited manually. Example: if a code generation tool produces N files in the project, they should not appear in the model. But if a user types in one of them, this exact file should.
The implementation now relies on frontend typing listener with a reasonable debounce (1 sec) that must cover only expected cases
GitOrigin-RevId: b9348336aead5171682cdb70fa52cdd08b8f8214
This is a fix for problems when a file does not get added to the model because of incorrect assumption that it must already be present there (update -> add)
GitOrigin-RevId: 92a13e2823cf9eae699b97b99217b4a7a0112637
This is required to be able to filter out irrelevant changes, e.g. when a file not present among recently opened files is modified. Thus the model now consists of the gateway that processes all changes and the state that stores the resulting list. On the frontend side only the resulting state is present as well, and it is accumulated just the same way as on the backend side.
GitOrigin-RevId: 5657dd604b7fec128481c76d452e4c31d3af22c2