Skip to content

Unable to load modules in haskell-language-server/plugins/default #1394

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

Open
berberman opened this issue Feb 18, 2021 · 5 comments
Open

Unable to load modules in haskell-language-server/plugins/default #1394

berberman opened this issue Feb 18, 2021 · 5 comments
Labels
component: ghcide component: implicit-hie status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@berberman
Copy link
Collaborator

berberman commented Feb 18, 2021

HLS version:

haskell-language-server version: 0.9.0.0 (GHC: 8.10.3) (PATH: /home/berberman/.cabal/store/ghc-8.10.3/haskell-language-server-0.9.0.0-fc61519dda1a1498575dccc3fb04c9f3a1600a61493f968ee632374480d5dcd6/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:		3.2.0.0
stack:		Not found
ghc:		8.10.3

I found HLS could not load modules in this directory: for example, I opened Example.hs, and I got

Multi Cradle: No prefixes matched
pwd: /home/berberman/Desktop/haskell/haskell-language-server
filepath: /home/berberman/Desktop/haskell/haskell-language-server/plugins/default/src/Ide/Plugin/Example.hs
prefixes:
("./ghcide/src",Cabal {component = Just "lib:ghcide"})
("./ghcide/session-loader",Cabal {component = Just "lib:ghcide"})
("./ghcide/test/preprocessor/Main.hs",Cabal {component = Just "ghcide:exe:ghcide-test-preprocessor"})
("./ghcide/bench/hist/Main.hs",Cabal {component = Just "ghcide:bench:benchHist"})
("./ghcide/bench/lib/Main.hs",Cabal {component = Just "ghcide:bench:benchHist"})
("./ghcide/bench/hist/Experiments/Types.hs",Cabal {component = Just "ghcide:bench:benchHist"})
("./ghcide/bench/lib/Experiments/Types.hs",Cabal {component = Just "ghcide:bench:benchHist"})
("./ghcide/exe/Main.hs",Cabal {component = Just "ghcide:exe:ghcide"})
("./ghcide/exe/Arguments.hs",Cabal {component = Just "ghcide:exe:ghcide"})
("./ghcide/exe/Paths_ghcide.hs",Cabal {component = Just "ghcide:exe:ghcide"})
("./ghcide/test/cabal",Cabal {component = Just "ghcide:test:ghcide-tests"})
("./ghcide/test/exe",Cabal {component = Just "ghcide:test:ghcide-tests"})
("./ghcide/test/src",Cabal {component = Just "ghcide:test:ghcide-tests"})
("./ghcide/bench/lib",Cabal {component = Just "ghcide:test:ghcide-tests"})
("./ghcide/bench/lib/Main.hs",Cabal {component = Just "ghcide:exe:ghcide-bench"})
("./ghcide/bench/exe/Main.hs",Cabal {component = Just "ghcide:exe:ghcide-bench"})
("./ghcide/bench/lib/Experiments.hs",Cabal {component = Just "ghcide:exe:ghcide-bench"})
("./ghcide/bench/lib/Experiments/Types.hs",Cabal {component = Just "ghcide:exe:ghcide-bench"})
("./ghcide/bench/exe/Experiments.hs",Cabal {component = Just "ghcide:exe:ghcide-bench"})
("./ghcide/bench/exe/Experiments/Types.hs",Cabal {component = Just "ghcide:exe:ghcide-bench"})
("./src",Cabal {component = Just "lib:haskell-language-server"})
("./exe/Main.hs",Cabal {component = Just "haskell-language-server:exe:haskell-language-server"})
("./exe/Plugins.hs",Cabal {component = Just "haskell-language-server:exe:haskell-language-server"})
("./exe/Wrapper.hs",Cabal {component = Just "haskell-language-server:exe:haskell-language-server-wrapper"})
("./test/functional",Cabal {component = Just "haskell-language-server:test:func-test"})
("./plugins/hls-tactics-plugin/src",Cabal {component = Just "haskell-language-server:test:func-test"})
("./plugins/hls-eval-plugin/test",Cabal {component = Just "haskell-language-server:test:func-test"})
("./plugins/hls-splice-plugin/src",Cabal {component = Just "haskell-language-server:test:func-test"})
("./plugins/hls-eval-plugin/src",Cabal {component = Just "haskell-language-server:test:func-test"})
("./test/wrapper",Cabal {component = Just "haskell-language-server:test:wrapper-test"})
("./hie-compat/src-ghc86",Cabal {component = Just "lib:hie-compat"})
("./hie-compat/src-ghc88",Cabal {component = Just "lib:hie-compat"})
("./hie-compat/src-reexport",Cabal {component = Just "lib:hie-compat"})
("./hie-compat/src-ghc810",Cabal {component = Just "lib:hie-compat"})
("./hie-compat/src-reexport",Cabal {component = Just "lib:hie-compat"})
("./hls-plugin-api/src",Cabal {component = Just "lib:hls-plugin-api"})
("./plugins/hls-class-plugin/src",Cabal {component = Just "lib:hls-class-plugin"})
("./plugins/hls-eval-plugin/src",Cabal {component = Just "lib:hls-eval-plugin"})
("./plugins/hls-explicit-imports-plugin/src",Cabal {component = Just "lib:hls-explicit-imports-plugin"})
("./plugins/hls-haddock-comments-plugin/src",Cabal {component = Just "lib:hls-haddock-comments-plugin"})
("./plugins/hls-hlint-plugin/src",Cabal {component = Just "lib:hls-hlint-plugin"})
("./plugins/hls-retrie-plugin/src",Cabal {component = Just "lib:hls-retrie-plugin"})
("./plugins/hls-splice-plugin/src",Cabal {component = Just "lib:hls-splice-plugin"})
("./plugins/hls-tactics-plugin/src",Cabal {component = Just "lib:hls-tactics-plugin"})
("./plugins/hls-tactics-plugin/test",Cabal {component = Just "hls-tactics-plugin:test:tests"})
("./shake-bench/src",Cabal {component = Just "lib:shake-bench"})

The cradles generated by implicit-hie didn't include this file. However,

$ hie-bios debug plugins/default/src/Ide/Plugin/Example.hs

worked without error, and further, after I changed loadImplicitHieCradle to HieBios.loadImplicitCradle at

cradle <- maybe (loadImplicitHieCradle $ addTrailingPathSeparator dir) HieBios.loadCradle hieYaml

and

cradle <- maybe (loadImplicitHieCradle $ addTrailingPathSeparator dir) loadCradle hieYaml

i.e. using hie-bios to load the cradle rather than implicit-hie-cradle, I could load these modules successfully. So I think this should be a bug in implicit-hie. It seems that implicit-hie doesn't support common stanzas, but after normalizing these parts (by running cabal format), the result is still inaccurate:

$ cabal format
$ gen-hie
cradle:
  cabal:
    - path: "./ghcide/src"
      component: "lib:ghcide"

    - path: "./ghcide/session-loader"
      component: "lib:ghcide"

    - path: "./ghcide/test/preprocessor/Main.hs"
      component: "ghcide:exe:ghcide-test-preprocessor"

    - path: "./ghcide/bench/hist/Main.hs"
      component: "ghcide:bench:benchHist"

    - path: "./ghcide/bench/lib/Main.hs"
      component: "ghcide:bench:benchHist"

    - path: "./ghcide/bench/hist/Experiments/Types.hs"
      component: "ghcide:bench:benchHist"

    - path: "./ghcide/bench/lib/Experiments/Types.hs"
      component: "ghcide:bench:benchHist"

    - path: "./ghcide/exe/Main.hs"
      component: "ghcide:exe:ghcide"

    - path: "./ghcide/exe/Arguments.hs"
      component: "ghcide:exe:ghcide"

    - path: "./ghcide/exe/Paths_ghcide.hs"
      component: "ghcide:exe:ghcide"

    - path: "./ghcide/test/cabal"
      component: "ghcide:test:ghcide-tests"

    - path: "./ghcide/test/exe"
      component: "ghcide:test:ghcide-tests"

    - path: "./ghcide/test/src"
      component: "ghcide:test:ghcide-tests"

    - path: "./ghcide/bench/lib"
      component: "ghcide:test:ghcide-tests"

    - path: "./ghcide/bench/lib/Main.hs"
      component: "ghcide:exe:ghcide-bench"

    - path: "./ghcide/bench/exe/Main.hs"
      component: "ghcide:exe:ghcide-bench"

    - path: "./ghcide/bench/lib/Experiments.hs"
      component: "ghcide:exe:ghcide-bench"

    - path: "./ghcide/bench/lib/Experiments/Types.hs"
      component: "ghcide:exe:ghcide-bench"

    - path: "./ghcide/bench/exe/Experiments.hs"
      component: "ghcide:exe:ghcide-bench"

    - path: "./ghcide/bench/exe/Experiments/Types.hs"
      component: "ghcide:exe:ghcide-bench"

    - path: "./src"
      component: "lib:haskell-language-server"

    - path: "./plugins/default/src/Main.hs"
      component: "haskell-language-server:exe:haskell-language-server"

    - path: "./plugins/default/src/Ide/Plugin/Brittany.hs"
      component: "haskell-language-server:exe:haskell-language-server"

    - path: "./exe/Wrapper.hs"
      component: "haskell-language-server:exe:haskell-language-server-wrapper"

    - path: "./test/utils"
      component: "haskell-language-server:test:func-test"

    - path: "./test/functional"
      component: "haskell-language-server:test:func-test"

    - path: "./plugins/hls-tactics-plugin/src"
      component: "haskell-language-server:test:func-test"

    - path: "./plugins/hls-eval-plugin/test"
      component: "haskell-language-server:test:func-test"

    - path: "./plugins/hls-splice-plugin/src"
      component: "haskell-language-server:test:func-test"

    - path: "./plugins/hls-eval-plugin/src"
      component: "haskell-language-server:test:func-test"

    - path: "./test/utils"
      component: "haskell-language-server:test:wrapper-test"

    - path: "./test/wrapper"
      component: "haskell-language-server:test:wrapper-test"

    - path: "./hie-compat/src-ghc86"
      component: "lib:hie-compat"

    - path: "./hie-compat/src-ghc88"
      component: "lib:hie-compat"

    - path: "./hie-compat/src-reexport"
      component: "lib:hie-compat"

    - path: "./hie-compat/src-ghc810"
      component: "lib:hie-compat"

    - path: "./hie-compat/src-reexport"
      component: "lib:hie-compat"

    - path: "./hls-plugin-api/src"
      component: "lib:hls-plugin-api"

    - path: "./plugins/hls-class-plugin/src"
      component: "lib:hls-class-plugin"

    - path: "./plugins/hls-eval-plugin/src"
      component: "lib:hls-eval-plugin"

    - path: "./plugins/hls-explicit-imports-plugin/src"
      component: "lib:hls-explicit-imports-plugin"

    - path: "./plugins/hls-haddock-comments-plugin/src"
      component: "lib:hls-haddock-comments-plugin"

    - path: "./plugins/hls-hlint-plugin/src"
      component: "lib:hls-hlint-plugin"

    - path: "./plugins/hls-retrie-plugin/src"
      component: "lib:hls-retrie-plugin"

    - path: "./plugins/hls-splice-plugin/src"
      component: "lib:hls-splice-plugin"

    - path: "./plugins/hls-tactics-plugin/src"
      component: "lib:hls-tactics-plugin"

    - path: "./plugins/hls-tactics-plugin/test"
      component: "hls-tactics-plugin:test:tests"

    - path: "./shake-bench/src"
      component: "lib:shake-bench"
@jneira jneira changed the title Unable to laod modules in haskell-language-server/plugins/default Unable to load modules in haskell-language-server/plugins/default Feb 18, 2021
@jneira jneira added component: ghcide type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. component: hie-bios labels Feb 18, 2021
@berberman
Copy link
Collaborator Author

@Ailrun was right, I overlooked default plugins at that time... #741 (comment)

@jneira
Copy link
Member

jneira commented Jun 13, 2021

@berberman iguess it still is reproduced for the two modules which still life in default.
If that is the case it would be great fill anisue in implicit hie, to investigate the cause tham may affect other projects.

@jneira jneira added the status: needs info Not actionable, because there's missing information label Jun 13, 2021
@Ailrun
Copy link
Member

Ailrun commented Jun 13, 2021

@jneira Do we even need to leave them in default plugin directory? I mean, yes, this issue is still better to be fixed for other projects, but for HLS itself, I think we can either move those two example plugins into the src directory or into an example plugin package.

@jneira
Copy link
Member

jneira commented Jun 13, 2021

Sure, the correct place even without this bug would be in ./plugins/hls-example-plugin imo.
But i would close this one when we have an issue tracking this upstream.

@Ailrun
Copy link
Member

Ailrun commented Jun 13, 2021

Yes, probably that will be better for this issue itself. I just wanted to be clear about HLS devs' problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide component: implicit-hie status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants