-
-
Notifications
You must be signed in to change notification settings - Fork 284
/
lspkind.lua
78 lines (72 loc) · 2.19 KB
/
lspkind.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
local ui = require('lspsaga').config.ui
local function merge_custom(kind)
local function find_index_by_type(k)
for index, opts in pairs(kind) do
if opts[1] == k then
return index
end
end
end
for k, v in pairs(ui.kind or {}) do
local index = find_index_by_type(k)
if not index then
vim.notify('[lspsaga] failed finding kind in default')
return
end
if type(v) == 'table' then
kind[index][2], kind[index][3] = unpack(v)
elseif type(v) == 'string' then
kind[index][3] = v
else
vim.notify('[lspsaga] value must be of type string or table')
return
end
end
end
local function get_kind()
local kind = {
{ 'File', ' ', 'Tag' },
{ 'Module', ' ', 'Exception' },
{ 'Namespace', ' ', 'Include' },
{ 'Package', ' ', 'Label' },
{ 'Class', ' ', 'Include' },
{ 'Method', ' ', 'Function' },
{ 'Property', ' ', '@property' },
{ 'Field', ' ', '@field' },
{ 'Constructor', ' ', '@constructor' },
{ 'Enum', ' ', '@number' },
{ 'Interface', ' ', 'Type' },
{ 'Function', ' ', 'Function' },
{ 'Variable', ' ', '@variable' },
{ 'Constant', ' ', 'Constant' },
{ 'String', ' ', 'String' },
{ 'Number', ' ', 'Number' },
{ 'Boolean', ' ', 'Boolean' },
{ 'Array', ' ', 'Type' },
{ 'Object', ' ', 'Type' },
{ 'Key', ' ', 'Constant' },
{ 'Null', ' ', 'Constant' },
{ 'EnumMember', ' ', 'Number' },
{ 'Struct', ' ', 'Type' },
{ 'Event', ' ', 'Constant' },
{ 'Operator', ' ', 'Operator' },
{ 'TypeParameter', ' ', 'Type' },
-- ccls
[252] = { 'TypeAlias', ' ', 'Type' },
[253] = { 'Parameter', ' ', '@parameter' },
[254] = { 'StaticMethod', ' ', 'Function' },
[255] = { 'Macro', ' ', 'Macro' },
-- for completion sb microsoft!!!
[300] = { 'Text', ' ', 'String' },
[301] = { 'Snippet', ' ', '@variable' },
[302] = { 'Folder', ' ', 'Title' },
[303] = { 'Unit', ' ', 'Number' },
[304] = { 'Value', ' ', '@variable' },
}
merge_custom(kind)
return kind
end
local kind = get_kind()
return {
kind = kind,
}