haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

Provide import quick-fixes for things from internal modules #865

Open lukel97 opened 6 years ago

lukel97 commented 6 years ago

Currently the quick fix suggestions for importing a module when a symbol cannot be found only suggest modules available on Hoogle. This should be expanded to search other modules in the same package/project/folder being worked on.

A minimal test case would be:

module A where
foo :: Int -> Int
foo x = x + 1

module B where
bar :: Int -> Int
bar = foo -- Variable not in scope: getProcessID - import suggestion for A

This may involve having to typecheck other modules in the background so we can get the exported symbols.

lorenzo commented 6 years ago

Could we somehow get the list of exposed-modules and other-modules from the cabal file?

lorenzo commented 6 years ago

I believe this is already working, for example I'm able to complete Haskell.Ide.Engine.* modules when working with the hie codebase. Is there anything missing here?

lukel97 commented 6 years ago

@Lorenzo sorry should have been more clear, this is for the missing variable/symbol suggestions that suggest modules to import. Updated the issue with an example