This repository was archived by the owner on Jan 3, 2024. It is now read-only.
File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ local defaults = {
14
14
-- options right now: termopen / quickfix
15
15
executor = require (" rust-tools/executors" ).termopen ,
16
16
17
+ -- function to expand snippets
18
+ snippet_func = nil ,
19
+
17
20
-- callback to execute once rust-analyzer is done initializing the workspace
18
21
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
19
22
on_initialized = nil ,
Original file line number Diff line number Diff line change
1
+ local rt = require (" rust-tools" )
2
+
1
3
local M = {}
2
4
3
5
function M .is_windows ()
@@ -65,10 +67,20 @@ function M.resize(vertical, amount)
65
67
end
66
68
67
69
function M .override_apply_text_edits ()
70
+ local override = nil
71
+ if rt .config .options .tools .snippet_func then
72
+ print (" here" )
73
+ override = rt .config .options .tools .snippet_func
74
+ else
75
+ override = function (edits , bufnr , offset_encoding , old )
76
+ M .snippet_text_edits_to_text_edits (edits )
77
+ old (edits , bufnr , offset_encoding )
78
+ end
79
+ end
80
+
68
81
local old_func = vim .lsp .util .apply_text_edits
69
82
vim .lsp .util .apply_text_edits = function (edits , bufnr , offset_encoding )
70
- M .snippet_text_edits_to_text_edits (edits )
71
- old_func (edits , bufnr , offset_encoding )
83
+ override (edits , bufnr , offset_encoding , old_func )
72
84
end
73
85
end
74
86
@@ -132,7 +144,6 @@ function M.is_ra_server(client)
132
144
or client .name == " rust_analyzer-standalone"
133
145
end
134
146
135
-
136
147
-- sanitize_command_for_debugging substitudes the command arguments so it can be used to run a
137
148
-- debugger.
138
149
--
You can’t perform that action at this time.
0 commit comments