New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preferences Code Hints #11130

Merged
merged 10 commits into from Jun 2, 2015

Conversation

Projects
None yet
9 participants
@sprintr
Contributor

sprintr commented May 16, 2015

This PR implements code hints for the preferences we use in brackets. Additionally it also shows a little description of the active preference to the user.

prefrence

CC:
@redmunds @ryanstewart @MiguelCastillo

@sprintr sprintr changed the title from ] to [Review Only] Preferences Code Hints May 16, 2015

@rroshan1

This comment has been minimized.

Show comment
Hide comment
@rroshan1

rroshan1 May 17, 2015

Contributor

Glad to see it ready!! 😃

Contributor

rroshan1 commented May 17, 2015

Glad to see it ready!! 😃

@petetnt

This comment has been minimized.

Show comment
Hide comment
@petetnt

petetnt May 19, 2015

Collaborator

This is pretty awesome 👍

The data.json and it's description field should be localization/internationalization-enabled and it would be nice if extensions could extend that (most likely by adding an optional description-value for PreferencesManager.definePreference)

PreferencesManager.definePreference("some.preferenceHere", "boolean", true, Strings.some.preferenceHere.description);

edit: Actually, going with the PreferencesManager.definePreference route and baking the values into src/nls/lang/Strings.js would make localization and updating extensions to support PrefsCodeHints a breeze. If the PreferenceManager supplies the descriptions and types, data.json wouldn't be needed at all provided that the descriptions would be added to all the built-in definePreferences.

edit 2: CodeFolding already does this but it's not visibile to UI so the variables are just in the Prefs.js

