atom / fuzzy-finder

Find and open files quickly
MIT License
274 stars 138 forks source link

Fix "Project is empty" issue when using Teletype #343

Closed jasonrudolph closed 6 years ago

jasonrudolph commented 6 years ago

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 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:

screen shot 2018-04-02 at 12 26 58 pm

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

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).