From abdd93ecfb07f4b2024fe2996f5ee50578f4c955 Mon Sep 17 00:00:00 2001 From: luozhiya Date: Fri, 28 Jun 2024 23:06:05 +0800 Subject: [PATCH] Check inline status --- lua/fittencode/actions/identify_programming_language.lua | 5 +++++ lua/fittencode/status.lua | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/fittencode/actions/identify_programming_language.lua b/lua/fittencode/actions/identify_programming_language.lua index 69c75ed..a016a7c 100644 --- a/lua/fittencode/actions/identify_programming_language.lua +++ b/lua/fittencode/actions/identify_programming_language.lua @@ -4,6 +4,7 @@ local API = require('fittencode.api').api local Base = require('fittencode.base') local Config = require('fittencode.config') local Log = require('fittencode.log') +local Status = require('fittencode.status') local M = {} @@ -16,6 +17,10 @@ local IPL_DEBOUNCE_TIME = 1000 local ipl_timer = nil local function _identify_current_buffer() + local inline = API.get_current_status() + if inline == Status.C.GENERATING then + return + end local buffer = api.nvim_get_current_buf() local name = api.nvim_buf_get_name(buffer) local ext = vim.fn.fnamemodify(name, ':e') diff --git a/lua/fittencode/status.lua b/lua/fittencode/status.lua index 7a47f8e..bd4c980 100644 --- a/lua/fittencode/status.lua +++ b/lua/fittencode/status.lua @@ -13,9 +13,7 @@ local Log = require('fittencode.log') ---@field get_current function local M = {} ----@alias StatusCodes table - ----@type StatusCodes +---@class StatusCodes local C = { DISABLED = 1, IDLE = 2, @@ -25,7 +23,8 @@ local C = { SUGGESTIONS_READY = 6, } -M.C = C +---@type StatusCodes +M.C = vim.deepcopy(C) function M:new(opts) local obj = {