Sublime Forum

Dev Build 3013

#1

Build 3013 is available now. This is the first dev build for Sublime Text 3, so you won’t get an auto update notification from previous builds.

3013 has atomic saves, where the file is first saved to a new file, and then renamed over the top of the existing file. Atomic saves are disabled by default, but can be enabled via the atomic_save setting.

There are a bunch of new APIs in 3013, notably on_text_command an on_window_command. These events allow plugins to be notified before a given command is run. Plugins can use them as simple notifications, or they can change the command that will be run: if, instead of returning None, an event handler returns a command name or a (command_name, args) tuple, then the returned command will be run instead of the originally issued one.

It’s easy to get into trouble with on_text_command, so do be careful. If, for example, you make a plugin that unilaterally returns “paste” from on_text_command, then every command issued will be a paste command, making things like undo, editing, navigation, etc not work. You’d have to manually delete the plugin to get things make to a working state.

The API reference has been updated with all the new APIs in S3: sublimetext.com/docs/3/api_reference.html

On OS X, experimental support has been added for handling line numbers passed through the byzantine apple events system. If you are using Unity 3D, please let me know if this is working for you.

0 Likes

#2

Resource api is nice. Thanks!

0 Likes

#3


Sublime Text Build 3013 is great.

0 Likes

#4

I really like the resource apis!

the following command does not seem to be working, i looked in the sublime.py file for it and could not find a match.
sublime.find_resources(pattern) [String] Finds resources whose file name matches the given pattern.

Here is how I am using it in code:

result = sublime.find_resources("*.sublime-commands")

The error code is:

AttributeError: 'module' object has no attribute 'find_resources'
0 Likes

#5

Yeah, find_resources is missing for me too

0 Likes

#6

It looks like one of the changes to sublime.py didn’t make it in, so find_resources isn’t currently exposed. I’ll fix this for the next build. In the mean time, you can use the hacky version:

sublime_api.find_resources('*.sublime-commands')
0 Likes

#7

Hey, I’m using Unity 3D 4.0 on OS X Mountain Lion, if it’s supposed to jump to the line number from double clicking console entries then that’s not working. Is there something else you wanted to check with Unity?

0 Likes

#8

Is there any chance you could include a better default C# package? The one it comes with doesn’t do Goto Symbol correctly, and the new Goto Definition doesn’t seem to work either, probably for the same reason. I’m using this one github.com/wintermi/csharp-tmbundle if that helps!

0 Likes

#9

Don’t know whether the root cause is ST3 or GoSublime, but disabling GoSublime makes the issue go away, although I’d have expected ST3 to not freeze due to a plugin’s behavior now with plugin_host.

How to reproduce:

  1. Open up lots of go files.
  2. Have GoSublime enabled
  3. Menu item File->Close All Files
  4. ST3 hangs forever.

The only way to regain control is to issue killall plugin_host and then after a few seconds ST3 unfreezes (but then without any plugins running). The freeze always happen with GoSublime enabled and never happens when it’s disabled.

ST3 3013 (although happened with 3011 (never upgraded to 3012) too so isn’t specific to this version)
OSX 10.8.2
GoSublime r13.02.08-2

The GoSublime error log is empty.

Also reported as a GoSublime github issue

0 Likes

#10

Thank you for on_text_command and on_window_command!

A minor nitpick:
The callbacks are not called for commands that are run from a Macro File.
Those are also not logged.
This would be helpful to track all actual invocations of a command.

0 Likes

#11

An error in sublime_plugin.py:

def on_window_command(window_id, name, args): window = sublime.Window(window_id) for callback in all_callbacks'on_text_command']: res = callback.on_window_command(window, name, args) if isinstance(res, tuple): return res elif res: return (res, None) return ("", None)
on_text_command string must replaced by on_window_command.

0 Likes

#12

When I open up the default preference files in Windows, I’m seeing line feed characters (\n, 0x0a) show up as question mark blocks. Doesn’t seem to affect anything, but it was fine in 3012. 32-bit Portable Windows build, running XP.

0 Likes

#13

It seems like something has changed with the view.edit functionality. What I have is a TextCommand that, when run() is called, passes the edit parameter and its self.view to another function to handle the processing.

In ST2, this function was able to open a new scratch view and insert text to it (using the passed edit object), but now the insert call doesn’t seem to do anything. I know there have been some changes to the way edit objects work – is there a better way to do what I’m trying here?

0 Likes

#14

Jon, I have a request that you may or may not be interested in implementing.

Currently there are a number of plugins that load up custom gutter icons. ST3 currently still uses the old way of loading gutter icons; they must be relative to “Theme - Default”. In the past, when a plugin was creating a region, you could just feed in the custom icon like so:

