-
Notifications
You must be signed in to change notification settings - Fork 297
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
setting runStartupCommands as array #913
Comments
Happy to submit a PR for this. Would it be this line that needs changing? |
Yeah that would be the line where you'd read it. You'd also have to change the type of that value in https://github.com/microsoft/vscode-python/blob/27dfd87f19569451e237760aff2945628d076d3c/src/client/common/types.ts#L392 (maybe to a 'string | string[]') and the definition of the setting in the package.json. |
What's the syntax for "type" in "python.dataScience.runStartupCommands": {
"type": "string | string[]",
// ...
} |
I don't believe it supports an |
Should I add a test for the array form of |
Yeah a unit test for the notebook would probably be good. |
Or in the notebook.functional.test.ts. Probably easier to just add a test there that sets runStartupCommands and check that they were run. |
I'm a little out of my depth with the test suite here. For one thing, trying to setup testing with runTest('runStartupCommands as array', async () => {
ioc.getSettings().datascience.runStartupCommands = [
'%load_ext autoreload',
'%autoreload 2',
'import sys',
"sys.path.append('${workspaceFolder}')",
'a=1'
];
const exec = ioc.get<IJupyterExecution>(IJupyterExecution);
await exec.dispose();
}); |
As far as testing, I'd check if the right versions of everything are installed, based on our CONTRIBUTING.md. Note that |
A way to verify that run startup commands in an array works would be to do something like so:
|
Sorry you'll also need to add mock values for the different executions (we run our tests without jupyter during PRs)
This should allow the test to pass during a PR. |
@rchiodo Thanks for helping with the test! |
@joyceerhl I did install
|
* add option to set dataScience.runStartupCommands as array (#12827) * appease hygiene CI with if statement braces :) Co-authored-by: Joyce Er <joyceerhuiling@gmail.com> * add news entry * add functional test for runStartupCommands * fix linter issue (hopefully) Co-authored-by: Joyce Er <joyceerhuiling@gmail.com>
Minor suggestion for improvement:
python.dataScience.runStartupCommands
must currently be a string. If you use it to run more than one or two commands, the string gets quite long, requiring a lot of horizontal scrolling, making it hard to read and even harder to modify.How about also allowing that setting to be an array? If an array is detected, simply convert it to string internally:
Then you could have
instead of
Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl
The text was updated successfully, but these errors were encountered: