Buffer desync
See original GitHub issueSometimes the contents of the buffer inside VSCode are different from the contents of Neovim.
Steps to reproduce:
- Install, for example, this extension.
- Navigate to the extension settings and click on “Edit in settings.json”:

- You will have desync.
Gdoes not move to the last line, exiting insert mode moves the cursor to the beginning of the file.
Note: the extension is just an example to 100% reproduce the issue. Desync can happen sometimes in a lot of other cases.
Log
2020-09-28T22:04:22.586Z BufferManager: onDidChangeVisibleTextEditors
2020-09-28T22:04:22.587Z BufferManager: onDidChangeActiveTextEditor
2020-09-28T22:04:22.637Z DocumentChangeManager: Change text document for uri: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.638Z DocumentChangeManager: Syncing document changes with neovim
2020-09-28T22:04:22.639Z DocumentChangeManager: Processing document vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.639Z DocumentChangeManager: No diff ranges for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json, skipping
2020-09-28T22:04:22.640Z DocumentChangeManager: Change text document for uri: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.640Z DocumentChangeManager: Syncing document changes with neovim
2020-09-28T22:04:22.641Z DocumentChangeManager: Processing document vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.642Z DocumentChangeManager: Change text document for uri: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.643Z DocumentChangeManager: Syncing document changes with neovim
2020-09-28T22:04:22.643Z DocumentChangeManager: Processing document vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.644Z DocumentChangeManager: Change text document for uri: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.644Z DocumentChangeManager: Syncing document changes with neovim
2020-09-28T22:04:22.645Z DocumentChangeManager: Processing document vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.649Z BufferManager: syncing active editor
2020-09-28T22:04:22.649Z BufferManager: Waiting for completing layout resyncing
2020-09-28T22:04:22.650Z DocumentChangeManager: BufId: 2, lineChanges: 1, tick: 7, skipTick: 8
2020-09-28T22:04:22.652Z DocumentChangeManager: BufId: 2, lineChanges: 1, tick: 7, skipTick: 8
2020-09-28T22:04:22.653Z DocumentChangeManager: BufId: 2, lineChanges: 1, tick: 7, skipTick: 8
2020-09-28T22:04:22.654Z DocumentChangeManager: Received neovim buffer changed event for bufId: 2, tick: 8
2020-09-28T22:04:22.654Z DocumentChangeManager: BufId: 2 skipping tick: 8
2020-09-28T22:04:22.655Z DocumentChangeManager: Received neovim buffer changed event for bufId: 2, tick: 9
2020-09-28T22:04:22.655Z DocumentChangeManager: Applying neovim edits
2020-09-28T22:04:22.655Z DocumentChangeManager: Accumulating edits for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json, bufId: 2
2020-09-28T22:04:22.661Z DocumentChangeManager: Applying edits for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.665Z DocumentChangeManager: Received neovim buffer changed event for bufId: 2, tick: 10
2020-09-28T22:04:22.687Z BufferManager: syncing layout
2020-09-28T22:04:22.688Z BufferManager: new/changed editors/windows
2020-09-28T22:04:22.688Z BufferManager: Visible editor, viewColumn: 1, doc: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.688Z BufferManager: Creating new neovim window for 1 column (undefined is OK here)
2020-09-28T22:04:22.695Z CursorManager: SelectionChanged
2020-09-28T22:04:22.696Z CursorManager: Waiting for possible layout completion operation
2020-09-28T22:04:22.696Z BufferManager: Waiting for completing layout resyncing
2020-09-28T22:04:22.710Z DocumentChangeManager: Change text document for uri: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.711Z DocumentChangeManager: Skipping a change since versions equals
2020-09-28T22:04:22.715Z CursorManager: Received cursor update from neovim, winId: 1004, pos: [0, 0]
2020-09-28T22:04:22.715Z CursorManager: No editor for winId: 1004
2020-09-28T22:04:22.716Z CursorManager: Received cursor update from neovim, winId: 1000, pos: [0, 0]
2020-09-28T22:04:22.716Z CursorManager: No editor for winId: 1000
2020-09-28T22:04:22.717Z BufferManager: Created new window: 1004
2020-09-28T22:04:22.718Z BufferManager: ViewColumn: 1 - WinId: 1004
2020-09-28T22:04:22.718Z BufferManager: Setting buffer: 2 to win: 1004, cursor: [102, 4]
2020-09-28T22:04:22.718Z BufferManager: Closing non visible editors
2020-09-28T22:04:22.719Z BufferManager: Waiting done
2020-09-28T22:04:22.719Z BufferManager: Waiting done
2020-09-28T22:04:22.719Z BufferManager: Setting active editor - viewColumn: 1, winId: 1004
2020-09-28T22:04:22.720Z CursorManager: Waiting for possible document change completion operation
2020-09-28T22:04:22.730Z CursorManager: Received cursor update from neovim, winId: 1004, pos: [101, 4]
2020-09-28T22:04:22.730Z CursorManager: Waiting for document change completion before setting the cursor, winId: 1004
2020-09-28T22:04:22.730Z CursorManager: Received cursor update from neovim, winId: 1000, pos: [0, 0]
2020-09-28T22:04:22.731Z CursorManager: No editor for winId: 1000
2020-09-28T22:04:22.735Z CursorManager: Received cursor update from neovim, winId: 1004, pos: [101, 4]
2020-09-28T22:04:22.736Z CursorManager: Waiting for document change completion before setting the cursor, winId: 1004
2020-09-28T22:04:22.736Z CursorManager: Received cursor update from neovim, winId: 1000, pos: [0, 0]
2020-09-28T22:04:22.736Z CursorManager: No editor for winId: 1000
2020-09-28T22:04:22.747Z DocumentChangeManager: Changes succesfully applied for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.747Z DocumentChangeManager: Accumulating edits for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json, bufId: 2
2020-09-28T22:04:22.748Z DocumentChangeManager: Applying edits for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.762Z DocumentChangeManager: Change text document for uri: vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.763Z DocumentChangeManager: Skipping a change since versions equals
2020-09-28T22:04:22.786Z DocumentChangeManager: Changes succesfully applied for vscode-userdata:/home/gena/.config/Code%20-%20OSS/User/settings.json
2020-09-28T22:04:22.787Z CursorManager: Waiting done
2020-09-28T22:04:22.787Z CursorManager: kind: 3, WinId: 1004, cursor: [100, 4], isMultiSelection: false
2020-09-28T22:04:22.787Z CursorManager: Updating cursor pos, winId: 1004, pos: [103, 4]
2020-09-28T22:04:22.787Z CursorManager: Waiting document change completion done, winId: 1004
2020-09-28T22:04:22.787Z CursorManager: Updating cursor in editor, viewColumn: 1, pos: [101, 4]
2020-09-28T22:04:22.788Z CursorManager: Waiting document change completion done, winId: 1004
2020-09-28T22:04:22.788Z CursorManager: Updating cursor in editor, viewColumn: 1, pos: [101, 4]
2020-09-28T22:04:22.843Z CursorManager: SelectionChanged
2020-09-28T22:04:22.844Z CursorManager: Waiting for possible layout completion operation
2020-09-28T22:04:22.844Z CursorManager: Waiting for possible document change completion operation
2020-09-28T22:04:22.844Z CursorManager: Waiting done
2020-09-28T22:04:22.844Z CursorManager: kind: 3, WinId: 1004, cursor: [101, 4], isMultiSelection: false
2020-09-28T22:04:22.845Z CursorManager: Skipping event since neovim has same cursor pos
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Buffer desync on undo / redo. · Issue #269 · vscode-neovim ...
I have a critical issue with vscode-neovim. Sometimes when I hit u to undo changes the buffer gets totally out of sync with...
Read more >Buffer.Sync – buffer v0.3.12 - HexDocs
buffer v0.3.12 Buffer.Sync behaviour View Source. Link to this section Summary. Functions. add(name, element).
Read more >Social Media Management Software for Growing Brands - Buffer
Stay in sync. Everyone's posts will be shared within your preset schedule. Account management. Easily share and manage access to each social account ......
Read more >OBS NDI Audio Video Desync Fix (No more Audio Buffering)
Are your NDI sources causing audio buffering and eventually desyncing issues between audio and video within OBS? This one simple fix (bug ...
Read more >sync(2): commit buffer cache to disk - Linux man page - Die.net
sync () causes all buffered modifications to file metadata and data to be written to the underlying file systems.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am often getting cases where normal mode does not seem to be operating on the same file I am seeing on the screen.
For example, in normal mode, the cursor can be stuck at the top, hjkl does nothing. If I go into insert mode, cursor down, press escape then the cursor jumps back to the top and freezes again. If I do some undos then the cursor might be able to move a few lines down.
I am getting it on an untitled/unsaved file right now, but it has happened on saved files.
@asvetliakov Something is quite broken, does this sound like a buffer desync?
@mizagog, sorry, forgot to mention, the version above is from a branch that draws labels for easymotion on top.