Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

StatusBar.addIndicator() doesn't actually add the indicator #5682

Closed
njx opened this issue Oct 25, 2013 · 14 comments
Closed

StatusBar.addIndicator() doesn't actually add the indicator #5682

njx opened this issue Oct 25, 2013 · 14 comments
Assignees

Comments

@njx
Copy link

njx commented Oct 25, 2013

Originally, when StatusBar.addIndicator() was implemented, it would actually add the indicator into the status bar. However, in d7bce2c, that line was removed, which is a breaking API change. It's not clear why it was removed.

(Edited 12/14/2013 by @lkcampbell to add repro steps)

OS Version: Mac OSX Mavericks

Brackets Version: Sprint 34

Repro Steps:
Open Brackets source code, then open Dev Tools to Console and paste the following code snippet into the Console:

var StatusBar = require("widgets/StatusBar"),
    $foo = $("<div>FOO</div>");
StatusBar.addIndicator("foo", $foo, true, "", "foo tooltip");

Look at the right side of the editor status bar.

In the Dev Tools, Elements tab, look at the contents of status-indicators div tag.

Observed Result:
The FOO div does not show up in the status bar and is not in the status-indicators div tag

Expected Result:
The FOO div shows up in the status bar and is in the status-indicators div tag

@njx
Copy link
Author

njx commented Oct 25, 2013

@larz0 - do you know why you removed this?

@larz0
Copy link
Member

larz0 commented Oct 25, 2013

@njx I think it was because it was inserting something else that's not supposed to be there. I can't remember what though. Could it be related to JSLint indicator?

@larz0
Copy link
Member

larz0 commented Oct 25, 2013

@njx I put it back in on this branch https://github.com/adobe/brackets/tree/larz/issue-5682 and there are no visible changes.

@lkcampbell
Copy link
Contributor

Assigning this issue to myself to fix, I need resolved so I can address issue #5078.

@ghost ghost assigned lkcampbell Nov 6, 2013
@lkcampbell
Copy link
Contributor

@njx, question for you. What repro steps are we using to test it and make sure I fixed it? This is the second issue I have run into where I need to create test steps for a Brackets module and I have no idea how to do it.

Do you guys have some way to conduct a headless test on some specific piece of the Brackets API?

@lkcampbell
Copy link
Contributor

Edited the description to include repro steps.

@lkcampbell
Copy link
Contributor

@njx and @larz0 , this problem is caused by what @njx mentioned above: the $indicators.prepend($indicator); line was removed from StatusBar.addIndicator().

But I also discovered the reason why @larz0 pulled this code in the first place.

This is what the status bar indicators look like normally:

screen shot 2013-12-14 at 8 45 32 am

This is what the status bar indicators look like after inserting the prepend line again:

screen shot 2013-12-14 at 8 42 47 am

The problem is addIndicator() doesn't have a way to indicate relative position. The default behavior is to push indicators onto the right side. It is a little counterintuitive because children of the status-indicators div are drawn right to left. That is to say, the first child is drawn on the rightmost side and the last child in drawn on the leftmost side.

We must have some special code that sets the JSLint indicator position manually right now. Reactivating the default behavior of addIndicator() overrides it.

My question is, how do you want me to fix this problem? What is the expected behavior? If the JSLint indicator is to remain in the middle, I may have to add relative positioning to the addIndicator() method interface. Any other ideas?

@lkcampbell
Copy link
Contributor

@njx or @redmunds, Randy was asking about the status of the "Reload Without User Extensions" feature today. This issue is one of the blocking issues for the feature. I am looking for feedback from you regarding the best way to address this problem. Please see my questions above.

@njx
Copy link
Author

njx commented Dec 20, 2013

Sorry, forgot to follow up. A few thoughts:

  • I think it makes sense to add indicators from right-to-left, since these indicators are right-justified. So addIndicator() should add the new indicator to the left side of the group.
  • I'm okay adding a relative position to addIndicator() (e.g. by ID), though I think we should really only use this for our core features. Third-party extensions shouldn't care too much about where they get added.

@lkcampbell
Copy link
Contributor

@njx and @redmunds, fix committed.

@ghost ghost assigned njx Dec 27, 2013
@redmunds
Copy link
Contributor

FBNC back to @njx

@njx
Copy link
Author

njx commented Jan 9, 2014

Haven't tried it myself but the code looks sensible. Closing.

@njx njx closed this as completed Jan 9, 2014
@peterflynn
Copy link
Member

@lkcampbell @redmunds Do you think this is clean enough to be an official API for use by extensions now? If so, would one of you mind adding it to the release notes as a new API?

@redmunds
Copy link
Contributor

@peterflynn Done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants