Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Fix pretty printer for diagnostic ranges #871

Merged
merged 1 commit into from
Oct 15, 2020
Merged

Fix pretty printer for diagnostic ranges #871

merged 1 commit into from
Oct 15, 2020

Conversation

hurryabit
Copy link
Contributor

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.
Copy link
Collaborator

@pepeiborra pepeiborra left a 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

@pepeiborra pepeiborra merged commit f58edfb into haskell:master Oct 15, 2020
@ndmitchell
Copy link
Collaborator

Is it worth including a test somewhere - these off-by-one things could certainly recur by accident quite easily.

@hurryabit
Copy link
Contributor Author

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 damlc integration tests? It got so bad, that I decided to add a test for the test utilities: digital-asset/daml#7708.

I suppose this giant file is the right place for a test: https://github.com/haskell/ghcide/blob/master/test/exe/Main.hs ?

@hurryabit hurryabit deleted the fix-pretty-range branch October 15, 2020 22:11
@ndmitchell
Copy link
Collaborator

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?

@hurryabit
Copy link
Contributor Author

@ndmitchell Here we go: #878

pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
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.
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
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.
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants