File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,12 @@ is_running() *osv.is_running()*
164
164
Return: ~
165
165
True if osv is running.
166
166
167
+ is_attached() *osv.is_attached()*
168
+ Checks whether | osv | is currently attached to a debuggee instance.
169
+
170
+ Return: ~
171
+ True if osv is attached.
172
+
167
173
print_profiler() *osv.print_profiler()*
168
174
Prints the last 1000 elapsed times in milliseconds for each profiled sections.
169
175
See | osv.launch() | to enable the profiler.
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ local client
54
54
55
55
local debug_hook_conn
56
56
57
+ local is_attached = false
58
+
57
59
local cache = {}
58
60
59
61
local start_profiler
@@ -311,6 +313,8 @@ function M.prepare_attach(blocking)
311
313
312
314
M .stop_freeze = false
313
315
316
+ is_attached = false
317
+
314
318
if not request .terminateDebuggee then
315
319
vim .schedule (function () M .prepare_attach (false ) end )
316
320
end
@@ -1086,6 +1090,8 @@ function M.prepare_attach(blocking)
1086
1090
end
1087
1091
end
1088
1092
1093
+ is_attached = true
1094
+
1089
1095
debug.sethook (function (event , line )
1090
1096
if lock_debug_loop then return end
1091
1097
@@ -1947,6 +1953,8 @@ function M.stop()
1947
1953
1948
1954
M .stop_freeze = false
1949
1955
1956
+ is_attached = false
1957
+
1950
1958
if exit_autocmd then
1951
1959
vim .api .nvim_del_autocmd (exit_autocmd )
1952
1960
exit_autocmd = nil
@@ -1958,6 +1966,9 @@ function M.is_running()
1958
1966
return nvim_server ~= nil
1959
1967
end
1960
1968
1969
+ function M .is_attached ()
1970
+ return is_attached
1971
+ end
1961
1972
function M .start_trace ()
1962
1973
function line_hook (event , line )
1963
1974
local surface = 0
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ function M.prepare_attach(blocking)
58
58
; implement handlers
59
59
local attach_now = function()
60
60
; redefine debug traceback
61
+ ; set is attached
61
62
; attach to current instance
62
63
end
63
64
if blocking then
Original file line number Diff line number Diff line change @@ -54,3 +54,16 @@ function M.is_running()
54
54
return nvim_server ~= nil
55
55
end
56
56
57
+ ;; script variables
58
+ local is_attached = false
59
+
60
+ ;; reset internal states
61
+ is_attached = false
62
+
63
+ ;; set is attached
64
+ is_attached = true
65
+
66
+ ;; implement
67
+ function M.is_attached()
68
+ return is_attached
69
+ end
You can’t perform that action at this time.
0 commit comments