var ProjectManager = brackets.getModule("project/ProjectManager"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
prefs = PreferencesManager.getExtensionPrefs("code-folding"),
FOLDS_PREF_KEY = "code-folding.folds",
// preference key strings are here for now since they are not used in any UI
ENABLE_CODE_FOLDING = "Enable code folding",
MIN_FOLD_SIZE = "Minimum fold size",
MIN_FOLD_SIZE_HELP = "Minimum number of lines to allow in a foldable range",
SAVE_FOLD_STATES = "Save fold states",
SAVE_FOLD_STATES_HELP = "Save fold states to disk when editor is closed and restore the folds when reopened",
ALWAYS_USE_INDENT_FOLD = "Always use indent fold",
ALWAYS_USE_INDENT_FOLD_HELP = "Fall back to using level of indentation as a folding guideline if no range finder is found for the current mode.",
HIDE_FOLD_BUTTONS = "Hide fold triangles",
HIDE_FOLD_BUTTONS_HELP = "Hide fold triangles unless the mouse is over the gutter",
MAX_FOLD_LEVEL = "Max fold level",
MAX_FOLD_LEVEL_HELP = "Used to limit the number of nested folds to find and collapse when View -> Collapse All is called or Alt is held down when collapsing. Should improve performance for large files.";
//default preference values
prefs.definePreference("enabled", "boolean", true,
{name: ENABLE_CODE_FOLDING, description: ENABLE_CODE_FOLDING});
prefs.definePreference("minFoldSize", "number", 2,
{name: MIN_FOLD_SIZE, description: MIN_FOLD_SIZE_HELP});
prefs.definePreference("saveFoldStates", "boolean", true,
{name: SAVE_FOLD_STATES, description: SAVE_FOLD_STATES_HELP});
prefs.definePreference("alwaysUseIndentFold", "boolean", false,
{name: ALWAYS_USE_INDENT_FOLD, description: ALWAYS_USE_INDENT_FOLD_HELP});
prefs.definePreference("hideUntilMouseover", "boolean", false,
{name: HIDE_FOLD_BUTTONS, description: HIDE_FOLD_BUTTONS_HELP});
prefs.definePreference("maxFoldLevel", "number", 2,
{name: MAX_FOLD_LEVEL, description: MAX_FOLD_LEVEL_HELP});

Collaborator

petetnt commented May 19, 2015

This is pretty awesome 👍

The data.json and it's description field should be localization/internationalization-enabled and it would be nice if extensions could extend that (most likely by adding an optional description-value for PreferencesManager.definePreference)

PreferencesManager.definePreference("some.preferenceHere", "boolean", true, Strings.some.preferenceHere.description);

edit: Actually, going with the PreferencesManager.definePreference route and baking the values into src/nls/lang/Strings.js would make localization and updating extensions to support PrefsCodeHints a breeze. If the PreferenceManager supplies the descriptions and types, data.json wouldn't be needed at all provided that the descriptions would be added to all the built-in definePreferences.

edit 2: CodeFolding already does this but it's not visibile to UI so the variables are just in the Prefs.js

var ProjectManager = brackets.getModule("project/ProjectManager"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
prefs = PreferencesManager.getExtensionPrefs("code-folding"),
FOLDS_PREF_KEY = "code-folding.folds",
// preference key strings are here for now since they are not used in any UI
ENABLE_CODE_FOLDING = "Enable code folding",
MIN_FOLD_SIZE = "Minimum fold size",
MIN_FOLD_SIZE_HELP = "Minimum number of lines to allow in a foldable range",
SAVE_FOLD_STATES = "Save fold states",
SAVE_FOLD_STATES_HELP = "Save fold states to disk when editor is closed and restore the folds when reopened",
ALWAYS_USE_INDENT_FOLD = "Always use indent fold",
ALWAYS_USE_INDENT_FOLD_HELP = "Fall back to using level of indentation as a folding guideline if no range finder is found for the current mode.",
HIDE_FOLD_BUTTONS = "Hide fold triangles",
HIDE_FOLD_BUTTONS_HELP = "Hide fold triangles unless the mouse is over the gutter",
MAX_FOLD_LEVEL = "Max fold level",
MAX_FOLD_LEVEL_HELP = "Used to limit the number of nested folds to find and collapse when View -> Collapse All is called or Alt is held down when collapsing. Should improve performance for large files.";
//default preference values
prefs.definePreference("enabled", "boolean", true,
{name: ENABLE_CODE_FOLDING, description: ENABLE_CODE_FOLDING});
prefs.definePreference("minFoldSize", "number", 2,
{name: MIN_FOLD_SIZE, description: MIN_FOLD_SIZE_HELP});
prefs.definePreference("saveFoldStates", "boolean", true,
{name: SAVE_FOLD_STATES, description: SAVE_FOLD_STATES_HELP});
prefs.definePreference("alwaysUseIndentFold", "boolean", false,
{name: ALWAYS_USE_INDENT_FOLD, description: ALWAYS_USE_INDENT_FOLD_HELP});
prefs.definePreference("hideUntilMouseover", "boolean", false,
{name: HIDE_FOLD_BUTTONS, description: HIDE_FOLD_BUTTONS_HELP});
prefs.definePreference("maxFoldLevel", "number", 2,
{name: MAX_FOLD_LEVEL, description: MAX_FOLD_LEVEL_HELP});

});
it("should detect an array", function () {
// After [
ctxInfo = JSONUtils.getContextInfo(testEditor, {line: 24, ch: 23});

This comment has been minimized.

@abose

abose May 19, 2015

Contributor

refactoring candidate with a for loop.

@abose

abose May 19, 2015

Contributor

refactoring candidate with a for loop.

This comment has been minimized.

@abose

abose May 19, 2015

Contributor

Cancel that, i see that this is just a test file 👍

@abose

abose May 19, 2015

Contributor

Cancel that, i see that this is just a test file 👍

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose May 19, 2015

Contributor

+1
@sprintr Why is this marked as review only?

Contributor

abose commented May 19, 2015

+1
@sprintr Why is this marked as review only?

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 19, 2015

Contributor

@abose Wanted to get some input on this so I marked it review only.

@petetnt Going to add i18n support today. Some preferences have got their own UI, so we don't want to have each and every pref in the code hints. I was thinking about providing an API to extension devs, so they can plug in their hints. Something like PreferencesManager.setHints() and PreferencesManager.getHints() should do the job.

As far as the core brackets preferences, we should use data.json, so translators (who are encouraged to commit on the web) can easily translate descriptions in a single file.

@rroshan1 Glad you liked it. :)

Contributor

sprintr commented May 19, 2015

@abose Wanted to get some input on this so I marked it review only.

@petetnt Going to add i18n support today. Some preferences have got their own UI, so we don't want to have each and every pref in the code hints. I was thinking about providing an API to extension devs, so they can plug in their hints. Something like PreferencesManager.setHints() and PreferencesManager.getHints() should do the job.

As far as the core brackets preferences, we should use data.json, so translators (who are encouraged to commit on the web) can easily translate descriptions in a single file.

@rroshan1 Glad you liked it. :)

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 24, 2015

