Skip to content

Commit 5f08c3e

Browse files
authored
Merge pull request #333 from painebot/tkp/scroll
Log on double command register to help find race condition, update demo
2 parents f85cd4a + 22ceac0 commit 5f08c3e

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ A plugin for JupyterLab that lets you set up and use as many filebrowsers as you
2020

2121
The backend is built on top of [PyFilesystem](https://github.com/PyFilesystem/pyfilesystem2) and [fsspec](https://filesystem-spec.readthedocs.io/en/latest/), while the frontend is built on top of [tree-finder](https://github.com/tree-finder/tree-finder).
2222

23+
![](https://raw.githubusercontent.com/jpmorganchase/jupyter-fs/main/docs/img/demo.gif)
2324

2425
## Install
2526

@@ -176,7 +177,7 @@ Similar to PyFilesystem, `fsspec` also allows for a `"url"` based opening scheme
176177

177178
## Server-side settings
178179

179-
If you prefer to set up your filesystem resources in the server-side config, you can do so. For example, you can set up a local filesystem by adding the following to your `jupyter_server_config.py` file:
180+
If you prefer to set up your filesystem resources in the server-side config, you can do so. For example, you can set up a local filesystem by adding the following to your `jupyter_server_config.py` file (or `jupyter_lab_config.py` or `jupyter_notebook_config.py` depending on your setup):
180181

181182
```python
182183
c.JupyterFs.resources = [

docs/img/demo.gif

628 KB
Loading

js/src/commands.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,17 @@ export async function createDynamicCommands(
477477
items = [...factories].map(factory => {
478478
const key = _openWithKeyForFactory(factory.label || factory.name);
479479
const label = factory.label || factory.name;
480-
openWithCommands.push(app.commands.addCommand(key, {
481-
execute: args => Promise.all(Array.from(map(model.selection, item => app.commands.execute("docmanager:open", { path: Path.fromarray(item.row.path), ...args })))),
482-
label,
483-
isVisible: () => true,
484-
}));
480+
if (!app.commands.hasCommand(key)) {
481+
openWithCommands.push(app.commands.addCommand(key, {
482+
execute: args => Promise.all(Array.from(map(model.selection, item => app.commands.execute("docmanager:open", { path: Path.fromarray(item.row.path), ...args })))),
483+
label,
484+
isVisible: () => true,
485+
}));
486+
} else {
487+
// Update label in case it has changed
488+
// eslint-disable-next-line no-console
489+
console.log("Skipping existing command:", key);
490+
}
485491
return openWith.addItem({
486492
args: { factory: factory.name, label: factory.label || factory.name },
487493
command: key,

0 commit comments

Comments
 (0)