Is there something better than tags?

I've been using haskellmode for vim for a while now and I'm really happy with it. It does however have some shortcomings. These are the things I find missing at times: 1. Fully functional go-to-definition. With that I mean that go-to-definition is aware of local definitions introduced in 'let' and 'where' clauses and ideally also for names bound in 'do' clauses. I've found there are several ways to generate a tags file, GHCi can generate them, and there are two tools for it, hasktags and hothasktags. haskellmode currently uses GHCi to generate tags. However, the limitation seems to be inherent in the tags format itself. AFAICS there is no way to get a fully functional go-to-definition with that format. 2. Retrieve type information for local defintions ('let', 'where', 'do'), and ideally also for sub expressions (like ':t filter (== 1)'. I believe haskellmode uses GHCi to get the type information out, but it is only able to get it for top-level definitions. Are there any options to address these two shortcomings in haskellmode? /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus

On 02/22/2011 11:45 AM, Magnus Therning wrote:
1. Fully functional go-to-definition. With that I mean that go-to-definition is aware of local definitions introduced in 'let' and 'where' clauses and ideally also for names bound in 'do' clauses. I've found there are several ways to generate a tags file, GHCi can generate them, and there are two tools for it, hasktags and hothasktags. haskellmode currently uses GHCi to generate tags. However, the limitation seems to be inherent in the tags format itself. AFAICS there is no way to get a fully functional go-to-definition with that format. Last time I checked (about a year ago), the file scope was the smallest scope supported by vim in tag files. So you are out of luck here. You would need to extend vim (either by extending the tag file format or by your own scripts handling this separately) and also your favourite tags generator.
2. Retrieve type information for local defintions ('let', 'where', 'do'), and ideally also for sub expressions (like ':t filter (== 1)'. I believe haskellmode uses GHCi to get the type information out, but it is only able to get it for top-level definitions. This is because ghci shows you this information only for the top level symbols (the ones available in :browse). Ghci would need to be extended first. Maybe it is there in GHC 7.0?
I hope I'm wrong somewhere and it could be done somehow more easily. Peter.

Excerpts from Magnus Therning's message of Tue Feb 22 11:45:34 +0100 2011:
generate them, and there are two tools for it, hasktags and hothasktags. haskellmode currently uses GHCi to generate tags. However, the limitation seems to be inherent in the tags format itself. AFAICS there is no way to get a fully functional go-to-definition with that format. learn about gd and gD those are not perfect though. Also keep in mind that # * start searches on words. They all are not language aware so they are only bad replacements for what you're looking for. If you compile with warnings doesn't ghc emit warnings about shadowing ? If so names tend to be unique such those searches tend to be helpful.
2. Retrieve type information for local defintions ('let', 'where', 'do'), and ideally also for sub expressions (like ':t filter (== 1)'. I believe haskellmode uses GHCi to get the type information out, but
I only know about scion which comes closest to what you ask for. (http://github.com/MarcWeber/scion-backend-vim) Marc Weber

On 02/22/2011 12:26 PM, Marc Weber wrote: > > learn about gd and gD those are not perfect though. > Also keep in mind that # * start searches on words. > They all are not language aware so they are only bad replacements for > what you're looking for. When we are talking about such simple helpers then you may want to check out: Mark : Highlight several words in different colors simultaneously. http://www.vim.org/scripts/script.php?script_id=2666 I also like showmarks to highlight interesting places: ShowMarks : Visually shows the location of marks. http://www.vim.org/scripts/script.php?script_id=152 >> 2. Retrieve type information for local defintions ('let', 'where', >> 'do'), and ideally also for sub expressions (like ':t filter (== 1)'. >> I believe haskellmode uses GHCi to get the type information out, but > I only know about scion which comes closest to what you ask for. > (http://github.com/MarcWeber/scion-backend-vim) Is this a correct summary? * can load cabal components (all files of the component) * can do type checking on buffer write * can show type of any symbol under cursor if the file type checks
participants (3)
-
Magnus Therning
-
Marc Weber
-
Peter Hercek