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

Intellisense not working for packages with Ionide in VSCode #421

Closed
jimmyp opened this issue Apr 26, 2017 · 9 comments
Closed

Intellisense not working for packages with Ionide in VSCode #421

jimmyp opened this issue Apr 26, 2017 · 9 comments

Comments

@jimmyp
Copy link

jimmyp commented Apr 26, 2017

I am just beginning with FSharp and am trying to work in VSCode on my mac. I've followed all the install instructions here https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-1.0.1

However Inoide can't seem to pick up any of the packages I've added. Here is an example:

Screenshot of error

As you can see the plugin is running ok as I get type info but it won't pick up the package. Hovering on the red squiggly shows the error The namespace of module 'FsUnit' is not defined

I'm running dotnetcore 1.0.3 and inoide-fsharp 2.25.10

@zakaluka
Copy link

zakaluka commented Apr 30, 2017

I am experiencing the same issue, and was able to reproduce it with a new project. Here is what I did:

  1. Open VS Code, ensure all extensions are updated (Ionide-fsharp, Ionide-FAKE, Ionide-Paket are the main ones).
  2. Open an empty folder.
  3. Hit Ctrl+Shift+P
  4. Select "F#: New Project"
  5. Select "expecto"
  6. Leave Project directory blank (doesn't really matter)
  7. Enter a name for the project (I used Temp)
  8. Allow all updates to finish
  9. Open Temp.fsproj
  10. Change "TargetFrameworkVersion" to 4.6.1 (what Expecto is built against)
  11. Open Tests.fs

At this point, I see that all Expecto references (the 'open', attributes, etc.) are underlined in red and mousing them shows some variation of "The namespace or module 'Expecto' is not defined."

However, if you run build.cmd, the project builds successfully.

Here are 3 images showing this behavior.

Update to Temp.fsproj: http://imgur.com/OBpLfYK

Build succeeded: http://imgur.com/BJu2tPL

Tests.fs can't recognize the library: http://imgur.com/M601yeA

EDIT: Additional notes:

  1. Opening the folder in VS Community 2017 also produces the same problem.
  2. Open the fsproj file in VS Community 2017 results in all references working correctly.

@czifro
Copy link

czifro commented May 2, 2017

I followed all 11 steps and cannot reproduce it. I also recreated a project according to @jimmyp 's pic and could not reproduce. Here are the specs I'm using:

OS => macOS Sierra 10.12.3
DotNet CLI => 1.0.3
Mono => 4.6.1 (arch: amd64)
VSCode => 1.11.2
Ionide-fsharp => 2.25.10
Ionide-FAKE => 1.2.3
Ionide-Paket => 1.6.3

(If there are later versions of the ionide packages, they have not appeared for me yet.)

I also tried closing and opening vscode and could not reproduce. I am a bit confused why I cannot reproduce.

@jimmyp
Copy link
Author

jimmyp commented May 2, 2017

My repro steps will be slightly different as I'm using dotnet core. I'll add them shortly.

@czifro
Copy link

czifro commented May 2, 2017

@jimmyp I am using dotnet core version 1.0.3. I replicated both scenarios, but could not reproduce the issue. Just out of curiosity, are you able recreate the issue on a different machine? @zakaluka same for your case. Can you reproduce the issue on a different machine?

@zakaluka
Copy link

zakaluka commented May 4, 2017

@czifro I only have one machine, so difficult to do. I will try to get my hands on another machine and see if I can reproduce there.

EDIT: Here is my setup.

OS => Windows 7
DotNet CLI => 1.0.3
VSCode => 1.11.2
Ionide-fsharp => 2.25.10
Ionide-FAKE => 1.2.3
Ionide-Paket => 1.6.3

I installed F#, .NET sdks, MSBuild, etc. through the Visual Studio installation tool. I'm not sure if that makes a difference or not.

EDIT 2:
MSBuild is installed in C:\Windows\Microsoft.NET\Framework\v4.0.30319 (there are no spaces in the path).

F# framework is installed in C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0 (there are spaces in the path, if that matters).

@czifro
Copy link

czifro commented May 4, 2017

The only thing that sticks out is the F# path. According to this line, 4.1 is not supported. It could also be what is wrong with #414. Could you try installing F# 4.0? I don't have a Windows machine to test this hypothesis.

/cc @Krzysztof-Cieslak

@zakaluka
Copy link

zakaluka commented May 4, 2017

@czifro I installed F# 4.0 RTM and removed the following line from my Ionide user settings:

"FSharp.toolsDirPath": "C:\\Program Files (x86)\\Microsoft SDKs\\F#\\4.1\\Framework\\v4.0"

I still get the same error, but I also saw something interesting on the F# Language Service (server) output:

Process is terminated due to StackOverflowException.

I did not get this same error message when my toolsDirPath was set to 4.1. I changed the log output to "DEBUG" to see if it would provide any more information, but it did not.

If there is a way to get more information about that, please let me know so I can see if that is the root cause of the problem.

EDIT:

I used the developer tools to check further. I saw Ionide requesting a load of the FsProj file and the response was an error.

Here's the request:

[Extension Host] [IONIDE-FSAC] REQ (058) -> {project}, File = "~\SevenMain\SevenMain\SevenMain.fsproj"
Data= Object
    FileName: "c:\files\ad\Projects\fsaoc2016\7\SevenMain\SevenMain\SevenMain.fsproj"
    __proto__: Object
[Extension Host] [IONIDE-FSAC] RES (058) <- {project} in 134 ms: Kind={"error"}
Data=Expecting element 'root' from namespace ''.. Encountered 'None'  with name '', namespace ''.

I have no idea what this means, though.

@zakaluka
Copy link

zakaluka commented May 7, 2017

Ok, I was able to solve the problem, and here's how I did it.

  1. Uninstalled VS 2017 Community Edition, including all SDKs, etc. (not sure if this was required or not).
  2. Downloaded and installed .NET Core SDK for Windows x64 from https://www.microsoft.com/net/download/core.
  3. Downloaded and installed F# 4.0 RTM from https://www.microsoft.com/en-us/download/details.aspx?id=48179.
  4. Downloaded and installed MSBuild Tools 2015 from https://www.microsoft.com/en-us/download/details.aspx?id=48159.

The key issue I had was that I was receiving an error about Build 14.0 not being available, and the last package solved that.

Installing all this basically gave me .NET Standard 1.x (4?, 5?, ... not sure). The important thing is that it solved my problem.

However, my original code was against .NET 4.6.1 and there were certain functions that the .NET Standard did not contain (or contained with different signatures). I didn't bother trying to install the .NET SDK again. Instead, the problems were few enough and simple enough that I just rewrote those parts of the code.

Hope this helps someone dealing with this problem (at least on Win 7).

@jimmyp
Copy link
Author

jimmyp commented May 7, 2017

I haven't been able to reliably reproduce this today when I've tried. Thanks for your time, happy to close this and I'll open another issue if I can nail it down.

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

4 participants