0

I installed the REPL package on Sublime Text 3 and when I run the script a new window opens and shows the results but I can't stop the execution (e.g. an infinite loop). The 'Cancel Build' command seems to be not active (grey), as shown in the image below:

enter image description here

This is what I have in the default key map:

{ "keys": ["ctrl+break"], "command": "cancel_build" }.

As you can see from the image, it lets me modify the key (currently Ctrl+Alt+C) but it's still not working (typed { "keys": ["ctrl+alt+c"], "command": "cancel_build" }).

What should I do? Thanks in advance

MattDMo
  • 100,794
  • 21
  • 241
  • 231

2 Answers2

1

In order to be able to cancel a build, the sublime-build file that's used to control the build needs to do one of two things:

  1. Include a target key to specify what plugin command to invoke to execute the build and a cancel key to specify what plugin command to invoke to cancel the build.

  2. Not include a target key, which makes the build execute using a built in default command that inherently knows how to cancel the build.

SublimeREPL uses a custom command to trigger the REPL to display, and that is either not in a sublime-build file (like when you pick the command from the REPL menu itself) or is a sublime-build file that doesn't include a cancel key and thus can't be cancelled.

To cancel a program in process in SublimeREPL, the best bet is probably to close the tab that it's running in, which should stop the process from running.

Alternately, you may want to investigate Terminus as a replacement, which is a more actively developed package that makes it possible to have a build wherein the cancel key does indeed work if you'd like that workflow.

Unlike SublimeREPL which comes mostly configured out of the box and should Just Work (presuming you have the appropriate tools already installed), Terminus requires you to set up your tools manually, which may be a stumbling block. The Terminus README includes links to some YouTube videos (disclosure: I'm the author of the videos) that shows how to use it for interactive builds.

OdatNurd
  • 21,371
  • 3
  • 50
  • 68
  • Thank you for your answer. I'm not sure I understood 100% what you wrote about the sublime-build file and also I'm not able to close the tab that's running because Sublime seems to crash and I have to shut it down through the task manager. If you say I can't change the command from the key map maybe it's easier for me to uninstall the REPL package. Can I do this? – newby_prog Feb 23 '21 at 09:43
  • If SublimeREPL is hanging Sublime such that you can't even close a tab, then the cancel key binding would be unlikely to work anyway. You can indeed uninstall the REPL package, though if you're trying to run a program that's interactive you need either that or Terminus. Terminus may behave better in an infinite loop situation than SublimeREPL doesl I'm not sure offhand. – OdatNurd Feb 23 '21 at 14:16
0

In Sublime Text (4126), I use ctrl+B to interrupt an ongoing build while building with Latextools giving a message:

build failed.

crtl+alt+c, crtl+c, and crtl+break(which is greyed out) do not work for me.

Okwizi
  • 11
  • 2