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

Themes in Brackets core #7616

Closed
wants to merge 82 commits into from
Closed

Themes in Brackets core #7616

wants to merge 82 commits into from

Conversation

MiguelCastillo
Copy link
Contributor

Initial commit. A few items remain to be done, but themes are now fully functional as a core component so you can start testing this out.

https://github.com/adobe/brackets/wiki/Themes

  • ThemeManager goes into core.
  • ExtensionLoader has special logic for themes extensions that don’t have JS
  • Settings pared down to just your “General” screen
  • All of the other loading/scanning code can go away
  • Use jQuery promises, sorry :*(
  • Settings screen should not use Knockout
  • Use new prefs API
  • Unit tests for theme loading and the customizations (scrollbars, etc.)

@dangoor dangoor changed the title Themes in Brackets core (REVIEW ONLY) Themes in Brackets core Apr 24, 2014
@@ -0,0 +1,24 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably just go in Settings.js

@marcelgerber
Copy link
Contributor

All used strings should be localized.

And btw, Travis failed (because of missing JSLint comments).

return PreferencesManager.ready.then(function() {
if ( Settings.getValue("paths") === (void 0) ) {
Settings.setValue("paths", DefaultSettings.paths);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess prefs.definePreference() should be used here to define default settings

@MiguelCastillo
Copy link
Contributor Author

Yeah, there are a few items in my list for code cleanup and integrate with what brackets already has. I think that by tomorrow or friday, code will be more inline with what we all expect :)

@MiguelCastillo
Copy link
Contributor Author

Love how quickly you guys are providing feedback! Its awesome

@dangoor
Copy link
Contributor

dangoor commented Apr 24, 2014

For some added context for those tuning in to this pull request right now: I asked Miguel if he could convert his extension into a pull request against core as something that we could begin discussing and also so that it was possible for it to load themes as extensions, which is not possible in an extension today. I added (REVIEW ONLY) because there's definitely more coming before this feature lands.

@@ -109,6 +109,7 @@ define(function (require, exports, module) {
exports.SORT_WORKINGSET_BY_NAME = "view.sortWorkingSetByName"; // WorkingSetSort.js _handleSortWorkingSetByName()
exports.SORT_WORKINGSET_BY_TYPE = "view.sortWorkingSetByType"; // WorkingSetSort.js _handleSortWorkingSetByType()
exports.SORT_WORKINGSET_AUTO = "view.sortWorkingSetAuto"; // WorkingSetSort.js _handleAutomaticSort()
exports.THEMES = "view.themes"; // themes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stay in sync with the detailed comments of the other entries.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably also use CMD_THEMES after the change done with the Find commands

This works by checking if the “theme” field exists in the package.json
to determine if the extension ought to be treated as a theme or not.
So that we can preemptively figure out if the extension is a theme or a
regular extension.
@MiguelCastillo
Copy link
Contributor Author

Alright, I think we are at a point where feedback would be great. Themes code is fully integrated into Brackets.

I created a theme that is already in the Extension Registry. The theme has to have a main.js or the registry wouldn't allow me to load it. So, we might need to adjust something there. This is the git link for the theme also
https://github.com/MiguelCastillo/Brackets-VisualStudioTheme

I am going to evaluate inline editor and mixin support. #4850

/**
* @private
* Verifies if an extension is a theme based on the presence of the field "theme"
* in the package.json. If it is a theme, then the theme file is just loaded by the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2 spaces

@marcelgerber
Copy link
Contributor

@larz0
Copy link
Member

larz0 commented Jun 12, 2014

@MiguelCastillo give me 5mins, I got disconnected from IRC for pasting too much console.log.

@larz0
Copy link
Member

larz0 commented Jun 13, 2014

@MiguelCastillo it seems like "Restore font size" won't work. Just a heads up.

@FezVrasta
Copy link
Contributor

Umh sorry for my intrusion ^_^"

I've cloned this PR but when I apply a theme using "View > Themes" nothing happens... Is it normal?

@MiguelCastillo
Copy link
Contributor Author

@FezVrasta Ah! No intrusion at all! We want your feedback.

You don't get a dialog at all?

@FezVrasta
Copy link
Contributor

I can open the window where I can choose the theme but when I click save the dialog is closed without any change of the theme.

@MiguelCastillo
Copy link
Contributor Author

Would you like to jump in IRC so that I can help you, help me fix the issue?

@FezVrasta
Copy link
Contributor

Sure, I'm there.

This is the log I get:

GET file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/Thor…me/C:/Program%20Files%20(x86)/Brackets/dev/src/styles/brackets_colors.less  less-1.7.0.min.js:13
r less-1.7.0.min.js:13
s less-1.7.0.min.js:13
I.imports.push less-1.7.0.min.js:13
a.importVisitor.visitImport less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.visitor.visitArray less-1.7.0.min.js:15
a.Ruleset.accept less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.visitor.visitArray less-1.7.0.min.js:15
a.Ruleset.accept less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.importVisitor.run less-1.7.0.min.js:15
E.parse less-1.7.0.min.js:13
lessifyTheme ThemeManager.js:120
(anonymous function) ThemeManager.js:185
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
e.(anonymous function) jquery-2.1.0.min.js:2
(anonymous function) FileUtils.js:64
(anonymous function) File.js:126
(anonymous function) AppshellFileSystem.js:392
GET file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/Thor…rogram%20Files%20(x86)/Brackets/dev/src/styles/brackets_theme_default.less  less-1.7.0.min.js:13
r less-1.7.0.min.js:13
s less-1.7.0.min.js:13
I.imports.push less-1.7.0.min.js:13
a.importVisitor.visitImport less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.visitor.visitArray less-1.7.0.min.js:15
a.Ruleset.accept less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.visitor.visitArray less-1.7.0.min.js:15
a.Ruleset.accept less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.importVisitor.run less-1.7.0.min.js:15
E.parse less-1.7.0.min.js:13
lessifyTheme ThemeManager.js:120
(anonymous function) ThemeManager.js:185
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
e.(anonymous function) jquery-2.1.0.min.js:2
(anonymous function) FileUtils.js:64
(anonymous function) File.js:126
(anonymous function) AppshellFileSystem.js:392
GET file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/default/Thor…%20Files%20(x86)/Brackets/dev/src/styles/brackets_codemirror_override.less  less-1.7.0.min.js:13
r less-1.7.0.min.js:13
s less-1.7.0.min.js:13
I.imports.push less-1.7.0.min.js:13
a.importVisitor.visitImport less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.visitor.visitArray less-1.7.0.min.js:15
a.Ruleset.accept less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.visitor.visitArray less-1.7.0.min.js:15
a.Ruleset.accept less-1.7.0.min.js:15
a.visitor.visit less-1.7.0.min.js:15
a.importVisitor.run less-1.7.0.min.js:15
E.parse less-1.7.0.min.js:13
lessifyTheme ThemeManager.js:120
(anonymous function) ThemeManager.js:185
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
e.(anonymous function) jquery-2.1.0.min.js:2
(anonymous function) FileUtils.js:64
(anonymous function) File.js:126
(anonymous function) AppshellFileSystem.js:392
Uncaught [object Object] less-1.7.0.min.js:13
(anonymous function) less-1.7.0.min.js:13
(anonymous function) ThemeManager.js:125
p less-1.7.0.min.js:13
a.importVisitor.run less-1.7.0.min.js:15
E.parse less-1.7.0.min.js:13
lessifyTheme ThemeManager.js:120
(anonymous function) ThemeManager.js:185
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
(anonymous function) jquery-2.1.0.min.js:2
j jquery-2.1.0.min.js:2
k.fireWith jquery-2.1.0.min.js:2
e.(anonymous function) jquery-2.1.0.min.js:2
(anonymous function) FileUtils.js:64
(anonymous function) File.js:126
(anonymous function) AppshellFileSystem.js:392

function loadCurrentThemes() {
return $.when(undefined, _.map(getCurrentThemes(), function (theme) {
if (!theme) {
return $.Deferred().reject("Theme not found");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should actually be:

return new $.Deferred().reject("Theme not found").promise();

Unfortunately, that error doesn't give a lot of information (what theme wasn't found?). It appears that information is not available in this context. It's not clear to me why getCurrentThemes() would even return an empty value.

@dangoor
Copy link
Contributor

dangoor commented Jun 17, 2014

My suggestions for tests would be:

  • write tests for the logic in Theme and ThemeSettings. Stuff like getDisplayName is really easy to write fast unit tests for. With a little tweaking, ThemeSettings may be easy to test just by rendering the form to a div and causing changes to happen and see what happens.
  • A lot of what's here is just integration code and visuals (CSS). Because the built-in themes work in the same way as extension themes, these will naturally get a lot of real user testing. An automated test that tries changing the theme and verifies that new stylesheets were applied and such could be valuable just for ensuring the basic connection of all of the parts...

@MiguelCastillo MiguelCastillo mentioned this pull request Jul 3, 2014
@dangoor
Copy link
Contributor

dangoor commented Jul 8, 2014

Closing this PR in favor of #8302.

@dangoor dangoor closed this Jul 8, 2014
@MiguelCastillo
Copy link
Contributor Author

@FezVrasta Hey! I fixed the issue you are running into in Windows... If you want to give latest another try, that would be really nice :) https://github.com/MiguelCastillo/brackets branch themes-v1.

@FezVrasta
Copy link
Contributor

Yes seems fixed now :)

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

Successfully merging this pull request may close these issues.

9 participants