diff --git a/CHANGELOG.md b/CHANGELOG.md index bfba9b7a9..252442734 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he ## Nightly (only) -Nothing, yet +- fix: only autofill "debug link" input if the hostname resolves ([vscode#228950](https://github.com/microsoft/vscode/issues/228950)) +- fix: support ANSI colorization in stdout logged strings ([vscode#230441](https://github.com/microsoft/vscode/issues/230441)) +- fix: disable entrypoint breakpoint at first pause in script ([vscode#230201](https://github.com/microsoft/vscode/issues/230201)) +- fix: avoid generating extra rebased paths in relative `rebaseLocalToRemote` ([#2091](https://github.com/microsoft/vscode-js-debug/issues/2091)) ## v1.94 (September 2024) diff --git a/src/ui/debugLinkUI.ts b/src/ui/debugLinkUI.ts index 1fa18cd23..f458e366c 100644 --- a/src/ui/debugLinkUI.ts +++ b/src/ui/debugLinkUI.ts @@ -3,6 +3,7 @@ *--------------------------------------------------------*/ import * as l10n from '@vscode/l10n'; +import * as dns from 'dns/promises'; import { inject, injectable } from 'inversify'; import { URL } from 'url'; import * as vscode from 'vscode'; @@ -14,16 +15,26 @@ import { readConfig, } from '../common/contributionUtils'; import { DefaultBrowser, IDefaultBrowserProvider } from '../common/defaultBrowserProvider'; +import { delay } from '../common/promiseUtil'; import { ExtensionContext, IExtensionContribution } from '../ioc-extras'; -function getPossibleUrl(link: string, requirePort: boolean): string | undefined { +async function assertResolves(hostname: string, timeout = 1000) { + return Promise.race([ + dns.lookup(hostname), + delay(timeout), + ]); +} + +async function getPossibleUrl(link: string, requirePort: boolean): Promise { if (!link) { return; } // if the link is already valid, all good try { - if (new URL(link).hostname) { + const url = new URL(link); + if (url.hostname) { + await assertResolves(url.hostname); // ensure it can be resolved return link; } } catch { @@ -34,6 +45,7 @@ function getPossibleUrl(link: string, requirePort: boolean): string | undefined try { const prefixed = `http://${link}`; const url = new URL(prefixed); + await assertResolves(url.hostname); if (!requirePort || url.port) { return prefixed; } @@ -103,10 +115,10 @@ export class DebugLinkUi implements IExtensionContribution { private async getLinkFromQuickInput() { const clipboard = await vscode.env.clipboard.readText(); const link = await vscode.window.showInputBox({ - value: getPossibleUrl(clipboard, false) || this.mostRecentLink, + value: await getPossibleUrl(clipboard, false) || this.mostRecentLink, placeHolder: 'https://localhost:8080', validateInput: input => { - if (input && !getPossibleUrl(input, false)) { + if (input && !URL.canParse(input)) { return l10n.t('The URL provided is invalid'); } },