Module: Girb::DebugIntegration
- Defined in:
- lib/girb/debug_integration.rb
Defined Under Namespace
Modules: GirbDebugCommands
Constant Summary
collapse
- GIRB_DIR =
Define at module level so it’s accessible as Girb::DebugIntegration::GIRB_DIR Points to lib directory, not gem root, so user’s files aren’t filtered
File.expand_path('..', __dir__)
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.ai_triggered ⇒ Object
Returns the value of attribute ai_triggered.
20
21
22
|
# File 'lib/girb/debug_integration.rb', line 20
def ai_triggered
@ai_triggered
end
|
.api_thread ⇒ Object
Returns the value of attribute api_thread.
20
21
22
|
# File 'lib/girb/debug_integration.rb', line 20
def api_thread
@api_thread
end
|
.auto_continue ⇒ Object
Returns the value of attribute auto_continue.
20
21
22
|
# File 'lib/girb/debug_integration.rb', line 20
def auto_continue
@auto_continue
end
|
.interrupted ⇒ Object
Returns the value of attribute interrupted.
20
21
22
|
# File 'lib/girb/debug_integration.rb', line 20
def interrupted
@interrupted
end
|
Class Method Details
.add_pending_debug_command(cmd) ⇒ Object
26
27
28
|
# File 'lib/girb/debug_integration.rb', line 26
def add_pending_debug_command(cmd)
pending_debug_commands << cmd
end
|
.auto_continue? ⇒ Boolean
36
37
38
|
# File 'lib/girb/debug_integration.rb', line 36
def auto_continue?
@auto_continue
end
|
.clear_interrupt! ⇒ Object
48
49
50
|
# File 'lib/girb/debug_integration.rb', line 48
def clear_interrupt!
@interrupted = false
end
|
.interrupt! ⇒ Object
44
45
46
|
# File 'lib/girb/debug_integration.rb', line 44
def interrupt!
@interrupted = true
end
|
.interrupted? ⇒ Boolean
40
41
42
|
# File 'lib/girb/debug_integration.rb', line 40
def interrupted?
@interrupted
end
|
.patch_debugger_frame_filter ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/girb/debug_integration.rb', line 80
def patch_debugger_frame_filter
return unless defined?(DEBUGGER__)
return if @frame_filter_patched
if DEBUGGER__.respond_to?(:capture_frames)
original_method = DEBUGGER__.method(:capture_frames)
DEBUGGER__.define_singleton_method(:capture_frames) do |*args|
frames = original_method.call(*args)
frames.reject! do |frame|
frame.realpath&.start_with?(Girb::DebugIntegration::GIRB_DIR)
end
frames
end
end
@frame_filter_patched = true
end
|
.pending_debug_commands ⇒ Object
22
23
24
|
# File 'lib/girb/debug_integration.rb', line 22
def pending_debug_commands
@pending_debug_commands ||= []
end
|
.session_started? ⇒ Boolean
52
53
54
|
# File 'lib/girb/debug_integration.rb', line 52
def session_started?
@session_started
end
|
.setup ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/girb/debug_integration.rb', line 68
def setup
return unless defined?(DEBUGGER__::SESSION)
return if @setup_done
register_ai_command
register_debug_tools
setup_keybinding
patch_debugger_frame_filter
@setup_done = true
puts "[girb] Debug AI assistant loaded. Use 'qq <question>' or Ctrl+Space."
end
|
.setup_if_needed ⇒ Object
100
101
102
103
|
# File 'lib/girb/debug_integration.rb', line 100
def setup_if_needed
return if @setup_done
setup
end
|
.start_session! ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/girb/debug_integration.rb', line 56
def start_session!
return if @session_started
SessionPersistence.start_session
@session_started = true
setup_exit_hook
end
|
.take_pending_debug_commands ⇒ Object
30
31
32
33
34
|
# File 'lib/girb/debug_integration.rb', line 30
def take_pending_debug_commands
cmds = @pending_debug_commands || []
@pending_debug_commands = []
cmds
end
|