Skip to content

Commit

Permalink
Add support for include-directories
Browse files Browse the repository at this point in the history
Add code to get the include-directories from the package description and pass
those on to flycheck.
  • Loading branch information
laleanor committed Nov 19, 2024
1 parent b7c4861 commit 23f8e14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flycheck-haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ buffer."
(cons "-hide-all-packages"
(seq-map (apply-partially #'concat "-package=")
.dependencies)))
(seq-map (apply-partially #'concat "-I")
.include-directories)
flycheck-ghc-args)))
(setq-local flycheck-hlint-args
(flycheck-haskell--delete-dups
Expand Down
8 changes: 8 additions & 0 deletions get-cabal-configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ getSourceDirectories :: [BuildInfo] -> FilePath -> [String]
getSourceDirectories buildInfo cabalDir =
map (cabalDir </>) (concatMap hsSourceDirs' buildInfo)

getIncludeDirectories :: [BuildInfo] -> FilePath -> [String]
getIncludeDirectories buildInfo cabalDir =
map (cabalDir </>) (concatMap includeDirs buildInfo)

hsSourceDirs' :: BuildInfo -> [FilePath]
hsSourceDirs' =
#if defined(Cabal36OrLater)
Expand Down Expand Up @@ -534,6 +538,7 @@ dumpPackageDescription pkgDesc projectDir = do
#endif
, cons (sym "package-name") [packageName]
, cons (sym "components") $ getComponents packageName pkgDesc
, cons (sym "include-directories") (includeDirs :: [UnixFilepath])
]
where
buildInfo :: [BuildInfo]
Expand All @@ -542,6 +547,9 @@ dumpPackageDescription pkgDesc projectDir = do
sourceDirs :: [UnixFilepath]
sourceDirs = ordNub (map mkUnixFilepath (getSourceDirectories buildInfo projectDir))

includeDirs :: [UnixFilepath]
includeDirs = ordNub (map mkUnixFilepath (getIncludeDirectories buildInfo projectDir))

exts :: [Extension]
exts = nub (concatMap usedExtensions buildInfo)

Expand Down

0 comments on commit 23f8e14

Please sign in to comment.