Contributor

Added internationalization support, moved all the descriptions to nls/root/strings.js

Contributor

sprintr commented May 24, 2015

Added internationalization support, moved all the descriptions to nls/root/strings.js

@MarcelGerber

This comment has been minimized.

Show comment
Hide comment
@MarcelGerber

MarcelGerber May 25, 2015

Contributor

I'm not too set about adding all these strings to the core nls file, as it's quite a lot of new strings.
Maybe we should consider creating another nls file for this?

Contributor

MarcelGerber commented May 25, 2015

I'm not too set about adding all these strings to the core nls file, as it's quite a lot of new strings.
Maybe we should consider creating another nls file for this?

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 25, 2015

Contributor

@MarcelGerber We can also move it to its own strings.js file. I didn't see any other core extension doing it.

Contributor

sprintr commented May 25, 2015

@MarcelGerber We can also move it to its own strings.js file. I didn't see any other core extension doing it.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose May 25, 2015

Contributor

I think it would be ok; if not easier to manage in the core file itself. adding js translation files for separate features would eventually decrease the maintainability of translations[as i saw in several other large projects]. For instance you would have to search over several files to find a string const; but with just one file, they are generally easy to locate; also people would need to go through several files to see if some strings changed to figure out translations.

Contributor

abose commented May 25, 2015

I think it would be ok; if not easier to manage in the core file itself. adding js translation files for separate features would eventually decrease the maintainability of translations[as i saw in several other large projects]. For instance you would have to search over several files to find a string const; but with just one file, they are generally easy to locate; also people would need to go through several files to see if some strings changed to figure out translations.

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 26, 2015

Contributor
  • Added a new API PreferencesManager.getAllPreferences to return all the preferences defined.
  • Added support for preference hinting by third-party extensions using the preferences they have defined. Here is a tiny extension to demonstrate how it can be done.

@abose Is there anything else remaining to cover in this PR?

Contributor

sprintr commented May 26, 2015

  • Added a new API PreferencesManager.getAllPreferences to return all the preferences defined.
  • Added support for preference hinting by third-party extensions using the preferences they have defined. Here is a tiny extension to demonstrate how it can be done.

@abose Is there anything else remaining to cover in this PR?

@petetnt

This comment has been minimized.

Show comment
Hide comment
@petetnt

petetnt May 26, 2015

Collaborator

Nice 👍

Collaborator

petetnt commented May 26, 2015

Nice 👍

