fix: Prevent code suggestions on paste
Description
It rejects code completion requests when the user pastes a code block.
Implementation details
The VSCode Extension API doesn't provide a paste
event listener. This MR circumvents this limitation by listening to the DocumentChanged
event and comparing the event's content with the clipboard's content. Code completion requests are rejected if the data points match and the event happens within a time interval.
Related Issues
Resolves 1058
How has this been tested?
- Check out the branch.
- Paste text on a JavaScript file.
- Code suggestions should not appear after pasting text
Screenshots (if appropriate):
Before | After |
---|---|
prevent_code_suggestions_before.mov | prevent_code_suggestions_on_paste_after.mov |
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap
Related to #1058 (closed)
Edited by Enrique Alcántara