Skip to content

Refactor plugin shows "bug in srcspan parser" when trying to construct code action #4079

Closed
@jhrcek

Description

@jhrcek

Your environment

Which OS do you use?
Linux
Which version of GHC do you use and how did you install it?
9.4.8
How is your project built (alternative: link to the project)?

Which LSP client (editor/plugin) do you use?
VSCode

Which version of HLS do you use and how did you install it?
latest master
Have you configured HLS in any way (especially: a hie.yaml file)?
hie.yaml

This compiler error:

• Illegal term-level use of the type constructor or class ‘Id’
• imported from ‘PI.Core.Id’ at /home/jhrcek/Devel/github.com/Holmusk/PI/backend/src/PI/Db/CohortExplorer/Builder.hs:65:20-21
• Perhaps use variable ‘id’ (imported from Prelude)
  Perhaps you want to add ‘Id’ to the import list in the import of
  ‘PI.Core.Id’
  (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/src/PI/Db/CohortExplorer/Builder.hs:65:1-22).
• In the second argument of ‘criteriaQuery’, namely
    ‘(Id 1 :: Id Cache)’
  In the second argument of ‘($)’, namely
    ‘criteriaQuery diagnosisLookup (Id 1 :: Id Cache) criteria’
  In a stmt of a 'do' block:
    pure $ criteriaQuery diagnosisLookup (Id 1 :: Id Cache) criteria

leads to this error being shown in the clinet:
Screenshot from 2024-02-16 11-37-07

The error is coming from here:

After adding some tracing I see that srcspan that's being passed to the parser is this:

srcspan="/home/jhrcek/Devel/github.com/Holmusk/PI/backend/src/PI/Db/CohortExplorer/Builder.hs:65:1-22). \8226 In the second argument of \8216criteriaQuery\8217, namely \8216(Id 1 :: Id Cache)\8217 In the second argument of \8216($)\8217, namely \8216criteriaQuery diagnosisLookup (Id 1 :: Id Cache) criteria\8217 In a stmt of a 'do' block: pure $ criteriaQuery diagnosisLookup (Id 1 :: Id Cache"

which seems like the regex extracting the input for srcpan parser is consuming too much input.
I'll look into this later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triagetype: 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