Support ccls symbols

This commit is contained in:
rqdmap
2023-04-25 13:48:21 +08:00
parent 512791925d
commit b740f88a72
2 changed files with 42 additions and 30 deletions

View File

@@ -66,6 +66,12 @@ M.defaults = {
TypeParameter = { icon = '𝙏', hl = '@parameter' }, TypeParameter = { icon = '𝙏', hl = '@parameter' },
Component = { icon = '', hl = '@function' }, Component = { icon = '', hl = '@function' },
Fragment = { icon = '', hl = '@constant' }, Fragment = { icon = '', hl = '@constant' },
-- ccls
TypeAlias = { icon = '', hl = '@type' },
Parameter = { icon = '', hl = '@parameter' },
StaticMethod = { icon = '', hl = '@function' },
Macro = { icon = '', hl = '@macro' },
}, },
} }

View File

@@ -3,34 +3,40 @@ local config = require 'symbols-outline.config'
local M = {} local M = {}
M.kinds = { M.kinds = {
'File', [1] = 'File',
'Module', [2] = 'Module',
'Namespace', [3] = 'Namespace',
'Package', [4] = 'Package',
'Class', [5] = 'Class',
'Method', [6] = 'Method',
'Property', [7] = 'Property',
'Field', [8] = 'Field',
'Constructor', [9] = 'Constructor',
'Enum', [10] = 'Enum',
'Interface', [11] = 'Interface',
'Function', [12] = 'Function',
'Variable', [13] = 'Variable',
'Constant', [14] = 'Constant',
'String', [15] = 'String',
'Number', [16] = 'Number',
'Boolean', [17] = 'Boolean',
'Array', [18] = 'Array',
'Object', [19] = 'Object',
'Key', [20] = 'Key',
'Null', [21] = 'Null',
'EnumMember', [22] = 'EnumMember',
'Struct', [23] = 'Struct',
'Event', [24] = 'Event',
'Operator', [25] = 'Operator',
'TypeParameter', [26] = 'TypeParameter',
'Component', [27] = 'Component',
'Fragment', [28] = 'Fragment',
-- ccls
[252] = 'TypeAlias',
[253] = 'Parameter',
[254] = 'StaticMethod',
[255] = 'Macro',
} }
function M.icon_from_kind(kind) function M.icon_from_kind(kind)
@@ -40,8 +46,8 @@ function M.icon_from_kind(kind)
return symbols[kind].icon return symbols[kind].icon
end end
-- If the kind is higher than the available ones then default to 'Object' -- If the kind index is not available then default to 'Object'
if kind > #M.kinds then if M.kinds[kind] == nil then
kind = 19 kind = 19
end end
return symbols[M.kinds[kind]].icon return symbols[M.kinds[kind]].icon