Skip to content

Completing record selectors with RecordDotSyntax inserts invalid imports instead #4405

Open
@evertedsphere

Description

@evertedsphere

In a record selector (.foo.|) (with | indicating the cursor), if there is a bar completion indicating a .bar field declared in Bar that would be valid there, HLS will treat this as a qualified import of bar and insert something like

import Bar as foo

f = (.foo.bar|)

which is syntactically invalid. I would expect the same completion but without the invalid import.

Although not ideal, a quick fix for this within HLS could be for the "add import" feature to simply warn/error on syntactically invalid requests.

Your environment

Which OS do you use? NixOS

Which version of GHC do you use and how did you install it? 9.8.2, via Nix

How is your project built? cabal

Which LSP client (editor/plugin) do you use? emacs with lsp-mode

Which version of HLS do you use and how did you install it? 2.9.0.0, via Nix

Have you configured HLS in any way (especially: a hie.yaml file)? No

Metadata

Metadata

Assignees

No one assigned

    Labels

    HackathonThis issue is suitable for hackathon sessionscomponent: ghcidetype: 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