Where custom is an icon named custom.png

../MyPlugin/Icons/custom

With the sublime-package format, this is impossible since the icons are now inside an archive, but regions require the icons to be a path minus the png extension.

Ideally it would be nice to give an icon path not relative to “Theme - Default” if the icons was provided with a path like “Packages/MyPlugin/Icons/custom” (keeping with the current convention used everywhere else). And it would be doubly nice if the API simply did a load_resource() on the path to retrieve the icon so it would work for sublime-package archives as well.

Currently, plugins will have to unpack icon resources themselves and also must create a dummy “Theme - Default” folder to allow the region command to find the icon relative to the “Theme - Default” and not fail.

0 Likes

#15

Another thing I’ve noticed in 3013: my Find Next/Find Previous actions do the opposite thing I’d expect. I.e., I press the key designated as “Find Next” in the menu…and it goes backwards. Find Previous goes forwards.

0 Likes

#16

Make sure you didn’t accidentally turned “reverse” on

0 Likes

#17

Thanks for the C++ highlighting fix!

0 Likes

#18

Hey Jon, when you get a chance, could you add some sort of banner or notice to the ST1 pages to let people know that it’s out of date and then link them to either to ST2 or ST3 docs? I’ve noticed people occasionally finding sublimetext.com/docs/key-bindings and then being confused when the information is irrelative.

0 Likes

#19

I have to force quit every time with this build, the whole program is hanging, after launching it for a few minutes.

[code]Date/Time: 2013-02-25 11:04:57 +0100
OS Version: 10.8.2 (Build 12C3012)
Architecture: x86_64
Report Version: 11

Command: Sublime Text
Path: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
Version: Build 3013 (3013)
Parent: launchd [143]

PID: 19496
Event: hang
Duration: 0.99s
Steps: 10 (100ms sampling interval)

Hardware model: MacBookPro10,1
Active cpus: 8
Free pages: 349385 pages (-2515)
Pageins: 0 pages
Pageouts: 0 pages

Process: Sublime Text [19496]
Path: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
Architecture: x86_64
Parent: launchd [143]
UID: 501
Task size: 25910 pages

Thread 0x39e234 DispatchQueue 1 priority 46
10 start + 52 (Sublime Text) [0x10d9a01a4]
10 main + 2924 (Sublime Text) [0x10d9a0f7e]
10 -[NSApplication run] + 517 (AppKit) [0x7fff91327283]
10 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128 (AppKit) [0x7fff9132fed2]
10 _DPSNextEvent + 685 (AppKit) [0x7fff91330613]
10 BlockUntilNextEventMatchingListInMode + 62 (HIToolbox) [0x7fff9077ecd3]
10 ReceiveNextEventCommon + 356 (HIToolbox) [0x7fff9077ee42]
10 RunCurrentEventLoopInMode + 209 (HIToolbox) [0x7fff9077f0a4]
10 CFRunLoopRunSpecific + 290 (CoreFoundation) [0x7fff93a386b2]
10 __CFRunLoopRun + 1513 (CoreFoundation) [0x7fff93a39099]
10 __CFRunLoopDoTimer + 557 (CoreFoundation) [0x7fff93a538bd]
10 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20 (CoreFoundation) [0x7fff93a53da4]
10 __NSFireTimer + 96 (Foundation) [0x7fff929c5513]
10 ns_work_queue_runner::run_items() + 189 (Sublime Text) [0x10db73ab3]
10 ??? (Sublime Text + 413806) [0x10da0306e]
10 int send_helper::send_message<33u, object_id>(object_id const&) + 253 (Sublime Text) [0x10da06187]
10 void wait_for_reply(reply_entry*, int*) + 57 (Sublime Text) [0x10da14ab9]
10 shm_read(shm_channel*, string_buffer*, int) + 68 (Sublime Text) [0x10db90556]
10 ??? (Sublime Text + 2041373) [0x10db9061d]
10 ??? (Sublime Text + 2041577) [0x10db906e9]
10 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8e7380fa]
*10 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Thread 0x39e240 DispatchQueue 2 priority 48
10 _dispatch_mgr_thread + 54 (libdispatch.dylib) [0x7fff920959ee]
10 kevent + 10 (libsystem_kernel.dylib) [0x7fff8e738d16]
*10 ??? (mach_kernel + 3467616) [0xffffff800054e960]

