-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
98 lines (95 loc) · 2.56 KB
/
config.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
local M = {}
---@class Config
M.options = {
insert = {
---@type "after"|"before"|"end"
---@usage "after" - insert after the receiver's struct declaration
---@usage "before" - insert before the receiver's struct declaration
---@usage "end" - insert at the end of the file
position = "after",
before_newline = true, -- additional newline before the implementation
after_newline = false, -- additional newline after the implementation
},
icons = {
interface = {
text = " ",
hl = "GoImplInterfaceIcon",
},
go = {
text = " ",
hl = "GoImplGoBlue",
},
},
prompt = {
receiver = " > ",
interface = " > ",
generic = " {name} > ",
},
style = {
---@type nui_popup_options
---The NuiPopup options for the popup that used to get the receiver
receiver_input = {
relative = "cursor",
position = { row = 1, col = 0 },
size = 40,
border = { style = "rounded", text = { top_align = "center" } },
win_options = {
winhighlight = "Normal:Normal,FloatBorder:GoImplGoBlue,FloatTitle:GoImplGoBlue",
},
},
---@type nui_popup_options
---The NuiPopup options for the previewer that used to get the generic arguments
generic_argument_input = {
border = {
style = "rounded",
text = {
top_align = "center",
},
},
win_options = {
winhighlight = "Normal:Normal,FloatBorder:GoImplGoBlue,FloatTitle:GoImplGoBlue",
},
},
---@type nui_popup_options
---The NuiPopup options for the previewer that used to show the interface declaration
generic_argument_previewer = {
border = {
padding = {
top = 0,
bottom = 0,
left = 2,
right = 2,
},
style = "rounded",
},
win_options = {
winhighlight = "Normal:Normal,FloatBorder:Normal",
},
},
---@type nui_layout_options
---The NuiLayout options for the popup that used to get the generic arguments
generic_argument_layout = {
position = "50%",
size = {
width = 80,
height = 20,
},
},
interface_selector = {
interface_icon = true,
query_highlight = true,
query_highlight_hl = "GoImplGoBlue",
package_highlight = true,
package_highlight_hl = "GoImplHighlight",
},
},
}
---Merge the user options with the default options
---@param user_opts Config
function M.init(user_opts)
M.options = vim.tbl_deep_extend("force", M.options, user_opts)
vim.api.nvim_set_hl(0, "GoImplGoBlue", { fg = "#6BC6F0", bold = true })
vim.api.nvim_set_hl(0, "GoImplInterfaceIcon", { fg = "#a9b665", bold = true })
vim.api.nvim_set_hl(0, "GoImplHighlight", { fg = "#ea6962", bold = true })
end
return M