fsprojects / fsharp-language-server

Other
214 stars 37 forks source link

Package restore fails #76

Open mrakgr opened 4 years ago

mrakgr commented 4 years ago

After trying it for a while, I cannot shake of the perception that there is something broken somewhere.

After the project is cloned and opened in VS, the first issue that I've run into is that the project just would not build. What happened is that the Nuget restore for the FsharpLanguageServer project will fail to download the relevant packages regardless of how long I let it run. The only way to get through this is to uninstall Fsharp.Compiler.Service and HtmlAgilityPack by hand and reinstall them again.

That gets me far enough to actually build the project.

Then I run into this issue. The missing dlls are the same, only the versions given are different. This happens when I run the project directly from the IDE (rather than the command line).

I've tried the dotnet-3 branch as well and this error also happens there (along with the package restore issue). The missing dlls issue also happens when I create my own solution and copy the project files into it.

So far I haven't figured out how to actually run the server.

    // Process messages on main thread
    let mutable quit = false
    while not quit do 
        match processQueue.Take() with 

I've traced it via the debugger and the missing dll error gets triggered in the processQueue.Take() call. I have absolutely no idea what the problem with System.Collections.Concurrent.BlockingCollection<PendingTask> is.

Interestingly, this error only happens after the let server = serverFactory(RealClient(send)) line. By that I mean if you do something like the following, it also gets triggered.

let connect(serverFactory: ILanguageClient -> ILanguageServer, receive: BinaryReader, send: BinaryWriter) = 
    let server = serverFactory(RealClient(send))
    let processQueue' = new System.Collections.Concurrent.BlockingCollection<PendingTask>(10)
    let _ = processQueue'.Take()
    let _ = 2 // does not get hit in the debugger due to the dll issue

When I tried doing the ...

    let processQueue' = new System.Collections.Concurrent.BlockingCollection<PendingTask>(10)
    let _ = processQueue'.Take()

...in the main function the program would just freeze.

mrakgr commented 4 years ago

Since I have the opportunity, let me ask some extra questions. My main interest in this plugin is to use it as a template for my Spiral language so I've been studying it for the past few days. As somebody who went through this, do you have any advice for how to approach this?

Besides the build issues I've been running into not just for this plugin, but also with VS Code, my low experience with webdev has been a problem. Also after studying it, I think that this F# plugin is too complex to serve as a template. The VS Code LSP samples on the other hand are far too simplistic. This plugin seemed like a natural place to start as Spiral is written in F#, but it might be better for me to study a plugin for a simpler language like C maybe.

The plan on how to do a language plugin might be simple on the surface - set up two processes that communicate via JSON, but I can't quite find the hook for this. Any advice would be appreciated.

mrakgr commented 4 years ago

Oh right, one more thing. Even after the plugin builds, and despite the LanguageServerProject being set to output a console application, only the dlls for it get compiled. For some reason the executables are not in the directory for me. As might be expected, this is not the case for the solution in which I've copied the files directly.