在Nix中,如何告诉“ Haskell语言服务器”以在当前项目中启用标志?
我的Nix Project的Cabal文件定义了一个标志,但默认情况下将其禁用:
flag with-examples
description: Include examples and their dependencies
default: False
但是当我在Nix-shell中运行Haskell-Language-Server
时,它说:
Hidden: no
Range: 1:1-2:1
Source: cradle
Severity: DsError
Message:
Error when calling cabal exec -v0 -- ghc --print-libdir
cabal: Could not resolve dependencies:
[__0] trying: ema-0.7.2.0 (user goal)
[__1] rejecting: ema:-with-examples (constraint from config file, command line
flag, or user target requires opposite flag selection)
[__1] trying: ema:+with-examples
[__2] unknown package: fsnotify (dependency of ema +with-examples)
[__2] fail (backjumping, conflict set: ema, fsnotify, ema:with-examples)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ema, ema:with-examples, fsnotify
在使标志true true之后,错误消失了默认,但这显然是不希望的行为。有没有办法修复HLS的这种行为?
我尝试使用cabal.project
flags添加
cabal。
复制此错误:(
git clone https://github.com/EmaApps/ema.git -b multisite
cd multisite && nix develop
nvim ema.cabal ## Make both the flags default: False
haskell-language-server
编辑以澄清这是Nix独有的)
My Nix project's cabal file defines a flag but leaves it disabled by default:
flag with-examples
description: Include examples and their dependencies
default: False
But when I run haskell-language-server
in the nix-shell, it says:
Hidden: no
Range: 1:1-2:1
Source: cradle
Severity: DsError
Message:
Error when calling cabal exec -v0 -- ghc --print-libdir
cabal: Could not resolve dependencies:
[__0] trying: ema-0.7.2.0 (user goal)
[__1] rejecting: ema:-with-examples (constraint from config file, command line
flag, or user target requires opposite flag selection)
[__1] trying: ema:+with-examples
[__2] unknown package: fsnotify (dependency of ema +with-examples)
[__2] fail (backjumping, conflict set: ema, fsnotify, ema:with-examples)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ema, ema:with-examples, fsnotify
The error goes away after making the flag True by default, but this is a clearly undesired behavior. Is there a way to fix this behavior of HLS?
I tried adding a cabal.project
file with flags: +with-examples
but that makes no difference.
To reproduce this error:
git clone https://github.com/EmaApps/ema.git -b multisite
cd multisite && nix develop
nvim ema.cabal ## Make both the flags default: False
haskell-language-server
(edited to clarify this is unique to Nix)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论