Skip to content
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 hovers just shows "Loading..." forever #17

Closed
yairchu opened this issue Feb 8, 2017 · 16 comments
Closed

Type hovers just shows "Loading..." forever #17

yairchu opened this issue Feb 8, 2017 · 16 comments

Comments

@yairchu
Copy link

yairchu commented Feb 8, 2017

When I hover on an expression to see its type it looks like this:
haskelly-screenshot
And it stays at "Loading..." forever.

This is when trying to use Haskelly for https://github.com/lamdu/lamdu/. I did also check on a different project, https://github.com/yairchu/generator/, where it worked fine.
So I guess something about Lamdu (multiple targets in single .cabal file?) doesn't work well with Intero, but it's better to have a nice error message than "Loading..." and false hope..

@martrik
Copy link
Collaborator

martrik commented Feb 9, 2017

Totally agree, we will look into it.

@lylek
Copy link

lylek commented Feb 10, 2017

Thanks for looking into it. It shows "Loading..." for me no matter what I'm looking at - single Haskell file or source file within a project.

@smobs
Copy link

smobs commented Feb 10, 2017

I also get this. Worth mentioning that I'm on windows and the project is on my D: drive (although it still didn't work when I moved the project to C: )

@martrik
Copy link
Collaborator

martrik commented Feb 10, 2017

Just to confirm, you don't get any code completion either right? (Code completion suggestions coming from the extension have a wrench icon next to them). Also, do your file/project paths have white spaces?

@lylek
Copy link

lylek commented Feb 10, 2017

No, I don't get any code completion either. I didn't even know you could get that. I do get syntax highlighting. For a single-file program, I get a button to "Run file", and that works. (Also "Load GHCi" and "QuickCheck". The "Load GHCi" button works - QuickCheck just errors because there are no QuickCheck defs.) For stack projects, I get "Load GHCi", "Stack test", "Stack build", and "Stack run". The first three work, but "Stack run" gives an error "Invalid argument `run'". Perhaps it should be "stack exec"?

stack --version gives me: Version 1.3.2 x86_64 hpack-0.15.0
And I am running on macOS Sierra 10.12.3, VS Code 1.9.1, Haskelly 0.4.10.

@martrik
Copy link
Collaborator

martrik commented Feb 10, 2017

To make sure, do you have Intero installed?

@lylek
Copy link

lylek commented Feb 10, 2017

No, what's Intero? Is that something I should or should not have installed?

@lylek
Copy link

lylek commented Feb 10, 2017

Ah, I see it now in the installation instructions. Sorry, I missed that. I'll follow the instructions to install the additional packages.

@lylek
Copy link

lylek commented Feb 11, 2017

Well, I've now installed Intero, QuickCheck and stack-run.

Good and bad news: When I fire up VS Code, there are some files where I can see type annotations. It seems to be OK with standalone files or files that are in stack projects. If I look at a file that's in a cabal (non-stack) project, it tells me "Couldn't guess that module name. Does it exist?" And then once it has done that, it gets stuck doing that. I can go to a file that it worked on before and now it gives me that same error. ☹️

could_not_guess_module_name

@lylek
Copy link

lylek commented Feb 11, 2017

It also gives some weird results for type annotations, such as:

  • Hovering over a string literal, it tries to look up the word in the string as variable
  • Hover over a literal zero and you may see "0 :: IO ()"

...and more. But I'm guessing these are more due to Intero.

@martrik
Copy link
Collaborator

martrik commented Feb 11, 2017

@lylek OK great that it works on both single files and Stack project. Currently Haskelly only supports this two scenarios, so it's normal that you don't get any type hover or code completion in the folder with just a cabal file. Regarding your last comment, it sounds that the problems are related to Intero itself. Maybe we can open an issue in their repo?

@lylek
Copy link

lylek commented Feb 12, 2017

OK thanks, understood about the two scenarios. I feel like sometimes though it successfully does inference on a file, and then after I click around a while on other files and go back to that file, it can't do inference on it anymore. I suspect that the reason is that once you open a Stack project in a window, Haskelly associates that with the window. That actually seems reasonable if your normal use case is opening a separate window for each project and not just browsing around at random. If I figure out more of a pattern behind the behavior, I'll let you know.

I've posted another issue for the bit about the string literals. I can actually see in the Haskelly source where the limitation is.

As for hovering over the zero and getting 'IO : ()', agreed that sounds like an Intero problem. If I figure out a bit more of a pattern to the Intero issues, I can post a bug report with them.

@martrik
Copy link
Collaborator

martrik commented Feb 12, 2017

The way we designed Haskelly is that it detects every change in the opened file. In every change we check if that new file belongs to a different Stack project, if so we refresh the Intero process with the new project. However, that's doesn't work for you right? Even after 10 seconds? Take into account that loading the new Stack project takes some time, so until it hasn't been fully loaded it's normal to see the Couldn't guess that module name. By the way, that's something which will be fixed in the new release.

@martrik martrik closed this as completed Feb 12, 2017
@yairchu
Copy link
Author

yairchu commented Feb 13, 2017

Updated to Haskelly 0.4.14 (as well as VS Code 1.9.1) and the original problem I reported still occurs with no change.

I wonder if the problem is fixed in an unreleased version of Haskelly? Then should I test the github version to check if the problem is fixed? Or maybe the issue was closed because of other topics folks discussed here in this thread unrelated to my original bug report? @martrik

@martrik
Copy link
Collaborator

martrik commented Feb 13, 2017

That's true, the issue was closed by mistake, sorry about that. I've opened a new issue (#23) that targets the root issue that's causing the 'Loading...'.

@Centril
Copy link

Centril commented Apr 24, 2017

Having this problem as well, for https://github.com/DATX02-17-26/DATX02-17-26

did:

stack install intero QuickCheck stack-run

I get neither type hovers, snippets, or code completion.

stack --version:
Version 1.4.0, Git revision e714f1dd3fade19496d91bd6a017e435a96a6bcd (4640 commits) x86_64 hpack-0.17.0

ghc --version:
The Glorious Glasgow Haskell Compilation System, version 8.0.2

I also tried installing via git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants