haskell / haskell/haskell-language-server
Internal error even though the correct fix is applied to "not in scope" for `showAst` usage
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 11
Description
[I haven't found much in existing issues](https://github.com/haskell/haskell-language-server/issues?q=%22ghcide-code-actions-bindings%22%20%2B%20%22ModuleName%22%20%2B%20%22internal%20error%22).
### 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](https://github.com/Aster89/haskell-language-server/commit/980ac7d9f6c7da707713ddbffac8a80a9e388f72#diff-28a6ec0c177dda04c167d9e5a66d6aa5c3373d4cd8c49c976a1764f8a0c3a535R101).
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:
```haskell
import Language.Haskell.GHC.ExactPrint.Utils
import Language.Haskell.GHC.ExactPrint.Utils (showAst)
```
which is correct.
### Debug information
```none
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.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.