Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust path parsing to allow correct URI on Windows #226

Merged
merged 3 commits into from
Sep 20, 2023
Merged
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
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