Skip to content

Haskell Language Server passes file target for direct cradle to the cabal cradle #4431

Open
@fendor

Description

@fendor

More generally, if a project has a multi cradle setup, we need to make sure we respect cradle type resolution.

Reproducer:

  • cabal 3.12.1.0
  • sessionLoading: multiComponent
  • HLS: master 1ec65ee

Logs:

2024-10-15T14:55:15.565298Z | Debug | Session loading result: Left [CradleError {cradleErrorDependencies = ["haskell-language-server.cabal","cabal.project","cabal.project.local"], cradleErrorExitCode = ExitFailure 1, cradleErrorStderr = ["Failed to run [\"cabal\",\"v2-repl\",\"--keep-temp-files\",\"--enable-multi-repl\",\"/home/hugin/Documents/haskell/hls/ghcide/src/Development/IDE/Spans/AtPoint.hs\",\"/home/hugin/Documents/haskell/hls/ghcide/test/data/hover/GotoImplementation.hs\",\"/home/hugin/Documents/haskell/hls/ghcide/test/exe/FindImplementationAndHoverTests.hs\"] in directory \"/home/hugin/Documents/haskell/hls\". Consult the logs for full command and error.","Failed command: cabal --builddir=/home/hugin/.cache/hie-bios/dist-hls-036ebb56a4cc135651b7510a90f3136d v2-repl --with-compiler /home/hugin/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/hugin/.cache/hie-bios/ghc-pkg-99f55999495b863a61d4f15d989eaab4 --keep-temp-files --enable-multi-repl /home/hugin/Documents/haskell/hls/ghcide/src/Development/IDE/Spans/AtPoint.hs /home/hugin/Documents/haskell/hls/ghcide/test/data/hover/GotoImplementation.hs /home/hugin/Documents/haskell/hls/ghcide/test/exe/FindImplementationAndHoverTests.hs","","Error: [Cabal-7121]\nFailed extracting script block: `{- cabal:` start marker not found\n\n","","Process Environment:","HIE_BIOS_GHC: /home/hugin/.ghcup/ghc/9.6.5/lib/ghc-9.6.5/bin/ghc-9.6.5","HIE_BIOS_GHC_ARGS: -B/home/hugin/.ghcup/ghc/9.6.5/lib/ghc-9.6.5/lib"]}]

the issue boils down to this cabal error:

$ cabal v2-repl --enable-multi-repl /home/hugin/Documents/haskell/hls/ghcide/src/Development/IDE/Spans/AtPoint.hs /home/hugin/Documents/haskell/hls/ghcide/test/data/hover/GotoHover.hs
Error: [Cabal-7121]
Failed extracting script block: `{- cabal:` start marker not found

GotoHover is part of a direct cradle with the contents:

cradle: {direct: {arguments: ["Foo", "Bar", "GotoHover", "RecordDotSyntax"]}}

Metadata

Metadata

Assignees

Labels

component: ghcidemulti-componentIssues relating to multi-component supporttype: 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