DRAFT: Cabal project plugin diagnostics#4615
Conversation
plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject/Orphans.hs
Outdated
Show resolved
Hide resolved
cc35958 to
5876ac7
Compare
plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject.hs
Outdated
Show resolved
Hide resolved
plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject.hs
Outdated
Show resolved
Hide resolved
plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject.hs
Outdated
Show resolved
Hide resolved
| let perr = NE.head errs | ||
| in Left $ | ||
| Diagnostics.fatalParseErrorDiagnostic file | ||
| ("Failed to parse cabal.project file: " <> T.pack (show perr)) |
There was a problem hiding this comment.
Is this a nicely readable view for the user?
Also, you are only showing the first error in the list, we also want to know about the other ones.
| cacheDir :: String | ||
| cacheDir = "ghcide" |
There was a problem hiding this comment.
We should expose this constant from haskell-language-server/ghcide/session-loader/Development/IDE/Session.hs instead of hard-coding it here.
| (_warnings, Right fields) -> | ||
| Right fields | ||
|
|
||
| -- Helper for parseCabalProjectFileContents, returns unique cache directory for given cabal.project file |
There was a problem hiding this comment.
| -- Helper for parseCabalProjectFileContents, returns unique cache directory for given cabal.project file | |
| -- Returns unique cache directory for given cabal.project file |
| -- Extract fields from cabal.project file | ||
| readCabalProjectFields |
There was a problem hiding this comment.
Please use haddock comments, otherwise the documentation won't show up.
| -- we don't want to double report diagnostics, all diagnostics are produced by 'parseCabalProjectFileContents'. | ||
| (_warnings, Left (_mbVer, errs)) -> | ||
| Left (map (Diagnostics.errorDiagnostic file) (NE.toList errs)) |
There was a problem hiding this comment.
After some thinking, we should report these warning diagnostics after all, the same will go for the cabal-plugin.
Since we ignore the file diagnostics in the rule (ParseCabalProjectFields) where this is called already, I would return warning diagnostics as well as error diagnostics in here for consistency.
| False @? "Expected parse to fail (missing import), but it succeeded" | ||
| ] | ||
|
|
||
| -- ------------------------ ------------------------------------------------ |
There was a problem hiding this comment.
I know it was like that, from where you copied it but please remove the space 🙃
144aeb3 to
c33a7f1
Compare
4f13a72 to
1a56c77
Compare
Draft of cabal.project plugin for GSoC 2025
Still in progress!