feat: syntax highlighting in preview (#36)

This commit is contained in:
registerGen 2022-06-29 14:47:19 +08:00
parent 466b6b8270
commit 222ac1ce7e

View File

@ -9,7 +9,6 @@ local constants = {
max_lines = 20,
}
---@class cmp_path.Options
---@field public trailing_slash boolean
@ -114,7 +113,7 @@ local function lines_from(file, count)
if first_k:find('\0') then
return {'binary file'}
end
local lines = {'```'}
local lines = {'```' .. vim.filetype.match { filename = file }}
for line in first_k:gmatch("[^\r\n]+") do
lines[#lines + 1] = line
if count ~= nil and #lines >= count then