From 8436715b02f2c4d6f22c217f2e9b21991ed152bb Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 2 Oct 2015 16:25:59 -0600 Subject: [PATCH] Deserialize Workspace in atom.loadStateSync --- src/atom.coffee | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 2a52cc317..dc1f857e6 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -174,6 +174,7 @@ class Atom extends Model notificationManager: @notifications, setRepresentedFilename: @setRepresentedFilename.bind(this), setDocumentEdited: @setDocumentEdited.bind(this), atomVersion: @getVersion() }) + @themes.workspace = @workspace @registerDefaultOpeners() @@ -539,7 +540,10 @@ class Atom extends Model @windowEventHandler = new WindowEventHandler(this) @packages.loadPackages() - @deserializeEditorWindow() + + workspaceElement = @views.getView(@workspace) + @keymaps.defaultTarget = workspaceElement + document.querySelector(@workspaceParentSelectorctor).appendChild(workspaceElement) @watchProjectPath() @@ -688,19 +692,7 @@ class Atom extends Model false deserializeWorkspace: -> - Workspace = require './workspace' - startTime = Date.now() - @workspace.deserialize(@state.workspace, @deserializers) - @themes.workspace = @workspace - @deserializeTimings.workspace = Date.now() - startTime - - workspaceElement = @views.getView(@workspace) - @keymaps.defaultTarget = workspaceElement - document.querySelector(@workspaceParentSelectorctor).appendChild(workspaceElement) - - deserializeEditorWindow: -> - @deserializeWorkspace() loadThemes: -> @themes.load() @@ -772,6 +764,10 @@ class Atom extends Model @project.deserialize(@state.project, @deserializers) if @state.project? @deserializeTimings.project = Date.now() - startTime + startTime = Date.now() + @workspace.deserialize(@state.workspace, @deserializers) if @state.workspace? + @deserializeTimings.workspace = Date.now() - startTime + getStateKey: (paths) -> if paths?.length > 0 sha1 = crypto.createHash('sha1').update(paths.slice().sort().join("\n")).digest('hex') @@ -800,7 +796,7 @@ class Atom extends Model try require(userInitScriptPath) if fs.isFileSync(userInitScriptPath) catch error - atom.notifications.addError "Failed to load `#{userInitScriptPath}`", + @notifications.addError "Failed to load `#{userInitScriptPath}`", detail: error.message dismissable: true