From fce10242dc906bf7079c8b5ac3a57f342bbd34f5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 8 Mar 2017 18:10:54 +0100 Subject: [PATCH] Don't load base style sheets in AtomEnvironment As it will happen again right after package activation. Signed-off-by: Nathan Sobo --- src/atom-environment.coffee | 1 - src/theme-manager.coffee | 12 +++++------- src/workspace-element.coffee | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index 8769db433..958d1d973 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -233,7 +233,6 @@ class AtomEnvironment extends Model @config.load() - @themes.loadBaseStylesheets() @initialStyleElements = @styles.getSnapshot() @themes.initialLoadComplete = true if onlyLoadBaseStyleSheets @setBodyPlatformClass() diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index f035889a2..9e7c20380 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -126,10 +126,10 @@ class ThemeManager # # Returns a {Disposable} on which `.dispose()` can be called to remove the # required stylesheet. - requireStylesheet: (stylesheetPath) -> + requireStylesheet: (stylesheetPath, priority) -> if fullPath = @resolveStylesheet(stylesheetPath) content = @loadStylesheet(fullPath) - @applyStylesheet(fullPath, content) + @applyStylesheet(fullPath, content, priority) else throw new Error("Could not find a file at path '#{stylesheetPath}'") @@ -175,9 +175,7 @@ class ThemeManager @reloadBaseStylesheets() reloadBaseStylesheets: -> - @requireStylesheet('../static/atom') - if nativeStylesheetPath = fs.resolveOnLoadPath(process.platform, ['css', 'less']) - @requireStylesheet(nativeStylesheetPath) + @requireStylesheet('../static/atom', -2) stylesheetElementForId: (id) -> escapedId = id.replace(/\\/g, '\\\\') @@ -231,8 +229,8 @@ class ThemeManager removeStylesheet: (stylesheetPath) -> @styleSheetDisposablesBySourcePath[stylesheetPath]?.dispose() - applyStylesheet: (path, text) -> - @styleSheetDisposablesBySourcePath[path] = @styleManager.addStyleSheet(text, sourcePath: path) + applyStylesheet: (path, text, priority) -> + @styleSheetDisposablesBySourcePath[path] = @styleManager.addStyleSheet(text, {priority, sourcePath: path}) activateThemes: -> new Promise (resolve) => diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 6defe33da..cee3c09f3 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -51,7 +51,7 @@ class WorkspaceElement extends HTMLElement line-height: #{@config.get('editor.lineHeight')}; } """ - @styles.addStyleSheet(styleSheetSource, sourcePath: 'global-text-editor-styles') + @styles.addStyleSheet(styleSheetSource, {sourcePath: 'global-text-editor-styles', priority: -1}) @views.performDocumentPoll() initialize: (@model, {@views, @workspace, @project, @config, @styles}) ->