-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PaddType throws no information found
, but pulp server inferring declaration fine
#113
Comments
This is implemented for top level declarations, through the compiler warnings. Quoting the
One of these two functions will work if you call them on a compiler warning for a missing type signature. |
aha..I didnt know what they do because they are not working for me its saying
So instead of them I am using this maps " type annotation
nmap <buffer><silent> <localleader>at :<C-U>PaddType<CR>
" suggestion
nmap <buffer><silent> <localleader>ap :<C-U>Papply<CR> but they are not working too module Main where
import Prelude
import Data.Array as Array
import Data.Foldable (sum)
isMultiple :: Int -> Boolean
isMultiple n = mod n 3 == 0 || mod n 5 == 0
answerA min max = sum $ Array.filter isMultiple $ Array.range min max PaddType says but
|
no information found
, but pulp server inferring declaration fine
Maybe @coot can help here? I'm not using the VIM plugin currently. |
It looks like #99 might be related. |
I'll take a look somewhere this week, thanks for the report. |
@coot would be greatly appreciated however I have tried to fix it myself and found that this is due to example ~/projects/pulp-test master purs ide client -p 4242
{"command":"rebuild","params": {"file": "/home/bjorn/projects/pulp-test/src/Main.purs"}}
{"result":[{"suggestion":{"replaceRange":{"startLine":11,"endLine":11,"startColumn":1,"endColumn":1},"replacement":"answerA :: Int -> Int -> Int\n\n"},"moduleName":"Main","errorLink":"https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md","errorCode":"MissingTypeDeclaration","message":" No type declaration was provided for the top-level declaration of answerA.\n It is good practice to provide type declarations as a form of documentation.\n The inferred type of answerA was:\n\n Int -> Int -> Int\n\n\nin value declaration answerA\n","filename":"/home/bjorn/projects/pulp-test/src/Main.purs","position":{"startLine":11,"endLine":11,"startColumn":1,"endColumn":67}}],"resultType":"success"}
~/projects/pulp-test master purs ide client -p 4242
{"params": {"currentModule": "Main", "search": "answerA", "filters": [{"filter": "modules", "params": {"modules": ["Prelude", "Data.Array"]}}]}, "command": "type"}
{"result":[],"resultType":"success"} also does someone know why request above without ~/projects/pulp-test master purs ide client -p 4242
{"params": {"search": "answerA"}, "command": "type"}
{"result":"Error parsing Command.","resultType":"error"} P.S. |
The filters parameter was not optional before purescript/purescript#3040. Just pass an empty array for now. The editor plugins don't use the type command to provide the type signatures. They use suggestions on the compilation warnings instead: https://github.com/purescript/purescript/blob/71fc308a53bf89678c1e1d4a242cc01561d556d1/src/Language/PureScript/Errors/JSON.hs#L26-L34 EDIT: is because |
I didnt get it, psc-ide-vim sends request with I know fix for this issue: example: ~/projects/pulp-test master purs ide client -p 4242
{"params": {"search": "answerA", "filters": [{"filter": "modules", "params": {"modules": ["Main"]}}]}, "command": "type"}
{"result":[{"exportedFrom":["Main"],"identifier":"answerA","definedAt":{"start":[11,1],"name":"/home/bjorn/projects/pulp-test/src/Main.purs","end":[11,67]},"expandedType":"Int → Int → Int","module":"Main","documentation":null,"type":"Int → Int → Int"}],"resultType":"success"} P.S. |
@BjornMelgaard That's new to me :) I didn't know the VIM plugin does it this way. The compiler already emits suggestions for these, so I figured the plugin could just use those.
|
@kritzcreek yes, plugin does this here Thanks, very helpful, I'll made fix soon) |
@kritzcreek made pr, can someone check |
The underlying issue that the current module needs to be added to the filter modules list (i.e. I'd therefore suggest to change function! s:getType(ident, filterModules, cb)
let currentModule = purescript#ide#utils#currentModule()
if a:filterModules
let [ident, qualifier] = purescript#ide#utils#splitQualifier(a:ident)
let imports = purescript#ide#import#listImports(currentModule, qualifier, "")
let modules = map(copy(imports), {key, val -> val["module"]})
let filters = [purescript#ide#utils#modulesFilter( add(modules, currentModule) )]
else
let filters = []
endif
call purescript#ide#utils#debug('PSCIDE s:getType currentModule: ' . currentModule, 3)
call purescript#ide#call(
\ { 'command': 'type'
\ , 'params':
\ { 'search': ident
\ , 'filters': filters
\ , 'currentModule': currentModule
\ }
\ },
\ 'Failed to get type info for: ' . a:ident,
\ 0,
\ {resp -> a:cb(resp)}
\ )
endfunction |
Let me know if this fixed the issue for you. |
No description provided.
The text was updated successfully, but these errors were encountered: