Skip to content

Internal error even though the correct fix is applied to "not in scope" for showAst usage #4941

Description

@Aster89

I haven't found much in existing issues.

Your environment

Which OS do you use? Up-to-date ArchLinux
Which version of GHC do you use and how did you install it? 9.14.1 from ghcup
How is your project built (alternative: link to the project)? https://github.com/Aster89/haskell-language-server/tree/internal-error-repro-steps

Which LSP client (editor/plugin) do you use?
Terminal Vim+YCM
Which version of HLS do you use and how did you install it? 2.13.0.0 from ghcup, not the local one I linked above.
Have you configured HLS in any way (especially: a hie.yaml file)? No

Steps to reproduce

Ask HLS to fix the "not in scope" error in using showAst at plugins/hls-case-split-plugin/src/Ide/Plugin/CaseSplit.hs:101.

One fundamental detail for the error to occur is that, as you can see, showAst is not in scope. If you fix that (by adding the appropriate import), then the code will still be erroneous because I'm passing undefined to showAst, but HLS correctly offers no FixIt.

Expected behaviour

No internal error.

Actual behaviour

Internal error.

However, one can enter 1/2 and press Enter to get either of these two imports at the top:

import Language.Haskell.GHC.ExactPrint.Utils
import Language.Haskell.GHC.ExactPrint.Utils (showAst)

which is correct.

Debug information

2026-05-26T11:00:04.508498Z | Error | ghcide-code-actions-bindings: Internal Error: Exception in plugin PluginId "ghcide-code-actions-bindings" while processing SMethod_TextDocumentCodeAction: GHC.Internal.Data.Data.dataTypeConstrs is not supported for ModuleName, as it is not an algebraic data type.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions