Skip to content

Commit

Permalink
Check inline status
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jun 28, 2024
2 parents d002a04 + abdd93e commit d6fd36d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lua/fittencode/actions/identify_programming_language.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand All @@ -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')
Expand Down
7 changes: 3 additions & 4 deletions lua/fittencode/status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ local Log = require('fittencode.log')
---@field get_current function
local M = {}

---@alias StatusCodes table<string, integer>

---@type StatusCodes
---@class StatusCodes
local C = {
DISABLED = 1,
IDLE = 2,
Expand All @@ -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 = {
Expand Down

0 comments on commit d6fd36d

Please sign in to comment.