Skip to content

Importing literate preprocessed module does not find module #3852

@sgraf812

Description

@sgraf812

Your environment

Check out https://github.com/sgraf812/abs-den/tree/lsp-bug, navigate to the paper directory , type $ nix develop.

Which LSP client (editor/plugin) do you use? This is on the command line.

Which version of HLS do you use and how did you install it?
Version 1.10.0.0 from nixpkgs.

Have you configured HLS in any way (especially: a hie.yaml file)?
Yes, there's a hie.yaml file in the paper directory to instruct GHC to use lhs2TeX as a literate preprocessor. Note that I verified that this hie.yaml file works as expected through the use of hie-bios check Main.hs.

Steps to reproduce

$ git clone https://github.com/sgraf812/abs-den
$ cd abs-den/paper
$ git checkout lsp-bug
$ ls -l
.rw-r--r-- 76 sgraf 24 Okt 19:39 hie.yaml
.rw-r--r-- 29 sgraf 24 Okt 20:05 Lib.lhs
.rw-r--r-- 46 sgraf 24 Okt 20:05 Main.hs
$ cat hie.yaml
cradle:
  direct:
    arguments: ["-pgmL", "lhs2TeX", "-optL--pre"]
$ cat Lib.lhs
> module Lib where f () = ()
$ cat Main.hs
import Lib

main :: IO ()
main = print (f ())
$ nix develop  # or install lhs2TeX
$ nix run nixpkgs#haskellPackages.hie-bios -- check Main.hs
<all good> 
$ nix run nixpkgs#haskellPackages.haskell-language-server -- Main.hs
2023-10-24T18:08:25.196793Z | Info | No log file specified; using stderr.
2023-10-24T18:08:25.197321Z | Info | haskell-language-server version: 1.10.0.0 (GHC: 9.2.8) (PATH: /nix/store/nk1ciwpfby9073ms8rhqx2k3lhf6nm3f-haskell-language-server-1.10.0.0/bin/.haskell-language-server-9.2.8-unwrapped)
2023-10-24T18:08:25.197653Z | Info | Directory: /home/sgraf/code/tex/abs-den/paper
2023-10-24T18:08:25.197784Z | Info | Logging heap statistics every 60.00s
 ghcide setup tester in /home/sgraf/code/tex/abs-den/paper.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/sgraf/code/tex/abs-den/paper
Found 1 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  (/home/sgraf/code/tex/abs-den/paper/hie.yaml)

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
2023-10-24T18:08:25.200927Z | Info | Cradle path: Main.hs
2023-10-24T18:08:25.201230Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2023-10-24T18:08:25.251648Z | Info | Interface files cache directory: /home/sgraf/.cache/ghcide/main-b723efa579d15c9b6ba5a0915c82313a5c4c1745
2023-10-24T18:08:25.251924Z | Info | Making new HscEnv. In-place unit ids: [main]
2023-10-24T18:08:25.422371Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /home/sgraf/code/tex/abs-den/paper/Main.hs
Hidden:   no
Range:    1:8-1:11
Source:   not found
Severity: DsError
Message:
  Could not load module ‘Lib’
  It is a member of the hidden package ‘libiserv-9.2.8’.
  You can run ‘:set -package libiserv’ to expose it.
  (Note: this unloads all the modules in the current scope.)
Files that failed:
 * /home/sgraf/code/tex/abs-den/paper/Main.hs

Completed (0 files worked, 1 file failed)

Expected behaviour

I did not expect an error reporting that Lib could not be found.

Actual behaviour

An error indicating that Lib could not be found.


I thought at first this is related to the caveat about preprocessors, but actually it should find the preprocessor just fine! I don't think the preprocessor is even invoked and that is the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs infoNot actionable, because there's missing informationtype: 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