This can be better with two separate if as below by pulling out the common logic into the first if condition.

````
if (!DocumentManager.getCurrentDocument()) {
    if ((!file && EditorManager.getCurrentlyViewedPath()) ||
            (file && file.fullPath === EditorManager.getCurrentlyViewedPath())) {
````