-
Notifications
You must be signed in to change notification settings - Fork 108
Add notebook.workingDirectory
setting
#8558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
E2E Tests 🚀 |
fb3b7c2
to
2f79d0b
Compare
723280c
to
a838fb7
Compare
notebook.workingDirectory
setting
c041ad5
to
6124250
Compare
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.
This is some good stuff. The tests are great and you even remembered to update the dates in the headers! (2025/2025 points).
Some comments on the config setting itself.
}, | ||
// --- Start Positron --- | ||
[NotebookSetting.workingDirectory]: { | ||
markdownDescription: nls.localize('notebook.workingDirectory', "Default working directory for notebook kernels. Supports variables like `${workspaceFolder}`. When empty, uses the notebook file's directory. Any change to this setting will apply to future opened notebooks."), | ||
type: 'string', | ||
default: '', | ||
scope: ConfigurationScope.RESOURCE |
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.
My only thought is it may get confusion when we're all-in on positron notebooks that this setting is in the original vscode notebooks contrib. I'm not sure we will respect every one of the original vscode notebook config options. I don't think it should go in the positron notebooks one though... So this is probably good for now and then maybe in the future we will split out to a new Switzerland positron(the editor)-specific-notebook-configs section?
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.
yeah, makes sense! We probably will still at least want to use the notebooks.
prefix right? (I put the setting here because I thought it should start with that prefix since it only applies to notebooks)
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
Outdated
Show resolved
Hide resolved
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.
Nicely done! Works as expected when changing the setting to ${workspaceFolder}
as well as ${workspaceFolder}/mypkg
where mypkg
exists, in both R and Python.
When I set it to a nonexistent folder like ${workspaceFolder}/mypkg2
or a bad template like ${workspaceFolder2}
it seemed to default to ${workspaceFolder}
, although I don't see where that's handled. Should we handle and/or test those cases?
extensions/positron-python/python_files/posit/positron/positron_jedilsp.py
Outdated
Show resolved
Hide resolved
Oh nice catch, I thought I tried this but that's different behavior from what I'd expect (I think I'd expect it to fall back to the parent dir). Turns out this is happening in kallichore. If the directory doesn't exist, it defaults to the pwd, which is the workspace root. Maybe I'll verify that the directory exists at the end of |
Okay, I just moved the default behavior of "if the setting doesn't resolve to an existing directory, use the notebook's parent" up the stack to when we're creating the RuntimeSession metadata (in |
I'll have to fix the Python tests and add an e2e test. |
Addresses #7988. Adds a
notebook.workingDirectory
setting and hides thejupyter.notebookFileRoot
setting, which doesn't work in Positron.Release Notes
New Features
notebook.workingDirectory
setting, which can be used to set the default working directory for notebooks (jupyter.notebookFileRoot
setting has no effect #7988)Bug Fixes
QA Notes
@:notebooks @:vscode-settings @:console @:extensions @:interpreter @:win
I added some unit tests but no e2e tests.
Some things to try:
jupyter.notebookFileRoot
setting should no longer exist%pwd
, and see its value for different values of the new setting (note you need to close/open the notebook for the change to take effect):${workspaceFolder}
${fileDirname}
${userHome}
/some/path/that/exists
/some/path/that/doesnt/exist
getwd()
) or Python (os.getcwd()
) notebooks, and for VSC or Positron notebooks