File tree 4 files changed +20
-1
lines changed
4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ rt.setup({
73
73
-- Commands:
74
74
-- RustEnableInlayHints
75
75
-- RustDisableInlayHints
76
+ -- RustToggleInlayHints
76
77
-- RustSetInlayHints
77
78
-- RustUnsetInlayHints
78
79
@@ -85,6 +86,8 @@ rt.setup({
85
86
require (' rust-tools' ).inlay_hints .enable ()
86
87
-- Disable inlay hints auto update and unset them for all buffers
87
88
require (' rust-tools' ).inlay_hints .disable ()
89
+ -- Toggle between enabled and disabled inlay hints states for all buffer
90
+ require (' rust-tools' ).inlay_hints .toggle ()
88
91
```
89
92
</details >
90
93
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ local M = {
11
11
inlay_hints = {
12
12
enable = nil ,
13
13
disable = nil ,
14
+ toggle = nil ,
14
15
set = nil ,
15
16
unset = nil ,
16
17
cache = nil ,
@@ -85,6 +86,9 @@ function M.setup(opts)
85
86
render = function ()
86
87
inlay .render (hints )
87
88
end ,
89
+ toggle = function ()
90
+ inlay .toggle (hints )
91
+ end ,
88
92
}
89
93
90
94
local join_lines = require (" rust-tools.join_lines" )
Original file line number Diff line number Diff line change 16
16
17
17
-- Disable hints and clear all cached buffers
18
18
function M .disable (self )
19
- self .disable = false
19
+ self .enabled = false
20
20
M .disable_cache_autocmd ()
21
21
22
22
for k , _ in pairs (self .cache ) do
@@ -44,6 +44,15 @@ function M.set(self)
44
44
M .cache_render (self , 0 )
45
45
end
46
46
47
+ -- Toggles inlay hints state globally. Uses disable and enable internally
48
+ function M .toggle (self )
49
+ if self .enabled then
50
+ M .disable (self )
51
+ else
52
+ M .enable (self )
53
+ end
54
+ end
55
+
47
56
-- Clear hints only for the current buffer
48
57
function M .unset ()
49
58
clear_ns (0 )
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ local function setup_commands()
55
55
RustDisableInlayHints = {
56
56
rt .inlay_hints .disable ,
57
57
},
58
+ RustToggleInlayHints = {
59
+ rt .inlay_hints .toggle ,
60
+ },
58
61
RustLastDebug = {
59
62
rt .cached_commands .execute_last_debuggable ,
60
63
},
You can’t perform that action at this time.
0 commit comments