Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions client/modules/IDE/components/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@
this.cm.getLine(this.startPos.line).length -
this.cm.getSelection().length;

// keydown event for handling Escape key press
var self = this;

cm.getWrapperElement().addEventListener('keydown', function (event) {
self.handleKeyPress(self.cm, event);
});


if (this.options.updateOnCursorActivity) {
var self = this;
cm.on(
Expand Down Expand Up @@ -159,6 +167,14 @@
}
},

handleKeyPress: function (cm, event) {
if (event.key === 'Escape' || event.keyCode === 27) {
// Close the completion component
this.close();
event.preventDefault(); // Prevent default Escape key behavior
}
},

update: function (first) {
if (this.tick == null) return;
var self = this,
Expand Down
Loading