Show outdated Hide outdated src/preferences/PreferencesBase.js
* @return {Object}
*/
getAllPreferences: function () {
return $.extend(true, {}, this._knownPrefs);

This comment has been minimized.

@TomMalbran

TomMalbran May 26, 2015

Contributor

Instead of $.extend for cloning you can use _.clone and _.cloneDeep from lowdash which is already included in the core.

@TomMalbran

TomMalbran May 26, 2015

Contributor

Instead of $.extend for cloning you can use _.clone and _.cloneDeep from lowdash which is already included in the core.

keys = data;
}
hints = $.map(Object.keys(keys), function (key) {

This comment has been minimized.

@TomMalbran

TomMalbran May 26, 2015

Contributor

You could just use Object.keys(keys).map(function (key) { ... })

@TomMalbran

TomMalbran May 26, 2015

Contributor

You could just use Object.keys(keys).map(function (key) { ... })

This comment has been minimized.

@sprintr

sprintr May 27, 2015

Contributor

Array.prototype.map will return undefined if it doesn't match. A possible workaround would be to use a Array.prototype.filter on the array returned by map to exclude undefined. $.map works fine for this scenario.

@sprintr

sprintr May 27, 2015

Contributor

Array.prototype.map will return undefined if it doesn't match. A possible workaround would be to use a Array.prototype.filter on the array returned by map to exclude undefined. $.map works fine for this scenario.

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 27, 2015

Contributor

@abose Can you give this PR a review.

Contributor

sprintr commented May 27, 2015

@abose Can you give this PR a review.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose May 27, 2015

Contributor

@sprintr will do some test with the changes and update by tomorrow 👍
Also if you feel that this PR is good to go, You could remove the [review only] tag .

Contributor

abose commented May 27, 2015

@sprintr will do some test with the changes and update by tomorrow 👍
Also if you feel that this PR is good to go, You could remove the [review only] tag .

@sprintr sprintr changed the title from [Review Only] Preferences Code Hints to Preferences Code Hints May 27, 2015

@@ -0,0 +1,573 @@
/*

This comment has been minimized.

@abose

abose May 28, 2015

Contributor

Could this file be moved to the /test/ folder?

@abose

abose May 28, 2015

Contributor

Could this file be moved to the /test/ folder?

This comment has been minimized.

@sprintr

sprintr May 28, 2015

Contributor

This is a standard practice that most of the core extensions do.

@sprintr

sprintr May 28, 2015

Contributor

This is a standard practice that most of the core extensions do.

StringMatch.basicMatchSort(hints);
return hints.map(function (token) {
var $hintItem = $("<span>").addClass("brackets-pref-hints"),

This comment has been minimized.

@abose

abose May 28, 2015

Contributor

codehints
The width of the selection keeps jumping; Would it be possible to fix the width and wrap the hint description. Maybe with and some css with display: block; visibility: visible/hidden; white-space: pre-wrap;

@abose

abose May 28, 2015

Contributor

codehints
The width of the selection keeps jumping; Would it be possible to fix the width and wrap the hint description. Maybe with and some css with display: block; visibility: visible/hidden; white-space: pre-wrap;

Show outdated Hide outdated src/extensions/default/PrefsCodeHints/main.js
];
// Define a preference for code hinting.
PreferencesManager.definePreference("codehint.PrefHints", "boolean", true);

This comment has been minimized.

@abose

abose May 28, 2015

Contributor

How about adding one more argument to the definePreference API and (maybe the last parameter as description/ object with possible values for the prefs) and then raise a preferences- code hints missing warning if the last parameter is missing - so that extension devs can directly incorporate code hints to their preferences?

@abose

abose May 28, 2015

Contributor

How about adding one more argument to the definePreference API and (maybe the last parameter as description/ object with possible values for the prefs) and then raise a preferences- code hints missing warning if the last parameter is missing - so that extension devs can directly incorporate code hints to their preferences?

This comment has been minimized.

@sprintr

sprintr May 28, 2015

Contributor

The last (forth) parameter is optional, we can ping extension authors about incorporating their hints if they want to.

@sprintr

sprintr May 28, 2015

Contributor

The last (forth) parameter is optional, we can ping extension authors about incorporating their hints if they want to.

This comment has been minimized.

@sprintr

sprintr May 28, 2015

Contributor

We also don't want to have all the preferences in code hints, because some of the preferences are managed from UI.

@sprintr

sprintr May 28, 2015

Contributor

We also don't want to have all the preferences in code hints, because some of the preferences are managed from UI.

This comment has been minimized.

@redmunds

redmunds May 28, 2015

Contributor

We also don't want to have all the preferences in code hints, because some of the preferences are managed from UI.

Some people prefer to edit preferences manually, so I think all preferences should be in code hints. Also, it's tricky to set a UI managed preference when it's language or path specific, so that's another case for manually editing preferences that have GUI controls.

@redmunds

redmunds May 28, 2015

Contributor

We also don't want to have all the preferences in code hints, because some of the preferences are managed from UI.

Some people prefer to edit preferences manually, so I think all preferences should be in code hints. Also, it's tricky to set a UI managed preference when it's language or path specific, so that's another case for manually editing preferences that have GUI controls.

This comment has been minimized.

@sprintr

sprintr May 28, 2015

Contributor

Preferences related to themes and fonts don't work if changed via brackets.json which is why they don't appear in code hints.

Edit: They do work when changed from UI.

@sprintr

sprintr May 28, 2015

Contributor

Preferences related to themes and fonts don't work if changed via brackets.json which is why they don't appear in code hints.

Edit: They do work when changed from UI.

@nethip

This comment has been minimized.

Show comment
Hide comment
@nethip

nethip May 28, 2015

Contributor

@sprintr Thanks for putting up this PR 👍 Really appreciate it!

I had a small suggestion. I think right now one has to manually go about editing the json file to make sure the preference name, along with its values kind of popup in code hints, while editing the preference file. How about adding another parameter to PreferencesManager.definePreference() that would take the list of preference values, along with the description, as an optional value.

This way extension writers can make sure their extension's preference names and values popup in the code hint.

Also we need to clearly document what needs to be done, going forward, to create a new preference in Brackets core. I was thinking if we can automate the job, but I might sound crazy 😼

Contributor

nethip commented May 28, 2015

@sprintr Thanks for putting up this PR 👍 Really appreciate it!

I had a small suggestion. I think right now one has to manually go about editing the json file to make sure the preference name, along with its values kind of popup in code hints, while editing the preference file. How about adding another parameter to PreferencesManager.definePreference() that would take the list of preference values, along with the description, as an optional value.

This way extension writers can make sure their extension's preference names and values popup in the code hint.

Also we need to clearly document what needs to be done, going forward, to create a new preference in Brackets core. I was thinking if we can automate the job, but I might sound crazy 😼

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 28, 2015

Contributor

@nethip I wrote a tiny extension to demonstrate how extension authors can plugin their hints. Just modified PreferencesManager.definePreference.

Contributor

sprintr commented May 28, 2015

@nethip I wrote a tiny extension to demonstrate how extension authors can plugin their hints. Just modified PreferencesManager.definePreference.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose May 29, 2015

Contributor

@sprintr
250px works very well now :)
I still think that all the preferences that can be configured using the preferences file can be hinted. Maybe we could specify in the wiki or in the hints itself that some preferences need a relaunch of brackets to take effect.

Contributor

abose commented May 29, 2015

@sprintr
250px works very well now :)
I still think that all the preferences that can be configured using the preferences file can be hinted. Maybe we could specify in the wiki or in the hints itself that some preferences need a relaunch of brackets to take effect.

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 29, 2015

Contributor

@abose I am going to do two things tomorrow.

  1. Allow all the preferences in code hints.
  2. Move the descriptions of preferences to the files where they are defined. So we won't need updating data.json with new prefs in future.
Contributor

sprintr commented May 29, 2015

@abose I am going to do two things tomorrow.

  1. Allow all the preferences in code hints.
  2. Move the descriptions of preferences to the files where they are defined. So we won't need updating data.json with new prefs in future.
@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose May 30, 2015

Contributor

+1 :)
But that would result in a major rewrite of this pr i guess ..

Contributor

abose commented May 30, 2015

+1 :)
But that would result in a major rewrite of this pr i guess ..

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr May 30, 2015

Contributor
  1. Each and every preference defined is now available through code hints.
  2. Added src/extensions/default/PrefCodeHints/unittest-files/preferences.json which carries a few preferences to run unit tests against. This approach will allow us not to break unit tests if we add new preferences in the future.
  3. The descriptions of all the defined preferences have now been moved to where they are defined.
  4. The descriptions of preferences that are not defined still lies in data.json.
  5. The code hints won't jump to different width if a code hint doesn't have description.
  6. The value of a value token will be replaced if the very next token is a value token.

@abose Rebased it against master. If it looks good to you then you can proceed to merge it.

Contributor

sprintr commented May 30, 2015

  1. Each and every preference defined is now available through code hints.
  2. Added src/extensions/default/PrefCodeHints/unittest-files/preferences.json which carries a few preferences to run unit tests against. This approach will allow us not to break unit tests if we add new preferences in the future.
  3. The descriptions of all the defined preferences have now been moved to where they are defined.
  4. The descriptions of preferences that are not defined still lies in data.json.
  5. The code hints won't jump to different width if a code hint doesn't have description.
  6. The value of a value token will be replaced if the very next token is a value token.

@abose Rebased it against master. If it looks good to you then you can proceed to merge it.

@MarcelGerber

This comment has been minimized.

Show comment
Hide comment
@MarcelGerber

MarcelGerber May 31, 2015

Contributor

I have one extension whose preference name is so long that a horizontal scrollbar is shown.
The horizontal scrollbar now covers the info text:
image

Contributor

MarcelGerber commented May 31, 2015

I have one extension whose preference name is so long that a horizontal scrollbar is shown.
The horizontal scrollbar now covers the info text:
image

prefs.definePreference("theme", "string", defaults.theme);
prefs.definePreference("themeScrollbars", "boolean", defaults.themeScrollbars);
prefs.definePreference("theme", "string", defaults.theme, {
description: Strings.DESCRIPTION_THEME

This comment has been minimized.

@MarcelGerber

MarcelGerber May 31, 2015

Contributor

For some reason, this pref doesn't show up for me.

@MarcelGerber

MarcelGerber May 31, 2015

Contributor

For some reason, this pref doesn't show up for me.

This comment has been minimized.

@MarcelGerber

MarcelGerber Jun 1, 2015

Contributor

Sorry, my fault. It does show up.

@MarcelGerber

MarcelGerber Jun 1, 2015

Contributor

Sorry, my fault. It does show up.

@@ -437,7 +438,9 @@ define(function (require, exports, module) {
}
if (brackets.platform === "win" && !brackets.inBrowser) {
PreferencesManager.definePreference("_windowsScrollFix", "boolean", true).on("change", enableOrDisableWinScrollFix);
PreferencesManager.definePreference("_windowsScrollFix", "boolean", true, {

This comment has been minimized.

@MarcelGerber

MarcelGerber May 31, 2015

Contributor

Is there some way to exclude a preference?
This is more or less a "hidden" preference that no one should ever need to change himself (and it will also go away at some point), so I'd appreciate it if this pref wasn't shown.
It wouldn't be much of an issue normally, but right now, this pref is the first to show up in the list...

@MarcelGerber

MarcelGerber May 31, 2015

Contributor

Is there some way to exclude a preference?
This is more or less a "hidden" preference that no one should ever need to change himself (and it will also go away at some point), so I'd appreciate it if this pref wasn't shown.
It wouldn't be much of an issue normally, but right now, this pref is the first to show up in the list...

This comment has been minimized.

@abose

abose Jun 1, 2015

Contributor

Exclude certain preferences from code hints: will add an issue to track this after this is merged.

@abose

abose Jun 1, 2015

Contributor

Exclude certain preferences from code hints: will add an issue to track this after this is merged.

Show outdated Hide outdated src/extensions/default/PrefsCodeHints/styles/brackets-prefs-hints.css
.brackets-pref-hints .hint-obj {
display: inline-block;
width: 250px;

This comment has been minimized.

@abose

abose Jun 1, 2015

Contributor

Changing this to min-width 300px and the below width to 300px could be a solution to the horizontal scrollbar problem.

@abose

abose Jun 1, 2015

Contributor

Changing this to min-width 300px and the below width to 300px could be a solution to the horizontal scrollbar problem.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose Jun 1, 2015

Contributor

@sprintr works very well now 👍 .will merge this today after the horizontal scrollbar merge is in.

Contributor

abose commented Jun 1, 2015

@sprintr works very well now 👍 .will merge this today after the horizontal scrollbar merge is in.

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr Jun 1, 2015

Contributor

@abose We should wait until #11195 get merged since that seems to be a nice way to do it. I'll add marquee effect to hints exceeding limits and functionality to exclude hints. Have to remove few merge conflicts too.

Contributor

sprintr commented Jun 1, 2015

@abose We should wait until #11195 get merged since that seems to be a nice way to do it. I'll add marquee effect to hints exceeding limits and functionality to exclude hints. Have to remove few merge conflicts too.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose Jun 2, 2015

Contributor

@sprintr Right now the scroll-bar fix truncates long code hints. Instead of truncating, if we change the css for .brackets-pref-hints .hint-obj from width: 250px; to min-width 250px ; Then instead of truncating the hint; the popup will take the size of the largest preference variable. The hint description will be wrapped at 250px. This would avoid any truncation and also resolve the layout problems. I think this might be more suited than truncating variable names.

Contributor

abose commented Jun 2, 2015

@sprintr Right now the scroll-bar fix truncates long code hints. Instead of truncating, if we change the css for .brackets-pref-hints .hint-obj from width: 250px; to min-width 250px ; Then instead of truncating the hint; the popup will take the size of the largest preference variable. The hint description will be wrapped at 250px. This would avoid any truncation and also resolve the layout problems. I think this might be more suited than truncating variable names.

@MarcelGerber

This comment has been minimized.

Show comment
Hide comment
@MarcelGerber

MarcelGerber Jun 2, 2015

Contributor

@sprintr LanguageManager actually defines its preferences, so you can modify the code there instead of including them in data.json:

pm.definePreference(_EXTENSION_MAP_PREF, "object", {}).on("change", function () {
_updateFromPrefs(_EXTENSION_MAP_PREF);
});
pm.definePreference(_NAME_MAP_PREF, "object", {}).on("change", function () {
_updateFromPrefs(_NAME_MAP_PREF);
});

With #11197, pretty much all preferences (except the meta language and path) will be defined.

Contributor

MarcelGerber commented Jun 2, 2015

@sprintr LanguageManager actually defines its preferences, so you can modify the code there instead of including them in data.json:

pm.definePreference(_EXTENSION_MAP_PREF, "object", {}).on("change", function () {
_updateFromPrefs(_EXTENSION_MAP_PREF);
});
pm.definePreference(_NAME_MAP_PREF, "object", {}).on("change", function () {
_updateFromPrefs(_NAME_MAP_PREF);
});

With #11197, pretty much all preferences (except the meta language and path) will be defined.

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr Jun 2, 2015

Contributor

@MarcelGerber You can now check marquee and exclusion of code hints. for exclusion add exclude: true in the options.

@abose We now have a marquee animation to show code hints longer than the box.

Contributor

sprintr commented Jun 2, 2015

@MarcelGerber You can now check marquee and exclusion of code hints. for exclusion add exclude: true in the options.

@abose We now have a marquee animation to show code hints longer than the box.

@MarcelGerber

This comment has been minimized.

Show comment
Hide comment
@MarcelGerber

MarcelGerber Jun 2, 2015

Contributor

Very nice! I also love the marquee effect

Contributor

MarcelGerber commented Jun 2, 2015

Very nice! I also love the marquee effect

Show outdated Hide outdated src/extensions/default/PrefsCodeHints/main.js
preference;
Object.keys(preferences).forEach(function (pref) {
preference = preferences[pref];
if (preference.excluded) {

This comment has been minimized.

@MarcelGerber

MarcelGerber Jun 2, 2015

Contributor

Maybe something more distinct, like excludeFromHints?

@MarcelGerber

MarcelGerber Jun 2, 2015

Contributor

Maybe something more distinct, like excludeFromHints?

Show outdated Hide outdated src/brackets.js
@@ -437,7 +438,9 @@ define(function (require, exports, module) {
}
if (brackets.platform === "win" && !brackets.inBrowser) {
PreferencesManager.definePreference("_windowsScrollFix", "boolean", true).on("change", enableOrDisableWinScrollFix);
PreferencesManager.definePreference("_windowsScrollFix", "boolean", true, {
description: Strings.DESCRIPTION_WINDOW_SCROLL_FIX

This comment has been minimized.

@MarcelGerber

MarcelGerber Jun 2, 2015

Contributor

You could just exclude that pref (and remove the corresponding string) 👍

@MarcelGerber

MarcelGerber Jun 2, 2015

Contributor

You could just exclude that pref (and remove the corresponding string) 👍

This comment has been minimized.

@sprintr

sprintr Jun 2, 2015

Contributor

@MarcelGerber Cool. I'll do that. There is another pref that is not being used defaultExtension, we can exclude that one too.

@sprintr

sprintr Jun 2, 2015

Contributor

@MarcelGerber Cool. I'll do that. There is another pref that is not being used defaultExtension, we can exclude that one too.

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr Jun 2, 2015

Contributor

@MarcelGerber Removed the width of hint object and it seems we don't need marquee anymore. Can you check it.

Contributor

sprintr commented Jun 2, 2015

@MarcelGerber Removed the width of hint object and it seems we don't need marquee anymore. Can you check it.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose Jun 2, 2015

Contributor

@sprintr some width jumps are there with just width. If you change it to min-width it will work i think .

Contributor

abose commented Jun 2, 2015

@sprintr some width jumps are there with just width. If you change it to min-width it will work i think .

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr Jun 2, 2015

Contributor

@abose Yeah, it works that way. It only happens where no description is available.

Contributor

sprintr commented Jun 2, 2015

@abose Yeah, it works that way. It only happens where no description is available.

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose Jun 2, 2015

Contributor

Verified. All unit tests passing. Merging.

Contributor

abose commented Jun 2, 2015

Verified. All unit tests passing. Merging.

abose added a commit that referenced this pull request Jun 2, 2015

@abose abose merged commit 0b17978 into adobe:master Jun 2, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose Jun 2, 2015

Contributor

@sprintr Thanks for this awesome contribution 🎉

Contributor

abose commented Jun 2, 2015

@sprintr Thanks for this awesome contribution 🎉

@sprintr

This comment has been minimized.

Show comment
Hide comment
@sprintr

sprintr Jun 2, 2015

Contributor

@abose Awesome!

Contributor

sprintr commented Jun 2, 2015

@abose Awesome!

@sprintr sprintr deleted the sprintr:pref-code-hints branch Jun 2, 2015

@busykai

This comment has been minimized.

Show comment
Hide comment
@busykai

busykai Jun 2, 2015

Contributor

@sprintr, great! this is really helpful!

Contributor

busykai commented Jun 2, 2015

@sprintr, great! this is really helpful!

@nethip

This comment has been minimized.

Show comment
Hide comment
@nethip

nethip Jun 8, 2015

Contributor

Great collaboration work on this PR! @sprintr @abose Does it make sense to update our existing documentation with the updated usage of definePreference() and also share this as an example?

Contributor

nethip commented Jun 8, 2015

Great collaboration work on this PR! @sprintr @abose Does it make sense to update our existing documentation with the updated usage of definePreference() and also share this as an example?

@abose

This comment has been minimized.

Show comment
Hide comment
@abose

abose Jun 9, 2015

Contributor

Issue #11200 tracks the doc changes required and hints for the new preferences API
@ryanstewart is reviewing the code hints being shown for preferences.

Contributor

abose commented Jun 9, 2015

Issue #11200 tracks the doc changes required and hints for the new preferences API
@ryanstewart is reviewing the code hints being shown for preferences.

@nethip

This comment has been minimized.

Show comment
Hide comment
@nethip

nethip Jun 10, 2015

Contributor

🆒

Contributor

nethip commented Jun 10, 2015

🆒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment