Skip to content

Module import code action ignores reexported-modules #2554

Closed
@guibou

Description

@guibou

Your environment

Which OS do you use: Linux
Which LSP client (editor/plugin) do you use: NeoVim + lspconfig
Describe your project (alternative: link to the project): https://github.com/guibou/repro_hls_base_no_prelude

Steps to reproduce

You can checkout https://github.com/guibou/repro_hls_base_no_prelude, it contains two cabal project with one Main.hs file with the following content:

{-# LANGUAGE NoImplicitPrelude #-}
module Main where

main :: IO ()
main = putStrLn "Hello, Haskell!"

Expected behaviour

The code above should not typecheck (i.e. IO is not in scope). Code action on the offending line should suggestion to import a few module, such as System.IO or Prelude.

Actual behaviour

There is two variations in the sample codebase.

  • One is a project with base as a dependency. Code action works as expected and suggest to import System.IO (as well as other modules from base which exports IO).

image

image

Note that in both cases, importing System.IO fixs the type error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: imports pluginstatus: needs infoNot actionable, because there's missing informationtype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions