-
Notifications
You must be signed in to change notification settings - Fork 107
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
How to extract flags used to make GHCi session? #363
Comments
runGhcid uses:
The interesting part will be the I don't think that this information is exposed right now, but it should not be hard to provide a command which exposes the needed information. |
Alternatively, "just" linking with obelisk-command would give you access to that function. Don't know if this is an option. |
Thanks for your prompt reply @eskimor Right, linking is not an option. Would it be appropriate to refactor I was also wondering that there is no call to |
The package db is generated by nix in a nix-shell ultimately via |
@mpickering The way that I go about this is to wrap up the commands that are being run in a nix-shell. In my current emacs setup, that actually means running hie in a nix shell, running a separate hie for backend/common/frontend. Like so:
This way, hie just runs individually for each cabal file, but it's not entirely idea. I end up having to create a sandbox for each cabal file and add-sourcing common so that they play nice. It's not ideal and can get pretty flakey with the slower than normal compile times in obelisk land, but my setup may help you a little (or at least not hurt), perhaps! 🙂 |
Thanks @benkolera I implemented prototype support for this on my branch - https://github.com/mpickering/obelisk/tree/ide-args It worked with the example project you linked above (after launching vscode from the shell). There is a problem with |
Note that we can get the pkg database directly: cat "$(nix-build -E '(import <nixpkgs> {}).haskellPackages.ghcWithPackages (p: [p.vector])' --no-out-link)"/bin/ghci
#! /nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash -e
export NIX_GHC='/nix/store/i512zr3700xrc9d6aapjwqa1hxgj53kl-ghc-8.6.4-with-packages/bin/ghc'
export NIX_GHCPKG='/nix/store/i512zr3700xrc9d6aapjwqa1hxgj53kl-ghc-8.6.4-with-packages/bin/ghc-pkg'
export NIX_GHC_DOCDIR='/nix/store/i512zr3700xrc9d6aapjwqa1hxgj53kl-ghc-8.6.4-with-packages/share/doc/ghc/html'
export NIX_GHC_LIBDIR='/nix/store/i512zr3700xrc9d6aapjwqa1hxgj53kl-ghc-8.6.4-with-packages/lib/ghc-8.6.4'
exec "/nix/store/8vq01xmxlp9wxzilkw85rb621ag7nwmd-ghc-8.6.4/bin/ghci" "-B$NIX_GHC_LIBDIR" "${extraFlagsArray[@]}" "$@" |
I'm closing this as the motivating use-case, haskell-ide-engine, has been supplanted by HLS. HLS integration is on our roadmap. Anyone that still has a use-case is welcome to make another issue. |
I want to add support to
haskell-ide-engine
for obelisk.In order to do this I just need the list of flags used to invoke
ghci
whenob run
is called.My ideal interface is that there is a command I can run (for example
ob get-args common/Foo.hs
) which will output the list of flags such thatghci $(ob get-args common/Foo.hs) common/Foo.hs
will succeed.I haven't yet looked into the internals of obelisk so a little bit of direction might be all I need to implement this. I've already implemented support for
cabal
,hadrian
andrules_haskell
.The text was updated successfully, but these errors were encountered: