sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
807 stars 39 forks source link

Preferences menu bar item sometimes grayed out on MacOS #2196

Closed YonatanAhituv closed 5 years ago

YonatanAhituv commented 6 years ago

Summary

Randomly, Sublime Text will gray out the preferences menu bar item under the Sublime Text menu area, and keep it that way until you get a lucky restart.

Expected behavior

Preferences Menu Bar Item always not grayed out.

Actual behavior

Preferences Menu Bar Item randomly grays out and stays that way for a while.

Steps to reproduce

(Not Really Sure how to Reproduce, just happens randomly)

Environment

keith-hall commented 6 years ago

if I understand right, you are referring to this menu: macos preferences

(screenshot taken from https://forum.sublimetext.com/t/my-preferences-menu-item-is-disabled/35179)

YonatanAhituv commented 6 years ago

@keith-hall Yes 👍

wbond commented 6 years ago

Can you provide a dump of your Sublime Text console one of the times you see this? The only way I can imagine this happening is if the menu gets corrupted, or the plugin host somehow gets messed up.

YonatanAhituv commented 6 years ago

@wbond Really sorry, but the bug just randomly disappeared and won't come back, I'm going to close this issue and if anyone else is experiencing it and comments, I'll go ahead and reopen it. Sorry!

YonatanAhituv commented 6 years ago

Just happened again, console output is here.

wbond commented 6 years ago

Unfortunately due to the sheer number of packages you have installed, I think it is going to be hard to pin down what may be causing it. I'd look for packages providing menu entries, especially dynamically.

I believe SideBarEnhancements does that, so perhaps start by disabling that and see if it helps?

wbond commented 6 years ago

Running the following in your ST console can help:

sublime.find_resources('*.sublime-menu')
ghost commented 6 years ago

This forum thread pins it down to SecondBar and Bartender.

I've also seen this happen on OS X some times, so I'd pin it to OS X (or macOS, whatever), third party apps, or corrupt folder permissions and not ST specifically, since you can still access the preferences by Command Palette or keybinding.

YonatanAhituv commented 6 years ago

It seems to work fine when opened through subl, weird.

wbond commented 6 years ago

@AtomicCoding Did you ever run the command to see what packages are adding to the menus?

YonatanAhituv commented 6 years ago

@wbond I did, it just returned a giant list which I was too lazy to go through. Output: ['Packages/Default/Context.sublime-menu', 'Packages/Default/Encoding.sublime-menu', 'Packages/Default/Find in Files.sublime-menu', 'Packages/Default/Indentation.sublime-menu', 'Packages/Default/Line Endings.sublime-menu', 'Packages/Default/Main.sublime-menu', 'Packages/Default/Side Bar Mount Point.sublime-menu', 'Packages/Default/Side Bar.sublime-menu', 'Packages/Default/Syntax.sublime-menu', 'Packages/Default/Tab Context.sublime-menu', 'Packages/Default/Widget Context.sublime-menu', 'Packages/Diff/Context.sublime-menu', 'Packages/Diff/Side Bar.sublime-menu', 'Packages/A File Icon/.sublime/Main.sublime-menu', 'Packages/AdvancedNewFile/Main.sublime-menu', 'Packages/Alignment/Main.sublime-menu', 'Packages/AutoFileName/Main.sublime-menu', 'Packages/Better Completion/Main.sublime-menu', 'Packages/BracketHighlighter/Main.sublime-menu', 'Packages/Color Highlighter/Context.sublime-menu', 'Packages/Color Highlighter/Main.sublime-menu', 'Packages/Environment Settings/Context.sublime-menu', 'Packages/Environment Settings/Main.sublime-menu', 'Packages/FileDiffs/Context.sublime-menu', 'Packages/FileDiffs/Main.sublime-menu', 'Packages/FileDiffs/Side Bar.sublime-menu', 'Packages/FileDiffs/Tab Context.sublime-menu', 'Packages/Git/Main.sublime-menu', 'Packages/GitGutter/Main.sublime-menu', 'Packages/Github Search/Context.sublime-menu', 'Packages/GitSavvy/Main.sublime-menu', 'Packages/GitStatusBar/Main.sublime-menu', 'Packages/Local History/menus/Context.sublime-menu', 'Packages/Local History/menus/Main.sublime-menu', 'Packages/MarkdownEditing/Context.sublime-menu', 'Packages/MarkdownEditing/Main.sublime-menu', 'Packages/MarkdownLivePreview/.sublime/Main.sublime-menu', 'Packages/Material Theme/Main.sublime-menu', 'Packages/Notifications/Main.sublime-menu', 'Packages/Origami/Context.sublime-menu', 'Packages/Origami/Main.sublime-menu', 'Packages/Package Control/Main.sublime-menu', 'Packages/PackageResourceViewer/Main.sublime-menu', 'Packages/Path Tools/Context.sublime-menu', 'Packages/Path Tools/Tab Context.sublime-menu', 'Packages/ProjectManager/support/Main.sublime-menu', 'Packages/Quick File Open/Main.sublime-menu', 'Packages/Side-by-Side Settings/Main.sublime-menu', 'Packages/SideBarEnhancements/Main.sublime-menu', 'Packages/SideBarEnhancements/Side Bar.sublime-menu', 'Packages/Status Bar Time/Main.sublime-menu', 'Packages/Stylus/Main.sublime-menu', 'Packages/SublimeLinter/menus/Context.sublime-menu', 'Packages/SublimeLinter/menus/Main.sublime-menu', 'Packages/TerminalView/Main.sublime-menu', 'Packages/Timenow/Main.sublime-menu', 'Packages/Trimmer/Main.sublime-menu', 'Packages/ColorPicker/Main.sublime-menu', 'Packages/ConvertToUTF8/Main.sublime-menu', 'Packages/DA UI/.junkyard/Main.sublime-menu', 'Packages/Dart/Support/Main.sublime-menu', 'Packages/Minify/Context.sublime-menu', 'Packages/Minify/Main.sublime-menu', 'Packages/SendCode/support/Main.sublime-menu', 'Packages/SublimeCodeIntel/Context.sublime-menu', 'Packages/SublimeCodeIntel/Main.sublime-menu', 'Packages/WakaTime/Main.sublime-menu', 'Packages/User/Side Bar.sublime-menu'] Think I'm gonna try write a shell script to grep for preferences in each of the files.

YonatanAhituv commented 6 years ago

@wbond Running for file in ~/Library/Application\ Support/Sublime\ Text\ 3/**/*.sublime-menu; do cat $file | grep "preferences" && echo "$file" && subl "$file"; done gave me a ton of different files, but they all seemed to register themselves to package settings, and if it was a plugin's fault, it wouldn't explain the random on and off behavior that I'm getting. So that seems to rule out plugins. I don't have bartender or secondbar installed either.

clenemt commented 6 years ago

Same problem here, appears every time I install vanilla or bartender.

YonatanAhituv commented 6 years ago

@clenemt I actually have none of those installed. I did have bartender in the past, but it was happening before. I do have SIMBL installed, but Sublime Text is on the blacklist and none of the plugins I have should effect it.

acheronfail commented 6 years ago

I have had Bartender installed the entire time I've used Sublime Text and never seen this issue. 🤔

notnullnotvoid commented 6 years ago

I'm also having this issue, but for me it is consistent. While trying to diagnose a problem with EasyClangComplete, I restarted sublime, and this happened. Disabling the package and restarting sublime fixes the issue. Enabling and restarting unfixes it. So it seems the package is the culprit.

But I still don't know why it happens, and it seems like a package shouldn't be able to cause this. I ran the command you posted @wbond and 'Packages/EasyClangComplete/Main.sublime-menu' is among the results. Here is my console log from a fresh startup with EasyClangComplete enabled.

notnullnotvoid commented 6 years ago

This started happening even when I have EasyClangComplete disabled on restart, so now I'm not sure what to believe.

natis commented 6 years ago

This.

This is the bug that is making me consider moving to VS Code. Reading over the thread, there doesn't seem to be a consistent package or installed application that is causing this.

And VS Code, Atom, Brackets, etc all lack compared to Sublime but this is a years' old issue that no one can narrow down.

wbond commented 6 years ago

@natis Can you provide your list of installed packages? Do you run any software on macOS to modify the menu bar?

Did you know the preferences (for Sublime Text itself) are available through the command palette and the keyboard shortcut cmd+comma?

If people can do the work of listing the software they've installed, it will likely help in being able to reproduce the issue, and then a solution can be determined.

natis commented 6 years ago

My installed packages: "AutoFileName", "BracketHighlighter", "CodeKit", "Color Highlighter", "EditorConfig", "Gist", "HTML5", "jQuery", "Package Control", "Sass", "Seti_UI", "Seti_UX", "SideBarEnhancements", "Smart Title Case"

The only app I have installed that people keep mentioning is Bartender. But the thing is, I'll disable a package at random and I can access the preference option again. Leave the package disabled, restart my computer and then it becomes a crap shot if it's greyed out or not.

"Did you know the preferences (for Sublime Text itself) are available through the command palette and the keyboard shortcut cmd+comma?" Yes but it doesn't always work when the option is greyed out. I end up just opening the file via the finder.

natis commented 6 years ago
screen shot 2018-06-02 at 3 36 03 pm

This is the result after a clean re-install with the only thing done was entering in my license.

natis commented 6 years ago

Still having the same issue. Preferences availability comes and goes without rhyme or reason. Is there a keyboard shortcut that bring up the keybindings settings because that's what I need access to now.

wbond commented 6 years ago

@natis Is the Sublime Text window focused? It looks from the screenshot like it may not be, but perhaps that is just a customized OS theme?

wbond commented 6 years ago

@natis The keyboard shortcut on Mac is cmd + ,

natis commented 6 years ago

@wbond the screenshot is when Sublime has focus. That's just an absolutely clean install, nothing added, no themes, anything.

Since this is a clean install, I need to alter the key mapping, not the settings. Is there a way to get to the user key mapping when the preferences link is greyed out? There are a lot of different options under the Preferences menu item that isn't Preferences.sublime-settings that users can't get easy access to.

wbond commented 6 years ago

@natis macOS has red green and yellow buttons normally. That is why I mentioned "OS theme".

You can use the command palette to open up preferences, keyboard settings, etc.

Since you have a clean install, and the preferences menu works for lots of people, that makes me think something else on your machine may be affecting the functionality. Do you have any third-party apps that affect the menu bar?

wbond commented 6 years ago

@natis If you use the macOS keyboard binding of cmd+backtick, does any other window show for Sublime Text? Is there an alert or something hidden in the background?

natis commented 6 years ago

The only app people seem to mention is Bartender but I tried quitting the app and it's still a no go. If it was consistently always unavailable, I could see it being a third party app installed on the system, but it's not consistently greyed out. It's honestly a crap shoot when I can access it vs. not access it.

Visual Studio Code is killing me. It's ugly, bulky, and won't just let me type without suggesting everything under the sun with each keystroke.

wbond commented 6 years ago

Hmm, well, I guess I take a stab at installing bartender to see if I can reproduce the issue there. At least if I can reproduce the issue perhaps I can find a workaround.

notnullnotvoid commented 6 years ago

I've been having the issue sometimes, and I don't have bartender or anything like it installed. So if that's causing it, it can't be the only thing that is.

wbond commented 6 years ago

Hmm, what about the version of macOS you are running?

notnullnotvoid commented 6 years ago

I'm on macOS 10.13.4 (17E202) ; Sublime 3.1.1, Build 3176

wbond commented 6 years ago

Is anyone here not running High Sierra?

ghost commented 6 years ago

I'm running OS X 10.11.6 El Capitan. Never ran anything after that. Never had the issue with ST. No Bartender or anything that changes the menubar either.

wbond commented 6 years ago

Bartender definitely has bugs. I installed it yesterday and this morning my wifi menu was missing from the menu bar even though I never set it to be hidden. Quitting Bartender did nothing to solve the issue, I had to hide and re-enable it in system preferences to get it to show up.

I think if you have Bartender installed, try removing it and restarting your machine. See if the issue returns after that.

I realize this may not solve the issue for all people, but I have a hunch it may help some users.

natis commented 6 years ago

You can configure which clock bar icons appear and where with bartender. I haven't had an issue with icons not appearing as expected with bartender. notnullnotvoid indicated he was having the same issue with Sublime and he didn't have bartender installed.

wbond commented 6 years ago

I realize this may not solve the issue for all people, but I have a hunch it may help some users.

ghost commented 6 years ago

I understand what @wbond is saying and I can't understand why users who are having this issue are flogging a dead horse instead of trying everything first.

3 things to consider:

So, first, uninstall Bartender, SIMBL, etc. Don't just disable stuff. Don't forget to backup the preferences (anything relevant in Preferences and Application Support folder).

Reboot, test. If the issue persists, disable all ST packages. Reboot, test. If the issue persists, it's something with macOS 10.11+ (or some setting in its environment - System Preferences > Accessibility, for example) and ST.

notnullnotvoid commented 6 years ago
  1. the problem is inconsistent, which makes diagnosing it a slow process
  2. I have no such applications installed
  3. I'm not going to revert to an OS version from 4 years ago just to help track down a bug in someone else's software
  4. given that several things have been seen to make it more likely, but none of them is a definitive cause, it seems very probable this is a bug in sublime text (perhaps a timing-based threading bug?), and other conditions on the system are simply affecting the likelihood of it appearing.
natis commented 6 years ago

First and foremost, thank you for looking into this. While I constantly try other editors, I keep coming back to Sublime because it feels fast and it feels right. If I leave Sublime, I want it to be because another group put out a better product, not because I felt that Sublime has deteriorated.

I uninstalled bartender and for the most part, the preferences option is selectable but this morning, it's not. See attached. What other information do you need to help narrow this down? If the preferences pane is really just shortcuts to things rather than what I'd call a traditional MacOS preference pane, could those items be moved to something else within the menu bar in a future release?

screen shot 2018-06-08 at 8 24 07 am
natis commented 6 years ago

To add to that, I used AppCleaner to do the removal of Bartender.

wbond commented 6 years ago

@natis Well, in one sense we need a way to reproduce the issue. Once the issue is reproduced, then I can find the bug or workaround. So far, even with spending time on it, I haven't been able to reproduce. Neither Jon nor I has experienced it in our usage of Sublime Text on Mac. I use a Mac (10.12) as my daily driver, and work in Sublime Text all day long and have never seen the bug. That isn't to suggest it doesn't exist, just that there is something else that is a prerequisite for this bug happening.

The Preferences menu uses NSMenuItem and setSubmenu. The difference between that and the other app menu items is that .sublime-menu files can add entries to the Preferences menu. It is as if something is preventing Sublime Text from updating the submenu.

Kronuz commented 6 years ago

I figured out what causes this, for those who don't regularly enjoy an always grayed out preferences menu. This produces a new Package (GrayPreferences) that will always enable that nice feature.

Steps to reproduce:

  1. Clean install of Sublime Text
  2. In Packages, add a single directory and put a large number of files in it
  3. Start Sublime Text
  4. Enjoy Preferences menu bar item always grayed out

Example:

mkdir "Sublime Text 3/Packages/GrayPreferences"
cd "Sublime Text 3/Packages/GrayPreferences"
for i in {1..10}; do touch {1..10000}.$i; done  # Create 100,000 empty files
subl  # Start Sublime Text with a grayed out Preferences menu

Edit: This feature becomes sporadically apparent when using packages with large amount of files in them; for example Babel or TypeScript (which contain large node_modules directories).

bitworm commented 6 years ago

this is very helpful. Now we just wait a few years for a new release, and pray....

luckman212 commented 6 years ago

Wow @Kronuz thanks for finding this! @wbond is there any progress on a fix for this one?

joshgoebel commented 6 years ago

Also seeing this issue. I have far fewer than 100,000 files though. Largest offenders:

./WakaTime:     1285
./GitSavvy:     1393
./FileBrowser:       456
./Tint:      238
joshgoebel commented 6 years ago

If I add GitSavvy and WakaTime to ignored_packages this works again about 75% of the time. So weird.

wbond commented 5 years ago

Has anyone experienced this on build 3180?

natis commented 5 years ago

I am not seeing the issue so far but will post if I do see it happen again. If it's fixed, I'll be so happy to delete VS Code from my machine.

yaroslavyaroslav commented 5 years ago

I've had suffer from this issue permanently. This build resolve it for me.