mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Merge branch 'master' into as-tiled-gutter
This commit is contained in:
16
README.md
16
README.md
@@ -11,9 +11,6 @@ Visit [atom.io](https://atom.io) to learn more or visit the [Atom forum](https:/
|
||||
Follow [@AtomEditor](https://twitter.com/atomeditor) on Twitter for important
|
||||
announcements.
|
||||
|
||||
Visit [issue #3684](https://github.com/atom/atom/issues/3684) to learn more
|
||||
about the Atom 1.0 roadmap.
|
||||
|
||||
## Documentation
|
||||
|
||||
If you want to read about using Atom or developing packages in Atom, the [Atom Flight Manual](https://atom.io/docs/latest/) is free and available online, along with ePub, PDF and mobi versions. You can find the source to the manual in [atom/docs](https://github.com/atom/docs).
|
||||
@@ -51,7 +48,7 @@ Currently only a 64-bit version is available.
|
||||
The Linux version does not currently automatically update so you will need to
|
||||
repeat these steps to upgrade to future releases.
|
||||
|
||||
### Red Hat Linux (Fedora, CentOS, Red Hat)
|
||||
### Red Hat Linux (Fedora 21 and under, CentOS, Red Hat)
|
||||
|
||||
Currently only a 64-bit version is available.
|
||||
|
||||
@@ -62,6 +59,17 @@ Currently only a 64-bit version is available.
|
||||
The Linux version does not currently automatically update so you will need to
|
||||
repeat these steps to upgrade to future releases.
|
||||
|
||||
### Fedora 22+
|
||||
|
||||
Currently only a 64-bit version is available.
|
||||
|
||||
1. Download `atom.x86_64.rpm` from the [Atom releases page](https://github.com/atom/atom/releases/latest).
|
||||
2. Run `sudo dnf install atom.x86_64.rpm` on the downloaded package.
|
||||
3. Launch Atom using the installed `atom` command.
|
||||
|
||||
The Linux version does not currently automatically update so you will need to
|
||||
repeat these steps to upgrade to future releases.
|
||||
|
||||
## Building
|
||||
|
||||
* [Linux](docs/build-instructions/linux.md)
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"url": "https://github.com/atom/atom.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"atom-package-manager": "0.171.0"
|
||||
"atom-package-manager": "1.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"grunt-peg": "~1.1.0",
|
||||
"grunt-shell": "~0.3.1",
|
||||
"harmony-collections": "~0.3.8",
|
||||
"legal-eagle": "~0.9.0",
|
||||
"legal-eagle": "~0.10.0",
|
||||
"minidump": "~0.8",
|
||||
"npm": "2.5.1",
|
||||
"rcedit": "~0.3.0",
|
||||
|
||||
@@ -95,7 +95,7 @@ module.exports = (grunt) ->
|
||||
if process.platform in ['darwin', 'linux']
|
||||
options =
|
||||
cmd: appPath
|
||||
args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}", '--include-deprecated-apis']
|
||||
args: ['--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}"]
|
||||
opts:
|
||||
env: _.extend({}, process.env,
|
||||
ATOM_INTEGRATION_TESTS_ENABLED: true
|
||||
@@ -104,7 +104,7 @@ module.exports = (grunt) ->
|
||||
else if process.platform is 'win32'
|
||||
options =
|
||||
cmd: process.env.comspec
|
||||
args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}", '--log-file=ci.log', '--include-deprecated-apis']
|
||||
args: ['/c', appPath, '--test', "--resource-path=#{resourcePath}", "--spec-directory=#{coreSpecsPath}", '--log-file=ci.log']
|
||||
opts:
|
||||
env: _.extend({}, process.env,
|
||||
ATOM_INTEGRATION_TESTS_ENABLED: true
|
||||
|
||||
@@ -30,7 +30,7 @@ Ubuntu LTS 12.04 64-bit is the recommended platform.
|
||||
### Arch
|
||||
|
||||
* `sudo pacman -S gconf base-devel git nodejs libgnome-keyring python2`
|
||||
* `export python=/usr/bin/python2` before building Atom.
|
||||
* `export PYTHON=/usr/bin/python2` before building Atom.
|
||||
|
||||
### Slackware
|
||||
|
||||
|
||||
@@ -120,14 +120,6 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
|
||||
"""
|
||||
require '../src/select-list-view'
|
||||
|
||||
Object.defineProperty module.exports, 'React', get: ->
|
||||
deprecate "Please require `react-atom-fork` instead: `React = require 'react-atom-fork'`. Add `\"react-atom-fork\": \"^0.11\"` to your package dependencies."
|
||||
require 'react-atom-fork'
|
||||
|
||||
Object.defineProperty module.exports, 'Reactionary', get: ->
|
||||
deprecate "Please require `reactionary-atom-fork` instead: `Reactionary = require 'reactionary-atom-fork'`. Add `\"reactionary-atom-fork\": \"^0.9\"` to your package dependencies."
|
||||
require 'reactionary-atom-fork'
|
||||
|
||||
if includeDeprecatedAPIs
|
||||
Object.defineProperty module.exports, 'Git', get: ->
|
||||
deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`"
|
||||
|
||||
37
package.json
37
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "0.211.0",
|
||||
"version": "1.0.1",
|
||||
"description": "A hackable text editor for the 21st Century.",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
@@ -11,12 +11,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/atom/atom/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/atom/atom/raw/master/LICENSE.md"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"atomShellVersion": "0.22.3",
|
||||
"dependencies": {
|
||||
"async": "0.2.6",
|
||||
@@ -47,12 +42,10 @@
|
||||
"normalize-package-data": "^2.0.0",
|
||||
"nslog": "^2.0.0",
|
||||
"oniguruma": "^4.1",
|
||||
"pathwatcher": "^4.4",
|
||||
"pathwatcher": "^4.4.1",
|
||||
"property-accessors": "^1.1.3",
|
||||
"q": "^1.1.2",
|
||||
"random-words": "0.0.1",
|
||||
"react-atom-fork": "^0.11.5",
|
||||
"reactionary-atom-fork": "^1.0.0",
|
||||
"runas": "2.0.0",
|
||||
"scandal": "2.0.3",
|
||||
"scoped-property-store": "^0.17.0",
|
||||
@@ -77,15 +70,15 @@
|
||||
"atom-light-ui": "0.41.0",
|
||||
"base16-tomorrow-dark-theme": "0.26.0",
|
||||
"base16-tomorrow-light-theme": "0.9.0",
|
||||
"one-dark-ui": "0.9.0",
|
||||
"one-dark-ui": "0.9.1",
|
||||
"one-dark-syntax": "0.7.1",
|
||||
"one-light-syntax": "0.7.0",
|
||||
"one-light-ui": "0.9.0",
|
||||
"one-light-ui": "0.9.1",
|
||||
"solarized-dark-syntax": "0.35.0",
|
||||
"solarized-light-syntax": "0.21.0",
|
||||
"archive-view": "0.58.0",
|
||||
"autocomplete-atom-api": "0.9.0",
|
||||
"autocomplete-css": "0.7.2",
|
||||
"autocomplete-css": "0.8.0",
|
||||
"autocomplete-html": "0.7.2",
|
||||
"autocomplete-plus": "2.17.4",
|
||||
"autocomplete-snippets": "1.7.0",
|
||||
@@ -95,11 +88,11 @@
|
||||
"bookmarks": "0.35.0",
|
||||
"bracket-matcher": "0.76.0",
|
||||
"command-palette": "0.36.0",
|
||||
"deprecation-cop": "0.52.0",
|
||||
"deprecation-cop": "0.53.0",
|
||||
"dev-live-reload": "0.46.0",
|
||||
"encoding-selector": "0.20.0",
|
||||
"exception-reporting": "0.25.0",
|
||||
"find-and-replace": "0.173.0",
|
||||
"find-and-replace": "0.174.0",
|
||||
"fuzzy-finder": "0.87.0",
|
||||
"git-diff": "0.55.0",
|
||||
"go-to-line": "0.30.0",
|
||||
@@ -114,7 +107,7 @@
|
||||
"open-on-github": "0.37.0",
|
||||
"package-generator": "0.39.0",
|
||||
"release-notes": "0.53.0",
|
||||
"settings-view": "0.208.0",
|
||||
"settings-view": "0.209.0",
|
||||
"snippets": "0.95.0",
|
||||
"spell-check": "0.59.0",
|
||||
"status-bar": "0.74.0",
|
||||
@@ -131,7 +124,7 @@
|
||||
"language-clojure": "0.16.0",
|
||||
"language-coffee-script": "0.41.0",
|
||||
"language-csharp": "0.6.0",
|
||||
"language-css": "0.31.0",
|
||||
"language-css": "0.32.0",
|
||||
"language-gfm": "0.77.0",
|
||||
"language-git": "0.10.0",
|
||||
"language-go": "0.27.0",
|
||||
@@ -144,18 +137,18 @@
|
||||
"language-make": "0.14.0",
|
||||
"language-mustache": "0.11.0",
|
||||
"language-objective-c": "0.15.0",
|
||||
"language-perl": "0.25.0",
|
||||
"language-php": "0.24.0",
|
||||
"language-perl": "0.26.0",
|
||||
"language-php": "0.26.0",
|
||||
"language-property-list": "0.8.0",
|
||||
"language-python": "0.36.0",
|
||||
"language-python": "0.37.0",
|
||||
"language-ruby": "0.56.0",
|
||||
"language-ruby-on-rails": "0.22.0",
|
||||
"language-sass": "0.39.0",
|
||||
"language-shellscript": "0.15.0",
|
||||
"language-source": "0.9.0",
|
||||
"language-sql": "0.16.0",
|
||||
"language-sql": "0.17.0",
|
||||
"language-text": "0.7.0",
|
||||
"language-todo": "0.23.0",
|
||||
"language-todo": "0.25.0",
|
||||
"language-toml": "0.16.0",
|
||||
"language-xml": "0.30.0",
|
||||
"language-yaml": "0.22.0"
|
||||
|
||||
@@ -158,6 +158,26 @@ describe "CommandRegistry", ->
|
||||
addError = error
|
||||
expect(addError.message).toContain(badSelector)
|
||||
|
||||
it "throws an error when called with a non-function callback and selector target", ->
|
||||
badCallback = null
|
||||
addError = null
|
||||
|
||||
try
|
||||
registry.add '.selector', 'foo:bar', badCallback
|
||||
catch error
|
||||
addError = error
|
||||
expect(addError.message).toContain("Can't register a command with non-function callback.")
|
||||
|
||||
it "throws an error when called with an non-function callback and object target", ->
|
||||
badCallback = null
|
||||
addError = null
|
||||
|
||||
try
|
||||
registry.add document.body, 'foo:bar', badCallback
|
||||
catch error
|
||||
addError = error
|
||||
expect(addError.message).toContain("Can't register a command with non-function callback.")
|
||||
|
||||
describe "::findCommands({target})", ->
|
||||
it "returns commands that can be invoked on the target or its ancestors", ->
|
||||
registry.add '.parent', 'namespace:command-1', ->
|
||||
|
||||
@@ -224,7 +224,7 @@ describe "Workspace", ->
|
||||
expect(workspace.paneContainer.root.children[0]).toBe pane1
|
||||
expect(workspace.paneContainer.root.children[1]).toBe pane4
|
||||
|
||||
describe "when the file is large (over 2mb)", ->
|
||||
describe "when the file is over 2MB", ->
|
||||
it "opens the editor with largeFileMode: true", ->
|
||||
spyOn(fs, 'getSizeSync').andReturn 2 * 1048577 # 2MB
|
||||
|
||||
@@ -235,6 +235,30 @@ describe "Workspace", ->
|
||||
runs ->
|
||||
expect(editor.displayBuffer.largeFileMode).toBe true
|
||||
|
||||
describe "when the file is over 20MB", ->
|
||||
it "prompts the user to make sure they want to open a file this big", ->
|
||||
spyOn(fs, 'getSizeSync').andReturn 20 * 1048577 # 20MB
|
||||
spyOn(atom, 'confirm').andCallFake -> selectedButtonIndex
|
||||
selectedButtonIndex = 1 # cancel
|
||||
|
||||
editor = null
|
||||
waitsForPromise ->
|
||||
workspace.open('sample.js').then (e) -> editor = e
|
||||
|
||||
runs ->
|
||||
expect(editor).toBeUndefined()
|
||||
expect(atom.confirm).toHaveBeenCalled()
|
||||
|
||||
atom.confirm.reset()
|
||||
selectedButtonIndex = 0 # open the file
|
||||
|
||||
waitsForPromise ->
|
||||
workspace.open('sample.js').then (e) -> editor = e
|
||||
|
||||
runs ->
|
||||
expect(atom.confirm).toHaveBeenCalled()
|
||||
expect(editor.displayBuffer.largeFileMode).toBe true
|
||||
|
||||
describe "when passed a path that matches a custom opener", ->
|
||||
it "returns the resource returned by the custom opener", ->
|
||||
fooOpener = (pathToOpen, options) -> {foo: pathToOpen, options} if pathToOpen?.match(/\.foo/)
|
||||
|
||||
@@ -61,7 +61,7 @@ class AtomApplication
|
||||
exit: (status) -> app.exit(status)
|
||||
|
||||
constructor: (options) ->
|
||||
{@resourcePath, @version, @devMode, @safeMode, @includeDeprecatedAPIs, @socketPath} = options
|
||||
{@resourcePath, @version, @devMode, @safeMode, @socketPath} = options
|
||||
|
||||
# Normalize to make sure drive letter case is consistent on Windows
|
||||
@resourcePath = path.normalize(@resourcePath) if @resourcePath
|
||||
@@ -86,16 +86,16 @@ class AtomApplication
|
||||
else
|
||||
@loadState() or @openPath(options)
|
||||
|
||||
openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, includeDeprecatedAPIs, newWindow, specDirectory, logFile, profileStartup}) ->
|
||||
openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile, profileStartup}) ->
|
||||
if test
|
||||
@runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile, includeDeprecatedAPIs})
|
||||
@runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile})
|
||||
else if pathsToOpen.length > 0
|
||||
@openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, includeDeprecatedAPIs, profileStartup})
|
||||
@openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup})
|
||||
else if urlsToOpen.length > 0
|
||||
@openUrl({urlToOpen, devMode, safeMode, includeDeprecatedAPIs}) for urlToOpen in urlsToOpen
|
||||
@openUrl({urlToOpen, devMode, safeMode}) for urlToOpen in urlsToOpen
|
||||
else
|
||||
# Always open a editor window if this is the first instance of Atom.
|
||||
@openPath({pidToKillWhenClosed, newWindow, devMode, safeMode, includeDeprecatedAPIs, profileStartup})
|
||||
@openPath({pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup})
|
||||
|
||||
# Public: Removes the {AtomWindow} from the global window list.
|
||||
removeWindow: (window) ->
|
||||
@@ -160,7 +160,6 @@ class AtomApplication
|
||||
getLoadSettings = =>
|
||||
devMode: @focusedWindow()?.devMode
|
||||
safeMode: @focusedWindow()?.safeMode
|
||||
includeDeprecatedAPIs: @focusedWindow()?.includeDeprecatedAPIs
|
||||
|
||||
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath, safeMode: @focusedWindow()?.safeMode)
|
||||
@on 'application:run-benchmarks', -> @runBenchmarks()
|
||||
@@ -172,8 +171,6 @@ class AtomApplication
|
||||
@on 'application:open-folder', -> @promptForPathToOpen('folder', getLoadSettings())
|
||||
@on 'application:open-dev', -> @promptForPathToOpen('all', devMode: true)
|
||||
@on 'application:open-safe', -> @promptForPathToOpen('all', safeMode: true)
|
||||
@on 'application:open-with-deprecated-apis', -> @promptForPathToOpen('all', includeDeprecatedAPIs: true)
|
||||
@on 'application:open-dev-with-deprecated-apis', -> @promptForPathToOpen('all', {includeDeprecatedAPIs: true, devMode: true})
|
||||
@on 'application:inspect', ({x, y, atomWindow}) ->
|
||||
atomWindow ?= @focusedWindow()
|
||||
atomWindow?.browserWindow.inspectElement(x, y)
|
||||
@@ -231,7 +228,7 @@ class AtomApplication
|
||||
|
||||
app.on 'open-url', (event, urlToOpen) =>
|
||||
event.preventDefault()
|
||||
@openUrl({urlToOpen, @devMode, @safeMode, @includeDeprecatedAPIs})
|
||||
@openUrl({urlToOpen, @devMode, @safeMode})
|
||||
|
||||
app.on 'activate-with-no-open-windows', (event) =>
|
||||
event.preventDefault()
|
||||
@@ -358,11 +355,10 @@ class AtomApplication
|
||||
# :newWindow - Boolean of whether this should be opened in a new window.
|
||||
# :devMode - Boolean to control the opened window's dev mode.
|
||||
# :safeMode - Boolean to control the opened window's safe mode.
|
||||
# :includeDeprecatedAPIs - Boolean to control the opened window's included deprecated APIs.
|
||||
# :profileStartup - Boolean to control creating a profile of the startup time.
|
||||
# :window - {AtomWindow} to open file paths in.
|
||||
openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, includeDeprecatedAPIs, profileStartup, window}) ->
|
||||
@openPaths({pathsToOpen: [pathToOpen], pidToKillWhenClosed, newWindow, devMode, safeMode, includeDeprecatedAPIs, profileStartup, window})
|
||||
openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, window}) ->
|
||||
@openPaths({pathsToOpen: [pathToOpen], pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, window})
|
||||
|
||||
# Public: Opens multiple paths, in existing windows if possible.
|
||||
#
|
||||
@@ -372,10 +368,9 @@ class AtomApplication
|
||||
# :newWindow - Boolean of whether this should be opened in a new window.
|
||||
# :devMode - Boolean to control the opened window's dev mode.
|
||||
# :safeMode - Boolean to control the opened window's safe mode.
|
||||
# :includeDeprecatedAPIs - Boolean to control the opened window's included deprecated APIs.
|
||||
# :windowDimensions - Object with height and width keys.
|
||||
# :window - {AtomWindow} to open file paths in.
|
||||
openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, includeDeprecatedAPIs, windowDimensions, profileStartup, window}={}) ->
|
||||
openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, profileStartup, window}={}) ->
|
||||
pathsToOpen = pathsToOpen.map (pathToOpen) ->
|
||||
if fs.existsSync(pathToOpen)
|
||||
fs.normalize(pathToOpen)
|
||||
@@ -410,7 +405,7 @@ class AtomApplication
|
||||
|
||||
bootstrapScript ?= require.resolve('../window-bootstrap')
|
||||
resourcePath ?= @resourcePath
|
||||
openedWindow = new AtomWindow({locationsToOpen, bootstrapScript, resourcePath, devMode, safeMode, includeDeprecatedAPIs, windowDimensions, profileStartup})
|
||||
openedWindow = new AtomWindow({locationsToOpen, bootstrapScript, resourcePath, devMode, safeMode, windowDimensions, profileStartup})
|
||||
|
||||
if pidToKillWhenClosed?
|
||||
@pidsToOpenWindows[pidToKillWhenClosed] = openedWindow
|
||||
@@ -457,7 +452,6 @@ class AtomApplication
|
||||
urlsToOpen: []
|
||||
devMode: @devMode
|
||||
safeMode: @safeMode
|
||||
includeDeprecatedAPIs: @includeDeprecatedAPIs
|
||||
})
|
||||
true
|
||||
else
|
||||
@@ -503,7 +497,7 @@ class AtomApplication
|
||||
# :specPath - The directory to load specs from.
|
||||
# :safeMode - A Boolean that, if true, won't run specs from ~/.atom/packages
|
||||
# and ~/.atom/dev/packages, defaults to false.
|
||||
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile, safeMode, includeDeprecatedAPIs}) ->
|
||||
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile, safeMode}) ->
|
||||
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
|
||||
resourcePath = @resourcePath
|
||||
|
||||
@@ -515,8 +509,7 @@ class AtomApplication
|
||||
isSpec = true
|
||||
devMode = true
|
||||
safeMode ?= false
|
||||
includeDeprecatedAPIs ?= true
|
||||
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile, safeMode, includeDeprecatedAPIs})
|
||||
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile, safeMode})
|
||||
|
||||
runBenchmarks: ({exitWhenDone, specDirectory}={}) ->
|
||||
try
|
||||
@@ -559,9 +552,9 @@ class AtomApplication
|
||||
# :safeMode - A Boolean which controls whether any newly opened windows
|
||||
# should be in safe mode or not.
|
||||
# :window - An {AtomWindow} to use for opening a selected file path.
|
||||
promptForPathToOpen: (type, {devMode, safeMode, includeDeprecatedAPIs, window}) ->
|
||||
promptForPathToOpen: (type, {devMode, safeMode, window}) ->
|
||||
@promptForPath type, (pathsToOpen) =>
|
||||
@openPaths({pathsToOpen, devMode, safeMode, includeDeprecatedAPIs, window})
|
||||
@openPaths({pathsToOpen, devMode, safeMode, window})
|
||||
|
||||
promptForPath: (type, callback) ->
|
||||
properties =
|
||||
|
||||
@@ -18,7 +18,7 @@ class AtomWindow
|
||||
isSpec: null
|
||||
|
||||
constructor: (settings={}) ->
|
||||
{@resourcePath, pathToOpen, locationsToOpen, @isSpec, @exitWhenDone, @safeMode, @devMode, @includeDeprecatedAPIs} = settings
|
||||
{@resourcePath, pathToOpen, locationsToOpen, @isSpec, @exitWhenDone, @safeMode, @devMode} = settings
|
||||
locationsToOpen ?= [{pathToOpen}] if pathToOpen
|
||||
locationsToOpen ?= []
|
||||
|
||||
@@ -47,7 +47,6 @@ class AtomWindow
|
||||
loadSettings.resourcePath = @resourcePath
|
||||
loadSettings.devMode ?= false
|
||||
loadSettings.safeMode ?= false
|
||||
loadSettings.includeDeprecatedAPIs ?= false
|
||||
|
||||
# Only send to the first non-spec window created
|
||||
if @constructor.includeShellLoadTime and not @isSpec
|
||||
|
||||
@@ -137,7 +137,6 @@ parseCommandLine = ->
|
||||
executedFrom = args['executed-from']
|
||||
devMode = args['dev']
|
||||
safeMode = args['safe']
|
||||
includeDeprecatedAPIs = args['include-deprecated-apis']
|
||||
pathsToOpen = args._
|
||||
test = args['test']
|
||||
specDirectory = args['spec-directory']
|
||||
@@ -171,7 +170,6 @@ parseCommandLine = ->
|
||||
process.env.PATH = args['path-environment'] if args['path-environment']
|
||||
|
||||
{resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed,
|
||||
devMode, includeDeprecatedAPIs, safeMode, newWindow, specDirectory, logFile,
|
||||
socketPath, profileStartup}
|
||||
devMode, safeMode, newWindow, specDirectory, logFile, socketPath, profileStartup}
|
||||
|
||||
start()
|
||||
|
||||
@@ -31,7 +31,7 @@ class Clipboard
|
||||
# {::readWithMetadata}.
|
||||
#
|
||||
# * `text` The {String} to store.
|
||||
# * `metadata` The additional info to associate with the text.
|
||||
# * `metadata` (optional) The additional info to associate with the text.
|
||||
write: (text, metadata) ->
|
||||
@signatureForMetadata = @md5(text)
|
||||
@metadata = metadata
|
||||
|
||||
@@ -92,6 +92,9 @@ class CommandRegistry
|
||||
disposable.add @add(target, commandName, callback)
|
||||
return disposable
|
||||
|
||||
if typeof callback isnt 'function'
|
||||
throw new Error("Can't register a command with non-function callback.")
|
||||
|
||||
if typeof target is 'string'
|
||||
validateSelector(target)
|
||||
@addSelectorBasedListener(target, commandName, callback)
|
||||
|
||||
@@ -323,8 +323,22 @@ class Project extends Model
|
||||
# allow ENOENT errors to create an editor for paths that dont exist
|
||||
throw error unless error.code is 'ENOENT'
|
||||
|
||||
@bufferForPath(filePath).then (buffer) =>
|
||||
@buildEditorForBuffer(buffer, options)
|
||||
absoluteFilePath = @resolvePath(filePath)
|
||||
|
||||
fileSize = fs.getSizeSync(absoluteFilePath)
|
||||
|
||||
if fileSize >= 20 * 1048576 # 20MB
|
||||
choice = atom.confirm
|
||||
message: 'Atom will be unresponsive during the loading of very large files.'
|
||||
detailedMessage: "Do you still want to load this file?"
|
||||
buttons: ["Proceed", "Cancel"]
|
||||
if choice is 1
|
||||
error = new Error
|
||||
error.code = 'CANCELLED'
|
||||
throw error
|
||||
|
||||
@bufferForPath(absoluteFilePath).then (buffer) =>
|
||||
@buildEditorForBuffer(buffer, _.extend({fileSize}, options))
|
||||
|
||||
# Retrieves all the {TextBuffer}s in the project; that is, the
|
||||
# buffers for all open files.
|
||||
@@ -354,8 +368,7 @@ class Project extends Model
|
||||
# * `filePath` A {String} representing a path. If `null`, an "Untitled" buffer is created.
|
||||
#
|
||||
# Returns a promise that resolves to the {TextBuffer}.
|
||||
bufferForPath: (filePath) ->
|
||||
absoluteFilePath = @resolvePath(filePath)
|
||||
bufferForPath: (absoluteFilePath) ->
|
||||
existingBuffer = @findBufferForPath(absoluteFilePath) if absoluteFilePath
|
||||
Q(existingBuffer ? @buildBuffer(absoluteFilePath))
|
||||
|
||||
@@ -405,7 +418,7 @@ class Project extends Model
|
||||
buffer?.destroy()
|
||||
|
||||
buildEditorForBuffer: (buffer, editorOptions) ->
|
||||
largeFileMode = fs.getSizeSync(buffer.getPath()) >= 2 * 1048576 # 2MB
|
||||
largeFileMode = editorOptions.fileSize >= 2 * 1048576 # 2MB
|
||||
editor = new TextEditor(_.extend({buffer, largeFileMode, registerEditor: true}, editorOptions))
|
||||
editor
|
||||
|
||||
|
||||
@@ -749,6 +749,8 @@ class TextEditor extends Model
|
||||
###
|
||||
|
||||
# Essential: Replaces the entire contents of the buffer with the given {String}.
|
||||
#
|
||||
# * `text` A {String} to replace with
|
||||
setText: (text) -> @buffer.setText(text)
|
||||
|
||||
# Essential: Set the text in the given {Range} in buffer coordinates.
|
||||
|
||||
@@ -140,8 +140,6 @@ atom.commands.add 'atom-workspace',
|
||||
'application:open-folder': -> ipc.send('command', 'application:open-folder')
|
||||
'application:open-dev': -> ipc.send('command', 'application:open-dev')
|
||||
'application:open-safe': -> ipc.send('command', 'application:open-safe')
|
||||
'application:open-with-deprecated-apis': -> ipc.send('command', 'application:open-with-deprecated-apis')
|
||||
'application:open-dev-with-deprecated-apis': -> ipc.send('command', 'application:open-dev-with-deprecated-apis')
|
||||
'application:add-project-folder': -> atom.addProjectFolder()
|
||||
'application:minimize': -> ipc.send('command', 'application:minimize')
|
||||
'application:zoom': -> ipc.send('command', 'application:zoom')
|
||||
|
||||
@@ -437,15 +437,16 @@ class Workspace extends Model
|
||||
item ?= atom.project.open(uri, options)
|
||||
catch error
|
||||
switch error.code
|
||||
when 'EFILETOOLARGE'
|
||||
atom.notifications.addWarning("#{error.message} Large file support is being tracked at [atom/atom#307](https://github.com/atom/atom/issues/307).")
|
||||
when 'CANCELLED'
|
||||
return Q()
|
||||
when 'EACCES'
|
||||
atom.notifications.addWarning("Permission denied '#{error.path}'")
|
||||
return Q()
|
||||
when 'EPERM', 'EBUSY'
|
||||
atom.notifications.addWarning("Unable to open '#{error.path}'", detail: error.message)
|
||||
return Q()
|
||||
else
|
||||
throw error
|
||||
return Q()
|
||||
|
||||
Q(item)
|
||||
.then (item) =>
|
||||
|
||||
@@ -75,7 +75,8 @@ var setupWindow = function(loadSettings) {
|
||||
ModuleCache.register(loadSettings);
|
||||
ModuleCache.add(loadSettings.resourcePath);
|
||||
|
||||
require('grim').includeDeprecatedAPIs = !!loadSettings.includeDeprecatedAPIs;
|
||||
// Only include deprecated APIs when running core spec
|
||||
require('grim').includeDeprecatedAPIs = isRunningCoreSpecs(loadSettings);
|
||||
|
||||
// Start the crash reporter before anything else.
|
||||
require('crash-reporter').start({
|
||||
@@ -219,6 +220,14 @@ var setupWindowBackground = function() {
|
||||
}, false);
|
||||
}
|
||||
|
||||
var isRunningCoreSpecs = function(loadSettings) {
|
||||
return !!(loadSettings &&
|
||||
loadSettings.isSpec &&
|
||||
loadSettings.specDirectory &&
|
||||
loadSettings.resourcePath &&
|
||||
path.dirname(loadSettings.specDirectory) === loadSettings.resourcePath);
|
||||
}
|
||||
|
||||
parseLoadSettings();
|
||||
setupWindowBackground();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user