Skip to content

Commit

Permalink
langserver: ignore duplicate document versions in textDocument/didCha…
Browse files Browse the repository at this point in the history
…nge (#940)
  • Loading branch information
radeksimko committed Jun 7, 2022
1 parent 4d0b6e8 commit a597cce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/langserver/handlers/did_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package handlers

import (
"context"
"fmt"

"github.com/hashicorp/terraform-ls/internal/document"
ilsp "github.com/hashicorp/terraform-ls/internal/lsp"
Expand Down Expand Up @@ -30,10 +29,10 @@ func (svc *service) TextDocumentDidChange(ctx context.Context, params lsp.DidCha

// Versions don't have to be consecutive, but they must be increasing
if newVersion <= doc.Version {
svc.stateStore.DocumentStore.CloseDocument(dh)
return fmt.Errorf("Old version (%d) received, current version is %d. "+
"Unable to update %s. This is likely a bug, please report it.",
svc.logger.Printf("Old document version (%d) received, current version is %d. "+
"Ignoring this update for %s. This is likely a client bug, please report it.",
newVersion, doc.Version, p.TextDocument.URI)
return nil
}

changes := ilsp.DocumentChanges(params.ContentChanges)
Expand Down

0 comments on commit a597cce

Please sign in to comment.