haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

Request textDocument/documentSymbol failed with `cannot satisfy -package-id` #837

Closed cah6 closed 6 years ago

cah6 commented 6 years ago

I'm trying to get Haskell Language Server working in vscode...it works for built-in packages (like containers) but fails for others (like aeson). I've also tried this from atom and it failed with the same output. From the vscode extension logs:

info: Using Cabal project at: /Users/christian.henry/coding/haskell/nix-test
DEBUG: reading cache: /Users/christian.henry/coding/haskell/nix-test/dist/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
       ["-i","-idist/build/nix-test/nix-test-tmp","-isrc","-idist/build/nix-test/autogen","-idist/build/global-autogen","-Idist/build/nix-test/autogen","-Idist/build/global-autogen","-Idist/build/nix-test/nix-test-tmp","-optP-include","-optPdist/build/nix-test/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint: []
DEBUG: making sure autogen files exist
DEBUG: autogen files out of sync
DEBUG: writing Cabal autogen files
DEBUG: reading cache: dist/setup-config.ghc-mod.resolved-components
VOMIT: Using the following mapped files: "/Users/christian.henry/coding/haskell/nix-test/src/Main.hs"
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" "dist/build/nix-test/nix-test-tmp" "-odir" "dist/build/nix-test/nix-test-tmp" "-hidir" "dist/build/nix-test/nix-test-tmp" "-stubdir" "dist/build/nix-test/nix-test-tmp" "-i" "-idist/build/nix-test/nix-test-tmp" "-isrc" "-idist/build/nix-test/autogen" "-idist/build/global-autogen" "-Idist/build/nix-test/autogen" "-Idist/build/global-autogen" "-Idist/build/nix-test/nix-test-tmp" "-optP-include" "-optPdist/build/nix-test/autogen/cabal_macros.h" "-hide-all-packages" "-Wmissing-home-modules" "-package-id" "base-4.11.1.0" "-package-id" "aeson-1.3.1.1-IIws8ihD9EF7nr6Y0MCLpZ" "-package-id" "containers-0.5.11.0" "-package-id" "lens-4.16.1-3z2CFiAMwL0tenn7vLScQ" "-package-id" "text-1.2.3.0" "-XHaskell2010" "-Wno-missing-home-modules" "-O0" "-fno-warn-missing-home-modules"
DEBUG: initSession: Session not initialized, creating new one
[Error - 7:02:47 PM] Request textDocument/documentSymbol failed.
  Message: <command line>: cannot satisfy -package-id aeson-1.3.1.1-IIws8ihD9EF7nr6Y0MCLpZ
    (use -v for more information)

  Code: -32700

Note that I'm using Nix, but launched vscode from a nix shell that should have access to everything it needs. Things I've tested from this shell:

  1. I can run hie:
    $ hie
    2018-09-17 20:38:35.095262 [ThreadId 4] - Using plain GHC version
    2018-09-17 20:38:35.17374 [ThreadId 4] - Run entered for HIE(hie) Version 0.2.0.0, Git revision 75e1aca6060840f3c3e011f8afbf3dc18f1fb710 (1522 commits) x86_64 ghc-8.4.3
    2018-09-17 20:38:35.175159 [ThreadId 4] - Current directory:/Users/christian.henry/coding/haskell/nix-test
  2. My ghc has the correct aeson:
    $ ghc-pkg describe aeson
    name: aeson
    version: 1.3.1.1
    id: aeson-1.3.1.1-IIws8ihD9EF7nr6Y0MCLpZ
    key: aeson-1.3.1.1-IIws8ihD9EF7nr6Y0MCLpZ
    ...
  3. I have the right cabal version for GHC 8.4.3:
    $ cabal --version
    cabal-install version 2.2.0.0
    compiled using version 2.2.0.1 of the Cabal library
  4. I can actually run GHC successfully with the arguments that it breaks on:
    $ ghc "-fbuilding-cabal-package" "-O" "-outputdir" "dist/build/nix-test/nix-test-tmp" "-odir" "dist/build/nix-test/nix-test-tmp" "-hidir" "dist/build/nix-test/nix-test-tmp" "-stubdir" "dist/build/nix-test/nix-test-tmp" "-i" "-idist/build/nix-test/nix-test-tmp" "-isrc" "-idist/build/nix-test/autogen" "-idist/build/global-autogen" "-Idist/build/nix-test/autogen" "-Idist/build/global-autogen" "-Idist/build/nix-test/nix-test-tmp" "-optP-include" "-optPdist/build/nix-test/autogen/cabal_macros.h" "-hide-all-packages" "-Wmissing-home-modules" "-package-id" "base-4.11.1.0" "-package-id" "aeson-1.3.1.1-IIws8ihD9EF7nr6Y0MCLpZ" "-package-id" "containers-0.5.11.0" "-package-id" "lens-4.16.1-3z2CFiAMwL0tenn7vLScQ" "-package-id" "text-1.2.3.0" "-XHaskell2010" "-Wno-missing-home-modules" "-O0" "-fno-warn-missing-home-modules" Main
    [1 of 1] Compiling Main             ( src/Main.hs, dist/build/nix-test/nix-test-tmp/Main.o )
    Linking src/Main ...
    clang-5.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang-5.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
  5. Cabal is all updated:
    $ cabal update
    Downloading the latest package list from hackage.haskell.org
    To revert to previous state run:
    cabal update --index-state='2018-09-17T22:51:40Z'

Anyone have ideas as to what I can try to fix this?

cah6 commented 6 years ago

Actually, I might be running into https://github.com/NixOS/nixpkgs/pull/46453. I'll close this since this seems to be an issue on the nix side.