diff --git a/lua/fittencode/engines/actions/init.lua b/lua/fittencode/engines/actions/init.lua index 6699d49f..cd598bb9 100644 --- a/lua/fittencode/engines/actions/init.lua +++ b/lua/fittencode/engines/actions/init.lua @@ -413,10 +413,9 @@ local function chain_actions(opts) end Promise:new(function(resolve, reject) local task_id = _create_task(headless) - Sessions.request_generate_one_stage(task_id, prompt_ctx, function(_, prompt, suggestions) - Log.debug('Generated Suggestions: {}', suggestions) - local lines, ms = preprocessing(presug, task_id, headless, preprocess_format, suggestions) - Log.debug('Preprocessed Lines: {}', lines) + Sessions.request_generate_one_stage(task_id, prompt_ctx, function(id, prompt, suggestions) + local lines, ms = preprocessing(presug, id, headless, preprocess_format, suggestions) + Log.debug('ActionsEngine<{}> Preprocessed: {}, Generated: {}', string.format('%x', id), lines, suggestions) elapsed_time = elapsed_time + ms if not lines or #lines == 0 then if extra_newline then diff --git a/lua/fittencode/engines/inline/init.lua b/lua/fittencode/engines/inline/init.lua index 937fb030..6e92db75 100644 --- a/lua/fittencode/engines/inline/init.lua +++ b/lua/fittencode/engines/inline/init.lua @@ -187,6 +187,7 @@ local function _generate_one_stage(row, col, on_success, on_error) local ctx = PromptProviders.get_current_prompt_ctx(row, col) Sessions.request_generate_one_stage(task_id, ctx, function(id, _, suggestions) local lines = preprocessing(ctx, id, suggestions) + Log.debug('InlineEngine<{}> Preprocessed: {}', string.format('%x', id), lines) if lines and #lines > 0 then status:update(SC.SUGGESTIONS_READY) apply_new_suggestions(task_id, row, col, lines) @@ -209,14 +210,16 @@ end ---@param on_success? function ---@param on_error? function function M.generate_one_stage(row, col, force, delaytime, on_success, on_error) + Log.debug('Start generating one stage') + if not force and model:cache_hit(row, col) and M.has_suggestions() then status:update(SC.SUGGESTIONS_READY) render_virt_text_segments(model:get_suggestions_segments()) schedule(on_success, model:make_new_trim_commmited_suggestions()) - -- Log.debug('Cache hit') + Log.debug('CACHE HIT') return else - -- Log.debug('Cache miss') + Log.debug('CACHE MISS') end if inline_suggestions_ready() then @@ -374,7 +377,12 @@ local function _accept_impl(range, direction, mode) if mode == 'stage' then set_text_event_filter(segments.stage) end - M.reset() + M:reset() + if Config.options.inline_completion.auto_triggering_completion then + -- generate_one_stage_current_force() + else + ignore_cursor = { Base.get_cursor() } + end else render_virt_text_segments(segments) end diff --git a/lua/fittencode/tasks.lua b/lua/fittencode/tasks.lua index 1189974e..685d41db 100644 --- a/lua/fittencode/tasks.lua +++ b/lua/fittencode/tasks.lua @@ -52,9 +52,9 @@ function TaskScheduler:create(row, col) local timestamp = uv.hrtime() table.insert(self.list, #self.list + 1, { row = row, col = col, timestamp = timestamp }) if row and col then - -- Log.debug('Task<{}>: {} Created at ({}, {})', self.tag, string.format('%x', timestamp), row, col) + Log.debug('Task<{}>: {} Created at ({}, {})', self.tag, string.format('%x', timestamp), row, col) else - -- Log.debug('Task<{}>: {} Created', self.tag, string.format('%x', timestamp)) + Log.debug('Task<{}>: {} Created', self.tag, string.format('%x', timestamp)) end return timestamp end @@ -79,7 +79,7 @@ function TaskScheduler:match_clean(task_id, row, col, clean) local task = self.list[i] if task.timestamp == task_id and task.row == row and task.col == col then ms = math.floor((uv.hrtime() - task.timestamp) / MS_TO_NS) - -- Log.debug('Task<{}>: {} Matched, Time elapsed: {} ms', self.tag, string.format('%x', task_id), ms) + Log.debug('Task<{}>: {} Matched, Time elapsed: {} ms', self.tag, string.format('%x', task_id), ms) match_found = true break end