sortDocuments(e) {
    let t = 0, r = e.length - 1;
    for (; t < r; ) {
      for (; t < e.length && this.hasTextDocument(e[t]); )
        t++;
      for (; r >= 0 && !this.hasTextDocument(e[r]); )
        r--;
      t < r && ([e[t], e[r]] = [e[r], e[t]]);
    }
    return e;
  }
Sort the given documents by priority. By default, documents with an open text document are prioritized.
This is useful to ensure that visible documents show their diagnostics before all other documents.

This improves the responsiveness in large workspaces as users usually don't care about diagnostics
in files that are currently not opened in the editor.