haskell / haskell/haskell-mode
Error overlay is put in the wrong place sometimes
- Dominant language
- Emacs Lisp
- Stars
- 1.4k
- Forks
- 354
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 2
Description
There is a function `haskell-check-paint-overlay` that paints an overlay from an error message that you get after loading a file with `C-c C-l` in an interactive session. Its argument `error-from-this-file-p` is set by `haskell-process-errors-warnings` according to
```
(string= (file-truename (buffer-file-name module-buffer))
;; (concat (haskell-session-current-dir session) file)
(file-truename file)
)
```
https://github.com/haskell/haskell-mode/blob/master/haskell-load.el#L524
But when I am visiting the source file in a directory like `ProjectRoot/src/SomeModule.hs`, stack repl shows the error message using the filename `src/SomeModule.hs:line:col`, whereas calling `true-filename` (which would use the directory of the currently visited source file, `ProjectRoot/src`) returns a name like `ProjectRoot/src/src/SomeModule.hs`, which is wrong, and causes the error overlay to appear in the wrong place — at the very top of the file, as if the error is in another file (https://github.com/haskell/haskell-mode/blob/master/haskell-load.el#L440)
I think it might be enough to use `(concat (haskell-session-current-dir session) file)`, but I'm not too sure what assumptions are being made there.
Contributor guide
Research direction
Read haskell-load.el around haskell-check-paint-overlay (line 440) and haskell-process-errors-warnings (line 524), then reproduce the issue with a source file under ProjectRoot/src and a stack REPL load via C-c C-l. Done means errors reported as src/SomeModule.hs are matched to the visited source file and the overlay appears at the reported line and column.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100