extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Module paths with `/` as separator are broken in Windows

Open keithfancher opened this issue 2 years ago • 3 comments

Discovered while working on this HLS PR: https://github.com/haskell/haskell-language-server/pull/4023, related to these issues:

  • https://github.com/haskell/haskell-language-server/issues/3174
  • https://github.com/kowainik/stan/issues/556

Stan, via extensions, appears to be prepending the hs-source-dirs from the .cabal file verbatim onto the module name. This means if the .cabal file uses / as its path separators, the returned file paths (and associated extension map) will be broken for Windows users.

For example, if your cabal file has:

  hs-source-dirs: extension-tests/language-pragma

... then the resulting Map key winds up looking like this for Windows users:

extension-tests/language-pragma\\LanguagePragmaTest.hs

This results in Map lookups missing, which in turn results in Stan not recognizing any of a project's enabled extensions. (One of the causes for the above-mentioned HLS issue.)

From a quick look, I think the issue might be happening around here somewhere. (I do see some Cabal version checks, not sure how those play into this...)

keithfancher avatar Feb 03 '24 00:02 keithfancher

Thanks for the report. stan and extensions have very little active maintainership currently. I'm happy to oversee and advise a patch to fix this, but I won't have time to do it myself any time in the near future. Perhaps @0rphee is interested?

tomjaguarpaw avatar Feb 03 '24 08:02 tomjaguarpaw

The first thing to do would be to produce an example that demonstrates the current behaviour, as simply as possible.

tomjaguarpaw avatar Feb 03 '24 08:02 tomjaguarpaw

Probably I won't be able to work on this for the foreseeable future, maybe in a few months.. :)

0rphee avatar Feb 06 '24 16:02 0rphee