Skip to content

Commit e6c627c

Browse files
authored
Cherry pick commits from master into April release (#11138)
* Load widget scripts from CDN and/or local python interpreter (#10987) * Address sonar issues * Fix linter * Fixes * Better way to pas array buffer * Added comments * Oops * Copy widget scripts to extension folder (#11082) * Copy widget scripts to extension folder * Fix test * Remove aml scripts from extension (#11085) * Validate python when nb opened not on extension activates (#11087) For #10893 * Support workspace images in markdown cells (#11086) For #10893 * Fix functional tests for ipywidgets and download just chrome b… (#11093) For #11092 playwright downloads other browsers, we need just one chrome (as this is closest to what VSCode is built upon) * Added tests for k3d widget (#11133) For #10799, #11096 * Fix failing ipywidget tests (#11132) For #11099 * Update change log
1 parent 438aa3d commit e6c627c

File tree

80 files changed

+2628
-906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2628
-906
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@
3333
([#11021](https://github.com/Microsoft/vscode-python/issues/11021))
3434
1. Hide "untrusted" interpreters from 'Select interpreter' dropdown list when in DeprecatePythonPath Experiment.
3535
([#11046](https://github.com/Microsoft/vscode-python/issues/11046))
36+
1. Make spacing of icons on notebook toolbars match spacing on other VS code toolbars.
37+
([#10464](https://github.com/Microsoft/vscode-python/issues/10464))
38+
1. Make jupyter server status centered in the UI and use the same font as the rest of VS code.
39+
([#10465](https://github.com/Microsoft/vscode-python/issues/10465))
40+
1. Performa validation of interpreter only when a Notebook is opened instead of when extension activates.
41+
([#10893](https://github.com/Microsoft/vscode-python/issues/10893))
42+
1. Scrolling in cells doesn't happen on new line.
43+
([#10952](https://github.com/Microsoft/vscode-python/issues/10952))
44+
1. Ensure images in workspace folder are supported within markdown cells in a `Notebook`.
45+
([#11040](https://github.com/Microsoft/vscode-python/issues/11040))
46+
1. Make sure ipywidgets have a white background so they display in dark themes.
47+
([#11060](https://github.com/Microsoft/vscode-python/issues/11060))
48+
1. Arrowing down through cells put the cursor in the wrong spot.
49+
([#11094](https://github.com/Microsoft/vscode-python/issues/11094))
3650

3751
### Fixes
3852

build/conda-functional-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ pythreejs
2121
ipyvolume
2222
beakerx
2323
bqplot
24+
K3D

build/webpack/webpack.datascience-ui.config.builder.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,6 @@ function buildConfiguration(isNotebook) {
105105
{
106106
from: path.join(constants.ExtensionRootDir, 'node_modules/font-awesome/**/*'),
107107
to: path.join(constants.ExtensionRootDir, 'out', 'datascience-ui', 'common', 'node_modules')
108-
},
109-
{
110-
from: path.join(constants.ExtensionRootDir, 'out/ipywidgets/azureml/azuremlindex.js'),
111-
to: path.join(constants.ExtensionRootDir, 'out', 'datascience-ui', bundleFolder)
112-
},
113-
{
114-
from: path.join(constants.ExtensionRootDir, 'out/ipywidgets/azureml/azuremlregistration.js'),
115-
to: path.join(constants.ExtensionRootDir, 'out', 'datascience-ui', bundleFolder)
116108
}
117109
]
118110
);

news/2 Fixes/10464.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/2 Fixes/10465.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/2 Fixes/10952.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/2 Fixes/11060.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/2 Fixes/11094.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

Lines changed: 77 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,10 +1636,22 @@
16361636
"description": "Allows a user to import a jupyter notebook into a python file anytime one is opened.",
16371637
"scope": "resource"
16381638
},
1639-
"python.dataScience.loadWidgetScriptsFromThirdPartySource": {
1640-
"type": "boolean",
1641-
"default": false,
1642-
"description": "Enables loading of scripts files for Widgets (ipywidgest, bqplot, beakerx, ipyleaflet, etc) from https://unpkg.com.",
1639+
"python.dataScience.widgetScriptSources": {
1640+
"type": "array",
1641+
"default": [],
1642+
"items": {
1643+
"type": "string",
1644+
"enum": [
1645+
"jsdelivr.com",
1646+
"unpkg.com"
1647+
],
1648+
"enumDescriptions": [
1649+
"Loads widget (javascript) scripts from https://www.jsdelivr.com/",
1650+
"Loads widget (javascript) scripts from https://unpkg.com/"
1651+
]
1652+
},
1653+
"uniqueItems": true,
1654+
"markdownDescription": "Defines the location and order of the sources where scripts files for Widgets are downloaded from (e.g. ipywidgest, bqplot, beakerx, ipyleaflet, etc). Not selecting any of these could result in widgets not rendering or function correctly. See [here](https://aka.ms/PVSCIPyWidgets) for more information. Once updated you will need to restart the Kernel.",
16431655
"scope": "machine"
16441656
},
16451657
"python.dataScience.gatherRules": {
@@ -2995,6 +3007,7 @@
29953007
"request": "^2.87.0",
29963008
"request-progress": "^3.0.0",
29973009
"rxjs": "^5.5.9",
3010+
"sanitize-filename": "^1.6.3",
29983011
"semver": "^5.5.0",
29993012
"stack-trace": "0.0.10",
30003013
"string-argv": "^0.3.1",
@@ -3171,7 +3184,7 @@
31713184
"node-has-native-dependencies": "^1.0.2",
31723185
"node-html-parser": "^1.1.13",
31733186
"nyc": "^15.0.0",
3174-
"playwright": "^0.11.1",
3187+
"playwright-chromium": "^0.13.0",
31753188
"postcss": "^7.0.27",
31763189
"postcss-cssnext": "^3.1.0",
31773190
"postcss-import": "^12.0.1",
@@ -3195,7 +3208,6 @@
31953208
"requirejs": "^2.3.6",
31963209
"rewiremock": "^3.13.0",
31973210
"rimraf": "^3.0.2",
3198-
"sanitize-filename": "^1.6.3",
31993211
"sass-loader": "^7.1.0",
32003212
"serialize-javascript": "^2.1.2",
32013213
"shortid": "^2.2.8",

package.nls.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
"Common.reload": "Reload",
146146
"Common.moreInfo": "More Info",
147147
"Common.and": "and",
148+
"Common.ok": "Ok",
148149
"Common.install": "Install",
149150
"Common.learnMore": "Learn more",
150151
"OutputChannelNames.languageServer": "Python Language Server",
@@ -464,6 +465,7 @@
464465
"DataScience.jupyterSelectURIRemoteDetail": "Specify the URI of an existing server",
465466
"DataScience.gatherQuality": "Did gather work as desired?",
466467
"DataScience.loadClassFailedWithNoInternet": "Error loading {0}:{1}. Internet connection required for loading 3rd party widgets.",
467-
"DataScience.loadThirdPartyWidgetScriptsDisabled": "Loading of Widgets is disabled by default. Click <a href='https://command:python.datascience.loadWidgetScriptsFromThirdPartySource'>here</a> to enable the setting 'python.dataScience.loadWidgetScriptsFromThirdPartySource'. Once enabled you will need to restart the Kernel",
468-
"DataScience.loadThirdPartyWidgetScriptsPostEnabled": "Please restart the Kernel when changing the setting 'loadWidgetScriptsFromThirdPartySource'."
468+
"DataScience.useCDNForWidgets": "Widgets require us to download supporting files from a 3rd party website. Click [here](https://aka.ms/PVSCIPyWidgets) for more information.",
469+
"DataScience.loadThirdPartyWidgetScriptsPostEnabled": "Please restart the Kernel when changing the setting 'python.dataScience.widgetScriptSources'.",
470+
"DataScience.enableCDNForWidgetsSetting": "Widgets require us to download supporting files from a 3rd party website. Click <a href='https://command:python.datascience.enableLoadingWidgetScriptsFromThirdPartySource'>here</a> to enable this or click <a href='https://aka.ms/PVSCIPyWidgets'>here</a> for more information. (Error loading {0}:{1})."
469471
}

src/client/common/application/types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,18 @@ export type WebPanelMessage = {
10451045
// Wraps the VS Code webview panel
10461046
export const IWebPanel = Symbol('IWebPanel');
10471047
export interface IWebPanel {
1048+
/**
1049+
* Convert a uri for the local file system to one that can be used inside webviews.
1050+
*
1051+
* Webviews cannot directly load resources from the workspace or local file system using `file:` uris. The
1052+
* `asWebviewUri` function takes a local `file:` uri and converts it into a uri that can be used inside of
1053+
* a webview to load the same resource:
1054+
*
1055+
* ```ts
1056+
* webview.html = `<img src="${webview.asWebviewUri(vscode.Uri.file('/Users/codey/workspace/cat.gif'))}">`
1057+
* ```
1058+
*/
1059+
asWebviewUri(localResource: Uri): Uri;
10481060
setTitle(val: string): void;
10491061
/**
10501062
* Makes the webpanel show up.
@@ -1082,6 +1094,11 @@ export interface IWebPanelOptions {
10821094
listener: IWebPanelMessageListener;
10831095
title: string;
10841096
rootPath: string;
1097+
/**
1098+
* Additional paths apart from cwd and rootPath, that webview would allow loading resources/files from.
1099+
* E.g. required for webview to serve images from worksapces when nb is in a nested folder.
1100+
*/
1101+
additionalPaths?: string[];
10851102
scripts: string[];
10861103
startHttpServer: boolean;
10871104
cwd: string;

src/client/common/application/webPanels/webPanel.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ export class WebPanel implements IWebPanel {
2828
private disposableRegistry: IDisposableRegistry,
2929
private port: number | undefined,
3030
private token: string | undefined,
31-
private options: IWebPanelOptions
31+
private options: IWebPanelOptions,
32+
additionalRootPaths: Uri[] = []
3233
) {
3334
const webViewOptions: WebviewOptions = {
3435
enableScripts: true,
35-
localResourceRoots: [Uri.file(this.options.rootPath), Uri.file(this.options.cwd)],
36+
localResourceRoots: [Uri.file(this.options.rootPath), Uri.file(this.options.cwd), ...additionalRootPaths],
3637
portMapping: port ? [{ webviewPort: RemappedPort, extensionHostPort: port }] : undefined
3738
};
3839
if (options.webViewPanel) {
@@ -71,6 +72,12 @@ export class WebPanel implements IWebPanel {
7172
this.panel.dispose();
7273
}
7374
}
75+
public asWebviewUri(localResource: Uri) {
76+
if (!this.panel) {
77+
throw new Error('WebView not initialized, too early to get a Uri');
78+
}
79+
return this.panel?.webview.asWebviewUri(localResource);
80+
}
7481

7582
public isVisible(): boolean {
7683
return this.panel ? this.panel.visible : false;
@@ -161,7 +168,7 @@ export class WebPanel implements IWebPanel {
161168
<meta name="theme" content="${Identifiers.GeneratedThemeName}"/>
162169
<title>VS Code Python React UI</title>
163170
<base href="${uriBase}${uriBase.endsWith('/') ? '' : '/'}"/>
164-
<link rel="stylesheet" href="${rootPath}/../common/node_modules/font-awesome/css/font-awesome.min.css">
171+
<link rel="stylesheet" href="${rootPath}/../common/node_modules/font-awesome/css/font-awesome.min.css">
165172
</head>
166173
<body>
167174
<noscript>You need to enable JavaScript to run this app.</noscript>

0 commit comments

Comments
 (0)