This is one of the reason why I have given up on using external tools and haven’t even try HLS. I rely instead on little knows ghci commands :type-at, :uses and :loc-at.
.
I believe those commands has been merged from intero
, leading to intero to be obsolete.
However, they are a bit tricky to call manualy but are easily to integrate in a text editor.
I use vim and tmux to load ghci and send command from vim to (via tmux) ghci.
Here is the code vim code to transform a visual selection to a ghci command
vnoremap <space>rt :call Haskell_type_at("type-at")<CR>gv
vnoremap <space>ru :call Haskell_type_at("uses")<CR>gv
vnoremap <space>rl :call Haskell_type_at("loc-at")<CR>gv
nmap <space>rT viw<space>rtv
nmap <space>rU viw<space>ruv
nmap <space>rL viw<space>rlv
function Haskell_type_at(mode) range
" mode can be type-at uses loc-at
let l:command = printf (":%s %s %d %d %d %d\n",a:mode, expand("%:p"), line('.'), col("'<"), line("'>"), col("'>")+1)
call TmuxSend(l:command)
endfunction