Skip to content

The code action to add missing language extension adds it in the wrong place #2034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jhrcek opened this issue Jul 22, 2021 · 1 comment
Closed
Labels
component: hls-pragmas-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@jhrcek
Copy link
Collaborator

jhrcek commented Jul 22, 2021

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:
AddMissingExtension

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.

@jneira jneira added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. component: hls-pragmas-plugin labels Jul 22, 2021
@jneira
Copy link
Member

jneira commented Jul 22, 2021

thanks for reporting the issue, we already have it in #1958 though

@jneira jneira closed this as completed Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-pragmas-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants