-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathroutes.lua
122 lines (113 loc) · 2.88 KB
/
routes.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
local require = require("noice.util.lazy")
local Config = require("noice.config")
local M = {}
---@param routes? NoiceRouteConfig[]
function M.get(routes)
---@type NoiceRouteConfig[]
local ret = {}
-- add custom routes
vim.list_extend(ret, routes or {})
-- add default routes
vim.list_extend(ret, M.defaults())
return ret
end
---@return NoiceRouteConfig[]
function M.defaults()
---@type NoiceRouteConfig[]
local ret = {}
for _, kind in ipairs({ "signature", "hover" }) do
table.insert(ret, {
view = Config.options.lsp[kind].view or Config.options.lsp.documentation.view,
filter = { event = "lsp", kind = kind },
opts = vim.tbl_deep_extend(
"force",
{},
Config.options.lsp.documentation.opts,
Config.options.lsp[kind].opts or {}
),
})
end
return vim.list_extend(ret, {
{
view = Config.options.cmdline.view,
opts = Config.options.cmdline.opts,
filter = { event = "cmdline" },
},
{
view = "confirm",
filter = {
any = {
{ event = "msg_show", kind = "confirm" },
{ event = "msg_show", kind = "confirm_sub" },
{ event = "msg_show", kind = "number_prompt" },
},
},
},
{
view = Config.options.messages.view_history,
filter = {
any = {
{ event = "msg_history_show" },
-- { min_height = 20 },
},
},
},
{
view = Config.options.messages.view_search,
filter = {
event = "msg_show",
kind = "search_count",
},
},
{
filter = {
any = {
{ event = { "msg_showmode", "msg_showcmd", "msg_ruler" } },
{ event = "msg_show", kind = "search_count" },
},
},
opts = { skip = true },
},
{
view = Config.options.messages.view,
filter = {
event = "msg_show",
kind = { "", "echo", "echomsg", "lua_print", "list_cmd" },
},
opts = { replace = true, merge = true, title = "Messages" },
},
{
view = Config.options.messages.view_error,
filter = { error = true },
opts = { title = "Error" },
},
{
view = Config.options.messages.view_warn,
filter = { warning = true },
opts = { title = "Warning" },
},
{
view = Config.options.notify.view,
filter = { event = "notify" },
opts = { title = "Notify" },
},
{
view = Config.options.notify.view,
filter = {
event = "noice",
kind = { "stats", "debug" },
},
opts = { lang = "lua", replace = true, title = "Noice" },
},
{
view = Config.options.lsp.progress.view,
filter = { event = "lsp", kind = "progress" },
},
{
view = Config.options.lsp.message.view,
opts = Config.options.lsp.message.opts,
filter = { event = "lsp", kind = "message" },
},
})
end
return M