nwolverson / purescript-language-server

MIT License
184 stars 41 forks source link

Completion of Prim modules #70

Closed milesfrain closed 4 years ago

milesfrain commented 4 years ago

Not sure if this is a duplicate, or if this is even the right repo to report this issue.

I noticed that automatic import with completion in my IDE (vscode) doesn't work on Prim classes. For example, I can type getBody, press tab, and then this line is inserted:

import Node.Express.Request (getBody)

But typing RowToList doesn't bring up any autocomplete options, and I need to manually add this import:

import Prim.RowList (class RowToList)
AndrewBrownK commented 4 years ago

This might be because of the following

https://pursuit.purescript.org/builtins/docs/Prim.Row

The Prim.Row module is embedded in the PureScript compiler. Unlike Prim, it is not imported implicitly. It contains automatically solved type classes for working with row types.

It makes enough sense to not implicitly import these modules, but that doesn't mean they should be precluded from suggested imports when you start typing them out

kritzcreek commented 4 years ago

I had to check, but this should at least be possible with the current purs ide. Here's Emacs: rowtolist

nwolverson commented 4 years ago

OK, this is because for whatever reason we filter module completion by the set of available modules. Not sure why we explicitly filter including all modules in this case, but ignoring that historic oddness for now, I've included the current Prim.* modules in the completion for

  1. import statements
  2. completion of identifiers in those modules
nwolverson commented 4 years ago

Apparently this was implemented in f886e8ee4887f160fff9c1ece553af2a43efd06c - not sure why I didn't close this at the time