Fuzzy application search results for Gnome Search
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
| Version | Status |
|---|---|
| 27 | Active |
| 26 | Active |
| 25 | Active |
| 24 | Active |
| 23 | Active |
| 22 | Rejected |
| 21 | Rejected |
| 20 | Active |
| 19 | Active |
| 18 | Active |
| 17 | Inactive |
| 16 | Active |
| 15 | Active |
| 14 | Inactive |
| 13 | Active |
| 12 | Active |
| 11 | Active |
| 10 | Active |
| 9 | Rejected |
| 8 | Rejected |
| 7 | Rejected |
| 6 | Rejected |
| 5 | Rejected |
| 4 | Rejected |
| 3 | Active |
| 2 | Active |
| 1 | Active |
Hi, I've finally gotten around to fixing the bugs I introduced when putting in the catch blocks and Promise rejects! ^^ Here's to hoping I haven't done anything very wrong this time
Oh yeah, also, I've added a new linter to my editor which told me that many of the functions can be made async instead of returning Promises, so I did that
It seems as though you still have uncaught promise rejections in your code, such as line 184 in indexUtils.js. `FileUtils.listDirectory()` returns a Promise with no catch clause, which is awaited in `Index.updateIndex()`. This is called in `Search.refresh()` in applicationUtils.js, but that chain of function calls has no catch clause and isn't awaited inside a `try..catch` block. In the case of `FileUtils.readFileOr()`, the Promise will never resolve with `loadOk == false`, because the Promise will reject with an error. Thus you should simply be doing: ```js function readFileOr(path, defaultValue) { return new Promise((resolve, reject) => { const file = Gio.File.new_for_path(path); file.load_contents_async(null, (_src, res) => { try { const data = file.load_contents_finish(res)[1]; resolve(ByteArray.toString(data)); } catch (e) { resolve(defaultValue); } }); }); } ``` In the case of `FileUtils.writeToFile()` you can save some work and just call `Gio.File.replace_contents_bytes_async()`, which will automatically overwrite the file if it exists, or create it if not. I also think your `iteratePromises()` function adds some unnecessary complexity, probably could just use `Promise.all()` or an async loop, but that's not a necessary fix for approval here. I think the above issues are all that would be necessary for approval, although some cleanup would probably make your debugging a lot easier in the future :)
godDAMMIT! (I'll do that, and THANK YOU for telling me about `Promise.all`, I didn't find that when I googled and was getting really mad at JS for not having that built-in ^^) And about the `Gio.File.replace_contents_bytes_async()` thing, when I wrote that code I was happy that I'd found a way to write files at all, because a lot of the methods on https://gjs-docs.gnome.org/gio20~2.66p-file just refused to work for me. I'll definitely swap that out for a simpler method if that doesn't break anything Would you mind rejecting all this review and https://extensions.gnome.org/review/29254 , so I can have four in a row?
Yeah, I'll be sticking to `for` loops instead of `Promise.all`, I think that's a little clearer, if that's alright