commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

(stack-mode) Type info should use span yielded by backend #70

Open mgsloan opened 8 years ago

mgsloan commented 8 years ago

If I ask for the type of an expression, but only select part of it, then that's the only part that appears in the result.

For example, where | delineates my selection, put|StrLn "H|ello!", I'll get StrLn "H :: IO (). This is why the type infos come with spans that say what they refer to.

Of course, if the buffer has been edited since the last compilation, then both the query span and results span may be off. Maybe it would be a good idea to have ide-backend directly provide the text of the code that the type info refers to.

mgsloan commented 8 years ago

Also, (stack-mode-type t) doesn't work for me - it does some insertion and then cond: Wrong type argument: char-or-string-p, nil.

chrisdone commented 8 years ago

The piggy back issue of (stack-mode-type t) is fixed.

lukehoersten commented 8 years ago

Also in this vein, two issues with (stack-mode-type &optional INSERT-VALUE) where INSERT-VALUE is true:

  1. Insert type on a top-level function/definition incorrectly uses the inline type syntax: (fn :: ...) instead of inserting the type on the line above.
  2. Insert type always seems to never actually put the type after the :: and instead just results in the incomplete literal string (fn ::.
chrisdone commented 8 years ago

Insert type on a top-level function/definition incorrectly uses the inline type syntax: (fn :: ...) instead of inserting the type on the line above.

Are you selecting the word when you use C-u C-c C-t? Because selecting an expression behaves as though you want to wrap it in a type signature.

lukehoersten commented 8 years ago

Ah yeah that's working. So that solves (1) but (2) still remains. May be related to my other issues regarding the new regressions.