Open poscat0x04 opened 3 years ago
I think this issue is already fixed in #616, which will be included in upcoming monthly release.
Hmmm, I don't think #616 will fix this. For example, hls will still try to rename the module name of "test/Spec.hs" from Main
to Spec
after the fix.
Hmmm, I don't think #616 will fix this. For example, hls will still try to rename the module name of "test/Spec.hs" from
Main
toSpec
after the fix.
Ah, you're right! So PR #616 solved this issue only partially and we need to use more metadata to determine the module name.
The plugin provides just a suggestion, it doesn't force you to do anything.
Naturally, it would be nice to solve the issue, but where would the necessary metadata come from?
Naturally, it would be nice to solve the issue, but where would the necessary metadata come from?
Hmm, it seems that flags given by hie-bios
don't include any information about main-is
.
Since HLS is build-system agnostic, IIUC, I think it is not so easy to do with GHC API alone...
By parsing the cabal file? I feel like hie-bios is responsible for this. Unfortunately, I'm not really familiar with how HLS works under the hood so I can't answer that question.
IIUC, currently the shake system does not store component details like main-is
. hie-bios does not consider the PackageDescription; instead, implicit-hie will parse cabal files to get component root, options, etc., which ghcide uses to initialize IDE session. Actually, we don't care about if the component is a library, or a test, or even a benchmark.
Parsing the cabal file could be the way to go, and it would be already in scope if we recover the hie package plugin #155. But it is not the case for now.
We could ask hie-bios for more info, but not sure if it would be feasible until it uses the new cabal show-build-info
feature. What do you think @fendor?
The module name of the file that "main-is" is pointing to should always be
Main
.Your environment
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
:VSCode