-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Restore eval plugin build for GHC 9.2 #2669
Conversation
Progress report: I can now find all comments containing code to evaluate. Tests for the plugin are now:
There is two cases of failures:
-- >>> :type +no 42
--- parse error on input ‘+’
+-- parse error on input `+'
|
3238e4e
to
ddb3aaa
Compare
ddb3aaa
to
54e352e
Compare
MR is ready for review. I do have one point to discuss, see inline comments. |
Using `HasCallStack`, `testCase` can no pinpoint the call location instead of pointing inside the utility function.
It restores the eval plugin. Now annotations with comments are found by walking the AST and locating specific annotations. In order to fix unit test, I implemented a new golden test function which accepts a different naming scheme depending on the GHC version.
Eval plugin does not report progress, I don't understand why.
b5d4e65
to
4dcca04
Compare
All tests are fixed! |
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.
LGTM, although I don't know enough about the exactprint/compat parts to comment on them.
@@ -295,8 +285,7 @@ runEvalCmd plId st EvalParams{..} = | |||
dbg "LOAD RESULT" $ asS loadResult | |||
case loadResult of | |||
Failed -> liftIO $ do | |||
hClose logHandle | |||
err <- readFile logFilename | |||
let err = "" |
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.
suspicious
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.
Yes it is. Previously the err
was filled by the logging architecture (see discussion here: #2669 (comment)) and @pepeiborra agreed that it can be removed. We can pull the thread even more by removing this err
value, changing the return type from Either
to Maybe
. I tried to reduce the amount of changes in order to restore this plugin.
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.
If it's something to do in a follow-up PR, please leave a comment. Otherwise future readers (possibly future you :) ) will be mystified.
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.
I think the simplest thing to do is fill the err
with asS loadResult
, or something even simpler like "failed to load module". I feel like it will be hard to change the Either
to a Maybe
because type CommandFunction idestate a = ideState a -> LspM Conflg (Either ResponseError Value)
, unless we're changing CommandFunction
which would change lots of things should just put some reason in there instead.
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.
Thank you, I'll address that in a followup commit.
@@ -53,22 +56,44 @@ queueForEvaluation ide nfp = do | |||
EvaluatingVar var <- getIdeGlobalState ide | |||
modifyIORef var (Set.insert nfp) | |||
|
|||
#if MIN_VERSION_ghc(9,0,0) | |||
#if MIN_VERSION_ghc(9,2,0) | |||
getAnnotations :: Development.IDE.GHC.Compat.Located HsModule -> [LEpaComment] |
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.
maybe nest these two in a where
clause of apiAnnComments'
so that the same names are defined in all versions?
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.
I'll address that in a followup commit.
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.
lgtm
Thank you for the merge. I was in the middle of addressing the comments of @michaelpj, I'll do that in a followup MR ;) |
The eval plugin is building again and working partially. The codelens
(and evaluation) only happen for code in module comment, code appearing
in the top level comments / haddock are ignored. I need to walk the AST
to locate them.
This is work in progress for #2179.