-
-
Notifications
You must be signed in to change notification settings - Fork 400
DRAFT: Cabal project plugin #4615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject/Orphans.hs
Outdated
Show resolved
Hide resolved
…bal-project plugin.
cc35958
to
5876ac7
Compare
, pluginHandlers = | ||
mconcat | ||
[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just omit pluginHandlers instead here, if you don't implement any.
|
||
cabalProjectRules :: Recorder (WithPriority Log) -> PluginId -> Rules () | ||
cabalProjectRules recorder plId = do | ||
-- Make sure we initialise the cabal project files-of-interest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nitpick, but you sometimes write cabal project
and sometimes, cabal.project
.
I would prefer if we were consistent here.
log' = logWith recorder | ||
|
||
{- | This is the kick function for the cabal project plugin. | ||
We run this action, whenever we shake session us run/restarted, which triggers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run this action, whenever we shake session us run/restarted, which triggers | |
We run this action, whenever a shake session is run/restarted, which triggers |
Diagnostics.fatalParseErrorDiagnostic file | ||
("Failed to parse cabal.project file: " <> T.pack (show perr)) | ||
|
||
(_warnings, Right fields) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not just ignore the warnings, the user will be interested to see them as they are also part of diagnostics.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
main = do | ||
defaultTestRunner $ | ||
testGroup | ||
"Cabal Plugin Tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should refer to cabal.project files.
let cabalFp = root </> "cabal.project" | ||
bytes <- BS.readFile cabalFp | ||
result <- E.try @E.IOException (Lib.parseCabalProjectFileContents cabalFp bytes) | ||
:: IO ( Either |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this type signature necessary?
-- | these functions are used to detect cabal kicks | ||
-- and look at diagnostics for cabal files | ||
-- kicks are run everytime there is a shake session run/restart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs talks about cabal files instead of cabal.project
-- | list comparison where the order in the list is irrelevant | ||
(@?==) :: (HasCallStack, Ord a, Show a) => [a] -> [a] -> Assertion | ||
(@?==) l1 l2 = sort l1 @?= sort l2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unused.
#include <iostream> | ||
int main() { std::cout << "OK | ||
"; return 0; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓
Draft of cabal.project plugin for GSoC 2025
Still in progress!