-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Move descriptions to their preferences #11201
Conversation
@@ -39,7 +39,16 @@ define(function (require, exports, module) { | |||
Strings = brackets.getModule("strings"), | |||
ThemeManager = brackets.getModule("view/ThemeManager"), | |||
_ = brackets.getModule("thirdparty/lodash"), | |||
data = JSON.parse(require("text!data.json")), | |||
data = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add a comment stating what this data is used for.
Fixes part of #11200 |
prefs.definePreference(PREF_PREFER_PROVIDERS, "array", []); | ||
prefs.definePreference(PREF_PREFER_PROVIDERS, "array", [], { | ||
description: Strings.DESCRIPTION_LINTING_PREFER, | ||
values: ["JSLint", "JSHint"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not specify value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could autocomplete with the registered linters? That would be cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it could be done, I guess. My point, though, it should not have default in the property definition (there's no default for this pref).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will add that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear: what I am asking you to do is to remove line 617. Hinting on registered plugins is not necessarily needed for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could just go ahead and remove this line (and also squash commits if you like), I could merge this PR in.
48ebb5c
to
c7fd590
Compare
@abose @marcelgerber I think it is ready for merging in. |
ae95113
to
79e0895
Compare
* Returns an array of the IDs of providers registered for a specific language | ||
* | ||
* @param {!string} languageId | ||
* @return {Array.<string>} Names of registered providers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be {?Array.<string>}
.
Or maybe it should return an empty array on the null case.
79e0895
to
9eed7fe
Compare
|
||
PreferencesManager.definePreference("codehint.TagHints", "boolean", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is codehint.TagHints
is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still there, I added description to it.
d382851
to
52d1ed2
Compare
_ = brackets.getModule("thirdparty/lodash"), | ||
data = JSON.parse(require("text!data.json")), | ||
languages = LanguageManager.getLanguages(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also listen to the LanguageManager events languageAdded and languageModified (?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do the same for the list of themes by listening to ExtensionManagers' statusChange event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statusChange
gets fired every time an extension gets loaded. We would need an event that is fired only when an extension gets installed/uninstalled, so we can update our preferences data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it makes a big difference to have this once instead of calling it when getting the list of hints?
You are already doing it for the code hint providers. So I think we can do something similar for both languages and themes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can check if the AppInit.appReady
has been called, after that we can update our preferences, theme data on each statusChange
event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, all extensions are loaded after appReady has been called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the ones you install after that, we need another event for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcelgerber I gave this a shot but since statusChange
event is fired before the theme gets registered, ThemeManager.getAllThemes()
still provides the old list of themes. But it works for getting code hints from newly installed extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcelgerber @TomMalbran Theme hints are not cached anymore, that should fix the issue of themes. Languages will still use languageAdded
event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sprintr I still don't see the point of having a cache of something that could be grabbed at the point of getting the hints like it is done with the code hint providers. getLanguages
copies the object, but since you will have to iterate through the list eventually to create the ui, should be fine to get them on getHints
when you actually need them. And the same goes for the themes, and maybe even the preferences. Seems easier than keeping a copy that needs to be synched.
9443b60
to
e105c29
Compare
function getProviderIDsForLanguage(languageId) { | ||
if (!_providers[languageId]) { | ||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcelgerber It now returns empty array.
147a1e8
to
2917141
Compare
Merging. Thanks @sprintr. |
Move descriptions to their preferences
@sprintr the jasmine unit tests suite is failing after this PR merge commit. with the following error |
@abose Debugging this right now. Seems a tricky one. |
Thanks @sprintr for the fix. |
@abose I'm sorry. I've looked through all the changes and, well, I didn't expect unit test failures as all this PR changed is the added descriptions and one newly added function. |
@marcelgerber No probs :) We also used to do the same thing until we noticed that in some cases even minor changes could sometimes cause a ripple. So just stuck to doing the basic smokes just before merge. |
All the descriptions of the preferences have been moved to their preferences and we no longer have
data.json
😄