Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal File Links Not Working in Theia 1.58.x #15050

Open
carstenrd opened this issue Feb 25, 2025 · 7 comments · May be fixed by #15177
Open

Terminal File Links Not Working in Theia 1.58.x #15050

carstenrd opened this issue Feb 25, 2025 · 7 comments · May be fixed by #15177

Comments

@carstenrd
Copy link

Issue Description

After upgrading from Theia 1.55.0 to the release/1.58.x branch, file paths in the terminal no longer become clickable links when using command+click. For example, when /tmp/log.text was printed to the terminal in 1.55.0, I could command+click to get it to open in the Theia Editor. In 1.58.x, there is no hover text and command+click does not open the file in the Theia Editor

Expected Behavior

When hovering over file paths in the terminal (such as file paths in error messages or command outputs), these paths should:

  1. Be detected as links
  2. Show a tooltip on hover
  3. Be clickable to open the corresponding file

Current Behavior

File paths in the terminal are not being detected as links. No tooltip appears when hovering over them, and they cannot be clicked to open the corresponding files.

Reproduction Steps

  1. Open a terminal in Theia
  2. Run a command that outputs file paths (e.g., ls -la)
  3. Hover over a file path in the output
  4. Observe that the path is not detected as a link (no tooltip appears)

Environment

  • Theia Version: release/1.58.x branch
  • Previously working in: Theia 0.55.0
  • OS: macOS and Linux

Environment Setup:

Currently using the following script to load Theia in the browser:

git clone https://github.com/eclipse-theia/theia \
    && cd theia \
    && git checkout release/1.58.x \
    && npm install \
    && npm run build:browser \
    && npm run download:plugins \
    && npm run start:browser
@tsmaeder
Copy link
Contributor

@carstenrd do you have any errors in the browser log when this happens?

@carstenrd
Copy link
Author

@tsmaeder Thanks for the reply

The only browser log i see when initially loading the page is for the favicon and that error is:

Image

I see warnings for various plugins, but nothing from the terminal plugin.

When hovering over a file path in the Terminal nothing happens, the path is not underlined (as it was in 1.55) and there is no log/errors in the console, its like the event is not triggering anymore.

@mcg1103
Copy link

mcg1103 commented Mar 9, 2025

I am still getting this as well. Has anyone else reproduced?

@xpomul
Copy link
Contributor

xpomul commented Mar 9, 2025

I am able to reproduce this (on MacOS). I am currently debugging it to find out what happens. I'll report my findings back here...

@xpomul
Copy link
Contributor

xpomul commented Mar 11, 2025

Sadly, I am running into obstacles when trying to debug.

What I can tell is that for me, it seems to be only reproducible with the packaged theia-ide.
When I launch a theia application using npm run start:electron from the theia repo, file links are working for me.

I have tried to add some diagnostic code in terminal/src/browser/terminal-file-link-provider.ts, but sadly, I can't manage to get a version of theia-ide packaged from my own sources. I have tried to use file:-links in the theia-ide/applications/electron/package.json and rebuild and package everything but whatever I do, I always end up with a state in which the packaged IDE does not launch (and neither is yarn electron start from the theia-ide repo working correctly for me).

I am currently stuck here.

Any hints how I could proceed to debug a packaged IDE are welcome...
Or maybe someone has an idea whether FileService.resolve(url) would behave differently in the packaged IDE vs. when run from the development corktree. (Because it is my current guess that the problem lies somewhere there...)

@carstenrd
Copy link
Author

I cannot speak about the internals, but I can reproduce this issue by running npm run start:browser (see the Environment Setup section of the original post) , I have not tried running electron.

I am running the browser IDE in both dev and production bundle and they both have this issue every time.

@xpomul
Copy link
Contributor

xpomul commented Mar 12, 2025

I was finally able to debug this.
It seems to be an injection issue that happens in conjunction with packages/plugin-ext/src/main/browser/terminal-main.ts.

This is what happens:

  • packages/terminal/src/browser/terminal-frontend-module.ts:126 binds TerminalLinkProvider to the LocalFileLinkProvider (and others) in the root container
  • packages/plugin-ext/src/main/browser/terminal-main.ts:80 binds TerminalLinkProvider to TerminalServiceMainImpl, but not in the root container (I don't see exactly which container or where it comes from, respectively), but the binding ends up in the TerminalWidget child container, not the root container.
  • Since the context of the TerminalWidgetImpl is that child container (and because bindContributionProvider dynamically uses the context it is injected in to provide the contributions), ContainerBasedContributionProvider.container for the Symbol(TerminalLinkProvider) in the context TerminalWidgetImpl/TerminalContribution is the child container, not the root container
  • When the TerminalLinkProvider uses its injected ContributionProvider< TerminalLinkProvider>, it collects contributions from the child module. And since in that child module, the TerminalServiceMainImpl is bound as the only contribution, it is returned as only contribution, and the LocalFileLinkProvider is not returned because it is only registered in the root container.

In short: The TerminalServiceMainImpl from the plugin-ext module overrides/shadows the LocalFileLinkProvider.

To fix, we could call getContributions(true) in packages/terminal/src/browser/terminal-link-provider.ts:75 to also consider bindings in the parent module(s) recursively.

I'll open a PR, hoping that this fix is fine.

xpomul added a commit to xpomul/theia that referenced this issue Mar 12, 2025
@xpomul xpomul linked a pull request Mar 12, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants