Merge branch 'master' into enable-csp

This commit is contained in:
Nathan Sobo
2014-03-06 18:14:25 -07:00
15 changed files with 2526 additions and 2510 deletions

View File

@@ -31,6 +31,7 @@ The classes available from `require 'atom'` are:
* [SelectListView][SelectListView]
* [View][View]
* [WorkspaceView][WorkspaceView]
* [Workspace][Workspace]
### How do I create a package?
@@ -54,5 +55,6 @@ Atom ships with node 0.11.10 and the comprehensive node API docs are available
[SelectListView]: ../classes/SelectListView.html
[View]: ../classes/View.html
[WorkspaceView]: ../classes/WorkspaceView.html
[Workspace]: ../classes/Workspace.html
[creating-a-package]: https://atom.io/docs/latest/creating-a-package
[node-docs]: http://nodejs.org/docs/v0.11.10/api

View File

@@ -20,7 +20,8 @@ The final package can be viewed at
To begin, press `cmd-shift-P` to bring up the [Command
Palette](https://github.com/atom/command-palette). Type "generate package" and
select the "Package Generator: Generate Package" command. Now we need to name
the package. Let's call it _ascii-art_.
the package. Try to avoid naming your package with the *atom-* prefix, for
example we are going to call this package _ascii-art_.
Atom will open a new window with the contents of our new _ascii-art_ package
displayed in the Tree View. Because this window is opened **after** the package

View File

@@ -1,7 +1,7 @@
{
"name": "atom",
"productName": "Atom",
"version": "0.68.0",
"version": "0.70.0",
"main": "./src/browser/main.js",
"repository": {
"type": "git",
@@ -20,7 +20,7 @@
"coffeestack": "0.7.0",
"delegato": "1.x",
"emissary": "1.x",
"first-mate": ">=1.1.5 <2.0",
"first-mate": ">=1.4 <2.0",
"fs-plus": "2.x",
"fstream": "0.1.24",
"fuzzaldrin": "~1.1",
@@ -47,7 +47,7 @@
"serializable": "1.x",
"space-pen": "3.1.1",
"temp": "0.5.0",
"text-buffer": "^1.2.0",
"text-buffer": "^1.4.0",
"theorist": "1.x",
"underscore-plus": ">=1.0.2 <2.0",
"vm-compatibility-layer": "0.1.0"
@@ -61,12 +61,12 @@
"solarized-dark-syntax": "0.12.0",
"solarized-light-syntax": "0.7.0",
"archive-view": "0.26.0",
"autocomplete": "0.26.0",
"autocomplete": "0.27.0",
"autoflow": "0.15.0",
"autosave": "0.12.0",
"background-tips": "0.9.0",
"bookmarks": "0.21.0",
"bracket-matcher": "0.23.0",
"bracket-matcher": "0.25.0",
"command-palette": "0.19.0",
"dev-live-reload": "0.28.0",
"exception-reporting": "0.17.0",
@@ -75,50 +75,50 @@
"fuzzy-finder": "0.39.0",
"git-diff": "0.25.0",
"go-to-line": "0.18.0",
"grammar-selector": "0.22.0",
"image-view": "0.28.0",
"grammar-selector": "0.23.0",
"image-view": "0.29.0",
"keybinding-resolver": "0.11.0",
"link": "0.20.0",
"markdown-preview": "0.44.0",
"markdown-preview": "0.47.0",
"metrics": "0.30.0",
"open-on-github": "0.23.0",
"package-generator": "0.30.0",
"release-notes": "0.26.0",
"settings-view": "0.89.0",
"snippets": "0.33.0",
"spell-check": "0.26.0",
"snippets": "0.35.0",
"spell-check": "0.28.0",
"status-bar": "0.35.0",
"styleguide": "0.26.0",
"symbols-view": "0.41.0",
"tabs": "0.27.0",
"timecop": "0.17.0",
"tree-view": "0.74.0",
"update-package-dependencies": "0.5.0",
"update-package-dependencies": "0.6.0",
"welcome": "0.11.0",
"whitespace": "0.16.0",
"wrap-guide": "0.16.0",
"whitespace": "0.18.0",
"wrap-guide": "0.17.0",
"language-c": "0.13.0",
"language-coffee-script": "0.15.0",
"language-css": "0.11.0",
"language-css": "0.13.0",
"language-gfm": "0.19.0",
"language-git": "0.9.0",
"language-go": "0.7.0",
"language-html": "0.10.0",
"language-html": "0.11.0",
"language-hyperlink": "0.8.0",
"language-java": "0.8.0",
"language-javascript": "0.15.0",
"language-java": "0.9.0",
"language-javascript": "0.17.0",
"language-json": "0.8.0",
"language-less": "0.6.0",
"language-make": "0.9.0",
"language-objective-c": "0.9.0",
"language-objective-c": "0.10.0",
"language-perl": "0.8.0",
"language-php": "0.9.0",
"language-php": "0.10.0",
"language-property-list": "0.7.0",
"language-python": "0.11.0",
"language-ruby": "0.14.0",
"language-python": "0.12.0",
"language-ruby": "0.15.0",
"language-ruby-on-rails": "0.10.0",
"language-sass": "0.8.0",
"language-shellscript": "0.7.0",
"language-shellscript": "0.8.0",
"language-source": "0.7.0",
"language-sql": "0.7.0",
"language-text": "0.6.0",

File diff suppressed because it is too large Load Diff

View File

@@ -2430,51 +2430,11 @@ describe "EditorView", ->
editorView.underlayer.trigger event
expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [12,2]]
# TODO: Move to editor-spec
describe ".reloadGrammar()", ->
[filePath] = []
beforeEach ->
tmpdir = fs.absolute(temp.dir)
filePath = path.join(tmpdir, "grammar-change.txt")
fs.writeFileSync(filePath, "var i;")
afterEach ->
fs.removeSync(filePath) if fs.existsSync(filePath)
it "updates all the rendered lines when the grammar changes", ->
editor = atom.project.openSync(filePath)
editorView.edit(editor)
expect(editor.getGrammar().name).toBe 'Plain Text'
atom.syntax.setGrammarOverrideForPath(filePath, 'source.js')
editor.reloadGrammar()
expect(editor.getGrammar().name).toBe 'JavaScript'
tokenizedBuffer = editorView.editor.displayBuffer.tokenizedBuffer
line0 = tokenizedBuffer.lineForScreenRow(0)
expect(line0.tokens.length).toBe 3
expect(line0.tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.modifier.js'])
it "doesn't update the rendered lines when the grammar doesn't change", ->
expect(editor.getGrammar().name).toBe 'JavaScript'
spyOn(editorView, 'updateDisplay').andCallThrough()
editor.reloadGrammar()
expect(editor.reloadGrammar()).toBeFalsy()
expect(editorView.updateDisplay).not.toHaveBeenCalled()
expect(editor.getGrammar().name).toBe 'JavaScript'
it "emits an editor:grammar-changed event when updated", ->
editor = atom.project.openSync(filePath)
editorView.edit(editor)
describe "when the editor's grammar is changed", ->
it "emits an editor:grammar-changed event", ->
eventHandler = jasmine.createSpy('eventHandler')
editorView.on('editor:grammar-changed', eventHandler)
editor.reloadGrammar()
expect(eventHandler).not.toHaveBeenCalled()
atom.syntax.setGrammarOverrideForPath(filePath, 'source.js')
editor.reloadGrammar()
editor.setGrammar(atom.syntax.selectGrammar('.coffee'))
expect(eventHandler).toHaveBeenCalled()
describe ".replaceSelectedText()", ->

View File

@@ -254,6 +254,30 @@ describe "Keymap", ->
it "favors the more specific complete match", ->
describe ".bindKeys(name, selector, bindings)", ->
it "normalizes bindings that use shift with lower case alpha char", ->
fooHandler = jasmine.createSpy('fooHandler')
fragment.on 'foo', fooHandler
keymap.bindKeys 'name', '*', 'ctrl-shift-l': 'foo'
result = keymap.handleKeyEvent(keydownEvent('l', ctrlKey: true, altKey: false, shiftKey: true, target: fragment[0]))
expect(result).toBe(false)
expect(fooHandler).toHaveBeenCalled()
it "normalizes bindings that use shift with upper case alpha char", ->
fooHandler = jasmine.createSpy('fooHandler')
fragment.on 'foo', fooHandler
keymap.bindKeys 'name', '*', 'ctrl-shift-L': 'foo'
result = keymap.handleKeyEvent(keydownEvent('l', ctrlKey: true, altKey: false, shiftKey: true, target: fragment[0]))
expect(result).toBe(false)
expect(fooHandler).toHaveBeenCalled()
it "normalizes bindings that use an upper case alpha char without shift", ->
fooHandler = jasmine.createSpy('fooHandler')
fragment.on 'foo', fooHandler
keymap.bindKeys 'name', '*', 'ctrl-L': 'foo'
result = keymap.handleKeyEvent(keydownEvent('l', ctrlKey: true, altKey: false, shiftKey: true, target: fragment[0]))
expect(result).toBe(false)
expect(fooHandler).toHaveBeenCalled()
it "normalizes the key patterns in the hash to put the modifiers in alphabetical order", ->
fooHandler = jasmine.createSpy('fooHandler')
fragment.on 'foo', fooHandler
@@ -306,7 +330,7 @@ describe "Keymap", ->
describe "when shift is pressed when a non-modifer key", ->
it "returns a string that identifies the key pressed", ->
expect(keymap.keystrokeStringForEvent(keydownEvent('A', shiftKey: true))).toBe 'A'
expect(keymap.keystrokeStringForEvent(keydownEvent('A', shiftKey: true))).toBe 'shift-A'
expect(keymap.keystrokeStringForEvent(keydownEvent('{', shiftKey: true))).toBe '{'
expect(keymap.keystrokeStringForEvent(keydownEvent('left', shiftKey: true))).toBe 'shift-left'
expect(keymap.keystrokeStringForEvent(keydownEvent('Left', shiftKey: true))).toBe 'shift-left'

View File

@@ -90,11 +90,13 @@ describe "Window", ->
it "saves the serialized state of the window so it can be deserialized after reload", ->
workspaceState = atom.workspace.serialize()
syntaxState = atom.syntax.serialize()
projectState = atom.project.serialize()
atom.unloadEditorWindow()
expect(atom.state.workspace).toEqual workspaceState
expect(atom.state.syntax).toEqual syntaxState
expect(atom.state.project).toEqual projectState
expect(atom.saveSync).toHaveBeenCalled()
it "unsubscribes from all buffers", ->

View File

@@ -230,7 +230,7 @@ class Atom extends Model
deserializeProject: ->
Project = require './project'
@project ?= @deserializers.deserialize(@project) ? new Project(path: @getLoadSettings().initialPath)
@project ?= @deserializers.deserialize(@state.project) ? new Project(path: @getLoadSettings().initialPath)
deserializeWorkspaceView: ->
Workspace = require './workspace'
@@ -281,6 +281,7 @@ class Atom extends Model
return if not @project and not @workspaceView
@state.syntax = @syntax.serialize()
@state.project = @project.serialize()
@state.workspace = @workspace.serialize()
@packages.deactivatePackages()
@state.packageStates = @packages.packageStates

View File

@@ -30,7 +30,6 @@ socketPath =
module.exports =
class AtomApplication
_.extend @prototype, EventEmitter.prototype
updateVersion: null
# Public: The entry point into the Atom application.
@open: (options) ->
@@ -130,6 +129,8 @@ class AtomApplication
# Enable updates unless running from a local build of Atom.
setupAutoUpdater: ->
return if /\w{7}/.test(@version) # Only released versions should check for updates.
autoUpdater.setFeedUrl "https://atom.io/api/updates?version=#{@version}"
autoUpdater.on 'checking-for-update', =>
@@ -143,10 +144,9 @@ class AtomApplication
autoUpdater.on 'update-available', =>
@applicationMenu.showDownloadingUpdateItem(true)
autoUpdater.on 'update-downloaded', (event, releaseNotes, releaseName, releaseDate, releaseURL) =>
atomWindow.sendCommand('window:update-available', [releaseName, releaseNotes]) for atomWindow in @windows
autoUpdater.on 'update-downloaded', (event, releaseNotes, releaseVersion, releaseDate, releaseURL) =>
atomWindow.sendCommand('window:update-available', [releaseVersion, releaseNotes]) for atomWindow in @windows
@applicationMenu.showInstallUpdateItem(true)
@updateVersion = releaseName
autoUpdater.on 'error', (event, message) =>
@applicationMenu.showCheckForUpdateItem(true)
@@ -417,8 +417,3 @@ class AtomApplication
promptForPath: ({devMode}={}) ->
dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory'], (pathsToOpen) =>
@openPaths({pathsToOpen, devMode})
# Public: If an update is available, it returns the new version string
# otherwise it returns null.
getUpdateVersion: ->
@updateVersion

View File

@@ -121,7 +121,6 @@ class AtomWindow
if @loaded
@focus()
@sendCommand('window:open-path', {pathToOpen, initialLine})
@sendCommand('window:update-available', global.atomApplication.getUpdateVersion()) if global.atomApplication.getUpdateVersion()
else
@browserWindow.once 'window:loaded', => @openPath(pathToOpen, initialLine)

View File

@@ -21,7 +21,13 @@ class KeyBinding
keys = @parseKeystroke(keystroke)
modifiers = keys[0...-1]
modifiers.sort()
[modifiers..., _.last(keys)].join('-')
key = _.last(keys)
modifiers.push 'shift' if /^[A-Z]$/.test(key) and 'shift' not in modifiers
key = key.toUpperCase() if /^[a-z]$/.test(key) and 'shift' in modifiers
[modifiers..., key].join('-')
normalizedKeystroke.join(' ')
@parseKeystroke: (keystroke) ->

View File

@@ -99,10 +99,12 @@ class Keymap
modifiers.push 'cmd'
if event.ctrlKey and key not in Modifiers
modifiers.push 'ctrl'
if event.shiftKey and key not in Modifiers
isNamedKey = key.length > 1
modifiers.push 'shift' if isNamedKey
# Don't push the shift modifier on single letter non-alpha keys (e.g. { or ')
modifiers.push 'shift' unless /^[^a-z]$/i.test(key)
if 'shift' in modifiers and /^[a-z]$/i.test(key)
key = key.toUpperCase()
else
key = key.toLowerCase()

View File

@@ -308,8 +308,8 @@ class WorkspaceView extends View
# Public: Get all existing pane views.
#
# Prefer {Workspace::getPanes} if you don't need access to the view objects.
# Also consider using {::eachPaneView} or {Workspace::eachPane} if you want
# to register a callback for all current and *future* pane views or panes.
# Also consider using {::eachPaneView} if you want to register a callback for
# all current and *future* pane views.
#
# Returns an Array of all open {PaneView}s.
getPaneViews: ->

View File

@@ -19,8 +19,6 @@ class Workspace extends Model
Serializable.includeInto(this)
@delegatesProperty 'activePane', 'activePaneItem', toProperty: 'paneContainer'
@delegatesMethod 'getPanes', 'saveAll', 'activateNextPane', 'activatePreviousPane',
toProperty: 'paneContainer'
@properties
paneContainer: -> new PaneContainer
@@ -186,6 +184,24 @@ class Workspace extends Model
getActivePane: ->
@paneContainer.activePane
# Public: Get all {Pane}s.
#
# Returns an {Array} of {Pane}s.
getPanes: ->
@paneContainer.getPanes()
# Public: Save all pane items.
saveAll: ->
@paneContainer.saveAll()
# Public: Make the next pane active.
activateNextPane: ->
@paneContainer.activateNext()
# Public: Make the previous pane active.
activatePreviousPane: ->
@paneContainer.activatePreviousPane()
# Public: Get the first pane {Pane} with an item for the given URI.
#
# Returns a {Pane} or `undefined` if no pane exists for the given URI.
@@ -195,9 +211,9 @@ class Workspace extends Model
# Public: Save the active pane item.
#
# If the active pane item currently has a URI according to the item's
# `.getUri` method, calls `.save` on the item. Otherwise {::saveActiveItemAs}
# will be called instead. This method does nothing if the active item does not
# implement a `.save` method.
# `.getUri` method, calls `.save` on the item. Otherwise
# {::saveActivePaneItemAs} # will be called instead. This method does nothing
# if the active item does not implement a `.save` method.
saveActivePaneItem: ->
@activePane?.saveActiveItem()

2
vendor/apm vendored

Submodule vendor/apm updated: e7898e7461...9ca4f9ffc7