TheSpyder / SyncedSideBar

Sublime Text plugin to sync project sidebar (folder view) with currently active file.
341 stars 23 forks source link

Opens closed sidebar #31

Closed YayC closed 8 years ago

YayC commented 9 years ago

After toggling the sidebar closed, switching files re-opens the sidebar (Sublime Text 3, OSX 10.9.4)

TheSpyder commented 9 years ago

Which build of Sublime 3? I'm not sure if it's only in the dev build, but they have introduced a way for the plugin to track when the sidebar is toggled (there still isn't a proper "is sidebar visible" api).

YayC commented 9 years ago

Build 3065

TheSpyder commented 9 years ago

hmm, that build should definitely work. Can you describe a bit more about when you toggle the sidebar, and when it re-appears?

YayC commented 9 years ago

Yup, sorry for the lack of context. I close the sidebar with the default shortcut (command + k, command + b). When I switch to another tab, it reopens. I tried with the console open and sublime.log_commands(True), but no output there. When I disable sidebar syncing via command palette, the sidebar remains closed.

Not a big issue, as it's very easy to turn syncing on/off via command palette. If there was an actual "toggle" command, you could also remap the "toggle sidebar" shortcut to also toggle sidebar syncing (using the chain of command plugin).

TheSpyder commented 9 years ago

That might be the clue. When I set log_commands to true, and hide the sidebar (I also use the mac keyboard shortcut), I get:

command: toggle_side_bar

That is what the plugin uses to detect the sidebar has been hidden. The only time this doesn't work is when a window opens (e.g. when sublime first loads), the plugin has to assume the sidebar is visible as it can't query for that info.

majidfn commented 9 years ago

Another example is when you are in "Distraction Free Mode" and you have two files side by side. Clicking on each would bring up the sidebar. (SublimeText 2, Build#2221)

TheSpyder commented 9 years ago

I might be able to listen for when distraction mode is triggered, but I don't believe there is an API to query whether it is active.

Really, without a way to know for sure that the sidebar has been hidden everything this plugin does to avoid opening it is a blind guess.

majidfn commented 9 years ago

I think having it for "Distraction free mode" would be very good.

sammcj commented 9 years ago

I've been trying to figure this sucker out for a few days now, It's driving me insane - has anyone got any ideas how to prevent the sidebar from appearing when hidden with this plugin?

TheSpyder commented 9 years ago

If all else fails, there are commands to enable and disable the plugin. You can use that to turn it off temporarily.

I haven't tested it recently but it should also be possible to turn the plugin off for a single project using a config entry in the sublime project file.

unifreak commented 8 years ago

I'm using sublime text build 3065, still got the same problem.

unifreak commented 8 years ago

@YayConnolly can you teach me how to use chain of command to do so?

YayC commented 8 years ago

@UniFreak been a while, but in my Preferences: Key Bindings - User file I have this line for example:

{
  "keys": ["ctrl+l", "r"],
  "command": "chain",
  "args": {
    "commands": [
      ["rubocop_check_single_file"],
      ["hide_panel", {"cancel": true}]
    ]
  }
},
TheSpyder commented 8 years ago

There's a new build of Sublime 3 with an API to detect if the sidebar is visible :)

I'm testing an update to the plugin that uses this API instead of monitoring the toggle_side_bar command. Looks good so far. I'll release it in a few days if there are no problems.

unifreak commented 8 years ago

@TheSpyder please let use know if you applied the update. can't wait to see this bug fixed.

TheSpyder commented 8 years ago

Everything looks good so I'll probably release it tomorrow!

TheSpyder commented 8 years ago

I've just pushed the change. Please let me know if there are any problems :)

YayC commented 8 years ago

Works great! Thank you!