-
Notifications
You must be signed in to change notification settings - Fork 205
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
Damlc ITs fix pretty range #7707
Conversation
The new version of `ghcide` fixes a bug in the pretty printer for diagnostics. So far, the column number for an error/warning you would be shown by `daml build` was always be one smaller than in DAML Studio. Now, we show the same locations across the command line tools and the IDE. CHANGELOG_BEGIN [DAML Compiler] Show the correct column numbers in error locations produced by command line tools like `daml build`. CHANGELOG_END
GHCIDE_REV = "30860c8c175732bbc9652b8e6d7dafb354380227" | ||
GHCIDE_SHA256 = "94afc5a3eda790956187080445a76e56b16f2e77c8f5cb3cc3450b6dd019d40a" | ||
GHCIDE_REV = "8e4f52892d88d23259547b03bb096b46f28c0afc" | ||
GHCIDE_SHA256 = "3fa3e23d760f1bdfb2a707d2593ea3eaedba748abfd649e8917c585780fa91db" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've recently upgraded to a newer ghcide version in #7706 which fixes the bug that column numbers in diagnostics printed on the command line were off by one. This PR brings the ranges in our test files in line with what the command line tools print, which is also what vscode shows. CHANGELOG_BEGIN CHANGELOG_END
d45738e
to
f420bac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible but the comment about GHC’s location tracking makes me wonder if we’re really making things better by going for 1-based column indexing.
-- which are 0-based in both line and column and also open. Error | ||
-- messages are formatted by GHC and are 1-based in line, 0-based | ||
-- in column and closed (so add one to column start, one to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the comment about GHC still apply? i.e., will we now get locations in error messages that are 0 based column-wise while the location of the diagnostics containing that error message is 1 based? At the very least it seems worth preserving the comment that documents this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment was never true. GHC's ranges were always 1-based and hence match the way we pretty-print diagnostics now:
https://github.com/digital-asset/daml-ghcide/blob/8e4f52892d88d23259547b03bb096b46f28c0afc/src/Development/IDE/GHC/Error.hs#L70
I think all the confusion came from the bug in the pretty-printer I've fixed yesterday. Since we don't use any SrcSpan
s in this test but only Range
s, I think the comment makes no sense in this place anymore. In view of #7708, there should also be no more confusion for our devs who want to add or fix tests, since we don't print anything 0-based anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thanks for the explanation
The new version of
ghcide
fixes a bug in the pretty printer fordiagnostics. So far, the column number for an error/warning you would
be shown by
daml build
was always be one smaller than in DAMLStudio. Now, we show the same locations across the command line tools
and the IDE.
We also bring our test files in sync with the ranges the command line
tools print now.
CHANGELOG_BEGIN
[DAML Compiler] Show the correct column numbers in error locations
produced by command line tools like
daml build
.CHANGELOG_END
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.
This change is