Skip to content

Add clickable error locations to UCM-emitted warnings/errors - #6326

Merged
pchiusano merged 9 commits into
unisonweb:trunkfrom
Baccata:clickable-error-locations
Nov 11, 2026
Merged

pchiusano merged 9 commits into
unisonweb:trunkfrom
Baccata:clickable-error-locations

Conversation

@Baccata

@Baccata Baccata commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Overview

When UCM is watching files, and upon compile errors/warnings, this adds a $file:$line:$column message, which is understood by many IDEs as being clickable.

Interesting/controversial decisions

Only added to UCM when it is watch mode (verified by the presence of watch-directory).

Test coverage

No test added, mostly because enabling this feature only in watch mode prevents the automation of tests. Tested by hand :

Screenshot 2026-10-29 at 15 27 40

Baccata and others added 5 commits October 29, 2026 14:31
When UCM loads a .u file and reports a parse error, type error, or type
warning, prepend a `path:line:col` reference (path relative to UCM's
working directory) above each one, so clicking it in an IDE terminal like
VSCode's jumps straight to the offending source.

- PrintError: add `rangeForErrorNote` / `rangeForWarn`, which pick the
  location to point at — the cause's own location when it carries one,
  otherwise the innermost error term (for warnings, the offending
  occurrence).
- Output: thread the source file name into the ParseErrors / TypeErrors /
  TypeWarns constructors (they previously carried only the source text).
- OutputMessages: add `clickableSourceLocation` / `withSourceLocation`,
  gated on the watch directory being present. Transcripts pass no
  directory, so their output is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@pchiusano pchiusano left a comment

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.

Thanks, left one comment which I’ll fix up since it’s very mechanical.

C.RedundantPattern loc -> rangeForAnnotated loc
C.InaccessiblePattern loc -> rangeForAnnotated loc
C.RunWatchTypeMismatch loc _ -> rangeForAnnotated loc
_ -> Nothing

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.

This is error prone, will start being wrong as soon as we add a new type of error and makes it harder as a reviewer to tell if everything has been covered even today. I’ll expand it out.

@pchiusano
pchiusano added this pull request to the merge queue Nov 10, 2026
@github-actions

Copy link
Copy Markdown

🤖 The merge queue's full run failed, which removed this pull request from the queue: https://github.com/unisonweb/unison/actions/runs/42845236172

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
# Conflicts:
#	.github/workflows/proofs/formatting/2eb107dbb6a5090bf6343549359eaacdc7e4a567739f3fb9ac34050e8dd9c6af.txt
#	.github/workflows/proofs/tests/08f200d34526554d04570b0dba09fb609c98fcdc6dbe312fcefe8fe1ae11d826.txt
#	.github/workflows/proofs/transcripts/f44f38a34f56db28ff16d9d3ee2c09e25904bd51c5c44d62c225cbaea6bd9b38.txt
pchiusano added a commit to Baccata/unison that referenced this pull request Nov 10, 2026
…akes one for a rename of another

Every attestation file of a check held the same line (the infrastructure hash
and the verdict), so git's rename detection paired a deleted attestation with
an added one at 100% similarity. Two pull requests that both re-attested then
renamed the same file to different names, a rename/rename conflict (unisonweb#6326
against trunk after unisonweb#6327 merged).

The file now holds a 16-character prefix of the infrastructure hash, the
verdict, and the hash it attests. Readers use the first two fields as before
and compare the infrastructure hash by prefix, so existing files still read.
@pchiusano
pchiusano added this pull request to the merge queue Nov 10, 2026
Merged via the queue into unisonweb:trunk with commit 09d3cc2 Nov 11, 2026
10 checks passed
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 this pull request may close these issues.

2 participants