Skip to content

OSC 8 hyperlink should open VS Code file explorer if inside cwd#265984

Merged
anthonykim1 merged 14 commits intomainfrom
anthonykim1/openVSCodeFileExplorer
Sep 29, 2025
Merged

OSC 8 hyperlink should open VS Code file explorer if inside cwd#265984
anthonykim1 merged 14 commits intomainfrom
anthonykim1/openVSCodeFileExplorer

Conversation

@anthonykim1
Copy link
Contributor

@anthonykim1 anthonykim1 commented Sep 10, 2025

Resolves: #229374

Current state, clicking on OSC 8 hyperlinked folder should navigate to VS Code file explorer rather than native file explorer.
But want to confirm what we want for #229374 (comment)

@anthonykim1 anthonykim1 added this to the September 2025 milestone Sep 10, 2025
@anthonykim1 anthonykim1 requested a review from Tyriar September 10, 2025 05:47
@anthonykim1 anthonykim1 self-assigned this Sep 10, 2025
@anthonykim1 anthonykim1 marked this pull request as ready for review September 10, 2025 15:01
@anthonykim1 anthonykim1 marked this pull request as draft September 10, 2025 17:48
@anthonykim1 anthonykim1 removed the request for review from Tyriar September 10, 2025 20:32
@anthonykim1
Copy link
Contributor Author

Should consider:

From Daniel's feedback: should consider url type should become uri instead and insider the opener, it knows how to redirect to the different file types when its' a file://

before requesting for review.

@anthonykim1
Copy link
Contributor Author

anthonykim1 commented Sep 11, 2025

Bit surprised that (below with beautiful delegation)

if (e.link.activate) {
// Custom activate call (external links only)
e.link.activate(e.link.text);
} else {
this._openLink(e.link);

only gets called when clicking on file links itself, but not the OSC 8 hyperlinks..

Iinstead it always go through

this._openers.get(TerminalBuiltinLinkType.Url)?.open({
type: TerminalBuiltinLinkType.Url,
text,
bufferRange: null!,
uri: URI.parse(text)

so then I tried to follow suggestion and re-route/deletegate into proper link type inside the URL open.

@Tyriar Curious what you think here, I feel like there might be more smarter way to do this.
It wasn't sure how to directly only pass in uri and avoid passing in link type in

this._openers.get(TerminalBuiltinLinkType.Url)?.open({
type: TerminalBuiltinLinkType.Url,
text,
bufferRange: null!,
uri: URI.parse(text)
since this._openers is Map<TerminalLinkType, ITerminalLinkOpener> and I feel forced to pass in some link type.

I could check the link type in terminalLinkManager.ts but that seems messier then delegation approach I have from TerminalUrlLinkOpener

@anthonykim1 anthonykim1 requested a review from Tyriar September 11, 2025 06:37
@anthonykim1 anthonykim1 marked this pull request as ready for review September 11, 2025 06:37
@anthonykim1 anthonykim1 marked this pull request as draft September 11, 2025 16:17
@anthonykim1 anthonykim1 marked this pull request as ready for review September 11, 2025 18:03
@anthonykim1 anthonykim1 requested a review from Tyriar September 11, 2025 18:03
Tyriar
Tyriar previously requested changes Sep 12, 2025
@anthonykim1 anthonykim1 marked this pull request as draft September 12, 2025 16:55
@anthonykim1 anthonykim1 marked this pull request as ready for review September 12, 2025 18:29
@anthonykim1 anthonykim1 requested a review from Tyriar September 12, 2025 18:30
@anthonykim1 anthonykim1 merged commit ceb07bd into main Sep 29, 2025
28 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/openVSCodeFileExplorer branch September 29, 2025 03:38
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Nov 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking an OSC 8 hyperlink to a folder in the terminal will open the native file explorer instead of VS Code's explorer

3 participants