What does IFileBrowserFactory.defaultBrowser do?

Question 1: What does IFileBrowserFactory.defaultBrowser do in the jupyterlab-git extension? I believe it’s an object that creates filebrowsers, but not sure why it’s needed.

The git extension integrates with the file browser in several ways:

  • when the directory is changed it check if the new directory is a git repository and updates the button for cloning (and state of the extension models) accordingly; this is implemented by listening on IFileBrowserFactory.defaultBrowser.model.pathChanged (which assumes that the default file browser is used),
  • when user right-clicks/opens context menu for any file a “Git” sub-menu which allows to git track/ignore/add/remove the selected file or files (see https://github.com/jupyterlab/jupyterlab-git/pull/877)
  • (in future we may want to highlight modified file)

Question 2: Why is IFileBrowserFactory undefined in my extension? Do I need to use other jupyterlab packages to activate it?

I cannot answer confidently without seeing your code, but I would guess that it might be missing in the list or required tokens (requires field in plugin: JupyterFrontEndPlugin<something> object), which for jupyterlab-git is in:

2 Likes