Home Download Buy Blog Forum Support

ST3: Launching external tools that aren't build tools

ST3: Launching external tools that aren't build tools

Postby BTG on Thu Apr 11, 2013 3:15 am

I would like to run some external tools that require their output to be parsed, independently of my default build scripts. For example, I have a tool that searches all source files for some identifiers that I can then jump to. The problem is that there's no way for me to have these two independent of each other, i.e. if I have Project A, B, and C, I want them each to be able to run Tool Z without having to put Tool Z into each of the build scripts as a variant. That's possible, but it's inconvenient (e.g. if I change Tool Z I have to now go and find all build scripts that reference it). My other option is to make a separate build script for Tool Z and then select it every time I need to use it, but that's inconvenient.

Is there a simpler way to do this? I can't just bind Tool Z to a key because I need to filter the output so I can jump to code. I could write a plug in that would select Tool Z as the build system and execute it and then reset the build system, but I'm not sure exactly how to do that.
BTG
 
Posts: 10
Joined: Thu Apr 11, 2013 2:35 am

Re: ST3: Launching external tools that aren't build tools

Postby jps on Thu Apr 11, 2013 5:40 am

Build systems are mostly just a frontend for the exec command (defined in exec.py in the default package), so you can write a plugin that calls the exec command directly. The only holdup is that you'll have to do the variable substitution yourself ($file and friends), as that's done by the build command before it forwards the arguments to the exec command.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: ST3: Launching external tools that aren't build tools

Postby schmiidt on Thu Apr 11, 2013 9:46 am

Somewhat related, when sublime text is launched from a commandline is it then possible to refer to the "current working directory" in a build system? E.g.

Code: Select all
{
   "shell_cmd": "make",
   "working_dir": "${current_working_dir}",
}


would work as if 'make' was executed from the commandline.
schmiidt
 
Posts: 20
Joined: Wed Oct 07, 2009 12:50 pm

Re: ST3: Launching external tools that aren't build tools

Postby schmiidt on Thu Apr 11, 2013 11:29 am

I just found out that 'start sublime_text.exe .' on Windows will start sublime text with a project at the current directory. I can then use 'project_path' to get the current directory in the build system instead of introducing a new build system variable ${current_working_dir}.
schmiidt
 
Posts: 20
Joined: Wed Oct 07, 2009 12:50 pm

Re: ST3: Launching external tools that aren't build tools

Postby BTG on Thu Apr 11, 2013 12:18 pm

Sorry if I'm being daft here, but where do I find exec.py in the ST3 installation? I'm using the portable version on Windows.
BTG
 
Posts: 10
Joined: Thu Apr 11, 2013 2:35 am

Re: ST3: Launching external tools that aren't build tools

Postby schmiidt on Thu Apr 11, 2013 2:25 pm

In my installation, I found 'exec.py' in the 'Default.sublime-package' archive under 'C:\Program Files\Sublime Text 3\Packages'.
schmiidt
 
Posts: 20
Joined: Wed Oct 07, 2009 12:50 pm

Re: ST3: Launching external tools that aren't build tools

Postby BTG on Thu Apr 11, 2013 2:44 pm

Ah, I hadn't realized that those were ZIP files. :oops:
BTG
 
Posts: 10
Joined: Thu Apr 11, 2013 2:35 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 14 guests