-
Notifications
You must be signed in to change notification settings - Fork 8
use extension context for notebook search #38
base: main
Are you sure you want to change the base?
Conversation
|
||
// Each notebook or markdown file packaged with your extension will be found through this | ||
// function so that they can be individually opened through the `showNotebookDocument` command. | ||
const extractNotebooksFromFolder = (fullFolderPath: string, notebookNames: Array<string>) => { | ||
const extractNotebooksFromFolder = (fullFolderPath: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a return type to the method signature :string[]
@@ -65,7 +35,7 @@ const getFolderContent = (folderPath: string) => { | |||
// to occur when you launch the book, add to the activate function. | |||
export function activate(context: vscode.ExtensionContext) { | |||
context.subscriptions.push(vscode.commands.registerCommand('launchNotebooks.<%= name %>', () => { | |||
let notebooksToDisplay: Array<string> = processNotebooks(); | |||
let notebooksToDisplay: Array<string> = extractNotebooksFromFolder(context.extensionPath); | |||
notebooksToDisplay.forEach(name => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upon extension activation, this will open all the notebooks? sounds scary 😨
|
||
// Each notebook or markdown file packaged with your extension will be found through this | ||
// function so that they can be individually opened through the `showNotebookDocument` command. | ||
const extractNotebooksFromFolder = (fullFolderPath: string, notebookNames: Array<string>) => { | ||
const extractNotebooksFromFolder = (fullFolderPath: string) => { | ||
let notebookNames: Array<string> = []; | ||
const files = getFolderContent(fullFolderPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i read this correctly, you only handle the files in the top level folder without recursively going to the sub folders, by design?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes themselves looks good to me, but I left some questions for the code that were not changed by this PR.
This PR fixes #37 - updates what the notebook and Jupyter book extensions using extension.contextPath to find files.