bitc / vim-hdevtools

Vim plugin for Haskell development
132 stars 25 forks source link

Implement "insert type definition of outer function under cursor". #35

Open annaluiseblume opened 5 years ago

annaluiseblume commented 5 years ago

This adds a function hdevtools#insert_type() which inserts the type definition of the outer function under the cursor. The definition is inserted right above the definition of the function.

The functions first gets the number of the first line of the outer function via the last line of output of hdevtools type <file> <line of cursor> <column of cursor>

This line number is then used to find the identifier of the function. The type is then determined via hdevtools info <file> <identifier>

bitc commented 5 years ago

Thanks, it might take me a while to look over this. If I don't reply here again withing a few weeks then please feel free to remind me about this by commenting/pinging me here

freuk commented 5 years ago

That's a cool feature. Pinging you as suggested @bitc :)

freuk commented 5 years ago

@annaluiseblume I'm testing that branch and having issues. It uses build_command_bare, which ignores my hdevtools_options. If I change that call, I get an error that seems to pertain to an empty list, where l:type_lines[0] results in a `list index out of range:0. I'll leave it at that - sorry not to dig further, I don't know vimscript.