go-langserver
go-langserver copied to clipboard
didChange event handling fails with out of range error after which every format request fails
The below was observed when using the language server via the Go extension to VS Code.
Below is a simple program of 12 lines. All I did was add tabs before the print statement followed by file save a couple of times. Soon there is an error when handling the textDocument/didChange event. After this every file save that triggers formatting ends up generating the below formatting error.
Weirdly, it says it found } in line 12, but } is in line 11
@keegancsmith @slimsag This looks similar to the errors in https://github.com/sourcegraph/go-langserver/pull/83#issuecomment-365572984
Can we add the formatting feature behind a flag?
yeah I think there are some issues around how we interpret ranges in go-langserver. I'll take a look soon.
By put it behind a feature flag, do you mean advertising full sync vs incremental sync?
Never mind the feature flag, I figured out a way to intercept the calls going to the language server from the Go extension. So what I have done is disabled the formatting feature from the language server. User can opt-in to use the formatting feature from the language server explicitly in VS Code now.
Well, by "now" I mean the next update