mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Merge branch 'master' into wl-electron-35
This commit is contained in:
@@ -365,7 +365,7 @@ Please open an issue on `atom/atom` if you have suggestions for new labels, and
|
||||
| `blocked` | [search][search-atom-repo-label-blocked] | [search][search-atom-org-label-blocked] | Issues blocked on other issues. |
|
||||
| `duplicate` | [search][search-atom-repo-label-duplicate] | [search][search-atom-org-label-duplicate] | Issues which are duplicates of other issues, i.e. they have been reported before. |
|
||||
| `wontfix` | [search][search-atom-repo-label-wontfix] | [search][search-atom-org-label-wontfix] | The Atom core team has decided not to fix these issues for now, either because they're working as intended or for some other reason. |
|
||||
| `invalid` | [search][search-atom-repo-label-invalid] | [search][search-atom-org-label-invalid] | Issues which are't valid (e.g. user errors). |
|
||||
| `invalid` | [search][search-atom-repo-label-invalid] | [search][search-atom-org-label-invalid] | Issues which aren't valid (e.g. user errors). |
|
||||
| `package-idea` | [search][search-atom-repo-label-package-idea] | [search][search-atom-org-label-package-idea] | Feature request which might be good candidates for new packages, instead of extending Atom or core Atom packages. |
|
||||
| `wrong-repo` | [search][search-atom-repo-label-wrong-repo] | [search][search-atom-org-label-wrong-repo] | Issues reported on the wrong repository (e.g. a bug related to the [Settings View package](https://github.com/atom/settings-view) was reported on [Atom core](https://github.com/atom/atom)). |
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ BABEL_PREFIXES = [
|
||||
"'use babel'"
|
||||
'"use babel"'
|
||||
'/** @babel */'
|
||||
'/* @flow */'
|
||||
]
|
||||
|
||||
PREFIX_LENGTH = Math.max(BABEL_PREFIXES.map((prefix) -> prefix.length)...)
|
||||
|
||||
@@ -54,6 +54,9 @@ module.exports = (grunt) ->
|
||||
# so that it doesn't becomes larger than it needs to be.
|
||||
ignoredPaths = [
|
||||
path.join('git-utils', 'deps')
|
||||
path.join('nodegit', 'vendor')
|
||||
path.join('nodegit', 'node_modules', 'node-pre-gyp')
|
||||
path.join('nodegit', 'node_modules', '.bin')
|
||||
path.join('oniguruma', 'deps')
|
||||
path.join('less', 'dist')
|
||||
path.join('bootstrap', 'docs')
|
||||
@@ -119,6 +122,9 @@ module.exports = (grunt) ->
|
||||
# Ignore *.cc and *.h files from native modules
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('ctags', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('git-utils', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('nodegit', 'src') + path.sep)}.*\\.(cc|h)?"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('nodegit', 'generate') + path.sep)}.*\\.(cc|h)?"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('nodegit', 'include') + path.sep)}.*\\.(cc|h)?"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('keytar', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('nslog', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('oniguruma', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
@@ -126,6 +132,8 @@ module.exports = (grunt) ->
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('runas', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('scrollbar-style', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('spellchecker', 'src') + path.sep)}.*\\.(cc|h)*"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('cached-run-in-this-context', 'src') + path.sep)}.*\\.(cc|h)?"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('marker-index', 'src') + path.sep)}.*\\.(cc|h)?"
|
||||
ignoredPaths.push "#{_.escapeRegExp(path.join('keyboard-layout', 'src') + path.sep)}.*\\.(cc|h|mm)*"
|
||||
|
||||
# Ignore build files
|
||||
@@ -178,6 +186,7 @@ module.exports = (grunt) ->
|
||||
cp path.join('resources', 'win', 'atom.cmd'), path.join(shellAppDir, 'resources', 'cli', 'atom.cmd')
|
||||
cp path.join('resources', 'win', 'atom.sh'), path.join(shellAppDir, 'resources', 'cli', 'atom.sh')
|
||||
cp path.join('resources', 'win', 'atom.js'), path.join(shellAppDir, 'resources', 'cli', 'atom.js')
|
||||
cp path.join('resources', 'win', 'apm.cmd'), path.join(shellAppDir, 'resources', 'cli', 'apm.cmd')
|
||||
cp path.join('resources', 'win', 'apm.sh'), path.join(shellAppDir, 'resources', 'cli', 'apm.sh')
|
||||
|
||||
if process.platform is 'linux'
|
||||
|
||||
@@ -3,32 +3,40 @@
|
||||
## Requirements
|
||||
|
||||
### General
|
||||
* [Node.js](http://nodejs.org/en/download/) v4.x
|
||||
* [Python](https://www.python.org/downloads/) v2.7.x
|
||||
* [Node.js](http://nodejs.org/en/download/) v4.x
|
||||
* [Python](https://www.python.org/downloads/) v2.7.x
|
||||
* The python.exe must be available at `%SystemDrive%\Python27\python.exe`.
|
||||
If it is installed elsewhere, you can create a symbolic link to the
|
||||
directory containing the python.exe using:
|
||||
`mklink /d %SystemDrive%\Python27 D:\elsewhere\Python27`
|
||||
* [GitHub Desktop](http://desktop.github.com/)
|
||||
|
||||
### On Windows 7
|
||||
* [Visual Studio 2013 Update 5](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_4)
|
||||
### Visual Studio
|
||||
|
||||
### On Windows 8 or 10
|
||||
* [Visual Studio Express 2013 or 2015 for Windows Desktop](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_2)
|
||||
* To ensure that node-gyp knows what version of Visual Studio is installed, set the `GYP_MSVS_VERSION` environment variable to the Visual Studio version (e.g. `2013` or `2015`)
|
||||
You can use either:
|
||||
|
||||
* [Visual Studio 2013 Update 5](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs) (Express or better) on Windows 7, 8 or 10
|
||||
* [Visual Studio 2015](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs) (Community or better) with Windows 8 or 10
|
||||
|
||||
Whichever version you use, ensure that:
|
||||
|
||||
* The default installation folder is chosen so the build tools can find it
|
||||
* Visual C++ support is installed
|
||||
* You set the `GYP_MSVS_VERSION` environment variable to the Visual Studio version (`2013` or `2015`), e.g. , e.g. ``[Environment]::SetEnvironmentVariable("GYP_MSVS_VERSION", "2015", "User")`` in PowerShell or set it in Windows advanced system settings control panel.
|
||||
* The git command is in your path
|
||||
|
||||
## Instructions
|
||||
|
||||
You can run these commands using Command Prompt, PowerShell or Git Shell via [GitHub Desktop](https://desktop.github.com/). These instructions will assume the use of Bash from Git Shell - if you are using Command Prompt use a backslash instead: i.e. `script\build`.
|
||||
|
||||
**VS2015 + Git Shell users** should note that the default path supplied with Git Shell includes reference to an older version of msbuild that will fail. It is recommended you use a PowerShell window that has git in the path at this time.
|
||||
|
||||
```bash
|
||||
# Use the Git Shell program which was installed by GitHub Desktop
|
||||
cd C:\
|
||||
git clone https://github.com/atom/atom/
|
||||
cd atom
|
||||
script/build # Creates application in the `Program Files` directory
|
||||
script/build
|
||||
```
|
||||
Note: If you use cmd or Powershell instead of Git Shell, use a backslash instead: i.e. `script\build`.
|
||||
These instructions will assume the use of Git Shell.
|
||||
This will create the Atom application in the `Program Files` folder.
|
||||
|
||||
### `script/build` Options
|
||||
* `--install-dir` - Creates the final built application in this directory. Example (trailing slash is optional):
|
||||
@@ -41,24 +49,25 @@ These instructions will assume the use of Git Shell.
|
||||
```
|
||||
* `--verbose` - Verbose mode. A lot more information output.
|
||||
|
||||
## Why do I have to use GitHub Desktop?
|
||||
## Do I have to use GitHub Desktop?
|
||||
|
||||
You don't. You can use your existing Git! GitHub Desktop's Git Shell is just easier to set up.
|
||||
No, you can use your existing Git! GitHub Desktop's Git Shell is just easier to set up.
|
||||
|
||||
If you _prefer_ using your existing Git installation, make sure git's cmd directory is in your PATH env variable (e.g. `C:\Program Files (x86)\Git\cmd`) before you open your powershell or command window.
|
||||
Note that you may have to open your command window as administrator. For powershell that doesn't seem to always be the case, though.
|
||||
If you _prefer_ using your existing Git installation, make sure git's cmd directory is in your PATH env variable (e.g. `C:\Program Files (x86)\Git\cmd`) before you open your PowerShell or Command Prompt.
|
||||
|
||||
If none of this works, do install Github Desktop and use its Git shell. Makes life easier.
|
||||
It is also recommended you open your Command Prompt or PowerShell as Administrator.
|
||||
|
||||
If none of this works, do install Github Desktop and use its Git Shell as it makes life easier.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Errors
|
||||
* `node is not recognized`
|
||||
|
||||
* If you just installed node, you'll need to restart your computer before node is
|
||||
available on your Path.
|
||||
* If you just installed Node.js, you'll need to restart your PowerShell/Command Prompt/Git Shell before the node
|
||||
command is available on your Path.
|
||||
|
||||
* `script/build` outputs only the Node and Python versions before returning
|
||||
* `script/build` outputs only the Node.js and Python versions before returning
|
||||
|
||||
* Try moving the repository to `C:\atom`. Most likely, the path is too long.
|
||||
See [issue #2200](https://github.com/atom/atom/issues/2200).
|
||||
@@ -67,7 +76,7 @@ If none of this works, do install Github Desktop and use its Git shell. Makes li
|
||||
|
||||
* This can occur because your home directory (`%USERPROFILE%`) has non-ASCII
|
||||
characters in it. This is a bug in [gyp](https://code.google.com/p/gyp/)
|
||||
which is used to build native node modules and there is no known workaround.
|
||||
which is used to build native Node.js modules and there is no known workaround.
|
||||
* https://github.com/TooTallNate/node-gyp/issues/297
|
||||
* https://code.google.com/p/gyp/issues/detail?id=393
|
||||
|
||||
@@ -75,19 +84,20 @@ If none of this works, do install Github Desktop and use its Git shell. Makes li
|
||||
|
||||
* See the next item.
|
||||
|
||||
* `error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.`
|
||||
* `error MSB8020: The build tools for Visual Studio 201? (Platform Toolset = 'v1?0') cannot be found.`
|
||||
|
||||
* If you're building Atom with Visual Studio 2013 or above make sure the `GYP_MSVS_VERSION` environment variable is set, and then re-run `script/build`:
|
||||
* If you're building Atom with Visual Studio 2013 or above make sure the `GYP_MSVS_VERSION` environment variable is set, and then re-run `script/build` after a clean:
|
||||
|
||||
```bash
|
||||
$env:GYP_MSVS_VERSION='2013' # '2015' if using Visual Studio 2015, and so on
|
||||
script/clean
|
||||
script/build
|
||||
```
|
||||
* If you are using Visual Studio 2013 or above and the build fails with some other error message this environment variable might still be required.
|
||||
* If you are using Visual Studio 2013 or above and the build fails with some other error message this environment variable might still be required and ensure you have Visual C++ language support installed.
|
||||
|
||||
* Other `node-gyp` errors on first build attempt, even though the right node and python versions are installed.
|
||||
* Other `node-gyp` errors on first build attempt, even though the right Node.js and Python versions are installed.
|
||||
* Do try the build command one more time, as experience shows it often works on second try in many of these cases.
|
||||
|
||||
### Windows build error reports in atom/atom
|
||||
* If all fails, use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+label%3Awindows&type=Issues) to get a list of reports about build errors on Windows, and see if yours has already been reported.
|
||||
* If it hasn't, please open a new issue with your Windows version, architecture (x86 or amd64), and a screenshot of your build output, including the Node and Python versions.
|
||||
* If it hasn't, please open a new issue with your Windows version, architecture (x86 or amd64), and a screenshot of your build output, including the Node.js and Python versions.
|
||||
|
||||
@@ -81,10 +81,10 @@
|
||||
'cmd-_': 'window:decrease-font-size'
|
||||
'cmd-0': 'window:reset-font-size'
|
||||
|
||||
'cmd-k up': 'pane:split-up' # Atom Specific
|
||||
'cmd-k down': 'pane:split-down' # Atom Specific
|
||||
'cmd-k left': 'pane:split-left' # Atom Specific
|
||||
'cmd-k right': 'pane:split-right' # Atom Specific
|
||||
'cmd-k up': 'pane:split-up-and-copy-active-item' # Atom Specific
|
||||
'cmd-k down': 'pane:split-down-and-copy-active-item' # Atom Specific
|
||||
'cmd-k left': 'pane:split-left-and-copy-active-item' # Atom Specific
|
||||
'cmd-k right': 'pane:split-right-and-copy-active-item' # Atom Specific
|
||||
'cmd-k cmd-w': 'pane:close' # Atom Specific
|
||||
'cmd-k alt-cmd-w': 'pane:close-other-items' # Atom Specific
|
||||
'cmd-k cmd-p': 'window:focus-previous-pane'
|
||||
|
||||
@@ -60,10 +60,10 @@
|
||||
'ctrl-_': 'window:decrease-font-size'
|
||||
'ctrl-0': 'window:reset-font-size'
|
||||
|
||||
'ctrl-k up': 'pane:split-up' # Atom Specific
|
||||
'ctrl-k down': 'pane:split-down' # Atom Specific
|
||||
'ctrl-k left': 'pane:split-left' # Atom Specific
|
||||
'ctrl-k right': 'pane:split-right' # Atom Specific
|
||||
'ctrl-k up': 'pane:split-up-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k down': 'pane:split-down-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k left': 'pane:split-left-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k right': 'pane:split-right-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k ctrl-w': 'pane:close' # Atom Specific
|
||||
'ctrl-k alt-ctrl-w': 'pane:close-other-items' # Atom Specific
|
||||
'ctrl-k ctrl-p': 'window:focus-previous-pane'
|
||||
|
||||
@@ -66,10 +66,10 @@
|
||||
'ctrl-_': 'window:decrease-font-size'
|
||||
'ctrl-0': 'window:reset-font-size'
|
||||
|
||||
'ctrl-k up': 'pane:split-up' # Atom Specific
|
||||
'ctrl-k down': 'pane:split-down' # Atom Specific
|
||||
'ctrl-k left': 'pane:split-left' # Atom Specific
|
||||
'ctrl-k right': 'pane:split-right' # Atom Specific
|
||||
'ctrl-k up': 'pane:split-up-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k down': 'pane:split-down-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k left': 'pane:split-left-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k right': 'pane:split-right-and-copy-active-item' # Atom Specific
|
||||
'ctrl-k ctrl-w': 'pane:close' # Atom Specific
|
||||
'ctrl-k alt-ctrl-w': 'pane:close-other-items' # Atom Specific
|
||||
'ctrl-k ctrl-p': 'window:focus-previous-pane'
|
||||
|
||||
76
package.json
76
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "1.6.0-dev",
|
||||
"version": "1.7.0-dev",
|
||||
"description": "A hackable text editor for the 21st Century.",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"fs-plus": "^2.8.0",
|
||||
"fstream": "0.1.24",
|
||||
"fuzzaldrin": "^2.1",
|
||||
"git-utils": "^4.1.0",
|
||||
"git-utils": "^4.1.2",
|
||||
"grim": "1.5.0",
|
||||
"jasmine-json": "~0.0",
|
||||
"jasmine-tagged": "^1.1.4",
|
||||
@@ -54,7 +54,7 @@
|
||||
"service-hub": "^0.7.0",
|
||||
"source-map-support": "^0.3.2",
|
||||
"temp": "0.8.1",
|
||||
"text-buffer": "8.2.1",
|
||||
"text-buffer": "8.3.0",
|
||||
"typescript-simple": "1.0.0",
|
||||
"underscore-plus": "^1.6.6",
|
||||
"yargs": "^3.23.0"
|
||||
@@ -66,70 +66,70 @@
|
||||
"atom-light-ui": "0.43.0",
|
||||
"base16-tomorrow-dark-theme": "1.1.0",
|
||||
"base16-tomorrow-light-theme": "1.1.1",
|
||||
"one-dark-ui": "1.1.9",
|
||||
"one-light-ui": "1.1.9",
|
||||
"one-dark-ui": "1.2.0",
|
||||
"one-light-ui": "1.2.0",
|
||||
"one-dark-syntax": "1.2.0",
|
||||
"one-light-syntax": "1.2.0",
|
||||
"solarized-dark-syntax": "1.0.0",
|
||||
"solarized-light-syntax": "1.0.0",
|
||||
"about": "1.3.0",
|
||||
"archive-view": "0.61.0",
|
||||
"about": "1.3.1",
|
||||
"archive-view": "0.61.1",
|
||||
"autocomplete-atom-api": "0.10.0",
|
||||
"autocomplete-css": "0.11.0",
|
||||
"autocomplete-html": "0.7.2",
|
||||
"autocomplete-plus": "2.26.0",
|
||||
"autocomplete-plus": "2.27.1",
|
||||
"autocomplete-snippets": "1.10.0",
|
||||
"autoflow": "0.26.0",
|
||||
"autosave": "0.23.0",
|
||||
"autoflow": "0.27.0",
|
||||
"autosave": "0.23.1",
|
||||
"background-tips": "0.26.0",
|
||||
"bookmarks": "0.38.2",
|
||||
"bracket-matcher": "0.79.0",
|
||||
"bracket-matcher": "0.79.1",
|
||||
"command-palette": "0.38.0",
|
||||
"deprecation-cop": "0.54.0",
|
||||
"deprecation-cop": "0.54.1",
|
||||
"dev-live-reload": "0.47.0",
|
||||
"encoding-selector": "0.21.0",
|
||||
"exception-reporting": "0.37.0",
|
||||
"find-and-replace": "0.197.1",
|
||||
"fuzzy-finder": "0.94.0",
|
||||
"git-diff": "0.57.0",
|
||||
"find-and-replace": "0.197.2",
|
||||
"fuzzy-finder": "0.94.1",
|
||||
"git-diff": "0.57.1",
|
||||
"go-to-line": "0.30.0",
|
||||
"grammar-selector": "0.48.0",
|
||||
"grammar-selector": "0.48.1",
|
||||
"image-view": "0.56.0",
|
||||
"incompatible-packages": "0.25.0",
|
||||
"incompatible-packages": "0.25.1",
|
||||
"keybinding-resolver": "0.33.0",
|
||||
"line-ending-selector": "0.3.0",
|
||||
"line-ending-selector": "0.3.1",
|
||||
"link": "0.31.0",
|
||||
"markdown-preview": "0.157.2",
|
||||
"markdown-preview": "0.157.3",
|
||||
"metrics": "0.53.1",
|
||||
"notifications": "0.62.1",
|
||||
"open-on-github": "0.41.0",
|
||||
"package-generator": "0.41.0",
|
||||
"settings-view": "0.232.3",
|
||||
"notifications": "0.62.2",
|
||||
"open-on-github": "0.41.1",
|
||||
"package-generator": "0.41.1",
|
||||
"settings-view": "0.232.4",
|
||||
"snippets": "1.0.1",
|
||||
"spell-check": "0.65.0",
|
||||
"status-bar": "0.82.0",
|
||||
"styleguide": "0.45.1",
|
||||
"symbols-view": "0.110.1",
|
||||
"tabs": "0.90.0",
|
||||
"timecop": "0.33.0",
|
||||
"tree-view": "0.201.0",
|
||||
"spell-check": "0.66.1",
|
||||
"status-bar": "0.83.1",
|
||||
"styleguide": "0.45.2",
|
||||
"symbols-view": "0.111.1",
|
||||
"tabs": "0.90.2",
|
||||
"timecop": "0.33.1",
|
||||
"tree-view": "0.201.2",
|
||||
"update-package-dependencies": "0.10.0",
|
||||
"welcome": "0.33.0",
|
||||
"whitespace": "0.32.1",
|
||||
"welcome": "0.33.1",
|
||||
"whitespace": "0.32.2",
|
||||
"wrap-guide": "0.38.1",
|
||||
"language-c": "0.51.1",
|
||||
"language-clojure": "0.19.1",
|
||||
"language-coffee-script": "0.46.0",
|
||||
"language-coffee-script": "0.46.1",
|
||||
"language-csharp": "0.11.0",
|
||||
"language-css": "0.36.0",
|
||||
"language-gfm": "0.84.0",
|
||||
"language-git": "0.12.1",
|
||||
"language-go": "0.42.0",
|
||||
"language-html": "0.44.0",
|
||||
"language-html": "0.44.1",
|
||||
"language-hyperlink": "0.16.0",
|
||||
"language-java": "0.17.0",
|
||||
"language-javascript": "0.109.0",
|
||||
"language-json": "0.17.3",
|
||||
"language-javascript": "0.110.0",
|
||||
"language-json": "0.17.4",
|
||||
"language-less": "0.29.0",
|
||||
"language-make": "0.21.0",
|
||||
"language-mustache": "0.13.0",
|
||||
@@ -138,7 +138,7 @@
|
||||
"language-php": "0.37.0",
|
||||
"language-property-list": "0.8.0",
|
||||
"language-python": "0.43.0",
|
||||
"language-ruby": "0.68.0",
|
||||
"language-ruby": "0.68.1",
|
||||
"language-ruby-on-rails": "0.25.0",
|
||||
"language-sass": "0.45.0",
|
||||
"language-shellscript": "0.21.0",
|
||||
@@ -147,7 +147,7 @@
|
||||
"language-text": "0.7.0",
|
||||
"language-todo": "0.27.0",
|
||||
"language-toml": "0.18.0",
|
||||
"language-xml": "0.34.2",
|
||||
"language-xml": "0.34.3",
|
||||
"language-yaml": "0.25.1"
|
||||
},
|
||||
"private": true,
|
||||
|
||||
@@ -36,6 +36,11 @@ describe "Babel transpiler support", ->
|
||||
transpiled = require('./fixtures/babel/babel-double-quotes.js')
|
||||
expect(transpiled(3)).toBe 4
|
||||
|
||||
describe 'when a .js file starts with /* @flow */', ->
|
||||
it "transpiles it using babel", ->
|
||||
transpiled = require('./fixtures/babel/flow-comment.js')
|
||||
expect(transpiled(3)).toBe 4
|
||||
|
||||
describe "when a .js file does not start with 'use babel';", ->
|
||||
it "does not transpile it using babel", ->
|
||||
expect(-> require('./fixtures/babel/invalid.js')).toThrow()
|
||||
|
||||
4
spec/fixtures/babel/flow-comment.js
vendored
Normal file
4
spec/fixtures/babel/flow-comment.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/* @flow */
|
||||
|
||||
const f: Function = v => v + 1
|
||||
module.exports = f
|
||||
@@ -1,6 +0,0 @@
|
||||
module.exports = function (state) {
|
||||
return {
|
||||
wasDeserializedBy: 'Deserializer1',
|
||||
state: state
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
module.exports = function (state) {
|
||||
return {
|
||||
wasDeserializedBy: 'Deserializer2',
|
||||
state: state
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,17 @@
|
||||
module.exports = {
|
||||
activate: function() {}
|
||||
activate () {},
|
||||
|
||||
deserializeMethod1 (state) {
|
||||
return {
|
||||
wasDeserializedBy: 'deserializeMethod1',
|
||||
state: state
|
||||
}
|
||||
},
|
||||
|
||||
deserializeMethod2 (state) {
|
||||
return {
|
||||
wasDeserializedBy: 'deserializeMethod2',
|
||||
state: state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"main": "./index",
|
||||
"deserializers": {
|
||||
"Deserializer1": "./deserializer-1.js",
|
||||
"Deserializer2": "./deserializer-2.js"
|
||||
"Deserializer1": "deserializeMethod1",
|
||||
"Deserializer2": "deserializeMethod2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
module.exports = function (state) {
|
||||
return {state: state}
|
||||
}
|
||||
@@ -1,3 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
activate: function() {}
|
||||
activate () {},
|
||||
|
||||
theDeserializerMethod (state) {
|
||||
return {state: state}
|
||||
},
|
||||
|
||||
viewProviderMethod1 (model) {
|
||||
if (model.worksWithViewProvider1) {
|
||||
let element = document.createElement('div')
|
||||
element.dataset['createdBy'] = 'view-provider-1'
|
||||
return element
|
||||
}
|
||||
},
|
||||
|
||||
viewProviderMethod2 (model) {
|
||||
if (model.worksWithViewProvider2) {
|
||||
let element = document.createElement('div')
|
||||
element.dataset['createdBy'] = 'view-provider-2'
|
||||
return element
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"main": "./index",
|
||||
"version": "1.0.0",
|
||||
"deserializers": {
|
||||
"DeserializerFromPackageWithViewProviders": "./deserializer"
|
||||
"DeserializerFromPackageWithViewProviders": "theDeserializerMethod"
|
||||
},
|
||||
"viewProviders": [
|
||||
"./view-provider-1",
|
||||
"./view-provider-2"
|
||||
"viewProviderMethod1",
|
||||
"viewProviderMethod2"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (model) {
|
||||
if (model.worksWithViewProvider1) {
|
||||
let element = document.createElement('div')
|
||||
element.dataset['createdBy'] = 'view-provider-1'
|
||||
return element
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (model) {
|
||||
if (model.worksWithViewProvider2) {
|
||||
let element = document.createElement('div')
|
||||
element.dataset['createdBy'] = 'view-provider-2'
|
||||
return element
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ describe "GitRepository", ->
|
||||
expect(repo.isStatusModified(repo.getDirectoryStatus(directoryPath))).toBe true
|
||||
|
||||
describe ".refreshStatus()", ->
|
||||
[newPath, modifiedPath, cleanPath, originalModifiedPathText] = []
|
||||
[newPath, modifiedPath, cleanPath, originalModifiedPathText, workingDirectory] = []
|
||||
|
||||
beforeEach ->
|
||||
workingDirectory = copyRepository()
|
||||
@@ -231,6 +231,64 @@ describe "GitRepository", ->
|
||||
expect(repo.isStatusNew(repo.getCachedPathStatus(newPath))).toBeTruthy()
|
||||
expect(repo.isStatusModified(repo.getCachedPathStatus(modifiedPath))).toBeTruthy()
|
||||
|
||||
it 'caches the proper statuses when a subdir is open', ->
|
||||
subDir = path.join(workingDirectory, 'dir')
|
||||
fs.mkdirSync(subDir)
|
||||
|
||||
filePath = path.join(subDir, 'b.txt')
|
||||
fs.writeFileSync(filePath, '')
|
||||
|
||||
atom.project.setPaths([subDir])
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('b.txt')
|
||||
|
||||
statusHandler = null
|
||||
runs ->
|
||||
repo = atom.project.getRepositories()[0]
|
||||
|
||||
statusHandler = jasmine.createSpy('statusHandler')
|
||||
repo.onDidChangeStatuses statusHandler
|
||||
repo.refreshStatus()
|
||||
|
||||
waitsFor ->
|
||||
statusHandler.callCount > 0
|
||||
|
||||
runs ->
|
||||
status = repo.getCachedPathStatus(filePath)
|
||||
expect(repo.isStatusModified(status)).toBe false
|
||||
expect(repo.isStatusNew(status)).toBe false
|
||||
|
||||
it 'caches the proper statuses when multiple project are open', ->
|
||||
otherWorkingDirectory = copyRepository()
|
||||
|
||||
atom.project.setPaths([workingDirectory, otherWorkingDirectory])
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('b.txt')
|
||||
|
||||
statusHandler = null
|
||||
runs ->
|
||||
repo = atom.project.getRepositories()[0]
|
||||
|
||||
statusHandler = jasmine.createSpy('statusHandler')
|
||||
repo.onDidChangeStatuses statusHandler
|
||||
repo.refreshStatus()
|
||||
|
||||
waitsFor ->
|
||||
statusHandler.callCount > 0
|
||||
|
||||
runs ->
|
||||
subDir = path.join(workingDirectory, 'dir')
|
||||
fs.mkdirSync(subDir)
|
||||
|
||||
filePath = path.join(subDir, 'b.txt')
|
||||
fs.writeFileSync(filePath, '')
|
||||
|
||||
status = repo.getCachedPathStatus(filePath)
|
||||
expect(repo.isStatusModified(status)).toBe true
|
||||
expect(repo.isStatusNew(status)).toBe false
|
||||
|
||||
describe "buffer events", ->
|
||||
[editor] = []
|
||||
|
||||
|
||||
@@ -88,18 +88,16 @@ describe "PackageManager", ->
|
||||
|
||||
state1 = {deserializer: 'Deserializer1', a: 'b'}
|
||||
expect(atom.deserializers.deserialize(state1)).toEqual {
|
||||
wasDeserializedBy: 'Deserializer1'
|
||||
wasDeserializedBy: 'deserializeMethod1'
|
||||
state: state1
|
||||
}
|
||||
|
||||
state2 = {deserializer: 'Deserializer2', c: 'd'}
|
||||
expect(atom.deserializers.deserialize(state2)).toEqual {
|
||||
wasDeserializedBy: 'Deserializer2'
|
||||
wasDeserializedBy: 'deserializeMethod2'
|
||||
state: state2
|
||||
}
|
||||
|
||||
expect(pack.mainModule).toBeNull()
|
||||
|
||||
describe "when there are view providers specified in the package's package.json", ->
|
||||
model1 = {worksWithViewProvider1: true}
|
||||
model2 = {worksWithViewProvider2: true}
|
||||
|
||||
@@ -231,10 +231,14 @@ describe "PaneContainerElement", ->
|
||||
expect(leftPane.getFlexScale()).toBe 1/1.1
|
||||
expect(rightPane.getFlexScale()).toBe 1/1.1
|
||||
|
||||
describe "changing focus directionally between panes", ->
|
||||
[containerElement, pane1, pane2, pane3, pane4, pane5, pane6, pane7, pane8, pane9] = []
|
||||
describe "changing focus, copying and moving items directionally between panes", ->
|
||||
[item1, item2, item3, item4, item5, item6, item7, item8, item9,
|
||||
pane1, pane2, pane3, pane4, pane5, pane6, pane7, pane8, pane9,
|
||||
container, containerElement] = []
|
||||
|
||||
beforeEach ->
|
||||
atom.config.set("core.destroyEmptyPanes", false)
|
||||
|
||||
# Set up a grid of 9 panes, in the following arrangement, where the
|
||||
# numbers correspond to the variable names below.
|
||||
#
|
||||
@@ -250,22 +254,30 @@ describe "PaneContainerElement", ->
|
||||
element = document.createElement('div')
|
||||
element.textContent = id
|
||||
element.tabIndex = -1
|
||||
element.copy = ->
|
||||
element.cloneNode(true)
|
||||
element
|
||||
|
||||
container = new PaneContainer(config: atom.config, confirm: atom.confirm.bind(atom))
|
||||
|
||||
[item1, item2, item3, item4, item5, item6, item7, item8, item9] =
|
||||
[buildElement('1'), buildElement('2'), buildElement('3'),
|
||||
buildElement('4'), buildElement('5'), buildElement('6'),
|
||||
buildElement('7'), buildElement('8'), buildElement('9')]
|
||||
|
||||
pane1 = container.getActivePane()
|
||||
pane1.activateItem(buildElement('1'))
|
||||
pane4 = pane1.splitDown(items: [buildElement('4')])
|
||||
pane7 = pane4.splitDown(items: [buildElement('7')])
|
||||
pane1.activateItem(item1)
|
||||
pane4 = pane1.splitDown(items: [item4])
|
||||
pane7 = pane4.splitDown(items: [item7])
|
||||
|
||||
pane2 = pane1.splitRight(items: [buildElement('2')])
|
||||
pane3 = pane2.splitRight(items: [buildElement('3')])
|
||||
pane2 = pane1.splitRight(items: [item2])
|
||||
pane3 = pane2.splitRight(items: [item3])
|
||||
|
||||
pane5 = pane4.splitRight(items: [buildElement('5')])
|
||||
pane6 = pane5.splitRight(items: [buildElement('6')])
|
||||
pane5 = pane4.splitRight(items: [item5])
|
||||
pane6 = pane5.splitRight(items: [item6])
|
||||
|
||||
pane8 = pane7.splitRight(items: [buildElement('8')])
|
||||
pane9 = pane8.splitRight(items: [buildElement('9')])
|
||||
pane8 = pane7.splitRight(items: [item8])
|
||||
pane9 = pane8.splitRight(items: [item9])
|
||||
|
||||
containerElement = atom.views.getView(container)
|
||||
containerElement.style.height = '400px'
|
||||
@@ -323,3 +335,87 @@ describe "PaneContainerElement", ->
|
||||
pane6.activate()
|
||||
containerElement.focusPaneViewOnRight()
|
||||
expect(document.activeElement).toBe pane6.getActiveItem()
|
||||
|
||||
describe "::moveActiveItemToPaneAbove(keepOriginal)", ->
|
||||
describe "when there are multiple rows above the focused pane", ->
|
||||
it "moves the active item up to the adjacent row", ->
|
||||
pane8.activate()
|
||||
containerElement.moveActiveItemToPaneAbove()
|
||||
expect(container.paneForItem(item8)).toBe pane5
|
||||
expect(pane5.getActiveItem()).toBe item8
|
||||
|
||||
describe "when there are no rows above the focused pane", ->
|
||||
it "keeps the active item in the focused pane", ->
|
||||
pane2.activate()
|
||||
containerElement.moveActiveItemToPaneAbove()
|
||||
expect(container.paneForItem(item2)).toBe pane2
|
||||
|
||||
describe "when `keepOriginal: true` is passed in the params", ->
|
||||
it "keeps the item and adds a copy of it to the adjacent pane", ->
|
||||
pane8.activate()
|
||||
containerElement.moveActiveItemToPaneAbove(keepOriginal: true)
|
||||
expect(container.paneForItem(item8)).toBe pane8
|
||||
expect(pane5.getActiveItem().textContent).toBe '8'
|
||||
|
||||
describe "::moveActiveItemToPaneBelow(keepOriginal)", ->
|
||||
describe "when there are multiple rows below the focused pane", ->
|
||||
it "moves the active item down to the adjacent row", ->
|
||||
pane2.activate()
|
||||
containerElement.moveActiveItemToPaneBelow()
|
||||
expect(container.paneForItem(item2)).toBe pane5
|
||||
expect(pane5.getActiveItem()).toBe item2
|
||||
|
||||
describe "when there are no rows below the focused pane", ->
|
||||
it "keeps the active item in the focused pane", ->
|
||||
pane8.activate()
|
||||
containerElement.moveActiveItemToPaneBelow()
|
||||
expect(container.paneForItem(item8)).toBe pane8
|
||||
|
||||
describe "when `keepOriginal: true` is passed in the params", ->
|
||||
it "keeps the item and adds a copy of it to the adjacent pane", ->
|
||||
pane2.activate()
|
||||
containerElement.moveActiveItemToPaneBelow(keepOriginal: true)
|
||||
expect(container.paneForItem(item2)).toBe pane2
|
||||
expect(pane5.getActiveItem().textContent).toBe '2'
|
||||
|
||||
describe "::moveActiveItemToPaneOnLeft(keepOriginal)", ->
|
||||
describe "when there are multiple columns to the left of the focused pane", ->
|
||||
it "moves the active item left to the adjacent column", ->
|
||||
pane6.activate()
|
||||
containerElement.moveActiveItemToPaneOnLeft()
|
||||
expect(container.paneForItem(item6)).toBe pane5
|
||||
expect(pane5.getActiveItem()).toBe item6
|
||||
|
||||
describe "when there are no columns to the left of the focused pane", ->
|
||||
it "keeps the active item in the focused pane", ->
|
||||
pane4.activate()
|
||||
containerElement.moveActiveItemToPaneOnLeft()
|
||||
expect(container.paneForItem(item4)).toBe pane4
|
||||
|
||||
describe "when `keepOriginal: true` is passed in the params", ->
|
||||
it "keeps the item and adds a copy of it to the adjacent pane", ->
|
||||
pane6.activate()
|
||||
containerElement.moveActiveItemToPaneOnLeft(keepOriginal: true)
|
||||
expect(container.paneForItem(item6)).toBe pane6
|
||||
expect(pane5.getActiveItem().textContent).toBe '6'
|
||||
|
||||
describe "::moveActiveItemToPaneOnRight(keepOriginal)", ->
|
||||
describe "when there are multiple columns to the right of the focused pane", ->
|
||||
it "moves the active item right to the adjacent column", ->
|
||||
pane4.activate()
|
||||
containerElement.moveActiveItemToPaneOnRight()
|
||||
expect(container.paneForItem(item4)).toBe pane5
|
||||
expect(pane5.getActiveItem()).toBe item4
|
||||
|
||||
describe "when there are no columns to the right of the focused pane", ->
|
||||
it "keeps the active item in the focused pane", ->
|
||||
pane6.activate()
|
||||
containerElement.moveActiveItemToPaneOnRight()
|
||||
expect(container.paneForItem(item6)).toBe pane6
|
||||
|
||||
describe "when `keepOriginal: true` is passed in the params", ->
|
||||
it "keeps the item and adds a copy of it to the adjacent pane", ->
|
||||
pane4.activate()
|
||||
containerElement.moveActiveItemToPaneOnRight(keepOriginal: true)
|
||||
expect(container.paneForItem(item4)).toBe pane4
|
||||
expect(pane5.getActiveItem().textContent).toBe '4'
|
||||
|
||||
@@ -325,3 +325,27 @@ describe "PaneContainer", ->
|
||||
expect(item1.saved).toBe true
|
||||
expect(item2.saved).toBe false
|
||||
expect(item3.saved).toBe true
|
||||
|
||||
describe "::moveActiveItemToPane(destPane) and ::copyActiveItemToPane(destPane)", ->
|
||||
[container, pane1, pane2, item1] = []
|
||||
|
||||
beforeEach ->
|
||||
class TestItem
|
||||
constructor: (id) -> @id = id
|
||||
copy: -> new TestItem(@id)
|
||||
|
||||
container = new PaneContainer(params)
|
||||
pane1 = container.getRoot()
|
||||
item1 = new TestItem('1')
|
||||
pane2 = pane1.splitRight(items: [item1])
|
||||
|
||||
describe "::::moveActiveItemToPane(destPane)", ->
|
||||
it "moves active item to given pane and focuses it", ->
|
||||
container.moveActiveItemToPane(pane1)
|
||||
expect(pane1.getActiveItem()).toBe item1
|
||||
|
||||
describe "::::copyActiveItemToPane(destPane)", ->
|
||||
it "copies active item to given pane and focuses it", ->
|
||||
container.copyActiveItemToPane(pane1)
|
||||
expect(container.paneForItem(item1)).toBe pane2
|
||||
expect(pane1.getActiveItem().id).toBe item1.id
|
||||
|
||||
@@ -606,12 +606,13 @@ describe "Pane", ->
|
||||
expect(item4.isDestroyed()).toBe false
|
||||
|
||||
describe "split methods", ->
|
||||
[pane1, container] = []
|
||||
[pane1, item1, container] = []
|
||||
|
||||
beforeEach ->
|
||||
container = new PaneContainer(config: atom.config, confirm: confirm, deserializerManager: atom.deserializers)
|
||||
pane1 = container.getActivePane()
|
||||
pane1.addItem(new Item("A"))
|
||||
item1 = new Item("A")
|
||||
pane1.addItem(item1)
|
||||
|
||||
describe "::splitLeft(params)", ->
|
||||
describe "when the parent is the container root", ->
|
||||
@@ -621,6 +622,11 @@ describe "Pane", ->
|
||||
expect(container.root.orientation).toBe 'horizontal'
|
||||
expect(container.root.children).toEqual [pane2, pane3, pane1]
|
||||
|
||||
describe "when `moveActiveItem: true` is passed in the params", ->
|
||||
it "moves the active item", ->
|
||||
pane2 = pane1.splitLeft(moveActiveItem: true)
|
||||
expect(pane2.getActiveItem()).toBe item1
|
||||
|
||||
describe "when `copyActiveItem: true` is passed in the params", ->
|
||||
it "duplicates the active item", ->
|
||||
pane2 = pane1.splitLeft(copyActiveItem: true)
|
||||
@@ -643,6 +649,11 @@ describe "Pane", ->
|
||||
expect(container.root.orientation).toBe 'horizontal'
|
||||
expect(container.root.children).toEqual [pane1, pane3, pane2]
|
||||
|
||||
describe "when `moveActiveItem: true` is passed in the params", ->
|
||||
it "moves the active item", ->
|
||||
pane2 = pane1.splitLeft(moveActiveItem: true)
|
||||
expect(pane2.getActiveItem()).toBe item1
|
||||
|
||||
describe "when `copyActiveItem: true` is passed in the params", ->
|
||||
it "duplicates the active item", ->
|
||||
pane2 = pane1.splitRight(copyActiveItem: true)
|
||||
@@ -665,6 +676,11 @@ describe "Pane", ->
|
||||
expect(container.root.orientation).toBe 'vertical'
|
||||
expect(container.root.children).toEqual [pane2, pane3, pane1]
|
||||
|
||||
describe "when `moveActiveItem: true` is passed in the params", ->
|
||||
it "moves the active item", ->
|
||||
pane2 = pane1.splitLeft(moveActiveItem: true)
|
||||
expect(pane2.getActiveItem()).toBe item1
|
||||
|
||||
describe "when `copyActiveItem: true` is passed in the params", ->
|
||||
it "duplicates the active item", ->
|
||||
pane2 = pane1.splitUp(copyActiveItem: true)
|
||||
@@ -687,6 +703,11 @@ describe "Pane", ->
|
||||
expect(container.root.orientation).toBe 'vertical'
|
||||
expect(container.root.children).toEqual [pane1, pane3, pane2]
|
||||
|
||||
describe "when `moveActiveItem: true` is passed in the params", ->
|
||||
it "moves the active item", ->
|
||||
pane2 = pane1.splitLeft(moveActiveItem: true)
|
||||
expect(pane2.getActiveItem()).toBe item1
|
||||
|
||||
describe "when `copyActiveItem: true` is passed in the params", ->
|
||||
it "duplicates the active item", ->
|
||||
pane2 = pane1.splitDown(copyActiveItem: true)
|
||||
|
||||
@@ -472,7 +472,7 @@ describe "TextEditorPresenter", ->
|
||||
|
||||
expect(getState(presenter).horizontalScrollbar.scrollWidth).toBe 10 * maxLineLength + 1
|
||||
expectStateUpdate presenter, ->
|
||||
presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'support.function.js'], 'p', 20)
|
||||
presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'meta.method-call.js', 'support.function.js'], 'p', 20)
|
||||
presenter.measurementsChanged()
|
||||
expect(getState(presenter).horizontalScrollbar.scrollWidth).toBe (10 * (maxLineLength - 2)) + (20 * 2) + 1 # 2 of the characters are 20px wide now instead of 10px wide
|
||||
|
||||
@@ -866,7 +866,7 @@ describe "TextEditorPresenter", ->
|
||||
|
||||
expect(getState(presenter).content.scrollWidth).toBe 10 * maxLineLength + 1
|
||||
expectStateUpdate presenter, ->
|
||||
presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'support.function.js'], 'p', 20)
|
||||
presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'meta.method-call.js', 'support.function.js'], 'p', 20)
|
||||
presenter.measurementsChanged()
|
||||
expect(getState(presenter).content.scrollWidth).toBe (10 * (maxLineLength - 2)) + (20 * 2) + 1 # 2 of the characters are 20px wide now instead of 10px wide
|
||||
|
||||
|
||||
@@ -88,6 +88,8 @@ describe "TextEditor", ->
|
||||
it "returns a different edit session with the same initial state", ->
|
||||
editor.setSelectedBufferRange([[1, 2], [3, 4]])
|
||||
editor.addSelectionForBufferRange([[5, 6], [7, 8]], reversed: true)
|
||||
editor.firstVisibleScreenRow = 5
|
||||
editor.firstVisibleScreenColumn = 5
|
||||
editor.foldBufferRow(4)
|
||||
expect(editor.isFoldedAtBufferRow(4)).toBeTruthy()
|
||||
|
||||
@@ -95,6 +97,8 @@ describe "TextEditor", ->
|
||||
expect(editor2.id).not.toBe editor.id
|
||||
expect(editor2.getSelectedBufferRanges()).toEqual editor.getSelectedBufferRanges()
|
||||
expect(editor2.getSelections()[1].isReversed()).toBeTruthy()
|
||||
expect(editor2.getFirstVisibleScreenRow()).toBe 5
|
||||
expect(editor2.getFirstVisibleScreenColumn()).toBe 5
|
||||
expect(editor2.isFoldedAtBufferRow(4)).toBeTruthy()
|
||||
|
||||
# editor2 can now diverge from its origin edit session
|
||||
@@ -135,6 +139,15 @@ describe "TextEditor", ->
|
||||
expect(editor2.getSoftTabs()).toBe true
|
||||
expect(editor2.getEncoding()).toBe 'macroman'
|
||||
|
||||
atom.config.set('editor.tabLength', -1)
|
||||
expect(editor2.getTabLength()).toBe 1
|
||||
atom.config.set('editor.tabLength', 2)
|
||||
expect(editor2.getTabLength()).toBe 2
|
||||
atom.config.set('editor.tabLength', 17)
|
||||
expect(editor2.getTabLength()).toBe 17
|
||||
atom.config.set('editor.tabLength', 128)
|
||||
expect(editor2.getTabLength()).toBe 128
|
||||
|
||||
it "uses scoped `core.fileEncoding` values", ->
|
||||
editor1 = null
|
||||
editor2 = null
|
||||
|
||||
@@ -234,7 +234,7 @@ describe "TokenizedBuffer", ->
|
||||
it "updates tokens to reflect the change", ->
|
||||
buffer.setTextInRange([[0, 0], [2, 0]], "foo()\n7\n")
|
||||
|
||||
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[1]).toEqual(value: '(', scopes: ['source.js', 'meta.function-call.js', 'punctuation.definition.arguments.begin.js'])
|
||||
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[1]).toEqual(value: '(', scopes: ['source.js', 'meta.function-call.js', 'meta.arguments.js', 'punctuation.definition.arguments.begin.bracket.round.js'])
|
||||
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: '7', scopes: ['source.js', 'constant.numeric.decimal.js'])
|
||||
# line 2 is unchanged
|
||||
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[2]).toEqual(value: 'if', scopes: ['source.js', 'keyword.control.js'])
|
||||
|
||||
@@ -11,7 +11,7 @@ Model = require './model'
|
||||
WindowEventHandler = require './window-event-handler'
|
||||
StylesElement = require './styles-element'
|
||||
StorageFolder = require './storage-folder'
|
||||
{getWindowLoadSettings} = require './window-load-settings-helpers'
|
||||
{getWindowLoadSettings, setWindowLoadSettings} = require './window-load-settings-helpers'
|
||||
registerDefaultCommands = require './register-default-commands'
|
||||
|
||||
DeserializerManager = require './deserializer-manager'
|
||||
@@ -384,6 +384,11 @@ class AtomEnvironment extends Model
|
||||
inSpecMode: ->
|
||||
@specMode ?= @getLoadSettings().isSpec
|
||||
|
||||
# Returns a {Boolean} indicating whether this the first time the window's been
|
||||
# loaded.
|
||||
isFirstLoad: ->
|
||||
@firstLoad ?= @getLoadSettings().firstLoad
|
||||
|
||||
# Public: Get the version of the Atom application.
|
||||
#
|
||||
# Returns the version text {String}.
|
||||
@@ -532,6 +537,11 @@ class AtomEnvironment extends Model
|
||||
steps.push(@maximize()) if dimensions?.maximized and process.platform isnt 'darwin'
|
||||
Promise.all(steps)
|
||||
|
||||
if @isFirstLoad()
|
||||
loadSettings = getWindowLoadSettings()
|
||||
loadSettings.firstLoad = false
|
||||
setWindowLoadSettings(loadSettings)
|
||||
|
||||
# Get the dimensions of this window.
|
||||
#
|
||||
# Returns an {Object} with the following keys:
|
||||
@@ -595,7 +605,14 @@ class AtomEnvironment extends Model
|
||||
{x: 0, y: 0, width: Math.min(1024, width), height}
|
||||
|
||||
restoreWindowDimensions: ->
|
||||
dimensions = @state.windowDimensions
|
||||
dimensions = null
|
||||
|
||||
# The first time the window's loaded we want to use the default dimensions.
|
||||
# But after that, e.g., when the window's been reloaded, we want to use the
|
||||
# dimensions we've saved for it.
|
||||
if not @isFirstLoad()
|
||||
dimensions = @state.windowDimensions
|
||||
|
||||
unless @isValidDimensions(dimensions)
|
||||
dimensions = @getDefaultWindowDimensions()
|
||||
@setWindowDimensions(dimensions).then -> dimensions
|
||||
@@ -633,7 +650,7 @@ class AtomEnvironment extends Model
|
||||
@registerDefaultTargetForKeymaps()
|
||||
|
||||
@packages.loadPackages()
|
||||
@loadStateSync()
|
||||
|
||||
@document.body.appendChild(@views.getView(@workspace))
|
||||
@backgroundStylesheet?.remove()
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ var babelVersionDirectory = null
|
||||
var PREFIXES = [
|
||||
'/** @babel */',
|
||||
'"use babel"',
|
||||
'\'use babel\''
|
||||
'\'use babel\'',
|
||||
'/* @flow */'
|
||||
]
|
||||
|
||||
var PREFIX_LENGTH = Math.max.apply(Math, PREFIXES.map(function (prefix) {
|
||||
|
||||
@@ -47,6 +47,7 @@ class AtomWindow
|
||||
loadSettings.devMode ?= false
|
||||
loadSettings.safeMode ?= false
|
||||
loadSettings.atomHome = process.env.ATOM_HOME
|
||||
loadSettings.firstLoad = true
|
||||
|
||||
# Only send to the first non-spec window created
|
||||
if @constructor.includeShellLoadTime and not @isSpec
|
||||
|
||||
@@ -171,7 +171,7 @@ module.exports =
|
||||
tabLength:
|
||||
type: 'integer'
|
||||
default: 2
|
||||
enum: [1, 2, 3, 4, 6, 8]
|
||||
minimum: 1
|
||||
description: 'Number of spaces used to represent a tab.'
|
||||
softWrap:
|
||||
type: 'boolean'
|
||||
|
||||
@@ -484,7 +484,7 @@ class GitRepository
|
||||
|
||||
relativeProjectPaths = @project?.getPaths()
|
||||
.map (path) => @relativize(path)
|
||||
.filter (path) -> path.length > 0
|
||||
.map (path) -> if path.length > 0 then path + '/**' else '*'
|
||||
|
||||
@statusTask?.terminate()
|
||||
@statusTask = Task.once @handlerPath, @getPath(), relativeProjectPaths, ({statuses, upstream, branch, submodules}) =>
|
||||
|
||||
@@ -23,9 +23,9 @@ module.exports = ({blobStore}) ->
|
||||
enablePersistence: true
|
||||
})
|
||||
|
||||
atom.loadStateSync()
|
||||
atom.displayWindow().then ->
|
||||
atom.startEditorWindow()
|
||||
require('electron').ipcRenderer.send('window-command', 'window:loaded')
|
||||
|
||||
# Workaround for focus getting cleared upon window creation
|
||||
windowFocused = ->
|
||||
|
||||
@@ -68,7 +68,8 @@ module.exports = ({blobStore}) ->
|
||||
logFile, headless, testPaths, buildAtomEnvironment, buildDefaultApplicationDelegate, legacyTestRunner
|
||||
})
|
||||
|
||||
promise.then(exitWithStatusCode) if getWindowLoadSettings().headless
|
||||
promise.then (code) ->
|
||||
exitWithStatusCode(code) if getWindowLoadSettings().headless
|
||||
catch error
|
||||
if getWindowLoadSettings().headless
|
||||
console.error(error.stack ? error)
|
||||
|
||||
@@ -84,7 +84,7 @@ class Package
|
||||
@loadKeymaps()
|
||||
@loadMenus()
|
||||
@loadStylesheets()
|
||||
@loadDeserializers()
|
||||
@registerDeserializerMethods()
|
||||
@configSchemaRegisteredOnLoad = @registerConfigSchemaFromMetadata()
|
||||
@settingsPromise = @loadSettings()
|
||||
if @shouldRequireMainModuleOnLoad() and not @mainModule?
|
||||
@@ -277,24 +277,24 @@ class Package
|
||||
@stylesheets = @getStylesheetPaths().map (stylesheetPath) =>
|
||||
[stylesheetPath, @themeManager.loadStylesheet(stylesheetPath, true)]
|
||||
|
||||
loadDeserializers: ->
|
||||
registerDeserializerMethods: ->
|
||||
if @metadata.deserializers?
|
||||
for name, implementationPath of @metadata.deserializers
|
||||
do =>
|
||||
deserializePath = path.join(@path, implementationPath)
|
||||
deserializeFunction = null
|
||||
atom.deserializers.add
|
||||
name: name,
|
||||
deserialize: =>
|
||||
@registerViewProviders()
|
||||
deserializeFunction ?= require(deserializePath)
|
||||
deserializeFunction.apply(this, arguments)
|
||||
Object.keys(@metadata.deserializers).forEach (deserializerName) =>
|
||||
methodName = @metadata.deserializers[deserializerName]
|
||||
atom.deserializers.add
|
||||
name: deserializerName,
|
||||
deserialize: (state, atomEnvironment) =>
|
||||
@registerViewProviders()
|
||||
@requireMainModule()
|
||||
@mainModule[methodName](state, atomEnvironment)
|
||||
return
|
||||
|
||||
registerViewProviders: ->
|
||||
if @metadata.viewProviders? and not @registeredViewProviders
|
||||
for implementationPath in @metadata.viewProviders
|
||||
@viewRegistry.addViewProvider(require(path.join(@path, implementationPath)))
|
||||
@requireMainModule()
|
||||
@metadata.viewProviders.forEach (methodName) =>
|
||||
@viewRegistry.addViewProvider (model) =>
|
||||
@mainModule[methodName](model)
|
||||
@registeredViewProviders = true
|
||||
|
||||
getStylesheetsPath: ->
|
||||
|
||||
@@ -36,6 +36,27 @@ class PaneContainerElement extends HTMLElement
|
||||
focusPaneViewOnRight: ->
|
||||
@nearestPaneInDirection('right')?.focus()
|
||||
|
||||
moveActiveItemToPaneAbove: (params) ->
|
||||
@moveActiveItemToNearestPaneInDirection('above', params)
|
||||
|
||||
moveActiveItemToPaneBelow: (params) ->
|
||||
@moveActiveItemToNearestPaneInDirection('below', params)
|
||||
|
||||
moveActiveItemToPaneOnLeft: (params) ->
|
||||
@moveActiveItemToNearestPaneInDirection('left', params)
|
||||
|
||||
moveActiveItemToPaneOnRight: (params) ->
|
||||
@moveActiveItemToNearestPaneInDirection('right', params)
|
||||
|
||||
moveActiveItemToNearestPaneInDirection: (direction, params) ->
|
||||
destPane = @nearestPaneInDirection(direction)?.getModel()
|
||||
return unless destPane?
|
||||
if params?.keepOriginal
|
||||
@model.copyActiveItemToPane(destPane)
|
||||
else
|
||||
@model.moveActiveItemToPane(destPane)
|
||||
destPane.focus()
|
||||
|
||||
nearestPaneInDirection: (direction) ->
|
||||
distance = (pointA, pointB) ->
|
||||
x = pointB.x - pointA.x
|
||||
|
||||
@@ -164,6 +164,15 @@ class PaneContainer extends Model
|
||||
else
|
||||
false
|
||||
|
||||
moveActiveItemToPane: (destPane) ->
|
||||
item = @activePane.getActiveItem()
|
||||
@activePane.moveItemToPane(item, destPane)
|
||||
destPane.setActiveItem(item)
|
||||
|
||||
copyActiveItemToPane: (destPane) ->
|
||||
item = @activePane.copyActiveItem()
|
||||
destPane.activateItem(item)
|
||||
|
||||
destroyEmptyPanes: ->
|
||||
pane.destroy() for pane in @getPanes() when pane.items.length is 0
|
||||
return
|
||||
|
||||
@@ -666,6 +666,8 @@ class Pane extends Model
|
||||
when 'before' then @parent.insertChildBefore(this, newPane)
|
||||
when 'after' then @parent.insertChildAfter(this, newPane)
|
||||
|
||||
@moveItemToPane(@activeItem, newPane) if params?.moveActiveItem
|
||||
|
||||
newPane.activate()
|
||||
newPane
|
||||
|
||||
|
||||
@@ -50,6 +50,14 @@ module.exports = ({commandRegistry, commandInstaller, config}) ->
|
||||
'window:focus-pane-below': -> @focusPaneViewBelow()
|
||||
'window:focus-pane-on-left': -> @focusPaneViewOnLeft()
|
||||
'window:focus-pane-on-right': -> @focusPaneViewOnRight()
|
||||
'window:move-active-item-to-pane-above': -> @moveActiveItemToPaneAbove()
|
||||
'window:move-active-item-to-pane-below': -> @moveActiveItemToPaneBelow()
|
||||
'window:move-active-item-to-pane-on-left': -> @moveActiveItemToPaneOnLeft()
|
||||
'window:move-active-item-to-pane-on-right': -> @moveActiveItemToPaneOnRight()
|
||||
'window:copy-active-item-to-pane-above': -> @moveActiveItemToPaneAbove(keepOriginal: true)
|
||||
'window:copy-active-item-to-pane-below': -> @moveActiveItemToPaneBelow(keepOriginal: true)
|
||||
'window:copy-active-item-to-pane-on-left': -> @moveActiveItemToPaneOnLeft(keepOriginal: true)
|
||||
'window:copy-active-item-to-pane-on-right': -> @moveActiveItemToPaneOnRight(keepOriginal: true)
|
||||
'window:save-all': -> @getModel().saveAll()
|
||||
'window:toggle-invisibles': -> config.set("editor.showInvisibles", not config.get("editor.showInvisibles"))
|
||||
'window:log-deprecation-warnings': -> Grim.logDeprecations()
|
||||
@@ -65,10 +73,18 @@ module.exports = ({commandRegistry, commandInstaller, config}) ->
|
||||
|
||||
commandRegistry.add 'atom-pane',
|
||||
'pane:save-items': -> @getModel().saveItems()
|
||||
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
|
||||
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
|
||||
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
|
||||
'pane:split-down': -> @getModel().splitDown(copyActiveItem: true)
|
||||
'pane:split-left': -> @getModel().splitLeft()
|
||||
'pane:split-right': -> @getModel().splitRight()
|
||||
'pane:split-up': -> @getModel().splitUp()
|
||||
'pane:split-down': -> @getModel().splitDown()
|
||||
'pane:split-left-and-copy-active-item': -> @getModel().splitLeft(copyActiveItem: true)
|
||||
'pane:split-right-and-copy-active-item': -> @getModel().splitRight(copyActiveItem: true)
|
||||
'pane:split-up-and-copy-active-item': -> @getModel().splitUp(copyActiveItem: true)
|
||||
'pane:split-down-and-copy-active-item': -> @getModel().splitDown(copyActiveItem: true)
|
||||
'pane:split-left-and-move-active-item': -> @getModel().splitLeft(moveActiveItem: true)
|
||||
'pane:split-right-and-move-active-item': -> @getModel().splitRight(moveActiveItem: true)
|
||||
'pane:split-up-and-move-active-item': -> @getModel().splitUp(moveActiveItem: true)
|
||||
'pane:split-down-and-move-active-item': -> @getModel().splitDown(moveActiveItem: true)
|
||||
'pane:close': -> @getModel().close()
|
||||
'pane:close-other-items': -> @getModel().destroyInactiveItems()
|
||||
'pane:increase-size': -> @getModel().increaseSize()
|
||||
|
||||
@@ -497,6 +497,7 @@ class TextEditor extends Model
|
||||
newEditor = new TextEditor({
|
||||
@buffer, displayBuffer, selectionsMarkerLayer, @tabLength, softTabs,
|
||||
suppressCursorCreation: true, @config, @notificationManager, @packageManager,
|
||||
@firstVisibleScreenRow, @firstVisibleScreenColumn,
|
||||
@clipboard, @viewRegistry, @grammarRegistry, @project, @assert, @applicationDelegate
|
||||
})
|
||||
newEditor
|
||||
|
||||
@@ -104,6 +104,14 @@ class WorkspaceElement extends HTMLElement
|
||||
|
||||
focusPaneViewOnRight: -> @paneContainer.focusPaneViewOnRight()
|
||||
|
||||
moveActiveItemToPaneAbove: (params) -> @paneContainer.moveActiveItemToPaneAbove(params)
|
||||
|
||||
moveActiveItemToPaneBelow: (params) -> @paneContainer.moveActiveItemToPaneBelow(params)
|
||||
|
||||
moveActiveItemToPaneOnLeft: (params) -> @paneContainer.moveActiveItemToPaneOnLeft(params)
|
||||
|
||||
moveActiveItemToPaneOnRight: (params) -> @paneContainer.moveActiveItemToPaneOnRight(params)
|
||||
|
||||
runPackageSpecs: ->
|
||||
if activePath = @workspace.getActivePaneItem()?.getPath?()
|
||||
[projectPath] = @project.relativizePath(activePath)
|
||||
|
||||
@@ -84,7 +84,10 @@
|
||||
setupCsonCache(CompileCache.getCacheDirectory())
|
||||
|
||||
var initialize = require(loadSettings.windowInitializationScript)
|
||||
initialize({blobStore: blobStore})
|
||||
|
||||
initialize({blobStore: blobStore}).then(function () {
|
||||
require('electron').ipcRenderer.send('window-command', 'window:loaded')
|
||||
})
|
||||
}
|
||||
|
||||
function setupCsonCache (cacheDir) {
|
||||
|
||||
Reference in New Issue
Block a user