Closed
Description
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"
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE QuasiQuotes #-}
module PI.Db.Code.Project where
tupleSection = (1,) <$> Just 2
{-# INLINE addOne #-}
addOne x = x + 1
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.