diff --git a/spec/git-repository-spec.coffee b/spec/git-repository-spec.coffee index e4d1e0c7f..c33d8b039 100644 --- a/spec/git-repository-spec.coffee +++ b/spec/git-repository-spec.coffee @@ -352,7 +352,13 @@ describe "GitRepository", -> atom.workspace.open('file.txt') waitsForPromise -> - project2 = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm, applicationDelegate: atom.applicationDelegate}) + project2 = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + applicationDelegate: atom.applicationDelegate, + grammarRegistry: atom.grammars + }) project2.deserialize(atom.project.serialize({isUnloading: false})) waitsFor -> diff --git a/spec/project-spec.js b/spec/project-spec.js index e919cb7f3..103a9e403 100644 --- a/spec/project-spec.js +++ b/spec/project-spec.js @@ -35,7 +35,12 @@ describe('Project', () => { }) it("does not deserialize paths to directories that don't exist", () => { - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) const state = atom.project.serialize() state.paths.push('/directory/that/does/not/exist') @@ -55,7 +60,12 @@ describe('Project', () => { const childPath = path.join(temp.mkdirSync('atom-spec-project'), 'child') fs.mkdirSync(childPath) - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) atom.project.setPaths([childPath]) const state = atom.project.serialize() @@ -80,7 +90,12 @@ describe('Project', () => { runs(() => { expect(atom.project.getBuffers().length).toBe(1) - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => deserializedProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -93,7 +108,12 @@ describe('Project', () => { runs(() => { expect(atom.project.getBuffers().length).toBe(1) - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => deserializedProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -113,7 +133,12 @@ describe('Project', () => { runs(() => { expect(atom.project.getBuffers().length).toBe(1) fs.mkdirSync(pathToOpen) - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => deserializedProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -131,7 +156,12 @@ describe('Project', () => { runs(() => { expect(atom.project.getBuffers().length).toBe(1) fs.chmodSync(pathToOpen, '000') - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => deserializedProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -148,7 +178,12 @@ describe('Project', () => { runs(() => { expect(atom.project.getBuffers().length).toBe(1) fs.unlinkSync(pathToOpen) - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => deserializedProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -165,7 +200,12 @@ describe('Project', () => { atom.workspace.getActiveTextEditor().setText('unsaved\n') expect(atom.project.getBuffers().length).toBe(1) - deserializedProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + deserializedProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => deserializedProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -189,7 +229,12 @@ describe('Project', () => { layerA = bufferA.addMarkerLayer({persistent: true}) markerA = layerA.markPosition([0, 3]) bufferA.append('!') - notQuittingProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + notQuittingProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => notQuittingProject.deserialize(atom.project.serialize({isUnloading: false}))) @@ -197,7 +242,12 @@ describe('Project', () => { runs(() => { expect(notQuittingProject.getBuffers()[0].getMarkerLayer(layerA.id), x => x.getMarker(markerA.id)).toBeUndefined() expect(notQuittingProject.getBuffers()[0].undo()).toBe(false) - quittingProject = new Project({notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm}) + quittingProject = new Project({ + notificationManager: atom.notifications, + packageManager: atom.packages, + confirm: atom.confirm, + grammarRegistry: atom.grammars + }) }) waitsForPromise(() => quittingProject.deserialize(atom.project.serialize({isUnloading: true}))) diff --git a/spec/workspace-spec.js b/spec/workspace-spec.js index 1bde0e6fe..80612e79c 100644 --- a/spec/workspace-spec.js +++ b/spec/workspace-spec.js @@ -43,7 +43,8 @@ describe('Workspace', () => { notificationManager: atom.notifications, packageManager: atom.packages, confirm: atom.confirm.bind(atom), - applicationDelegate: atom.applicationDelegate + applicationDelegate: atom.applicationDelegate, + grammarRegistry: atom.grammars }) return atom.project.deserialize(projectState).then(() => { workspace = atom.workspace = new Workspace({ diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index af61ffb36..714d8f1fc 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -167,7 +167,10 @@ class AtomEnvironment extends Model @packages.setContextMenuManager(@contextMenu) @packages.setThemeManager(@themes) - @project = new Project({notificationManager: @notifications, packageManager: @packages, @config, @applicationDelegate}) + @project = new Project({ + notificationManager: @notifications, packageManager: @packages, grammarRegistry: @grammars + @config, @applicationDelegate + }) @commandInstaller = new CommandInstaller(@applicationDelegate) @protocolHandlerInstaller = new ProtocolHandlerInstaller() diff --git a/src/project.js b/src/project.js index 734dfcad7..2942bcdbf 100644 --- a/src/project.js +++ b/src/project.js @@ -19,10 +19,11 @@ class Project extends Model { Section: Construction and Destruction */ - constructor ({notificationManager, packageManager, config, applicationDelegate}) { + constructor ({notificationManager, packageManager, config, applicationDelegate, grammarRegistry}) { super() this.notificationManager = notificationManager this.applicationDelegate = applicationDelegate + this.grammarRegistry = grammarRegistry this.emitter = new Emitter() this.buffers = [] this.rootDirectories = []