fix: every_keystroke completion mode should fallback to automatic when active
This prevents `every_keystroke` mode from re-triggering on every keystroke if a completion suggestions are already available. Instead it will now filter the returned suggestions normally. This dramatically reduces load on the LSP. closes #479
This commit is contained in:
parent
f35e522260
commit
01cbdf8545
1 changed files with 9 additions and 1 deletions
|
|
@ -6552,7 +6552,15 @@ pub const Editor = struct {
|
|||
}
|
||||
|
||||
pub fn run_triggers(self: *Self, cursel: *const CurSel, char: u8, event: TriggerEvent) void {
|
||||
switch (tui.config().completion_trigger) {
|
||||
var mode = tui.config().completion_trigger;
|
||||
|
||||
if (mode == .every_keystroke) {
|
||||
const update_completion = "update_completion";
|
||||
const in_completion = command.get_id(update_completion) != null;
|
||||
mode = if (in_completion) .automatic else .every_keystroke;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
.manual => return,
|
||||
.every_keystroke => return self.run_triggers_every_keystroke(cursel, char, event),
|
||||
.automatic => {},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue