0

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)

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.

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:

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 .... Within the Haskell Extension in VSCode. 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). 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. But I really don't know what the errors/warnings are caused by. Does anyone know how to solve this problem?

jns_ai_unr
  • 753
  • 1
  • 8
  • 19

1 Answers1

1

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. 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.

jns_ai_unr
  • 753
  • 1
  • 8
  • 19