diff --git a/internal/lsp/general.go b/internal/lsp/general.go index 0f8f663ef5..f3f860897b 100644 --- a/internal/lsp/general.go +++ b/internal/lsp/general.go @@ -29,9 +29,13 @@ func (s *Server) initialize(ctx context.Context, params *protocol.InitializePara } s.isInitialized = true // mark server as initialized now - // TODO(rstambler): Change this default to protocol.Incremental (or add a - // flag). Disabled for now to simplify debugging. + // TODO(iancottrell): Change this default to protocol.Incremental and remove the option s.textDocumentSyncKind = protocol.Full + if opts, ok := params.InitializationOptions.(map[string]interface{}); ok { + if opt, ok := opts["incrementalSync"].(bool); ok && opt { + s.textDocumentSyncKind = protocol.Incremental + } + } s.setClientCapabilities(params.Capabilities) diff --git a/internal/lsp/text_synchronization.go b/internal/lsp/text_synchronization.go index 9f2074979e..9777e7dde0 100644 --- a/internal/lsp/text_synchronization.go +++ b/internal/lsp/text_synchronization.go @@ -64,7 +64,7 @@ func (s *Server) applyChanges(ctx context.Context, params *protocol.DidChangeTex return "", jsonrpc2.NewErrorf(jsonrpc2.CodeInternalError, "invalid range for content change") } start, end := spn.Start().Offset(), spn.End().Offset() - if end <= start { + if end < start { return "", jsonrpc2.NewErrorf(jsonrpc2.CodeInternalError, "invalid range for content change") } var buf bytes.Buffer