Skip to content

Commit

Permalink
Fix The Freeze Hinter processing#3252
Browse files Browse the repository at this point in the history
Making runnig all the tests and
Working When Press the Esc key to dismiss the Hinter.

1.Start typing something with the Hinter enabled.
2.The Hinter window pops up.
3.Press the Esc key to dismiss the Hinter.
  • Loading branch information
Jatin24062005 committed Dec 9, 2024
1 parent 5d843d7 commit 7346e51
Show file tree
Hide file tree
Showing 3 changed files with 3,592 additions and 8,241 deletions.
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

0 comments on commit 7346e51

Please sign in to comment.