Skip to content

Code action to remove redundant imports is sometimes not created #4220

Closed
@jhrcek

Description

@jhrcek

Using hls 2.7.0.0 in vscode with ghc 9.4.8, I sometimes don't get "remove redundant imports" code action.

Here's a one-module reproducer (assuming you have a cabal project with postgresql-simple dependency):

module Main where

import Database.PostgreSQL.Simple.Types (In (..), PGArray (..), Values (..), fromIdentifier, fromQuery)

main :: IO ()
main = do
    let array = PGArray []
        in_ = In []
        values = Values [] []
    putStrLn "Hello, Haskell!"

Although warning is generated and displayed on hover:

The import of ‘Identifier(fromIdentifier), Query(fromQuery)’
from module ‘Database.PostgreSQL.Simple.Types’ is redundanttypecheck(-Wunused-imports)

The usual code action to remove unused import is not created.
Not a big deal, but it's breaking my flow, as now I have to focus on what the warning is exactly saying and fix it manually 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    HackathonThis issue is suitable for hackathon sessionslevel: easyThe issue is suited for beginnerstype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions