From 7ae4d1405b8509478b12c714729547f59b8e341e Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sun, 22 Jan 2023 11:57:04 +0100 Subject: [PATCH] Add additional commands, Add readme --- Default.sublime-commands | 25 ++++++++++++++++++ README.md | 56 ++++++++++++++++++++++++++++++++++++++++ remedy.py | 9 ++++--- 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/Default.sublime-commands b/Default.sublime-commands index 13472fb..f2f6324 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -27,4 +27,29 @@ "caption": "RemedyBG: Add selection or word under cursor to watch window", "command": "remedy_restart_debugging", }, + { + "caption": "RemedyBG: All in one, this is for the convienient mouse + keyboard usage", + "command": "remedy_restart_debugging", + }, + { + "caption": "RemedyBG: Build and run to cursor, requires a project", + "command": "remedy_build", + "args": { + "command": "run_to_cursor" + } + }, + { + "caption": "RemedyBG: Build and start debugging, requires a project", + "command": "remedy_build", + "args": { + "command": "start_debugging" + } + }, + { + "caption": "RemedyBG: Build and goto cursor, requires a project", + "command": "remedy_build", + "args": { + "command": "goto_cursor" + } + }, ] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b022b6c --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ + +### RemedyBG debugger integration with Sublime Text + +I frequently find that nothing beats the Visual Studio workflow. +You just click Ctrl+F10 and you are inspecting the code you have just written. +This package seeks to recreate that experience in Sublime Text but without +the buggy and slow Visual Studio, thanks to a much better debugger that is RemedyBG +and it's user API! + +### Requirement + +Obviously you need to have remedybg: +https://remedybg.itch.io/remedybg + +It needs to be available in the PATH with name "remedybg.exe". Alternatively you +can add "remedy_executable": "C:/path/to/remedy" to your settings. + +### Remedy build system + +Sadly Sublime doesn't allow for querying of currently chosen build system. +To make it so that you can build before starting to debug you need to have +a project / project file. That project file needs a build system, if there +is only one build system, everything is going to work. If there are more, +you will need to add a field called "remedy_build_system", here is an example: + +``` +{ + "folders": + [ + { + "path": "." + } + ], + "remedy_target": "this_is_optional/main.exe", + "remedy_build_system": "first", + "build_systems": + [ + { + "name": "first", + "shell_cmd": "build.bat" + } + ] +} +``` + +### All in one + +Feature idea. By clicking using your middle mouse button you can issue most +of the available debugger commands. + * Debugger goes to the place you clicked on + * The word you clicked is going to get added to watch window + * If the word you clicked on matches "rt"(run_to_cursor, "r"(run), "rr"(stop), "rrr"(restart) then it's going to delete that word in sublime and issue a debugger command. So far I have found it to be nice for code discovery kind of stuff with the mouse + keyboard workflow, you can bind this to the keyboard too though. The commands are easy to type using single hand. + +### Credits + +* septag - plugin is based on his 10x plugin https://github.com/slynch8/10x/blob/main/PythonScripts/RemedyBG/RemedyBG.py \ No newline at end of file diff --git a/remedy.py b/remedy.py index ab7e6a6..2bd4cc4 100644 --- a/remedy.py +++ b/remedy.py @@ -1,3 +1,8 @@ +""" +CREDITS +* septag - plugin is based on his 10x plugin https://github.com/slynch8/10x/blob/main/PythonScripts/RemedyBG/RemedyBG.py +""" + import subprocess import os, io, ctypes @@ -279,9 +284,7 @@ remedy_instance = RemedyInstance() def get_remedy_executable(): window = sublime.active_window() settings = window.settings() - result = settings.get("remedy_executable") - if result == None: - result = "remedybg" + result = settings.get("remedy_executable", "remedybg") return result def execute_process(view, cmd, offset = 1):