Skip to content
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

HLS multi-component bug in primer-service and primer-test #181

Open
1 task done
georgefst opened this issue Oct 20, 2021 · 6 comments
Open
1 task done

HLS multi-component bug in primer-service and primer-test #181

georgefst opened this issue Oct 20, 2021 · 6 comments
Assignees
Labels
blocked/upstream ❌ Blocked by upstream issue tracking This is a tracking issue

Comments

@georgefst
Copy link
Contributor

georgefst commented Oct 20, 2021

(Just tracking this here in case anyone bumps in to it, and so that I've got a record of what the issue is for when I inevitably hit it again.)

If we load primer/primer-service/exe-server/Main.hs in to an editor running Haskell Language Server, we'll see a bizarre error in runDB:

Couldn't match type 'Primer.Database.Op' with 'Primer.Database.Op'

This is an instance of haskell/haskell-language-server#1370.

Workaround: load some module from lib:primer-service in to the editor. e.g. primer-service/src/Primer/Server.hs (EDIT: and one from primer-selda e.g. primer-selda/src/Primer/Database/Selda.hs). This may take a few seconds for HLS to re-initialise with the new component, but it should resolve the error.

@georgefst georgefst added the blocked/upstream ❌ Blocked by upstream issue label Oct 20, 2021
@dhess
Copy link
Member

dhess commented Oct 20, 2021

So does this mean we're doing something wrong at Haskell/Cabal level with our dependencies, or is this purely an HLS issue?

@georgefst
Copy link
Contributor Author

So does this mean we're doing something wrong at Haskell/Cabal level with our dependencies, or is this purely an HLS issue?

I'm pretty certain this is purely an HLS issue. Although I wasn't sure when I started investigating. Given there's nothing we can actually do on our end, would you prefer this closed? It would still serve as a useful record.

@dhess dhess added the tracking This is a tracking issue label Oct 20, 2021
@dhess
Copy link
Member

dhess commented Oct 20, 2021

Nah, let's track the upstream issue. It turns out that GitHub recently added a feature that does it automatically, so long as you format it something like this:

(Actually it seems the automatic tracking label on the upstream repo only works if you put the checkbox + link in the original post? Can you put it there and see? edit heh, you beat me to it :) )

@georgefst
Copy link
Contributor Author

That's pretty cool. I've edited the OP.

@georgefst
Copy link
Contributor Author

Unfortunately, #625 has made us considerably more vulnerable to this. Fix is essentially the same - load a module from primer-hedgehog (e.g. TestM) in to the editor if seeing these sorts of errors in primer-test.

@georgefst georgefst changed the title HLS multi-component bug in primer-service HLS multi-component bug in primer-service and primer-test Aug 16, 2022
@georgefst
Copy link
Contributor Author

georgefst commented Sep 14, 2022

For the record, until this is fixed upstream, my fix is to load one file from each component in to VSCode:

code  \
  primer/src/Primer/Core.hs \
  primer/gen/Primer/Gen/Core/Raw.hs \
  primer/testlib/Primer/Test/Util.hs \
  primer/test/Test.hs \
  primer-api/src/Primer/API.hs \
  primer-api/gen/Primer/Gen/API.hs \
  primer-api/testlib/Primer/API/Test/Util.hs \
  primer-api/test/Test.hs \
  primer-service/src/Primer/Server.hs \
  primer-service/exe-server/Main.hs \
  primer-service/exe-client/Main.hs \
  primer-service/exe-openapi/Main.hs \
  primer-service/test/Tests/OpenAPI.hs \
  primer-selda/src/Primer/Database/Selda.hs \
  primer-selda/testlib/Primer/Database/Selda/Test/Util.hs \
  primer-selda/test/Test.hs \
  primer-benchmark/src/Benchmarks.hs \
  primer-benchmark/test/Main.hs \
  primer-benchmark/bench/Main.hs \

I'm sure this can be adapted for other editors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/upstream ❌ Blocked by upstream issue tracking This is a tracking issue
Projects
None yet
Development

No branches or pull requests

2 participants