Thread 0x39e248 priority 46
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 ??? (Sublime Text + 2061364) [0x10db95434]
10 basic_queue_runner::run() + 76 (Sublime Text) [0x10db9527a]
10 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8e7380fa]
*10 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Thread 0x39e249 priority 46
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 ??? (Sublime Text + 2069849) [0x10db97559]
10 io_worker::thread_proc() + 45 (Sublime Text) [0x10db976d3]
10 io_scheduler::extract_next_request() + 96 (Sublime Text) [0x10db97114]
10 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8e7380fa]
*10 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Thread 0x39e24a priority 46
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 ??? (Sublime Text + 2069849) [0x10db97559]
10 io_worker::thread_proc() + 45 (Sublime Text) [0x10db976d3]
10 io_scheduler::extract_next_request() + 96 (Sublime Text) [0x10db97114]
10 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8e7380fa]
*10 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Thread 0x39e269 priority 46
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 shm_reader_thread(void*) + 113 (Sublime Text) [0x10d9f805b]
10 shm_read(shm_channel*, string_buffer*, int) + 68 (Sublime Text) [0x10db90556]
10 ??? (Sublime Text + 2041373) [0x10db9061d]
10 ??? (Sublime Text + 2041577) [0x10db906e9]
10 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8e7380fa]
*10 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Thread 0x39e278 priority 46
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 ??? (Sublime Text + 2800554) [0x10dc49baa]
10 __psynch_cvwait + 10 (libsystem_kernel.dylib) [0x7fff8e7380fa]
*10 psynch_cvcontinue + 0 (mach_kernel) [0xffffff80005b4b10]

Thread 0x39e2b6 priority 62
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 NSThread__main + 1345 (Foundation) [0x7fff929e7612]
10 +[NSURLConnection(Loader) _resourceLoadLoop:] + 356 (Foundation) [0x7fff92989586]
10 CFRunLoopRunSpecific + 290 (CoreFoundation) [0x7fff93a386b2]
10 __CFRunLoopRun + 1078 (CoreFoundation) [0x7fff93a38ee6]
10 __CFRunLoopServiceMachPort + 195 (CoreFoundation) [0x7fff93a33803]
10 mach_msg_trap + 10 (libsystem_kernel.dylib) [0x7fff8e736686]
*10 ipc_mqueue_receive_continue + 0 (mach_kernel) [0xffffff8000213030]

Thread 0x39e2c5 priority 46
10 thread_start + 13 (libsystem_c.dylib) [0x7fff8c205181]
10 _pthread_start + 327 (libsystem_c.dylib) [0x7fff8c218742]
10 __select + 10 (libsystem_kernel.dylib) [0x7fff8e738322]
*10 ??? (mach_kernel + 3576576) [0xffffff8000569300]

Binary Images:
0x10d99e000 - 0x10de4fff7 com.sublimetext.3 Build 3013 (3013) <753F7ABA-785E-380A-98E4-0B848A69AADB> /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
0x7fff8c204000 - 0x7fff8c2d0fe7 libsystem_c.dylib <8CBCF9B9-EBB7-365E-A3FF-2F3850763C6B> /usr/lib/system/libsystem_c.dylib
0x7fff8e726000 - 0x7fff8e741ff7 libsystem_kernel.dylib /usr/lib/system/libsystem_kernel.dylib
0x7fff9071f000 - 0x7fff90a4fff7 com.apple.HIToolbox 2.0 <317F75F7-4B0F-35F5-89A7-F20BA60AC944> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
0x7fff911db000 - 0x7fff91e08ff7 com.apple.AppKit 6.8 (1187.34) <1FF64844-EB62-3F96-AED7-6525B7CCEC23> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x7fff92091000 - 0x7fff920a6ff7 libdispatch.dylib /usr/lib/system/libdispatch.dylib
0x7fff92952000 - 0x7fff92caefff com.apple.Foundation 6.8 (945.11) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x7fff93a04000 - 0x7fff93bedfff com.apple.CoreFoundation 6.8 (744.12) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
*0xffffff8000200000 - 0xffffff8000734d7c mach_kernel <0AFA55FD-872F-3BBE-8630-214EB586A16D> /mach_kernel
[/code]

0 Likes

#20

Since you pointed to the API docs I thought I’d let you know about undocumented features in the docs and other things:

Firstly, view.begin_edit() (and end_edit) have been changed drastically and require an edit_token which can only be obtained within a command callback. This information is not given in the ST3 docs since it still states that Edit objects can manually be created in the “Class sublime.Edit” section.
Then, looking at the source of sublime_plugin there seems to be an edit_token passed in any command. How do these behave in Application or Window Commands? Are they even implemented or just some internal simplification for calling commands with the same number of parameters?

Finally, I once created a list with undocumented API features from ST2 which are still missing for ST3: github.com/SublimeText/UnofficialDocs/issues/15
You should certainly add is_checked and on_query_completions, find_open_file and log_result_regex (only ST2 docs). The other things are rather hacky and are not needed in the docs.

0 Likes