Skip to content

Commit

Permalink
Merge pull request #226 from sourcery-ai/ben/sou-1988-bug-webview-not…
Browse files Browse the repository at this point in the history
…-loading-on-windows

fix: adjust path parsing to allow correct URI on Windows
  • Loading branch information
bm424 authored Sep 20, 2023
2 parents a3fc5ac + 2dacd1c commit 496f1be
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export class ChatProvider implements vscode.WebviewViewProvider {

constructor(private _context: vscode.ExtensionContext) {
this._extensionUri = _context.extensionUri;
this._assetsUri = vscode.Uri.parse(getCodingAssistantAssetsPath());
const _assetsPath = getCodingAssistantAssetsPath();
// Parsing the path using `file` rather than `parse` allows it to work on Windows
// See https://github.com/microsoft/vscode-uri/blob/5af89bac2109c0dc7f904b20cc88cac0568747b1/src/uri.ts#L309-L311
this._assetsUri = vscode.Uri.file(_assetsPath);
}

public async resolveWebviewView(
Expand All @@ -55,6 +58,9 @@ export class ChatProvider implements vscode.WebviewViewProvider {
_token: vscode.CancellationToken
) {
this._view = webviewView;
console.log(
`Initialising webview. Assets URI: ${this._assetsUri}; Extension URI: ${this._extensionUri}`
);

webviewView.webview.options = {
// Allow scripts in the webview
Expand Down

0 comments on commit 496f1be

Please sign in to comment.