Repository navigation
feat(output): make file paths clickable - #18377
KevinGruber2001 wants to merge 5 commits into
Conversation
b73f5b6 to
438103c
Compare
EclipseSourceAI
left a comment
There was a problem hiding this comment.
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.
OutputLinkComputerbuilds four regexps for each workspace folder, coveringfile:3:5,file(10,3),file on line N, column Mandfile:line N, column M. Windows folders get an extra forward-slash variant. Each match resolves to afileURI with an#L<line>,<col>fragment, and the existing fragment handling inEditorManager.revealSelectionplaces the cursor.OutputLinkProvideris aFrontendApplicationContribution. It resolves the OS paths of the workspace roots viaFileService.fsPathand registers the provider again whenever the workspace changes, which makes Monaco recompute the links.@theia/outputnow depends on@theia/filesystemand@theia/workspace.
Results:
npm ci && npm run build:browsersucceeds.- 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.jsonat Ln 3, Col 5 andsrc/a.tsat Ln 3, Col 2. /etc/hosts:1:1is not linked.
Notes for maintainers
- New dependency edges:
@theia/outputnow depends on@theia/workspaceand@theia/filesystem. Every in-repo package that uses output already depends on workspace exceptai-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
left a comment
There was a problem hiding this comment.
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 Codeadds the Microsoft MIT header and acode copied and modified fromline aboveOutputLinkComputer, 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 pathsadds a negative lookbehind ((?<![\w.\-/\\])) before the folder match, so a workspace root like/no longer turns substrings such asapplication/json,50/100or/other/workspace/project/README.mdinto 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:
- MIT header for code copied from VS Code's outputLinkComputer.ts
- regex matched substrings within words when the workspace folder is a file system root
I can't resolve them myself as I would need write permission on this repository.
| continue; | ||
| } | ||
| const startColumn = match.index + 1; | ||
| const endColumn = startColumn + match[0].length; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I remove the trailing dot now, and added a test case
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 4andfile:line 20, column 4. Windows paths are matched with either separator.How to test
OutputChannel.appendLine('/path/to/workspace/package.json:3:5').Breaking changes
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers