-
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
Server Not Initialized Error #12
Comments
Hi - I shouldn't have thought so, normally if you see any LSP message at all, then I think the server is running. There's an extended logging facility that currently sends log entries to a server called Seq which I can send you instructions for enabling. That may shed some more light on the problem. Otherwise, you might be able to attach the Visual Studio debugger to the language server process once it has been started and turn on "break on all exceptions" to see if there's some unhandled error somewhere that's crashing the server... Are you able to use your locally-built version of the language server from within VS Code (i.e. follow instructions to run the extension by hitting F5)? If it works from within VS Code, but when called from Eclipse then perhaps there's some sort of difference in how it implements LSP (I'm using OmniSharp's LSP implementation, BTW). Until now, I've treated the LSP implementation as a black box because it simply worked for my use-case but if it's not working elsewhere then perhaps some more investigation is needed :) |
Ah, ok. Looking through the LSP code it sounds like the language server is being sent a request before it has been sent an https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#initialize |
I'm not sure how the Eclipse LSP client works, but there might be some method you have to call to send the |
Ok thanks, I will take another crack at it. |
Ah - is this related to aCute? If so, be aware that OmniSharp itself does not actually speak LSP (it was built before LSP was a thing) and so if you're trying to use OmniSharp client library to talk to the MSBuild service then they won't communicate correctly. I think there's an LSP client called LSP4J that might do the trick though. |
BTW, if you're still having problems and have some repro code I could use, I'd be happy to try running it and capturing more detailed diagnostics from the language service. |
I have my .csproj file editor code here. Opening a .csproj file in the Generic Editor will begin the LS. In the console you can see that an Do requests get queued or could it be that the second request is processed before the server finishes initializing? |
I believe the protocol says the client is supposed to wait for the server's response to Initialize before sending anything else but I could be wrong. Let me have a look at the LSP implementation library to see what the expected behaviour should be. Just out of curiosity, if you stuck a pause of, say, 5 seconds in there (to allow for start-up time) does the problem go away? Just trying to establish whether it works at all or whether there is something else at play. |
Bad news, added a 5 second delay and same result, so not a queuing problem |
Ok - I'll be at work in around 60 mins - will capture a trace of the messages that occur when it works correctly. Does LSP4J have a facility to trace messages? |
Then we can compare :) |
In the meanwhile would you mind passing a writer to the "trace" parameter of the Launcher and posting the resulting output? Would be good to get an idea of the exact sequence of messages being exchanged... |
Ok, here's the sequence of messages I see:
Unfortunately, it doesn't show the |
The output of the input/output from the MSBuildStreamConnectionProvider. Is this what you are looking for / expected?
|
Thanks - ok, so it looks to me like the server hasn't sent the response to the initial Let me add a little logging to the server to capture that stuff. Give me 10 or 15 minutes? |
Ok, @LucasBullen, would you mind pulling the latest code from |
BTW, if you are able to put your client code into a console app, I can run it and attach a debugger to the language service to see if anything is causing the server to die (since it looks like you never receive any responses from it at all). |
Another question, on the build instructions it says |
Oops! Sorry, I renamed that project to just |
BTW, sorry about this but you may need to fetch the master branch again (it's now 5am here, but was 3am when I made the change, and I forgot to push one of the changes required to make logging work). Last time, I promise :) |
Thanks for all the help you are putting in. |
No worries - I'd love to see it being used in other editors; the more people find it useful, the better |
Got the logging output:
Not too much going on, but at least we can see that the logger was initialised. |
Heh, ok - I've been writing an LSP client over the last couple of days and have fully instrumented versions of the LSP assemblies lying around somewhere (they dump the STDIN and STDOUT streams to the log). Give me an hour or so and I'll dig them up and post them here. |
Even better I have a (simplified) dummy language server with extended logging - will dig that up, too. |
Ok, @LucasBullen, would you mind trying to build and use this language server instead? It has lots of extended logging and a simplified design (but is built using the same LSP framework): https://github.com/tintoy/dotnet-language-client To get it running:
Then use You'll need to set the Here's a sample of what the log should contain:
|
From the Server log:
To get it working I did have to download JsonRpc.1.0.0.nupkg and Lsp.1.0.0.nupkg and replace the dependencies to 1.0.0 instead of 1.0.1 if you think that is what caused the issue. |
1.0.1 did not work? Or was the package missing? |
Ok, sorry for wasting your time - I'm a moron, the packages were excluded by .gitignore. Give me 5 and I'll add them :) |
Ready to go - can you pull down the latest source, re-run |
I'm waiting for the new colouriser API for LSP to stabilise and then I can give you syntax highlighting too :) |
BTW are the line and column positions you're passing 0-based or 1-based? It looks like it thinks it's outside the quotes based on the completions but the cursor appears to be inside them. |
(for LSP, line and column are 0-based) |
0-based: |
That's correct - what about inside the quotes for the Include attribute of a PackageReference item? |
Inside the quotes at |
But that's great, currently using a TextMate language for syntax highlighting as well. Thank you for all your help with getting this set up, especially with the time difference. I'd say we got this one figured out and should move the suggestion error to a different issue. I'll open up other issues if I find any. |
Cheers, that'd be great. |
BTW, if you open a new issue, could you attach the project file you're testing with? Also, are you using Windows-style or Unix-style line endings? |
(attach file rather than paste contents, in case line endings are the problem) |
Will do, and Unix-style line endings (Testing on Fedora). |
Cheers - I have tests that are ready for Unix line endings but haven't
added non-Windows test data yet.
…On Wed, 20 Sep. 2017, 10:10 pm Lucas Bullen ***@***.***> wrote:
Will do, and Unix-style line endings (Testing on Fedora).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABkezPv7FEFP8kQNVvu0H_Am9ZcZf56_ks5skQDJgaJpZM4PU_8s>
.
|
Another question for you, I am not getting the hover results that you show in the gif within the readme. I receive the following response from the initialize message and shows that there isn't hover capabilities:
|
That's odd - if it says there's a completion provider, it should say there's a hover provider (they're both registered at the same time). What response do you get from the server when you send a |
What's especially odd is that it looks like all server capabilities are marked as |
Ah, I think I understand - OmniSharp's LSP implementation relies on dynamic registration of server capabilities after the server has been initialised:
|
When you send the I think I'm going to have to open a PR with the upstream repo to get that fixed. Either way, you should still be able to call |
With
Response: |
Ah, that doesn't mean hover isn't supported (you'd get error response Are you able to attach the file you're working with? I can run it through a couple of test suites I have to see what's going on. I remember we discussed before that it might be a line-endings problem (which could potentially make the line / column wrong). |
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<PackageReference Include="Microsoft.AspNet.WebApi" Version="5.2.0" />
</Project> |
Any chance you could attach it as a file? Otherwise the line endings will probably wind up normalised... |
Also, how much information is there in the log file - does it list the MSBuild objects it did find when the project was first loaded and parsed? Do those line and column numbers line up with your expectations? |
Ah, just realised - that's not a valid project file, so you won't get some types of hover :) Try this: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi" Version="5.2.0" />
</ItemGroup>
</Project> |
BTW, the server will publish diagnostics telling you if there's anything wrong with the project:
|
I am attempting to add your language server within Eclipse. When starting the server I only receive the following message back:
{"protocolVersion":"2.0","message":{"code":-32002,"message":"Server Not Initialized"}}
To confirm, I am meant to launch the LS by following the build instructions then executing /out/language-server/MSBuildProjectTools.LanguageServer.Host.dll?
Are there any dependencies that would stop the server from initializing? Am I unaware of a required step?
The text was updated successfully, but these errors were encountered: