-
Notifications
You must be signed in to change notification settings - Fork 25
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
User-configurable whitespace #31
Conversation
var userColors = _preferences.get("colors"), | ||
template = _.template(stylesTemplate), | ||
css = template({ | ||
"whitespace": userColors.light.whitespace, |
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.
For whatever reason, this one key is not being rendered in both light and dark, but all the others work. I've checked the resulting CSS and it is all valid, so it's odd why it is not working.
@DennisKehrig (When you get back,) can you fill me in on why the stylesheet is added/removed to/from the DOM on extension toggle? Was there an historical reason for this or a design choice, and why? @MiguelCastillo Can you recommend a theme that styles the whitespace this extension creates so I can test if this PR will overwrite that styling? |
I don't know a theme that does it as it is generally not common to add classes defined by other extensions. But I can create one for you later this evening. |
Well what do you know? The Monokai theme styles the whitespace. I can use that for testing.Thanks anyway. :) |
Miguel, does the |
@MiguelCastillo Except for colors, this is ready to be merged. Could you perhaps do a code review soon, keeping in mind the following points?
No real rush, though I would like to get this in soon so @DennisKehrig can release whenever he gets back. :) |
Hey @larz0? I hate to ask you this, but I can't think of anyone else. Would you mind too terribly coming up with some complementary colors for the whitespace that match the built-in Brackets dark theme? There are only two colors: trailing whitespace (which is red in the light theme) and everything else (a light gray in light theme). :) |
@le717 OMG! dude I am really sorry, I saw this and somehow completely forgot to get back to you! I will take a look so that we can merge this :) |
@MiguelCastillo No problem man, I'm terribly busy myself lately. I'm just going back to my open PRs, trying to get them finished up so they don't go stale. :) |
Miguel, can you please take a look at this really soon? This really needs to be finished up so other pending changes and improvements can be made. :) |
@le717 sorry I missed this as well somehow. Looks good 👍 |
@@ -0,0 +1,4 @@ | |||
{ | |||
"spaceUnits": 4, |
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.
Should this file be checked in?
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.
I think I added this to help keep a basic consistent code style across the files. I'll probably pull it and submit a new PR with it and an equivalent .editorconfig file.
The code looks good. The only real question I have is around the asymmetry when you are registering/unregistering the event handler for themes properties. e.g. All else looks good to me. :) |
@larz0 Thanks! :) |
@MiguelCastillo All feedback addressed, per pending comments. :) I do have a problem with the listeners, and this is a not a new issue, but it is heightened with the new theme listeners. Despite the presence of the |
var CodeMirror = brackets.getModule("thirdparty/CodeMirror2/lib/codemirror"); | ||
var _ = brackets.getModule("thirdparty/lodash"), | ||
AppInit = brackets.getModule("utils/AppInit"), | ||
CodeMirror = brackets.getModule("thirdparty/CodeMirror2/lib/codemirror"), |
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.
CodeMirror is an unused variable. I don't know how I missed this one earlier ;)
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.
Huh. I thought it was still needed after dropping CM2. Removed.
|
function onCheckedStateChange() { | ||
_preferences.set("checked", Boolean(_command.getChecked())); | ||
function onCheckedStateChange(e) { | ||
_preferences.set("checked", e.target._checked); |
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 change seems odd... It seems like if there was a regression it would be due to a timing issue where command.getChecked() isn't set when the callback is invoked. Hopefully this will go away when your PR for updating the events is merged.
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 is what happens when you do late night coding. 😛 Found the real cause and reverted this.
The only concern I have is the regression:
Otherwise this is ready to be merged. |
Yeah man, the changes look great! |
compiled = template(_preferences.get("colors")); | ||
|
||
// Update the styling with the changes | ||
_styleInline.text(compiled); |
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 method is so much tighter! It looks great
All review changes and feedback read and addressed. If it still looks good, I'll flatten this and merge it right in! |
*/ | ||
function _applyColors() { | ||
// Compile the CSS from the template | ||
var template = _.template(stylesTemplate), |
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 can create this _.template
when the extension loads so that the template does not get parsed each time. This routine will basically become:
// Update the styling with the changes
_styleInline.text(template(_preferences.get("colors")));
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're catching everything, aren't you? :D
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.
Of course! I don't like half @ssing things :D
I must have not copied my last changes for testing, because with them, I'm getting an |
OK, forget that, suddenly it works. The final changes to |
Sweet, the code looks really clean :) I like it. And you are very welcome! :) |
Add user-configurable whitespace colors
nice work @le717 ! |
For #26. Adds a preference so whitespace can be recolored by the user. Supersedes #30.
Implementation preferences layout
Notes