ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

sublime-text-2-buildview

by rctay ST2/ST3

A Sublime Text 2/3 plugin to show build output in a view.

Details

  • 2018.04.15.11.41.56
  • github.​com
  • github.​com
  • 4 months ago
  • 1 hour ago
  • 5 years ago

Installs

  • Total 12K
  • Win 7K
  • OS X 3K
  • Linux 2K
Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7
Windows 6 8 4 6 7 1 10 11 12 6 4 8 8 24 3 9 6 5 15 10 9 8 9 7 5 12 6 10 10 8 11 2 10 6 9 7 8 9 9 6 14 15 14 15 12 7
OS X 2 2 0 0 2 4 1 1 6 1 0 2 0 0 3 2 1 1 1 1 4 0 6 0 0 3 0 2 0 2 0 1 4 2 2 3 1 0 2 3 4 1 4 3 0 2
Linux 2 1 3 2 1 4 3 6 5 1 4 6 5 3 3 4 2 4 1 1 4 1 3 3 3 0 0 1 5 3 5 1 3 3 1 4 2 2 5 4 4 4 11 6 0 2

Readme

Source
raw.​githubusercontent.​com

A Sublime Text 2/3 plugin to show build output in a view.

Gratipay me! Donate with Bitcoin Donate with Ethereum

In Sublime Text, build results are shown in a fixed horizontal panel; you can't drag it to put it vertically next to your code, like in Eclipse, VS.

With this plugin, like any other view, you can put your build results where you want:

This is super useful if you are repeatedly running a program on your code/ script and want to have its output handy. (You probably already have a .sublime-build or build_systems entry in your .sublime-project.)

The core functionality is done in pipe_views.PipeViews, an abstraction allowing Unix-like “pipes” to be created between Views in Sublime.

Usage

The plugin hooks on to the keyboard shortcuts for launching builds; if you have different shortcuts for them, change the .sublime-keymap files accordingly. These bindings must have the following context:

"context": [{"key": "build_fake", "operator":"equal", "operand":true}]

Several aspects of the plugin's behaviour can be changed as detailed below. They can be changed on a per-view basis via the Command Palette in either the view source code or with build output, or through settings under "buildview".

Note: it seems settings set via Command Palette are persisted through sublime exits/launches.

Disabling

Command Palette: - Disable/Enable buildview for this window

key: "buildview.enabled" values: true/false

Sublime's settings hierarchy is respected. So you could, for example, enable the plugin only for selected projects, by setting "enabled" to false in Packages/User/Preferences.sublime-settings, and set it to true in your .sublime-project.

For example, you can add this to your Preferences.sublime-settings:

{
    ...
    "buildview.enabled": false
    ...
}

Then in the project's .sublime-project file:

{
    ...
    "folders": [...]
    "settings": {
        "buildview.enabled": true,
        "buildview.scroll": "top"
    }
    ...
}

("scroll" added for demonstration; for details on "scroll", refer below.)

Output scrolling

Command Palette: - Build output always at top - Build output always at end - Build output stays at same position

key: "buildview.scroll"

values: - "top" - "bottom" - "last"

default: "bottom"

The plugin can scroll the output to the top, bottom, or the position before the current build was launched. The default is to scroll to the bottom (ie. continually show fresh output as it is emitted).

“Save changes?” warning

key: "buildview.silence_modified_warning"

values: true/false

default: true.

Since version 90e2365182e9566b2fa79dd7dc79d6b0d7e433f6 (Package Control: 2014.01.27.15.16.48), closing the build output view, directly, or indirectly, eg. by exiting Sublime Text, no longer causes a “Save changes?” warning to be displayed.

If you wish to have the old behaviour (of having a warning displayed), set to false.

Suppress build results panel

The built-in build results view will display momentarily. To disable this, use the User preference setting:

{
    ...
    "show_panel_on_build": false,
    ...
}

Known Issues/TODO

  • pin/unpin location, so that subsequent builds scrolls to the same location
  • build view is “forgotten” after restarting Sublime
  • improve disabling/enabling options (eg whitelists, blacklists)
  • improve namespacing of settings into a dictionary, once sublime supports merging of settings dictionaries through the hierarchy. For example, if buildview hypothetically read settings from a dictionary, and you had in your Preferences.sublime-settings

    { … “buildview”: { “enabled”: false, “scroll”: “top” } … }

and you then did this in the project's .sublime-project file

{
       ...
       "folders": [...]
       "settings": {
           "buildview": {
               "enabled": true
           }
       }
       ...
   }

buildview would behave as though the `"scroll"` setting was not defined
because sublime does not automatically merge settings dictionaries through
the settings hierarchy, so the `"scroll"` setting does not bubble up.

Pull requests welcome!

Hacking notes

  • after editing pipe_views.py, restart Sublime or re-save commands.py for the changes to take effect.
  • who's view is it anyway? A variety of names are used for views in the source code, according to their different roles:
    • source view: the built-in view that shows up when you click Show Build Results
    • destination view: the view that mirrors the build output, the one with the title “Build Output”
    • otherwise, a view should generally refer to one holding the source for the build

Donate

If you liked this plugin, you can donate here:
Gratipay me! Donate with Bitcoin Donate with Ethereum