Separate Build for every file/tab in Sublime Text - sublimetext3

When you run Build System is Sublime by default it creates a bottom pop-up that is bound to that sublime window. When you change to other tabs bottom pop-up will still stay for the Build that you have started.
I would like to have separate Build/Build pop-up for every tab that is opened in that window. For example; there are two tabs open, file01 and file02. I run Build System for file01 and while its running I switch to other tab, file02, and there is no Build pop-up. I can edit file02 and also run build on it separately while build on file01(tab one) is running. Also starting and stopping Builds for for different files will not affect Builds for other files/tabs. Essentially every tab in a window would have separate Build System and Build pop-up.

The short answer to your question is, there is no out of the box way to do this; by design build systems are executed in the context of a window and not a file tab within a window.
The longer form answer is that builds are executed by an instance of a WindowCommand, which is a command that is specific to a window. That command can do anything that it likes in order to drive the build.
By default, the command used is named exec, and its implementation can be found by using the command palette by using View Package File and looking at Default/exec.py.
The implementation that ships with Sublime follows the rule that there is one build per window, and so when you trigger a build if one is already running, it is cancelled in favor of the new one.
To do what you want, you would need an implementation of what that command does that instead tracks the build per tab instead of per window. Such a command would need to cover all of the edge cases inherent in this as well, such as the commands that navigate through errors not working if there is more than one build result, or what happens if you close a file while a build is running, etc.

Related

failed to launch preferred application for category TerminalEmulator?

I get this error:
Failed to launch preferred application for category "TerminalEmulator".
Step 1
Go to applications and search for qterminal and open QTerminal.
This will open a terminal.
Step 2
Type sudo apt install xfce4-settings, hit enter, wait for process to complete.
Now you can use all your applications.
After a lot of scrapping through various answers which asked to install or update various things, all just was for NO LUCK!
Then I decided to do it in my own lazy way.
I donot have any problem with QTerminal, hence I just tweak some parts in the thunar and settings.
In thunar(file manager) > Edit > Configure custom actions > Open Terminal Here (If this tag is not available then create it or if there is multiple tags with same value then keep only one and delete other)>double click on it to open and customize it.
In the next box you'll see "command" which will be run when clicking on "Open Terminal Here". Just dont write any command manually. There on the right side a "Select Application" icon is present. Just click it and select your preferred terminal. Save this change and Bingo! you'll be opening the folder in your preferred terminal.
now you'll see the command (basically path to the terminal application with a modifier f to open folder). Select only the application path and copy it, we'll need it in step 2.
In this step we will set up just tweak setting
Setting>Keyboard>Shortcuts
if Ctrl+Alt+T is already defined here then just edit it or create new "Custom shortcut"
paste the copied path of the terminal (what we copied in step 1) in the command section. Save it
DONE!!! *** You can set any shortcut key for your convenience ***

Cannot add Sublime project preferences after opening repo via Github Desktop

I have been happy to notice that Github Desktop lets me open a repo in Sublime Text. It seems to open the repo as a project but I have a hard time figuring out how to edit the project preferences for the repo. Specifically, I would like to add file_exclude_patterns.
I have tried Project > Save Project As... in Sublime, but then when I open the repo through Github Desktop it opens two Sublime windows: one that respects my project preferences and one that ignores them.
From your problem description, it sounds like you might be running into issues with the hot_exit setting. When that setting is turned on (which is the default), then whenever you quit Sublime, it saves the state of all open windows into a session file before it quits.
That session file contains a list of every window that's open, what files are open in each, their scroll position, selection, any unsaved changes to files, and so on. When you restart Sublime, it loads the session file and restores its state back to what it was previously, seamlessly putting you back to where you were before.
One of the potentially unintended side effects of this is that the session is always restored every time you start Sublime. So if you have a project open in a window, and you quit, Sublime keeps a record that you had one window containing that project. If you start it and tell it to open the same project, it will first restore the session and then open the project, resulting in two windows.
As such, turning off hot_exit may solve this problem for you. When it's off, the session information isn't saved, and Sublime starts in a more or less "fresh" state every time. The downside to this is that you will be prompted to save all unsaved files, your list of open files is lost, etc. Depending on your use case, this may or may not be an issue.
If you already have that setting off and this still happens, then the issue would be that GitHub for Windows is opening both the project and the folder, which would result in two windows. In that case there's not a lot to do but poke the people in charge of GitHub for Windows and tell them to fix their code.
On the other hand, if you turn off hot_exit and you get one window, but it doesn't respect your project preferences, then the problem is that GitHub for Windows is only opening the folder, not the sublime-project file.
In that case, there's not a whole lot to be done, unfortunately. Sublime won't load a sublime-project file just because it happens to be contained in a folder, since there can conceivably be many of them in there (many people keep their project files in a single folder, for example).
If Sublime is associated with sublime-project files, then opening the sublime-project file would result in Sublime opening the project for you, so that may be a possibility as well.
Beyond that, you're more or less in the realm of things like using Project > Switch Project or Project > Quick Switch Project to get the window to display what you want; that's not very handy with regards to just opening the project, though.

