microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.33k stars 28.59k forks source link

terminal failed to detect a local link #146175

Closed ryanroe closed 2 years ago

ryanroe commented 2 years ago

Issue Type: Bug

vscode-terminal-link-detection-fail

  1. create a new nodejs project with index.js

  2. install package blessed@0.1.81

  3. paste the following code

    const blessed = require("blessed");
    const _screen = blessed.screen({
    smartCSR: true,
    useBCE: true,
    debug: true,
    sendFocus: true,
    terminal: "xterm-256color",
    fullUnicode: true,
    });
    const box = blessed.box({
    top: 0,
    left: 0,
    width: "100%",
    height: "100%",
    border: {
      type: "line",
    },
    });
    box.setContent("./index.js");
    _screen.append(box);
    _screen.key(["1"], (ch, key) => {
    process.exit(0);
    });
    _screen.render();
  4. execute node ./index.js from integrated terminal

Expected result

./index.js can be detected as (local) link

Actual result

./index.js failed to be recognized as link

VS Code version: Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1, 2022-03-10T14:33:55.248Z) OS version: Windows_NT x64 10.0.22533 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Celeron(R) CPU G3930 @ 2.90GHz (2 x 2904)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: disabled_off
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|11.45GB (3.95GB free)| |Process Argv|--crash-reporter-id 156a4de7-45ab-4d68-93fa-ff7bc5091f3e| |Screen Reader|no| |VM|0%|
Extensions (11) Extension|Author (truncated)|Version ---|---|--- vscode-zipfs|arc|2.3.0 markdown-mermaid|bie|1.13.2 path-intellisense|chr|2.8.0 githistory|don|0.6.19 gitlens|eam|12.0.5 prettier-vscode|esb|9.4.0 csharp|ms-|1.24.1 cpptools|ms-|1.9.7 hexeditor|ms-|1.9.5 vscode-js-profile-flame|ms-|1.0.0 gitmoji-vscode|sea|1.1.2
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805cf:30301675 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 vsclayoutctrt:30451275 dsvsc009:30452663 pythonvsnew555:30457759 vscscmwlcmt:30438805 vscgsvid1:30447480 pynewfile477:30450038 ```
ryanroe commented 2 years ago

but if i shrink terminal size with rows=6 (or lower) cols=unchanged , the detection works by holding ctrl key down, but the detected path is not incorrect ( something like ┐│.\index.js)

meganrogge commented 2 years ago

we've made some improvements to link detection since the version you're using was released. can you see if you can reproduce in the Insiders build?

ryanroe commented 2 years ago

we've made some improvements to link detection since the version you're using was released. can you see if you can reproduce in the Insiders build?

just tested with no luck :(

seems to be xterm's issue

is text returned by https://github.com/microsoft/vscode/blob/043166e2122048b2a160be5b1983ea390ae8df39/src/vs/workbench/contrib/terminal/browser/links/terminalLinkHelpers.ts#L124 exceeds MaxLineLength defined by https://github.com/microsoft/vscode/blob/043166e2122048b2a160be5b1983ea390ae8df39/src/vs/workbench/contrib/terminal/browser/links/terminalLocalLinkDetector.ts#L19 ?

Version: 1.66.0-insider (user setup)
Commit: 45999664ef626d6d665cb585104efdcab383a3cd
Date: 2022-03-28T07:49:37.594Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Windows_NT x64 10.0.22533
Tyriar commented 2 years ago

We don't treat as a link separator, adding that character to the terminal.integrated.wordSeparators setting is how you get this to work. Closing as designed