[英]Local dependency causes error messages in Haskell Extension for VSCode
I am trying to combine the pandoc and the pandoc-types repos to be able to change the source code in both while having the advantages of the Haskel Extension for VSCode ( documentation on hover and autocomplete )我正在尝试结合pandoc和pandoc-types 存储库,以便能够同时更改两者的源代码,同时具有 Haskel Extension for VSCode 的优势(有关悬停和自动完成的文档)
I used both approaches described in my own answer to my question .我使用了我自己对我的问题的回答中描述的两种方法。 I am able to successfully compile my code with
pandoc-types
as a local dependency using cabal build
and stack build
.我能够使用
cabal build
和stack build
使用pandoc-types
作为本地依赖项成功编译我的代码。
As mentioned in the Link above, in order to add a local dependency to a stack
project, the following file needs to be changed from this:如上面链接中所述,为了向
stack
项目添加本地依赖项,需要更改以下文件:
flags:
pandoc:
trypandoc: false
embed_data_files: true
static: false
packages:
- '.'
extra-deps:
- pandoc-types-1.22
- texmath-0.12.0.3
- rfc5051-0.2
- haddock-library-1.9.0
- skylighting-0.10.0.3
- skylighting-core-0.10.0.3
- doclayout-0.3
- emojis-0.1
- hslua-1.1.2
- jira-wiki-markup-1.3.2
- HsYAML-0.2.1.0
- HsYAML-aeson-0.2.0.0
- doctemplates-0.8.2
- commonmark-0.1.1
- commonmark-extensions-0.2.0.2
- commonmark-pandoc-0.2.0.1
- git: https://github.com/jgm/citeproc
commit: 1860f189e9995c1dc27a68893bedfbf8de1ee67f
ghc-options:
"$locals": -fhide-source-paths -Wno-missing-home-modules
resolver: lts-14.6
nix:
packages: [zlib]
... to this: ...到这个:
flags:
pandoc:
trypandoc: false
embed_data_files: true
static: false
packages:
- '.'
- pandoc-types
extra-deps:
- texmath-0.12.0.3
- rfc5051-0.2
- haddock-library-1.9.0
- skylighting-0.10.0.2
- skylighting-core-0.10.0.2
- doclayout-0.3
- emojis-0.1
- hslua-1.1.2
- jira-wiki-markup-1.3.2
- HsYAML-0.2.1.0
- HsYAML-aeson-0.2.0.0
- doctemplates-0.8.2
- commonmark-0.1.0.2
- commonmark-extensions-0.2.0.1
- commonmark-pandoc-0.2.0.1
- citeproc-0.1.0.1
ghc-options:
"$locals": -fhide-source-paths -Wno-missing-home-modules -exclude-module={Paths_pandoc.hs}
resolver: lts-14.6
nix:
packages: [zlib]
But this change results in about 400 warnings of the type A do-notation statement discarded a result of type <...>
and about 40 errors like Could not deduce ... arising from a use of ...
.但是这种变化导致大约 400 条
A do-notation statement discarded a result of type <...>
型A do-notation statement discarded a result of type <...>
警告A do-notation statement discarded a result of type <...>
以及大约 40 条错误,例如Could not deduce ... arising from a use of ...
Within the Haskell Extension in VSCode.在 VSCode 的 Haskell 扩展中。 The first warning should actually already be suppressed with the -fno-warn-unused-do-bind flag in ghc-options within the pandoc.cabal file (assuming this is what the extension reads in order to print warnings/errors).
第一个警告实际上应该已经被 pandoc.cabal 文件中的 ghc-options 中的 -fno-warn-unused-do-bind 标志抑制了(假设这是扩展为了打印警告/错误而读取的内容)。 But most importantly the hover documentation does not properly work.
但最重要的是悬停文档无法正常工作。 Compilation still works.
编译仍然有效。
Since I am new to Haskell, and I need to understand the code base, I really require proper IDE features.由于我是 Haskell 的新手,我需要了解代码库,因此我确实需要适当的 IDE 功能。 But I really don't know what the errors/warnings are caused by.
但我真的不知道错误/警告是由什么引起的。 Does anyone know how to solve this problem?
有谁知道如何解决这个问题?
The general setup seems to be correct for my case mentioned in the question.对于我在问题中提到的情况,一般设置似乎是正确的。 In order for the Haskell-Language-Server (the base for the extension) to work correctly one needs to setup the hie-bios using a file named
hie.yaml
.为了让 Haskell-Language-Server(扩展的基础)正常工作,需要使用名为
hie.yaml
的文件设置hie-bios 。 In my case the file looks like this:在我的情况下,文件如下所示:
cradle:
stack:
- path: "./pandoc-types/src"
component: "pandoc-types:lib"
- path: "./src"
component: "pandoc:lib"
- path: "."
component: "pandoc:exe:pandoc"
The language server properly starts without errors and the local dependency is not downloaded and build in the process.语言服务器正确启动,没有错误,并且本地依赖项不会在此过程中下载和构建。
However I still have not gotten the hover documentation to work.但是,我仍然没有使悬停文档起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.