From e20d294dadaedc3418671960d9280526b46eac0f Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 20 Sep 2023 11:38:18 +0100 Subject: [PATCH 1/3] fix: adjust path parsing to allow correct URI on Windows --- src/chat.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chat.ts b/src/chat.ts index 18b8e082..613cc07e 100644 --- a/src/chat.ts +++ b/src/chat.ts @@ -46,7 +46,7 @@ export class ChatProvider implements vscode.WebviewViewProvider { constructor(private _context: vscode.ExtensionContext) { this._extensionUri = _context.extensionUri; - this._assetsUri = vscode.Uri.parse(getCodingAssistantAssetsPath()); + this._assetsUri = vscode.Uri.file(getCodingAssistantAssetsPath()); } public async resolveWebviewView( @@ -55,6 +55,7 @@ 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 From bb1f097d3ccb04475dea267eb74c3ae768ff5dae Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 20 Sep 2023 11:52:15 +0100 Subject: [PATCH 2/3] docs: add a note --- src/chat.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chat.ts b/src/chat.ts index 613cc07e..768f66ff 100644 --- a/src/chat.ts +++ b/src/chat.ts @@ -46,7 +46,10 @@ export class ChatProvider implements vscode.WebviewViewProvider { constructor(private _context: vscode.ExtensionContext) { this._extensionUri = _context.extensionUri; - this._assetsUri = vscode.Uri.file(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( From 2dacd1c7106c94937438277d13d59fb7700b9a08 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 20 Sep 2023 11:52:56 +0100 Subject: [PATCH 3/3] style: prettier --- src/chat.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chat.ts b/src/chat.ts index 768f66ff..51604b0d 100644 --- a/src/chat.ts +++ b/src/chat.ts @@ -58,7 +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}`); + console.log( + `Initialising webview. Assets URI: ${this._assetsUri}; Extension URI: ${this._extensionUri}` + ); webviewView.webview.options = { // Allow scripts in the webview