Sublime Forum

Dev Build 2043

#1

Dev Build 2043 is out now. Dev Builds are in-progress versions of Sublime Text 2 - use them if you want the latest features, but keep in mind that you will encounter more bugs.

I’ve been working on menus for this build, you can see this in a few areas:

  • Right click on a directory in the side bar, and you can create a new file at that location
  • Right click some files in the side bar, and you can delete them (files in folders only, not open files)
  • Right click with two files selected in the side bar, and you can diff them

I’m planning to expand the file manipulation related commands on the sidebar in the future, to allow new directories to be created, and files to be renamed. I’m not intending on writing a finder/explorer/nautilus replacement, however.

Individual packages may now extend menus, too. You can see a minimalist example of this in the new Diff packages, which extends Context.sublime-menu and Side Bar.sublime-menu. It’s also possible to extend the main menu, although it’s a little bit tricker, as you need to make sure your menu items go in the right spot, and not just at the end. An example Main.sublime-menu is:


    {
        "id": "tools",
        "children":
        
            {
                "id": "packages",
                "children":
                
                    {
                        "caption": "Talk",
                        "children":
                        
                            { "caption": "Hello, World!", "command": "echo" }
                        ]
                    }
                ]
            }
        ]
    }
]

This adds a new sub-folder to Tools/Packages called “Talk”, with a single “Hello, World!” menu item inside.

Snippets have also received some attention: punctuation based tab triggers work again, and the snippet fields are much more proactive about cancelling themselves than they were before.

Finally, inspired by theblacklion’s diff plugin, there’s now an entry on the context menu to diff the current buffer against the on disk version, showing you the unsaved changes.

The full list of changes is on the Dev Build page, as usual.

0 Likes

Dev Build 2063
Menu Customization
#2

Nice work Jon, thanks.

Now the first bug report :frowning:

Diff command only work on unicode files, with windows-1252 files:
Traceback (most recent call last):
File “.\sublime_plugin.py”, line 230, in run_
File “.\diff.py”, line 25, in run
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe9 in position 17: ordinal not in range(128)

startup, version: 2043 windows x64 channel: dev

0 Likes

#3

Good work, diff highlighting rocks!

Some bugs I encountered:

  • Show unsaved changes sometimes works, sometimes does not. I could not figure out the exact reason, but in my tests this action on my local_settings.py.example file works (opens a diff file) while on the similar file, settings.py does not (opens an empty diff file)
  • I cannot figure out how Diff already opened files as multiple file selection and right click is not available there. Does it mean we can only diff files that are not yet opened (via file browser) ?
  • New file context menu does not actually create a file. It creates a new buffer ready to be saved in given directory. Is this the way it supposed to function? What will happen if you add New folder context menu?
0 Likes

#4

Hmm… auto-save and show unsaved changes kind of bite each other. Auto-save is being triggered on_deactivated which the diff invokes. Any idea for a workaround?

Btw… love it :smile:

0 Likes

#5

Thanks, I’ll look into it

[quote=“ekolguy”]

  • Show unsaved changes sometimes works, sometimes does not. I could not figure out the exact reason, but in my tests this action on my local_settings.py.example file works (opens a diff file) while on the similar file, settings.py does not (opens an empty diff file)

  • I cannot figure out how Diff already opened files as multiple file selection and right click is not available there. Does it mean we can only diff files that are not yet opened (via file browser) ?

  • New file context menu does not actually create a file. It creates a new buffer ready to be saved in given directory. Is this the way it supposed to function? What will happen if you add New folder context menu?[/quote]

  • It’ll show an empty buffer if there’s no difference between the current file and the on disk one. I’ll change it to emit a status message in this scenario instead.

  • I’m planning to make open files still selectable in the folder area, which will resolve this issue

  • New File is working the way it’s supposed to, yeah. My personal feeling is that this is a better option than prompting for a filename and creating something on disk immediately. New Folder will just prompt though.

I’ll make the unsaved changes show up in an output panel instead, which is a better thing to do, and will go some way to resolving this issue, as long as you don’t click in the output panel, anyway :slight_smile:

0 Likes

#6

What does Diff highlighting do exactly?

Now that new file/folder/delete is on the sidebar, can we please get rename?

I’m excited to see what kind of plugins will arise from this new extensibility — context menus!

0 Likes

#7

The problem is, both of those files have unsaved changes in them.

0 Likes

#8

[quote=“ekolguy”]

The problem is, both of those files have unsaved changes in them.[/quote]

I am seeing the same behaviour on OS X 10.6.6. Save a file, do some changes, select Show Unsaved Changes, empty buffer.

This appears to always be the case for .html.erb files (which maps to the HTML (Rails) syntax), but for .js files Show Unsaved Changes works as expected.

Edit: Oh yeah, and thanks for a great update! ST2 is getting really, really good.

0 Likes

#9

With the new file creation from sidebar, would it be possible to specify a filename when creating the file, so kind of :

