@@ -162,7 +162,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
162162 uri = p .TextDocument .URI
163163 log .Printf ("--> didChange(%s@%d)" , p .TextDocument .URI , p .TextDocument .Version )
164164 for _ , change := range p .ContentChanges {
165- log .Printf (" > %s -> '%s' " , change .Range , strconv .Quote (change .Text ))
165+ log .Printf (" > %s -> %s " , change .Range , strconv .Quote (change .Text ))
166166 }
167167
168168 if res , err := handler .didChange (ctx , p ); err != nil {
@@ -177,7 +177,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
177177
178178 log .Printf (" --> didChange(%s@%d)" , p .TextDocument .URI , p .TextDocument .Version )
179179 for _ , change := range p .ContentChanges {
180- log .Printf (" > %s -> '%s' " , change .Range , strconv .Quote (change .Text ))
180+ log .Printf (" > %s -> %s " , change .Range , strconv .Quote (change .Text ))
181181 }
182182 err = handler .ClangdConn .Notify (ctx , req .Method , p )
183183 return nil , err
@@ -291,16 +291,12 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
291291 var result interface {}
292292 if req .Notif {
293293 err = handler .ClangdConn .Notify (ctx , req .Method , params )
294- if enableLogging {
295- log .Println (" sent" , req .Method , "notification to clangd" )
296- }
294+ // log.Println(" sent", req.Method, "notification to clangd")
297295 } else {
298296 ctx , cancel := context .WithTimeout (ctx , 800 * time .Millisecond )
299297 defer cancel ()
300298 result , err = lsp .SendRequest (ctx , handler .ClangdConn , req .Method , params )
301- if enableLogging {
302- log .Println (" sent" , req .Method , "request id" , req .ID , " to clangd" )
303- }
299+ // log.Println(" sent", req.Method, "request id", req.ID, " to clangd")
304300 }
305301 if err == nil && handler .buildSketchSymbolsLoad {
306302 handler .buildSketchSymbolsLoad = false
@@ -555,12 +551,7 @@ func (handler *InoHandler) didChange(ctx context.Context, req *lsp.DidChangeText
555551 if ! ok {
556552 return nil , unknownURI (doc .URI )
557553 }
558- if trackedDoc .Version + len (req .ContentChanges ) != doc .Version {
559- return nil , errors .Errorf ("document out-of-sync: expected version %d but got %d" , trackedDoc .Version + 1 , doc .Version )
560- }
561- for _ , change := range req .ContentChanges {
562- textutils .ApplyLSPTextDocumentContentChangeEvent (trackedDoc , & change )
563- }
554+ textutils .ApplyLSPTextDocumentContentChangeEvent (trackedDoc , req .ContentChanges , doc .Version )
564555
565556 // If changes are applied to a .ino file we increment the global .ino.cpp versioning
566557 // for each increment of the single .ino file.
0 commit comments