Floobits / floobits-sublime

Floobits real-time collaboration plugin for Sublime Text 2 and 3
Apache License 2.0
294 stars 31 forks source link

Only set project data if it does not exist #234

Closed Yoplitein closed 8 years ago

Yoplitein commented 8 years ago

This fixes the (really ?%!#$%! annoying) behaviour of overwriting project data upon joining a workspace.

ggreer commented 8 years ago

The condition in your if statement will never be true, as even an empty window has a folders attribute on project_data.

I don't want to sound dismissive, but is your computer really slow or something? That's the only way an existing window's project data could be overwritten. If you look at the surrounding code, you'll see the steps are:

  1. Try to find find an existing window with the workspace directory already open.
  2. If that fails, try to find an existing window that is empty (no project data).
  3. If that fails, open a new window.
  4. Wait up to 500ms for the new window to open. (Sublime Text has no API that lets a plugin know when the new_window command completes.)
  5. If after 500ms, no empty window can be found, just use the active window.

I'll change this code so that it inserts the path instead of stomping over all project data. That should give you the desired behavior. Sorry for the frustration caused.

Yoplitein commented 8 years ago

Empty windows do in fact have no project data, at least under ST3 on Windows.

Project data is only overwritten when joining an existing workspace, with the workspace's project open. Otherwise it opens a new window and creates a new project in memory.

ggreer commented 8 years ago

OK, master should be fixed. I'm going to test this a little more before tagging a release. Please let me know if that fixes your problem.

Yoplitein commented 8 years ago

Yep, that fixes it. Thanks!

ggreer commented 8 years ago

OK. I've tagged a new release: 3.5.2. Thanks for reporting this.

Yoplitein commented 8 years ago

214 could also probably be closed now.