Run code on file open in Sublime Text

I'd like to run some code in Sublime Text every time I open a file. Is there any way of doing this?
The background, if you want more context: I recently started using Sublime Text as my main editor, and although I love having Vim mode available through the Vintageous plug-in, I just want it to be available, not forcing its way into being turned on every time I open a file.
The author does not seem open to adding an option for being turned off by default--which is entirely okay: I'm not trying to be critical of his choices, and I'm glad he's made his code available to me--so it occurred to me that Sublime Text might offer some way of running some code every time you open a file. If so, I would simply run something that sets the mode to the normal Sublime Text mode (as opposed to Vim's "normal" mode).
You can run code in response to various events by creating a plugin and subclassing sublime_plugin.EventListener. The methods you would be most interested in are on_load() and on_new(). From there, you can either run an existing command, or you can make your own in a different class (probably subclassing sublime_plugin.TextCommand).

How can I programmatically save a Sublime Text 3 workspace (without a dialog box)?

I really want a way to switch programming contexts quickly without hunting for windows that I've left strewn about. What would be nice is a command line tool to let me switch between different patches that I might be working on, and automatically open the sublime text workspace that I had open the last time I was working on that patch. The issue is that in order for the tool to know about the workspaces associated with said patches, it either needs to be told about them explicitly, or it needs to be able to tell sublime to save the current workspace with a specific file path.
Sublime does have a save_workspace_as command, but it opens a saveAs dialog, which is not what I want, and I can't seem to find any documentation that suggests that save_workspace_as can take an argument.
Any ideas?

PyDev, PyUnit Usage Questions

In the PyUnit view in Pydev...
Suppose the view currently shows 5 tests, 1 of which fails.
When I right click on the failed test, and then run it (with either Run or Debug), all the other tests disappear from the view. How do I stop it from removing all the other tests?
Next question.....
Also, Pydev then creates a run configuration for the test that I just ran. Which means that if I right click on the test module in the PyDev Package Explorer, and then try to "Run As" "Python Unit Test", I then have to select which run configuration. How do I stop it creating a new run configuration?
When you right-click a failed test and run it, you did a new run configuration that just ran it alone (so, you get the results just showing that one).
What is implemented is that you have a 'pin' icon in the pyunit view. You can click it to 'bookmark' the run, so, when you press the 'reload', which is the icon in the right of the pin, it'll reload those results (or you can manually choose the results from any run from the test run history dropdown).
As for running, there's no way to stop it from creating a new run configuration, but what you can do is just re-run the last one with Ctrl+F11 (provided you configured it properly as explained in http://pydev.org/manual_101_run.html).
You can also access old runs with Alt+R, T > number from 1 to 9 an old configuration you want to run.
Even though it is possibly not the exact approach you may expect, one option is to start the Unittest from the command line and attach the debugger by RemoteDebugServer via 'pydevd.py'.
This is now a fully automated option of ePyUnit which includes the automation of remote debugging with PyDev and Eclipse by 'pydevd.py'. This works seamlessly for the 'subprocess' call as well as independently started command line processes.
See:
https://pypi.python.org/pypi/epyunit
https://pythonhosted.org/epyunit/
For basics of remote debugging:
http://www.pydev.org/manual_adv_remote_debugger.html
Also enhanced unittest integration into PyUnit.
Comments and fixes are welcome.
Have fun..

Resources