However, it's possible for getRemoteEditors() to return null. When that happens, the file finder fails to show any local files. Instead, it shows "Project is empty", and we see an error in the console:
This pull request teaches the fuzzy-finder to gracefully handle a null return value from getRemoteEditors().
Alternate Designs
We could change Teletype's getRemoteEditors() method to return an empty array instead of returning null. (I intend to open a pull request for that change soon.) However, Teletype is not presently bundled with Atom. If we only fix the issue in Teletype, people might not realize that they need to upgrade Teletype in order to fix this behavior in the fuzzy finder. Since fuzzy-finder is bundled with Atom, we can fix this issue in fuzzy-finder and guarantee that people get this fix when they upgrade Atom.
Verification process
[x] Verify file finder shows local files when Teletype is enabled and getRemoteEditors() returns null
[x] Verify file finder shows local files and remote files when Teletype is enabled and getRemoteEditors() returns nonempty list of remote editors
[x] Verify file finder shows local files Teletype is disabled
[x] Verify file finder shows local files Teletype is not installed
Note: Because @annthurium first observed this issue with Teletype 0.10.0, I'll run through the verification process above with Teletype 0.10.0 and the current version (0.11.0).
Description of the Change
If teletype is installed and enabled, the file finder asks the teletype service for a list of remote editors:
https://github.com/atom/fuzzy-finder/blob/8c3c074f8dbff7a82b323c15af14889307dcf3b2/lib/project-view.js#L61
fuzzy-finder then iterates over the list of remote editors:
https://github.com/atom/fuzzy-finder/blob/8c3c074f8dbff7a82b323c15af14889307dcf3b2/lib/project-view.js#L62
However, it's possible for
getRemoteEditors()
to returnnull
. When that happens, the file finder fails to show any local files. Instead, it shows "Project is empty", and we see an error in the console:This pull request teaches the fuzzy-finder to gracefully handle a null return value from
getRemoteEditors()
.Alternate Designs
We could change Teletype's
getRemoteEditors()
method to return an empty array instead of returning null. (I intend to open a pull request for that change soon.) However, Teletype is not presently bundled with Atom. If we only fix the issue in Teletype, people might not realize that they need to upgrade Teletype in order to fix this behavior in the fuzzy finder. Since fuzzy-finder is bundled with Atom, we can fix this issue in fuzzy-finder and guarantee that people get this fix when they upgrade Atom.Verification process
getRemoteEditors()
returns nullgetRemoteEditors()
returns nonempty list of remote editorsNote: Because @annthurium first observed this issue with Teletype 0.10.0, I'll run through the verification process above with Teletype 0.10.0 and the current version (0.11.0).