MAJOR: Project rename and preparation for v1.0.0
I hope I haven't missed any for the renames!
This commit is contained in:
74
lua/outline/symbols.lua
Normal file
74
lua/outline/symbols.lua
Normal file
@@ -0,0 +1,74 @@
|
||||
local cfg = require 'outline.config'
|
||||
|
||||
local M = {}
|
||||
|
||||
M.kinds = {
|
||||
[1] = 'File',
|
||||
[2] = 'Module',
|
||||
[3] = 'Namespace',
|
||||
[4] = 'Package',
|
||||
[5] = 'Class',
|
||||
[6] = 'Method',
|
||||
[7] = 'Property',
|
||||
[8] = 'Field',
|
||||
[9] = 'Constructor',
|
||||
[10] = 'Enum',
|
||||
[11] = 'Interface',
|
||||
[12] = 'Function',
|
||||
[13] = 'Variable',
|
||||
[14] = 'Constant',
|
||||
[15] = 'String',
|
||||
[16] = 'Number',
|
||||
[17] = 'Boolean',
|
||||
[18] = 'Array',
|
||||
[19] = 'Object',
|
||||
[20] = 'Key',
|
||||
[21] = 'Null',
|
||||
[22] = 'EnumMember',
|
||||
[23] = 'Struct',
|
||||
[24] = 'Event',
|
||||
[25] = 'Operator',
|
||||
[26] = 'TypeParameter',
|
||||
[27] = 'Component',
|
||||
[28] = 'Fragment',
|
||||
|
||||
-- ccls
|
||||
[252] = 'TypeAlias',
|
||||
[253] = 'Parameter',
|
||||
[254] = 'StaticMethod',
|
||||
[255] = 'Macro',
|
||||
}
|
||||
|
||||
---@param kind string|integer
|
||||
function M.icon_from_kind(kind)
|
||||
local kindstr = kind
|
||||
if type(kind) ~= 'string' then
|
||||
kindstr = M.kinds[kind]
|
||||
end
|
||||
if not kindstr then
|
||||
kindstr = 'Object'
|
||||
end
|
||||
|
||||
if type(cfg.o.symbols.icon_fetcher) == 'function' then
|
||||
local icon = cfg.o.symbols.icon_fetcher(kindstr)
|
||||
if icon and icon ~= "" then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
|
||||
if cfg.o.symbols.icon_source == 'lspkind' then
|
||||
local has_lspkind, lspkind = pcall(require, 'lspkind')
|
||||
if not has_lspkind then
|
||||
vim.notify("[outline]: icon_source set to lspkind but failed to require lspkind!", vim.log.levels.ERROR)
|
||||
else
|
||||
local icon = lspkind.symbolic(kindstr, { with_text = false })
|
||||
if icon and icon ~= "" then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return cfg.o.symbols.icons[kindstr].icon
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user