-
Notifications
You must be signed in to change notification settings - Fork 17
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
Type info suddenly stops being returned from ide-backend #88
Comments
This code reproduces the bug, giving the following unexpected output:
I am OK with the empty list in the second result. I am not OK with it in the third result, where the typo info should match that returned in the first result. Here's the test, written against ide-backend alone: {-# LANGUAGE OverloadedStrings #-}
module Main where
import IdeSession
main = do
sess <- initSession defaultSessionConfig
{ configDir = "."
, configGenerateModInfo = True
}
let cb = \_ -> return ()
update = flip (updateSession sess) cb
update $ updateCodeGeneration True
update $ updateStdoutBufferMode (RunLineBuffering Nothing)
update $ updateStderrBufferMode (RunLineBuffering Nothing)
update $ updateModule "Foo.hs"
"module Foo where\n\
\\n\
\import Bar\n\
\\n\
\foo = bar >> bar\n\
\\n\
\foobar = putStrLn \"Baz\"\n"
update $ updateModule "Bar.hs"
"module Bar where\n\
\\n\
\bar = putStrLn \"Hello, world!\"\n"
update $ updateModule "Baz.hs"
"module Baz where\n\
\\n\
\import Foo\n\
\import Bar\n\
\\n\
\baz = foobar\n"
getSourceErrors sess
gif <- getSpanInfo sess
print $ gif "Baz" (SourceSpan "Baz.hs" 6 8 6 9)
update $ updateModule "Baz.hs"
"module Baz where\n\
\\n\
\import Foo\n\
\import Bar\n\
\\n\
\baz = foobar >>>> foo >> bar\n"
getSourceErrors sess
gif <- getSpanInfo sess
print $ gif "Baz" (SourceSpan "Baz.hs" 6 8 6 9)
update $ updateModule "Baz.hs"
"module Baz where\n\
\\n\
\import Foo\n\
\import Bar\n\
\\n\
\baz = foobar >> foo >> bar\n"
getSourceErrors sess
gif <- getSpanInfo sess
print $ gif "Baz" (SourceSpan "Baz.hs" 6 8 6 9) |
@edsko @Mikolaj This is a major issue for us, I'd like to get a fix for this by the time we have our beta release this week. Please spend up to 1 day on initial work on fixing this, and if it looks like the fix will take more time, please be in touch with me ASAP. We do not want to have to include a bunch of other changes to get a fix for this, so please provide this as a patch against the code we're currently building against (https://github.com/fpco/ide-backend/tree/47b556895bfb2fd9ef071f7dbb6f8923870a15e6). If you have any questions, please let us know. |
I should also note that I first witnessed this behavior about two weeks ago, but wrote it off to our isolation container running slowly in our testing environment. So I don't believe this is something new, just something that's gone unnoticed. |
It'd also be good to check that asking for info about modules that aren't in compilation doesn't cause something like this. While I have no concrete evidence that this is a problem, I just fixed a frontend bug that would cause info queries for a "Main" module that's not included in compilation. Interacting with "Main" modules seemed to be helpful in reproducing this. |
@mgsloan I'm not sure what you mean in suggesting that "Main" might somehow be special. The test case above demonstrates the problem with having any module named "Main". I don't think that name is special to the ide-backend at all. |
@jwiegley Right, "Main" is only special to the frontend. Multiple "Main" modules are allowed. The bug was that type info queries were allowed for "Main" modules even when they weren't the current target (therefore excluded). Anyway, I don't want to distract from the matter at hand - fixing your test case is definitely the priority. |
Looking at this now. |
Fixed this issue (which was due to the fact that ordering a list of ghc's |
@edsko Can I patch the version of ide-backend that I'm using by just cherry picking those two commits? |
@jwiegley I'm not sure which two commits you are referring to? I've pushed the patch directly to your |
@edsko Ok, thanks, I'm integrating it now! |
@edsko Your update to
I've confirmed that this does not fail prior to your changes. Can you please rectify this so that I can deploy it? |
I can't reproduce the test failure. Have you done 'cabal install' inside the server/ directory? |
@Mikolaj We aren't using a version of ide-backend which has a cabal file in the server directory. |
Some bits of the IRC log, to share with all interested parties and note down some things to verify later on. 07:27 < johnw> I'm even getting a failure in the good version now 09:21 < johnw> do these failures look benign to you: https://gist.github.com/5865406 |
Like @Mikolaj said: the first failure is probably due to the absence of a |
I've created a simple project with three modules:
If I keep switching modules, and clicking on identifier names, I see type info for those names. But if I edit the code such that there is a syntax error, and then fix that error, it's possible (quite easily, in fact), to get into a state where no type info is returned for any identifier anymore.
It's not that an exception is happening either. I'm calling
getSpanInfo
, and then calling function it returns, and I'm getting back an empty list:This state is very easy to get one's self into, and there seems to be no simple or consistent way to "undo it". It presents to the user as if our IDE simply stops giving type information or allowing the user to jump to function definitions within the project.
This is, I believe, the source of the problem reported in fpco/fpco#1681.
Pinging @snoyberg @Mikolaj
The text was updated successfully, but these errors were encountered: