diff options
author | Ike Devolder <ike.devolder@gmail.com> | 2019-07-07 23:14:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-07 23:14:28 +0200 |
commit | a4fdbb27bdbdee8a56b80505ada9a71ed63b281f (patch) | |
tree | b2945dc96af96b3432afc8fc8cf6eb1f66220a05 | |
parent | 662be63ba06cad2253cba69a9011217b0f304c9a (diff) | |
parent | b3601a6797a74c225920f632e097ba0167b7fadb (diff) | |
download | vdebug-a4fdbb27bdbdee8a56b80505ada9a71ed63b281f.zip |
Merge pull request #419 from vim-vdebug/check-if-is-connected
first check if there is a connection before acting on some events
-rw-r--r-- | python3/vdebug/event.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/python3/vdebug/event.py b/python3/vdebug/event.py index a352234..303e1dc 100644 --- a/python3/vdebug/event.py +++ b/python3/vdebug/event.py @@ -335,6 +335,11 @@ class ListenEvent(Event): class StepOverEvent(Event): def run(self): + if not self.session or not self.session.is_connected(): + self.ui.say("Step over is only possible when " + "Vdebug is running") + return False + log.Log("Stepping over") self.ui.set_status("running") res = self.api.step_over() @@ -344,6 +349,11 @@ class StepOverEvent(Event): class StepIntoEvent(Event): def run(self): + if not self.session or not self.session.is_connected(): + self.ui.say("Step in is only possible when " + "Vdebug is running") + return False + log.Log("Stepping into statement") self.ui.set_status("running") res = self.api.step_into() @@ -353,6 +363,11 @@ class StepIntoEvent(Event): class StepOutEvent(Event): def run(self): + if not self.session or not self.session.is_connected(): + self.ui.say("Step out is only possible when " + "Vdebug is running") + return False + log.Log("Stepping out of statement") self.ui.set_status("running") res = self.api.step_out() @@ -362,6 +377,11 @@ class StepOutEvent(Event): class RunToCursorEvent(Event): def run(self): + if not self.session or not self.session.is_connected(): + self.ui.say("Run to cursor is only possible when " + "Vdebug is running") + return False + row = self.ui.get_current_row() file = self.ui.get_current_file() if file != self.ui.sourcewin.get_file(): |