Open ElayneB opened 5 years ago
I am also getting the same issue. This error is coming when the rootUri path at the server side having less number of lines than what is coming in the didOpen message. So, for the current workaround, I have done 2 things:
I think this issue could be related to #1490
I think we are experiencing the same issue, but your workaround hasn't fixed it for me. I can save the file with many blank lines, but as soon as my client gets beyond the saved state of the file I get the out of bounds exception. I also only get proper completion responses based on the saved state of the file.
This maybe expected behavior for omnisharp in lsp
mode. Omnisharp responds to initialization
with a textDocumentSync: 0
. According the spec, this response indicates that the server does not synchronize files. However, the logs indicate that the language server is trying to sync the files, and it sounds like you have found some success in getting this working.
It would be great to get some insight from a contributor as to the current state of lsp
mode.
I've seen issues with incremental changes with *.cake
files and therefore only supporting full changes for Cake.
https://github.com/OmniSharp/omnisharp-roslyn/blob/479ce0c9e4da03e7728dae8c5e51f783728b0efb/src/OmniSharp.LanguageServerProtocol/Handlers/TextDocumentSyncHandler.cs#L35
It could it be so that incremental changes is broken also for plain C# as @Aayush04 suggests.
@ElayneB does it work if you send only full changes from your client?
@mholo65 So, I am working with .cs file. In my case, incremental changes are not working. And yes, in case of full changes. You can see my issue details #1490 where when I am sending full changes it started working.
@mholo65 My client is sending full changes and I am still getting the error. Here's an example didChange request my client is sending.
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///srv/app/language_servers/csharp/Program.cs","version":39},"contentChanges":[{"text":"using System;\n\nnamespace csharp\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"dsfsf\");\n \n \n \n \n \n \n Console\n \t\n }\n }\n}\n\n\n"}]}}
@Aayush04, do you have logs of it working with full changes that you can share? I'd like to compare them to mine and see if I see differences in the workflow / formatting.
I believe sync issues (at least partially) are fixed with:
The underlying issue was in LSP library:
Text synchronization does not appear to be working when running roslyn in
-lsp
mode. I've attached a log from the server showing this error.The log shows my client initializing the server, opening a document, and then making some changes. It ends with an error when it requests autocompletion from a cursor position that the server believes does not exist.
lsp-textsync-errorlog.txt