Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Support Remote Development Board Selection #1459

Merged
merged 3 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/arduino/arduinoContentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class ArduinoContentProvider implements vscode.TextDocumentContentProvide
var backgroundcolor = styles.getPropertyValue('--background-color') || '#1e1e1e';
var color = styles.getPropertyValue('--color') || '#d4d4d4';
var theme = document.body.className || 'vscode-dark';
var url = "${this._webserver.getEndpointUri(type)}?" +
var url = "${(await vscode.env.asExternalUri(this._webserver.getEndpointUri(type))).toString()}?" +
"theme=" + encodeURIComponent(theme.trim()) +
"&backgroundcolor=" + encodeURIComponent(backgroundcolor.trim()) +
"&color=" + encodeURIComponent(color.trim());
Expand Down
6 changes: 4 additions & 2 deletions src/arduino/localWebServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as bodyParser from "body-parser";
import * as express from "express";
import * as http from "http";
import * as path from "path";
import { Uri } from "vscode";

export default class LocalWebServer {
private app = express();
Expand All @@ -19,8 +20,9 @@ export default class LocalWebServer {
public getServerUrl(): string {
return `http://localhost:${this.server.address().port}`;
}
public getEndpointUri(type: string): string {
return `http://localhost:${this.server.address().port}/${type}`;

public getEndpointUri(type: string): Uri {
return Uri.parse(`http://localhost:${this.server.address().port}/${type}`);
}

public addHandler(url: string, handler: (req, res) => void): void {
Expand Down