feat: enable diagnostics (#891)

This commit is contained in:
yetone
2024-11-23 21:49:33 +08:00
committed by GitHub
parent d14b2290d1
commit 9042f5f202
7 changed files with 102 additions and 20 deletions

View File

@@ -5,7 +5,7 @@ local Range = {}
Range.__index = Range
---@class avante.RangeSelection: table<string, integer>
---@field line number
---@field lnum number
---@field col number
---Create a selection range
@@ -18,4 +18,17 @@ function Range:new(start, finish)
return instance
end
---Check if the line and column are within the range
---@param lnum number Line number
---@param col number Column number
---@return boolean
function Range:contains(lnum, col)
local start = self.start
local finish = self.finish
if lnum < start.lnum or lnum > finish.lnum then return false end
if lnum == start.lnum and col < start.col then return false end
if lnum == finish.lnum and col > finish.col then return false end
return true
end
return Range