-
Notifications
You must be signed in to change notification settings - Fork 97
Fix pretty printer for diagnostic ranges #871
Conversation
With the current implementation, VS Code will show "1:1" for the top left corner, but the pretty printer renders this poisition to "1:0". This is particularly interesting for people building command line tools using `ghcide`, like the our DAML compiler at Digital Asset. tools with command line drivers, like us at Digital Asset. I would argue that VS Code has the ultimate authority on this since we can't change what it displays without also moving the squiggly lines. This PR fixes the discrepance by simply adding one to the column number in the prtty printer, like we do for the line number.
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.
Seems very reasonable, thanks
Is it worth including a test somewhere - these off-by-one things could certainly recur by accident quite easily. |
@ndmitchell Oh yes, they do. Do you remember our I suppose this giant file is the right place for a test: https://github.com/haskell/ghcide/blob/master/test/exe/Main.hs ? |
Yep, that giant file is the one. You've answered the question who tests the tests, but now who tests the tests that test the tests? |
@ndmitchell Here we go: #878 |
With the current implementation, VS Code will show "1:1" for the top left corner, but the pretty printer renders this poisition to "1:0". This is particularly interesting for people building command line tools using `ghcide`, like the our DAML compiler at Digital Asset. tools with command line drivers, like us at Digital Asset. I would argue that VS Code has the ultimate authority on this since we can't change what it displays without also moving the squiggly lines. This PR fixes the discrepance by simply adding one to the column number in the prtty printer, like we do for the line number.
With the current implementation, VS Code will show "1:1" for the top left corner, but the pretty printer renders this poisition to "1:0". This is particularly interesting for people building command line tools using `ghcide`, like the our DAML compiler at Digital Asset. tools with command line drivers, like us at Digital Asset. I would argue that VS Code has the ultimate authority on this since we can't change what it displays without also moving the squiggly lines. This PR fixes the discrepance by simply adding one to the column number in the prtty printer, like we do for the line number.
With the current implementation, VS Code will show "1:1" for the top left corner, but the pretty printer renders this poisition to "1:0". This is particularly interesting for people building command line tools using `ghcide`, like the our DAML compiler at Digital Asset. tools with command line drivers, like us at Digital Asset. I would argue that VS Code has the ultimate authority on this since we can't change what it displays without also moving the squiggly lines. This PR fixes the discrepance by simply adding one to the column number in the prtty printer, like we do for the line number.
With the current implementation, VS Code will show "1:1" for the top
left corner, but the pretty printer renders this poisition to "1:0".
This is particularly interesting for people building command line tools
using
ghcide
, like the our DAML compiler at Digital Asset.tools with command line drivers, like us at Digital Asset.
I would argue that VS Code has the ultimate authority on this since we
can't change what it displays without also moving the squiggly lines.
This PR fixes the discrepance by simply adding one to the column number
in the prtty printer, like we do for the line number.