The autocomplete-plus package uses a TextBuffer.onDidChange() handler to trigger the completion dropdown and uses TextEditor.getLastCursor().getBufferPosition() to determine its placement and prefix. Because bracket pair insertion is done with separate .insertText() and .moveLeft() calls, the onDidChange event is fired while the cursor is at the end of the matched pair, and not when it's placed between them:
Performing these two calls within a transaction defers the onDidChange event until after the cursor is in its final position:
The autocomplete-plus package uses a
TextBuffer.onDidChange()
handler to trigger the completion dropdown and usesTextEditor.getLastCursor().getBufferPosition()
to determine its placement and prefix. Because bracket pair insertion is done with separate.insertText()
and.moveLeft()
calls, theonDidChange
event is fired while the cursor is at the end of the matched pair, and not when it's placed between them:Performing these two calls within a transaction defers the
onDidChange
event until after the cursor is in its final position:xref atom/autocomplete-plus#954