File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ local M = {}
3
3
--- @class Options
4
4
--- Automatically apply code-actions if there is only 1 available.
5
5
--- @field apply boolean
6
+ --- Preview all changes per default.
7
+ --- @field previe boolean
6
8
--- Configuration provided to vim.diff (see `:h vim.diff()`)
7
9
--- @field diff table
8
10
local default_config = {
9
11
apply = true ,
12
+ preview = false ,
10
13
diff = {
11
14
ctxlen = 5 ,
12
15
},
@@ -19,6 +22,10 @@ function M.setup(config)
19
22
user_config = vim .tbl_deep_extend (" force" , default_config , config )
20
23
end
21
24
25
+ function M .adhoc_merge (config )
26
+ return vim .tbl_deep_extend (" force" , user_config , config )
27
+ end
28
+
22
29
setmetatable (M , {
23
30
__index = function (_ , key )
24
31
return user_config [key ]
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function M.setup(opts)
15
15
end
16
16
17
17
M .rename = function (new_name , opts )
18
- opts = vim . tbl_deep_extend ( " force " , config , opts or {})
18
+ opts = config . adhoc_merge ( opts or {})
19
19
20
20
-- Reset it to the original before every operation in case of a failure.
21
21
--- @diagnostic disable-next-line : duplicate-set-field
@@ -40,7 +40,7 @@ M.rename_preview = function(new_name, opts)
40
40
end
41
41
42
42
M .code_action = function (opts )
43
- opts = vim . tbl_deep_extend ( " force " , config , opts or {})
43
+ opts = config . adhoc_merge ( opts or {})
44
44
45
45
-- Reset it to the original before every operation in case of a failure.
46
46
--- @diagnostic disable-next-line : duplicate-set-field
@@ -56,7 +56,6 @@ M.code_action = function(opts)
56
56
util .apply_workspace_edit = lWorkspaceEdit .make_apply_workspace_edit (apply_workspace_edit )
57
57
58
58
-- automatically trigger Telescope when there is only one action
59
- opts .apply = true
60
59
vim .lsp .buf .code_action (opts )
61
60
end
62
61
You can’t perform that action at this time.
0 commit comments