Right click folder -> click new file -> type name of file within tree -> begin editing file.

Thanks for all the changes :smile:

0 Likes

#10

[quote=“stiang”]

The problem is, both of those files have unsaved changes in them.
I am seeing the same behaviour on OS X 10.6.6. Save a file, do some changes, select Show Unsaved Changes, empty buffer.

This appears to always be the case for .html.erb files (which maps to the HTML (Rails) syntax), but for .js files Show Unsaved Changes works as expected.

Edit: Oh yeah, and thanks for a great update! ST2 is getting really, really good.[/quote]

Same here, look at the console if you don’t have an error like:
Traceback (most recent call last):
File “.\sublime_plugin.py”, line 230, in run_
File “.\diff.py”, line 25, in run
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe9 in position 17: ordinal not in range(128)

The error happen between the creation of the diff buffer and the filling of it, so the result is an empty buffer…

0 Likes

#11

[quote=“jps”]
I’ve been working on menus for this build, you can see this in a few areas:

  • Right click on a directory in the side bar, and you can create a new file at that location
  • Right click some files in the side bar, and you can delete them (files in folders only, not open files)[/quote]

Awesome release Jon, as always.

I found a small bug in relation to refresh not picking up file renames on OSX.

Steps to reproduce:

  • Add a folder to project

  • Add a file “ABC.txt” to the project (using any means to create the file), and the sidebar will display the file

  • Either using Reveal in Finder or command line, rename the file from “ABC.txt” to “abc.txt”

  • Sidebar still displays “ABC.txt”. Even forced refresh do not pick the changes

I have enabled case sensibility on my filesystem, so doing ls display the filename properly.

Could be that Python do not make distinction about this? Is quite common that OSX can work on both case sensitive or not FS, but some libraries or languages determine that at compilation time, not runtime.

Cheers!

0 Likes

#12

This is a really nice update.

I just wanted to say that ctrl+space now errors with: no available completions.
So the completions drop down never shows up.

ST2 2043 Win 7 x64 (portable version).

Thanks.

0 Likes

#13

[quote=“daylerees”]With the new file creation from sidebar, would it be possible to specify a filename when creating the file, so kind of :

Right click folder -> click new file -> type name of file within tree -> begin editing file.
[/quote]

I think the current solution is more powerful. You create a new file in a given folder and when you hit Ctrl+S you can save it in this folder (default) but you can still change the folder or abandon the new file altogether.

0 Likes

#14

Could this be optional? I’m already a huge fan of it showing the diff in a buffer, and I don’t auto-save on focus lost. :smile:

0 Likes

#15

[quote=“adzenith”]

Could this be optional? I’m already a huge fan of it showing the diff in a buffer, and I don’t auto-save on focus lost. :smile:[/quote]

I don’t like the output panel for diffs, too. What about changing the auto-save to only react on the window focus? This way you can leave it as is :smile:.

0 Likes

#16

I love the new diffing with highlighting! Having it built into the text editor is a nice feature.

I agree with this. Having a new buffer for diffs is preferred over the panel. I’m also a huge fan of the save on focus lost (thanks for adding it a few releases ago!), but having it only auto save on window focus lost would fix these other problems.

0 Likes

#17

I think, I’ve made up my mind. For my orgmode plugin the current auto save on view focus lost is great (due to the way I work with it e.g. switching between views and not windows). But for other files (html, css, js, php, py, c etc.), where I might use a diff before saving, it would matter when switching over to a console or browser (-> window focus lost). Can’t we have switches for both? :smiley:

0 Likes

#18

Sublime Text 2 is awesome text editor. Really love to check new release everyday:D

I meet serious bug on 2043 build.
I always open some windows, but 2043 can’t handle multiple window.
When type somethings on another window, the letters show up on the first window only.

steps

  1. open 1st window.(1st window)
  2. File -> New Window(2nd window)
  3. write on 2nd window -> the letters show up on 1st window.(bug)
  4. write on 1st window -> the letters show up on 1st window.(normal)
  5. close 2nd window -> write on 1st window -> crash…

I’m using Ubuntu 10.10. I didn’t check it on other platform.

Regards,

0 Likes

#19

Why can I only diff/delete files if they are in folders? I rarely use folders, I just use open files in my projects. Seems an odd limitation.

Also, once I’ve added a folder, I right-click on it to “remove folder” and nothing happens. I can’t figure out how to get rid of it. Bug?

0 Likes

#20

[quote=“theblacklion”]

I think, I’ve made up my mind. For my orgmode plugin the current auto save on view focus lost is great (due to the way I work with it e.g. switching between views and not windows). But for other files (html, css, js, php, py, c etc.), where I might use a diff before saving, it would matter when switching over to a console or browser (-> window focus lost). Can’t we have switches for both? :smiley:[/quote]

If you grab the text on disk before the file loses focus then you can save it and show the diff anyway. Seems like that might be cleaner than having a per-view setting or something.

0 Likes