Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Extension path in Jupyter Book extension should use context.extensionPath #37

Open
Charles-Gagnon opened this issue Sep 3, 2020 · 0 comments · May be fixed by #38
Open

Extension path in Jupyter Book extension should use context.extensionPath #37

Charles-Gagnon opened this issue Sep 3, 2020 · 0 comments · May be fixed by #38

Comments

@Charles-Gagnon
Copy link

Charles-Gagnon commented Sep 3, 2020

Currently the jupyter book template is using the hardcoded .azuredatastudio/extensions folder as the root to search for the extension folder.

https://github.com/llali/generator-azuredatastudio/blob/main/generators/app/templates/ext-jupyterbook/src/jupyter-book.ts#L13

This is bad for a couple reasons :

  1. The path might change - while that's pretty unlikely there's always the possibility we put the folder somewhere else or name it something different
  2. This won't work for other versions of ADS - for example our insiders builds have a .azuredatastudio-insiders folder that extensions are installed into
  3. It's unnecessary to iterate over all the other folders in that directory - that's just adding extra overhead

Instead you should use https://github.com/microsoft/azuredatastudio/blob/main/src/vs/vscode.d.ts#L5616 (which comes from the context passed to the activate function)

And so you should be able to get rid of most of this logic and just have this be in the activate function :

export function activate(context: vscode.ExtensionContext) {
    context.subscriptions.push(vscode.commands.registerCommand('launchBook.<%= name %>', () => {
        vscode.commands.executeCommand('bookTreeView.openBook', context.extensionPath, false);
    }));
@Charles-Gagnon Charles-Gagnon changed the title Extension path in Jupyter Book extension shouldn't be hardcoded Extension path in Jupyter Book extension should use context.extensionPath Sep 3, 2020
@laurajjiang laurajjiang linked a pull request Sep 4, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant