Skip to content

Commit 7346e51

Browse files
committed
Fix The Freeze Hinter processing#3252
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.
1 parent 5d843d7 commit 7346e51

File tree

3 files changed

+3592
-8241
lines changed

3 files changed

+3592
-8241
lines changed

client/modules/IDE/components/show-hint.js

+16
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@
7272
this.cm.getLine(this.startPos.line).length -
7373
this.cm.getSelection().length;
7474

75+
// keydown event for handling Escape key press
76+
var self = this;
77+
78+
cm.getWrapperElement().addEventListener('keydown', function (event) {
79+
self.handleKeyPress(self.cm, event);
80+
});
81+
82+
7583
if (this.options.updateOnCursorActivity) {
7684
var self = this;
7785
cm.on(
@@ -159,6 +167,14 @@
159167
}
160168
},
161169

170+
handleKeyPress: function (cm, event) {
171+
if (event.key === 'Escape' || event.keyCode === 27) {
172+
// Close the completion component
173+
this.close();
174+
event.preventDefault(); // Prevent default Escape key behavior
175+
}
176+
},
177+
162178
update: function (first) {
163179
if (this.tick == null) return;
164180
var self = this,

0 commit comments

Comments
 (0)