The code action to add missing language extension adds it in the wrong place #2034
Labels
component: hls-pragmas-plugin
type: bug
Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
The current behavior of this code action is problematic.

It seems to be adding the LANGUAGE pragma below the last pragma in the file.
If you happen to have some pragma like INLINE somewhere below, the LANGUAGE pragma is added after that.
But LANGUAGE pragmas are only valid before the module declaration.
See this gif illustrating the issue:
Your environment
haskell-language-server version: 1.2.0.0 (GHC: 8.8.4) (PATH: /home/jhrcek/.local/bin/haskell-language-server) (GIT hash: 78381b8135811618101a9177ffd32102dac56b68) Tool versions found on the $PATH cabal: 3.4.0.0 stack: 2.7.1 ghc: 8.8.4
Which OS do you use:
Which lsp-client do you use:
Describe your project (alternative: link to the project):
Contents of
hie.yaml
:Steps to reproduce
Create a haskell file like this, hover over the one and select code action
Add "TupleSections"
Expected behaviour
Missing language pragma is added before the module declaration, where it is valid.
Actual behaviour
Missing language pragma is added after the last pragma in the file.
The text was updated successfully, but these errors were encountered: