from https://github.com/FrigoEU/psc-ide-vim/issues/147 and https://github.com/FrigoEU/psc-ide-vim/issues/112
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
main :: Effect Unit
main = do
let a = 1 -- can't get type of a
log "hi" -- but can get type of log
when my cursor at a variable and I do :Ptype - it should show type inferred of a
I have NO way to see the inferred type of a
it shows purs ide: no type information found for a
logs show that it tries to find type definition of a in imported modules
purescript#ide#call: command: {"params": {"currentModule": "Main", "search": "a", "filters": [{"filter": "modules", "params": {"modules"
: ["Prelude", "Main"]}}]}, "command": "type"}
purs ide server so it derive type of range? something like language-server does (https://microsoft.github.io/language-server-protocol/specification){
start: { line: 5, character: 23 },
end : { line 6, character : 0 }
}
maybe someone knows other way to see the derived type of a?
maybe someone knows other way to see the derived type of
a?
You could use a hole let a = 1 :: ?what. That might fail in some situations if classes are involved though.
For a while I've thought that this would come naturally if we move to the LSP directly in purs ide - but maybe ala that range suggestion an interim step makes sense.
proposal:
when range is not selected, position of 1 char is sent to purs ide - no changes
when range is selected, range is sent to purs ide - purs ide wraps selected text in hole and returns type of a hole
e.g.
user selects log "hi"
in
main :: Effect Unit
main = do
log "hi"
purs ide internally wraps log "hi" in parenthesis, like
main :: Effect Unit
main = do
(log "hi" :: ?what)
and returns type of hole ?what
Most helpful comment
proposal:
when range is not selected, position of 1 char is sent to
purs ide- no changeswhen range is selected, range is sent to
purs ide-purs idewraps selected text in hole and returns type of a holee.g.
user selects
log "hi"in
purs ideinternally wrapslog "hi"in parenthesis, likeand returns type of hole
?what