@@ -162,7 +162,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
162
162
uri = p .TextDocument .URI
163
163
log .Printf ("--> didChange(%s@%d)" , p .TextDocument .URI , p .TextDocument .Version )
164
164
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 ))
166
166
}
167
167
168
168
if res , err := handler .didChange (ctx , p ); err != nil {
@@ -177,7 +177,7 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
177
177
178
178
log .Printf (" --> didChange(%s@%d)" , p .TextDocument .URI , p .TextDocument .Version )
179
179
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 ))
181
181
}
182
182
err = handler .ClangdConn .Notify (ctx , req .Method , p )
183
183
return nil , err
@@ -291,16 +291,12 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
291
291
var result interface {}
292
292
if req .Notif {
293
293
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")
297
295
} else {
298
296
ctx , cancel := context .WithTimeout (ctx , 800 * time .Millisecond )
299
297
defer cancel ()
300
298
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")
304
300
}
305
301
if err == nil && handler .buildSketchSymbolsLoad {
306
302
handler .buildSketchSymbolsLoad = false
@@ -555,12 +551,7 @@ func (handler *InoHandler) didChange(ctx context.Context, req *lsp.DidChangeText
555
551
if ! ok {
556
552
return nil , unknownURI (doc .URI )
557
553
}
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 )
564
555
565
556
// If changes are applied to a .ino file we increment the global .ino.cpp versioning
566
557
// for each increment of the single .ino file.
0 commit comments