Skip to content

Import Regression: Wrong Import Placement on first Import #2100

Closed
@emilypi

Description

@emilypi

Here's a weird one: first imports are inserted in wrong place. Unsure why.

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

askell-language-server version: 1.3.0.0 (GHC: 8.10.4) (PATH: /Users/emilypi/.ghcup/bin/haskell-language-server-wrapper-1.3.0) (GIT hash: e7c5e90b6df5dff2760d76169eddaea3bdd6a831)
Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		2.5.1
ghc:		8.10.4

Which OS do you use:
MacOS Big Sure

Which lsp-client do you use:

Emacs

Describe your project (alternative: link to the project):
*.cabal files, cabal.project

Contents of hie.yaml:

cradle:
  cabal:
    - path: "src"
      component: "lib:order"

    - path: "test"
      component: "order:test:doctests"

Steps to reproduce

  1. Make a first import with functions defined (along with comments)

Screen Shot 2021-08-16 at 11 44 07 AM

  1. Import goes in wrong place.

Screen Shot 2021-08-16 at 11 44 15 AM

  1. If importing another thing, imports are added below first import

Screen Shot 2021-08-16 at 11 46 12 AM

  1. However, when physically moved, to the right spot, imports work as expected.

Screen Shot 2021-08-16 at 11 44 40 AM

Screen Shot 2021-08-16 at 11 44 46 AM

Expected behaviour

Imports should be inserted in correct area of the module.

Actual behaviour

The first import is inserted above the first signicant decl, regardless of comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: imports plugintype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions