Skip to content

feat(output): make file paths clickable - #18377

Open
KevinGruber2001 wants to merge 5 commits into
eclipse-theia:masterfrom
KevinGruber2001:feat/clickable-files-and-links-in-output
Open

KevinGruber2001 wants to merge 5 commits into
eclipse-theia:masterfrom
KevinGruber2001:feat/clickable-files-and-links-in-output

Conversation

@KevinGruber2001

@KevinGruber2001 KevinGruber2001 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What it does

Closes #15835

Adds a Monaco link provider for output channels so that paths of workspace files become clickable and open in an editor at the reported position. As in VS Code, only absolute paths that start with a workspace folder are linked. The supported position formats are file:3:5, file(10,3), file on line 20, column 4 and file:line 20, column 4. Windows paths are matched with either separator.

How to test

  1. Open a workspace and run a command that writes absolute paths into an output channel, for example a task or an extension like CMake Tools. You can also use a small extension that calls OutputChannel.appendLine('/path/to/workspace/package.json:3:5').
  2. Ctrl/Cmd+click the path. The file opens with the cursor at line 3, column 5.
  3. Check that paths outside the workspace are not linked.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Review checklist

Reminder for reviewers

@KevinGruber2001
KevinGruber2001 force-pushed the feat/clickable-files-and-links-in-output branch from b73f5b6 to 438103c Compare November 18, 2026 09:54
@KevinGruber2001
KevinGruber2001 marked this pull request as ready for review November 18, 2026 10:37
@ndoschek ndoschek moved this from In review to Needs Classification in PR Review Flow Nov 18, 2026
@ndoschek ndoschek moved this to Waiting on reviewers in PR Review Flow Nov 18, 2026
@ndoschek

Copy link
Copy Markdown
Member

@EclipseSourceAI

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review. May contain mistakes.

Useful comment? React 👍. Disagree? React 👎 to reject it for follow-up reviews. A reply explaining why helps too.

Agent approval means no blocking issues found. Unrelated and Follow-up comments are non-blocking. A maintainer must still sign off.

Only a maintainer can re-request a review from this agent.

Powered by Eclipse Enclave via review-guard-mcp

Issues Follow-ups Unrelated
2 0 0
Summary

This PR adds a Monaco LinkProvider for the output scheme, so that absolute paths of workspace files in output channels become Ctrl+clickable.

  • OutputLinkComputer builds four regexps for each workspace folder, covering file:3:5, file(10,3), file on line N, column M and file:line N, column M. Windows folders get an extra forward-slash variant. Each match resolves to a file URI with an #L<line>,<col> fragment, and the existing fragment handling in EditorManager.revealSelection places the cursor.
  • OutputLinkProvider is a FrontendApplicationContribution. It resolves the OS paths of the workspace roots via FileService.fsPath and registers the provider again whenever the workspace changes, which makes Monaco recompute the links.
  • @theia/output now depends on @theia/filesystem and @theia/workspace.

Results:

  • npm ci && npm run build:browser succeeds.
  • ESLint is clean on packages/output.
  • All 32 output tests pass, including the 10 new ones.
  • UI test in the browser app:
    • GCC, MSBuild and plain paths are linked.
    • Ctrl+click opens package.json at Ln 3, Col 5 and src/a.ts at Ln 3, Col 2.
    • /etc/hosts:1:1 is not linked.
Notes for maintainers
  • New dependency edges: @theia/output now depends on @theia/workspace and @theia/filesystem. Every in-repo package that uses output already depends on workspace except ai-llamafile. Adopters who use output without workspace will now pull it in.
  • VS Code computes these links in a worker. Here they are computed on the main thread every time Monaco recomputes links. That should be fine at the default output.maxChannelHistory.
  • Matching is case-insensitive on POSIX too, the same as VS Code.
  • Electron and Windows paths were only covered by the unit tests. I did not run them in the UI.

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review. May contain mistakes.

Useful comment? React 👍. Disagree? React 👎 to reject it for follow-up reviews. A reply explaining why helps too.

Agent approval means no blocking issues found. Unrelated and Follow-up comments are non-blocking. A maintainer must still sign off.

Only a maintainer can re-request a review from this agent.

Powered by Eclipse Enclave via review-guard-mcp

Issues Follow-ups Unrelated Fixed since last review Still open from last review
0 0 0 2 0
Changes since last review

Since the last review, two fix commits were pushed on top of the original feature commit:

  • chore(output): add copyright notice for code copied from VS Code adds the Microsoft MIT header and a code copied and modified from line above OutputLinkComputer, matching the placement used elsewhere in the codebase (e.g. packages/core/src/common/strings.ts).
  • fix(output): don't link workspace paths within words or other paths adds a negative lookbehind ((?<![\w.\-/\\])) before the folder match, so a workspace root like / no longer turns substrings such as application/json, 50/100 or /other/workspace/project/README.md into links. New unit tests cover all three cases plus a "paths after delimiters" case.

Build (npm ci && npm run build:browser) succeeds with 0 errors. All 35 @theia/output tests pass (including the 3 new ones), and ESLint is clean on the package.

  • MIT header/copyright notice thread: fixed, header added in the standard position with the standard wording.
  • Workspace-root-substring-match thread: fixed, verified the lookbehind actually blocks the reported cases and doesn't affect normal matches at line start or after whitespace/delimiters.
Notes for maintainers

No new issues found in the changes since the last review. The regex-only fix doesn't change any UI-facing behavior beyond what the earlier UI test already covered, so no new UI pass was done this round.

Suggested squash commit message

feat(output): make file paths clickable in output channels

Add a Monaco link provider for the output scheme so absolute workspace
paths with line/column info become Ctrl+clickable and open at the
reported position.

These previous comments can be resolved as they are now handled:

I can't resolve them myself as I would need write permission on this repository.

@ndoschek
ndoschek requested a review from sdirix November 24, 2026 17:30
continue;
}
const startColumn = match.index + 1;
const endColumn = startColumn + match[0].length;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A trailing sentence period becomes part of the link, e.g. Compiled /ws/src/a.ts. links a.ts.. We should trim trailing . from the path and the range, as the VS Code code this is based on does. Please add a test case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove the trailing dot now, and added a test case

@github-project-automation github-project-automation Bot moved this from Waiting on reviewers to Waiting on author in PR Review Flow Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on author

Development

Successfully merging this pull request may close these issues.

Convert file paths and links in output console to clickable links

4 participants