Skip to content

Commit

Permalink
it works!
Browse files Browse the repository at this point in the history
  • Loading branch information
sadasant committed May 26, 2022
1 parent 52e5687 commit bb37293
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
2 changes: 0 additions & 2 deletions src/platform/common/platform/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export class FileSystem implements IFileSystem {
}

async getFiles(dir: vscode.Uri): Promise<vscode.Uri[]> {
console.log('getFiles', { dir });
const files = await this.vscfs.readDirectory(dir);
console.log({ files });
return files.filter((f) => f[1] === vscode.FileType.File).map((f) => vscode.Uri.file(f[0]));
}

Expand Down
7 changes: 3 additions & 4 deletions src/webviews/extension-side/variablesView/variableView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// Licensed under the MIT License.
'use strict';
import '../../../platform/common/extensions';

import { Uri, WebviewView as vscodeWebviewView } from 'vscode';

import { joinPath } from '../../../platform/vscode-path/resources';
import { captureTelemetry, sendTelemetryEvent } from '../../../telemetry';
import { INotebookWatcher, IVariableViewPanelMapping } from './types';
import { VariableViewMessageListener } from './variableViewMessageListener';
Expand Down Expand Up @@ -58,14 +57,14 @@ export class VariableView extends WebviewViewHost<IVariableViewPanelMapping> imp
private readonly commandManager: ICommandManager,
private readonly documentManager: IDocumentManager
) {
const variableViewDir = Uri.joinPath(context.extensionUri, 'out', 'webviews', 'webview-side', 'viewers');
const variableViewDir = joinPath(context.extensionUri, 'out', 'webviews', 'webview-side', 'viewers');
super(
configuration,
workspaceService,
(c, d) => new VariableViewMessageListener(c, d),
provider,
variableViewDir,
[Uri.joinPath(variableViewDir, 'variableView.js')]
[joinPath(variableViewDir, 'variableView.js')]
);

// Sign up if the active variable view notebook is changed, restarted or updated
Expand Down
23 changes: 0 additions & 23 deletions src/webviews/extension-side/webviews/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,12 @@ export abstract class Webview implements IWebview {

// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected async generateLocalReactHtml() {
console.log('AAAAAA');
if (!this.webviewHost?.webview) {
throw new Error('WebView not initialized, too early to get a Uri');
}
console.log('BBBBBB');

const uriBase = this.webviewHost?.webview.asWebviewUri(this.options.cwd).toString();
console.log({ uriBase });
const uris = this.options.scripts.map((script) => this.webviewHost!.webview!.asWebviewUri(script));
console.log({ uris });
let testFiles: Uri[] = [];
try {
testFiles = await this.fs.getFiles(this.options.rootPath);
} catch (e) {
console.log(e);
}

console.log({ testFiles });

// This method must be called so VSC is aware of files that can be pulled.
// Allow js and js.map files to be loaded by webpack in the webview.
testFiles
.filter((f) => {
const ext = uriPath.extname(f).toLowerCase();
return ext === '.js' || ext === '.js.map';
})
.forEach((f) => this.webviewHost?.webview!.asWebviewUri(f));

const rootPath = this.webviewHost.webview.asWebviewUri(this.options.rootPath).toString();
const fontAwesomePath = this.webviewHost.webview
Expand All @@ -114,7 +93,6 @@ export abstract class Webview implements IWebview {
)
)
.toString();
console.log({ rootPath, fontAwesomePath });

// Change to `true` to force on Test middleware for our react code
const forceTestMiddleware = 'false';
Expand Down Expand Up @@ -160,7 +138,6 @@ export abstract class Webview implements IWebview {
try {
if (this.webviewHost?.webview) {
const localFilesExist = await Promise.all(this.options.scripts.map((s) => this.fs.exists(s)));
console.log({ scripts: this.options.scripts, localFilesExist });
if (localFilesExist.every((exists) => exists === true)) {
// Call our special function that sticks this script inside of an html page
// and translates all of the paths to vscode-resource URIs
Expand Down

0 comments on commit bb37293

Please sign in to comment.