ndmitchell / record-dot-preprocessor

A preprocessor for a Haskell record syntax using dot
Other
129 stars 19 forks source link

Better output locations in preprocessor #3

Open ndmitchell opened 6 years ago

ndmitchell commented 6 years ago

Currently I don't leave LINE or COLUMN pragmas in the output. I should.

ndmitchell commented 5 years ago

I now have LINE annotations but not COLUMN ones.

pkapustin commented 4 years ago

Currently multi-line updates cause problems with line numbering in the following code, so that hints and navigation in ghcide no longer work. Is it possible to respect source line numbers in the multi-line updates?

ndmitchell commented 4 years ago

@pkapustin probably, I guess I don't increment something at some point? If you want to experiment and send a patch I'd happily accept,

pkapustin commented 4 years ago

I think what happens is that record-dot-preprocessor always expands record update to one line even if it takes multiple lines in a source file (for example, because several fields are updated and each is placed on a separate line). I am not sure how to fix it, but I think it would be very nice if the output generated by record-dot-preprocessor followed the source in case of multi-line updates.

ndmitchell commented 4 years ago

@pkapustin I found two issues which I've pushed fixes for. I'd appreciate you trying it to confirm it really does help. We can only emit LINE declarations at the start of a line.

I imagine those two things will be a massive improvement, but it's somewhat subtle invariants, so keen to see in practice. If it works, will make a release (or if you're unable to test I'll make a release too).

pkapustin commented 4 years ago

@ndmitchell This works great now! LINE declarations are emitted after all multi-line updates, and the problem is gone.

pkapustin commented 4 years ago

@ndmitchell Thank you so much for fixing this!

ndmitchell commented 4 years ago

Version 0.2.4 now released with those fixes included.