Sublime Forum

New file opens a new tab, SidebarEnhancement not working?

#1

Hi All,

Firstly can I just say I am a massive fan of Sublime Text, not many days go by where I dont spend hours using it.

I’m a Mac user, and am currently running macOS Big Sur, Version 11.4. I recently updated Sublime Text 4 to Stable Channel, Build 4107. The new look is great, I’m a fan, but one thing that is really bothering me is this. When I right click a folder in the sidebar and select ‘New File’, I’m used to getting a filename input box, type the filename, press return and boom the new file is created with the correct name. What an awesome feature.

But what is actually happening is that a new tab is opened up with the title ‘untitled’, the only way it seems to then name the file is to save it and browse to where the file should be and then type the name, which is painfully slow in comparison.

Ive tried a few things to fix this.

  1. Following the steps in the Installation steps from the SidebarEnhancements github page:
    https://github.com/titoBouzout/SideBarEnhancements

  2. Checking that the package is not ignored in Preferences.sublime-settings, as described here
    https://stackoverflow.com/questions/28167587/sidebar-enhancement-plugin-installed-but-not-working

  3. Deleting the Sublime Text 3 app, all associated settings, and re-installing.

Nothing seems to fix the issue. I’ve found this so frustrating that Ive reverted back to Sublime Text 3 as that seems to be the only way I can have this feature working.

Am I alone here, or does anyone else have the same issue, or even better knows how to fix it please?

There’s also a very similar looking ancient issue:

Thanks

0 Likes

#2

Do you see any errors in the ST4 console when it starts up that indicate that the plugin might not be loading correctly?

Something else to check would be to Sublime in Safe Mode, then install Package Control and Sidebar Enhancements; does that work or does it still fail in the same way?

0 Likes

#3

Hi Odat,

Thanks for the answer. In the console, in both normal mode, and safe mode after installing Package Control and Sidebar Enhancements as you suggested I see:

reloading python 3.3 plugin SideBarEnhancements.SideBar
reloading python 3.3 plugin SideBarEnhancements.SideBarAPI
reloading python 3.3 plugin SideBarEnhancements.SideBarDefaultDisable

But when I right click and select new file I still get a new tab opened, and not the filename box.

Something I’ve noticed is that when I select New Folder rather than New File, I do get the prompt for the folder name.

So in answer to your question I believe the answer is that - Yes it does still fail in the same way.

0 Likes

#4

This package both works and does not work in ST4, depending on how you look at it; the issue is a problem with the package itself, though you can work around it.

If you look in the side bar menu when you right click on a folder, you’ll see an item labeled New File (note that there is no ellipsis on it); that’s the item that’s native to Sublime. If you go into the console and use sublime.log_commands(True) and select that menu item, you’ll see it triggering new_file_at, which is the built in command. This item is not visible when you right click on files, only folders.

You’ll also see further down in the menu an item labeled New File... (this time with ellipsis on it)); this one is available when you right click on files OR on folders. If you select it with command logging turned on, you’ll see it executing side_bar_new_file, which is the version from the package and does what you would expect.

So in that sense, this works exactly as expected.

What DOESN’T work is that SideBarEnhancements tries to hide the built in items, but the way that it does it needs to be updated to support ST4 because it’s no longer doing it correctly. What it’s trying to do is redefine the built in commands so that they hide themselves.

In ST3 there’s a single plugin host (running Python 3.3) that all packages run inside, so redefining those commands the way it’s trying to do works as expected.

In ST4 there are two plugin hosts; the legacy 3.3 host and a new Python 3.8 host. Each host is distinct from each other, and SideBarEnhancements hasn’t been updated to run in the new host. So it’s happily redefining the commands, but in the wrong plugin host, which leaves the original commands in place and causes confusion.

The proper fix to this would be for the author to update the package so that it’s ST4 aware and does this correctly.

In a pinch, you can:

  1. Select Tools > Developer > New Plugin...
  2. Select all of the text in the created file and replace it with the contents of https://github.com/titoBouzout/SideBarEnhancements/blob/st3/SideBarDefaultDisable.py
  3. Save the file in the place Sublime will default to (your User package); you can use any name you like but make sure it’s a .py file.

The User package always runs in the newer plugin host, as do all of the packages that ship with Sublime, so this gets the plugin that disables the commands to run in the correct host.

You want to remember that you did this because this plugin will hide the default commands even if you remove or disable SideBarEnhancements (which is why the author should fix their package).

2 Likes

Creating a new file in the file-manager
#5

Odat,

You’re a legend. Thats worked a treat.

Funny that I hadn’t even noticed that there were 2 New File options!!

Thank you so much.

DBX

0 Likes

#6

Created an account just to say thank-you to you both. SAVED me all the agony with the missing file name prompt! Thank you!

0 Likes