Skip to content

Commit

Permalink
Fix wsl rdb bugs (#478)
Browse files Browse the repository at this point in the history
* Fix wsl rdb bugs

* Fix package.json local refs

* Fix wording

* restore package-lock

* Fix package-lock (again)

* Fix unit tests
  • Loading branch information
TwitchBronBron committed Apr 27, 2023
1 parent 32706e6 commit 5a557b0
Show file tree
Hide file tree
Showing 8 changed files with 2,629 additions and 1,377 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/mockVscode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ export let vscode = {
},
onDidChangeTextEditorSelection: () => { },
registerUriHandler: () => { },
registerWebviewViewProvider: () => { },
registerWebviewViewProvider: () => {
return {
asWebViewUri: () => { }
};
},
showSaveDialog: () => {
return Promise.resolve('');
},
Expand Down
13 changes: 12 additions & 1 deletion src/viewProviders/BaseWebviewViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ export abstract class BaseWebviewViewProvider implements vscode.WebviewViewProvi
return this.getIndexHtml();
}

/**
* Get a webview-supported URI for the given path
*/
private asWebviewUri(...parts: string[]) {
return this.view?.webview?.asWebviewUri?.(
vscode.Uri.file(
path.join(...parts)
)
);
}

private getIndexHtml() {
let html: string;
try {
Expand All @@ -146,7 +157,7 @@ export abstract class BaseWebviewViewProvider implements vscode.WebviewViewProvi
//the data that will be replaced in the index.html
const data = {
viewName: this.id,
baseHref: vscode.Uri.file(this.webviewBasePath).with({ scheme: 'vscode-resource' }) + '/',
baseHref: `${this.asWebviewUri(this.webviewBasePath)}/`,
additionalScriptContents: this.additionalScriptContents().join('\n ')
};
/**
Expand Down
Loading

0 comments on commit 5a557b0

Please sign in to comment.