Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,28 @@ export class LocalWidgetScriptSourceProvider implements IWidgetScriptSourceProvi

const validFiles = files.filter((file) => {
// Should be of the form `<widget module>/index.js`
const parts = file.split('/'); // On windows this uses the unix separator too.
let parts = file.split('/'); // On windows this uses the unix separator too.
if (parts.length === 1) {
// Fall back if search API changes and returns results with OS path sep.
parts = file.split('\\');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically future proofing the code.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should port this change into master then.

}
if (parts.length !== 2) {
traceError('Incorrect file found when searching for nnbextension entrypoints');
traceError(`Incorrect file found when searching for nnbextension entrypoints ${file}`);
return false;
}
return true;
});

const mappedFiles = validFiles.map(async (file) => {
// Should be of the form `<widget module>/index.js`
const parts = file.split('/');
let parts = file.split('/'); // On windows this uses the unix separator too.
if (parts.length === 1) {
// Fall back if search API changes and returns results with OS path sep.
parts = file.split('\\');
}
const moduleName = parts[0];

const fileUri = Uri.file(path.join(nbextensionsPath, file));
const fileUri = Uri.file(path.join(nbextensionsPath, moduleName, parts[1]));
const scriptUri = (await this.localResourceUriConverter.asWebviewUri(fileUri)).toString();
// tslint:disable-next-line: no-unnecessary-local-variable
const widgetScriptSource: WidgetScriptSource = { moduleName, scriptUri, source: 'local' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { InterpreterService } from '../../../client/interpreter/interpreterServi

// tslint:disable: no-any no-invalid-this

suite('xxxData Science - ipywidget - Widget Script Source Provider', () => {
suite('Data Science - ipywidget - Widget Script Source Provider', () => {
let scriptSourceProvider: IPyWidgetScriptSourceProvider;
let notebook: INotebook;
let configService: IConfigurationService;
Expand Down