go-langserver icon indicating copy to clipboard operation
go-langserver copied to clipboard

didChange event handling fails with out of range error after which every format request fails

Open ramya-rao-a opened this issue 7 years ago • 3 comments

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.

screen shot 2018-05-10 at 9 05 10 pm

Weirdly, it says it found } in line 12, but } is in line 11

ramya-rao-a avatar May 11 '18 04:05 ramya-rao-a

@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?

ramya-rao-a avatar May 11 '18 04:05 ramya-rao-a

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?

keegancsmith avatar May 17 '18 14:05 keegancsmith

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

ramya-rao-a avatar May 17 '18 16:05 ramya-rao-a