Skip to content

ANSI OSC 8 hyperlink support NOT working properly (#155445) #170963

@smallscript

Description

@smallscript

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.74.2
  • OS Version: Windows 10

In reference to Support OSC 8 hyperlink support #155445.

Per this gist spec it works properly in wt.exe but not in VsCode.

    # OSC 8 ; params ; URI ST <name> OSC 8 ;; ST 
    escape_mask = '\033]8;{};{}\033\\{}\033]8;;\033\\'

After about 6 hours of experimentation (in various MS-Windows based terminals) to understand why it was not working, I figured out the bug in VsCode.

In the example steps below I provide two forms

  • a first (incorrect) form works in wt.exe and also sort-of works in VsCode.
  • a second (per-gist correct) form works in wt.exe but does not work in VsCode.
    • where we introduce a SPACE in the closing OSC ; ;.

The example shows the trigger/change to make it sort-of work in VsCode.

You will notice that when made to sort-of work in VsCode the ENTIRE line from start to end including the prompt becomes the link, which is wrong. It is a very quirky and touchy bug behavior.

Steps to Reproduce: (these steps worked 100%, other variations required pre-conditions)

  1. If we introduce a SPACE in the closing OSC ; ; we can get VsCode to work (incorrectly) as opposed to not-at-all.
# VsCode WORKS: (incorrectly) includes ENTIRE LINE and PROMPT as LINK
# i.e., VsCode acts like `[BEFORE-LINK ctrl-click-here AFTER-LINK](http://example.com)`
# should act like `BEFORE-LINK [ctrl-click-here\n](http://example.com) AFTER-LINK`
#
# wt.exe WORKS
# wt.exe acts like `BEFORE-LINK [ctrl-click-here\n](http://example.com) AFTER-LINK`
works_vsc = 'BEFORE-LINK \x1B]8;;http://example.com\x1B\\ctrl-click-here\x1B]8; ;\x1B\\ AFTER-LINK'

# VsCode FAILS: in this correct format, which works with no issues in wt.exe
#
# wt.exe WORKS
# i.e., wt.exe acts like `BEFORE-LINK [ctrl-click-here](http://example.com) AFTER-LINK`
fails_vsc 'BEFORE-LINK \x1B]8;;http://example.com\x1B\\ctrl-click-here\x1B]8;;\x1B\\ AFTER-LINK'

print(works_vsc)
print(fails_vsc)

Metadata

Metadata

Assignees

Labels

author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable buggood first issueIssues identified as good for first-time contributorshelp wantedIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code Insidersterminal-linksverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions