Comparar commits

...

579 Commits

Autor SHA1 Mensagem Data
Max Brunsfeld cffe733641 Fix config event subscription methods
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-19 17:28:33 -08:00
Nathan Sobo 3127171b2b Fix Config::isDefault 2014-12-19 16:47:24 -08:00
Nathan Sobo 1d48cb641c Fix Config::save 2014-12-19 16:47:24 -08:00
Nathan Sobo b7b5852863 Store all settings in the scoped property store
There are a few failing specs, but I think they can all be addressed by
having a `source` for all properties and using it to target only the
user settings in various cases.
2014-12-19 16:47:18 -08:00
Max Brunsfeld d104e68342 Revert "Revert "Merge pull request #4631""
This reverts commit dc2a453986.

Conflicts:
	spec/config-spec.coffee
	src/config.coffee
2014-12-19 14:20:27 -08:00
Max Brunsfeld 9640678c29 ⬆️ snippets@0.60.0 2014-12-19 14:19:16 -08:00
Kevin Sawicki 2ce1677aa5 Prepare 0.164 2014-12-19 13:46:19 -08:00
Kevin Sawicki d5c8956d38 ⬆️ release-notes@0.43 2014-12-19 13:27:45 -08:00
Kevin Sawicki d532f506fe ⬆️ package-generator@0.34 2014-12-19 11:53:55 -08:00
Kevin Sawicki 32b414328a ⬆️ release-notes@0.42 2014-12-19 11:49:18 -08:00
Ben Ogle b1697399dc Merge pull request #4698 from atom/bo-fix-load-settings
Pass safeMode and devMode load settings to new windows
2014-12-19 11:36:31 -08:00
Ben Ogle 27eccfaf81 Upgrade notification@0.20.0 2014-12-19 11:35:46 -08:00
Ben Ogle ebbd8101ba Upgrade notifications to provide more user info 2014-12-19 10:45:19 -08:00
Ben Ogle 20504fc7a8 Pull load settings out of the focused window 2014-12-19 10:38:03 -08:00
Ben Ogle 0db1971825 Default devMode and safeMode to false 2014-12-19 10:38:03 -08:00
Ben Ogle 80c828d001 Pass the load settings through so all windows share devMode and safeMode 2014-12-19 10:38:03 -08:00
Ben Ogle e688df57f2 Add atom.inSafeMode() 2014-12-19 10:38:03 -08:00
Max Brunsfeld 0790d33e9d ⬆️ language-html@0.27.0
For handlebars template scope fix
2014-12-19 10:34:14 -08:00
Kevin Sawicki 05820a3044 ⬆️ release-notes@0.41 2014-12-19 09:08:36 -08:00
Kevin Sawicki c4ac602644 ⬆️ language-sass@0.29 2014-12-18 18:23:37 -08:00
Kevin Sawicki 12d4fae91c Fall back to system root for cmd.exe path 2014-12-18 17:58:18 -08:00
Kevin Sawicki 2f334979d5 Add explorer check using SystemRoot path
Closes #4551
2014-12-18 17:20:40 -08:00
Max Brunsfeld d9e414af27 ⬆️ scoped-property-store@0.15.4
For performance improvements
2014-12-18 16:24:20 -08:00
Kevin Sawicki 335c1e215a Prepare 0.163 2014-12-18 11:46:03 -08:00
Max Brunsfeld b9b7646d4b ⬆️ tree-view@0.139.0
For bug fixes
2014-12-18 11:27:23 -08:00
Kevin Sawicki d885fb2d13 Merge pull request #4691 from atom/ks-improve-middle-mouse-paste
Improve middle mouse paste on Linux
2014-12-18 11:23:47 -08:00
Kevin Sawicki f5ae96820a Update spec for new middle mouse paste behavior 2014-12-18 11:04:52 -08:00
Kevin Sawicki 435fee1433 Use skinny arrow 2014-12-18 10:40:44 -08:00
Kevin Sawicki c96f976162 Write to selection clipboard from setTimeout
This is so that in progress transactions aren't written to the
selection clipboard.
2014-12-18 10:40:04 -08:00
Kevin Sawicki 5115540f8e Track middle button mouse down events on Linux 2014-12-18 09:51:32 -08:00
Kevin Sawicki d642553351 Paste selection clipboard after finalizing selections 2014-12-18 09:26:14 -08:00
Kevin Sawicki fa090345a8 ⬆️ release-notes@0.40 2014-12-18 08:58:19 -08:00
Max Brunsfeld 55d291ffde ⬆️ underscore-plus@1.6.6 2014-12-18 08:50:16 -08:00
Max Brunsfeld 48f63926ab ⬆️ underscore-plus@1.6.5 2014-12-17 18:13:48 -08:00
Max Brunsfeld b0501c9cb2 Merge pull request #4672 from atom/mb-optimize-config-events
Avoid firing repeated config events while packages are loaded
2014-12-17 18:11:33 -08:00
Max Brunsfeld 355ab1eb2f ⬆️ underscore-plus@1.6.4 2014-12-17 17:35:07 -08:00
Max Brunsfeld 28ac51d140 Add Config::transact
Use this method to avoid emitting unecessary config events
when activating or deactivating multiple packages
2014-12-17 16:54:47 -08:00
Kevin Sawicki d6210b24d9 ⬆️ status-bar@0.54 2014-12-17 13:01:54 -08:00
Max Brunsfeld b0731afd4c Don't pass keyPath to Config::onDidChange callback
The keyPath field was never used by core or any package, and
for scoped settings, its value was always equal to the keyPath
specified by the caller.
2014-12-17 12:03:46 -08:00
Kevin Sawicki 1c81aa90c0 Add initial SquirrelUpdate specs 2014-12-17 10:47:43 -08:00
Kevin Sawicki bbf6930061 💄 2014-12-17 10:02:34 -08:00
Kevin Sawicki 3d149eb9d1 Only update desktop shortcut if it already exists
Delete the created shortcut if it was previously deleted
after it was first installed.

Closes #4665
2014-12-17 09:55:46 -08:00
Kevin Sawicki 5a8b96b180 Add git as debian dependency
Used by npm to install module dependencies that use git URLs

Closes #4668
2014-12-17 09:11:25 -08:00
Kevin Sawicki 5add777291 Prepare 0.162 2014-12-16 18:35:01 -08:00
Max Brunsfeld f866e69704 ⬆️ scoped-property-store@0.15.3 2014-12-16 18:06:28 -08:00
Ben Ogle b27b4387fc Upgrade solarized-dark-syntax@0.29.0 2014-12-16 16:39:40 -08:00
Ben Ogle 1f850f0af1 Upgrade solarized dark to fix some ruby highlighting 2014-12-16 16:35:14 -08:00
Kevin Sawicki 9f1bbc54de Delete docker image after running 2014-12-16 16:20:46 -08:00
Ben Ogle e7d34d4b83 Upgrade wrap guide to use scoped config 2014-12-16 16:17:36 -08:00
simurai c5a15fb50e Add a note about font-family in syntax themes
#4646
2014-12-17 09:14:21 +09:00
Kevin Sawicki 7a251f5432 Prepare 0.161 2014-12-16 15:44:41 -08:00
Max Brunsfeld dc2a453986 Revert "Merge pull request #4631 from atom/mb-new-config-api"
This reverts commit 5147fb6a8b, reversing
changes made to 9bbbb58084.
2014-12-16 15:27:39 -08:00
Kevin Sawicki fdd55dfd27 Restart Atom with project path from focused window
Closes #4653
2014-12-16 15:26:42 -08:00
Max Brunsfeld 5147fb6a8b Merge pull request #4631 from atom/mb-new-config-api
New config API
2014-12-16 15:22:15 -08:00
Ben Ogle 9bbbb58084 Fix context menu when shadow DOM is enabled
Closes #4623
2014-12-16 15:16:12 -08:00
Kevin Sawicki 9ad080cd31 ⬆️ grammar-selector@0.40 2014-12-16 15:10:33 -08:00
Ben Ogle 509976fa18 Merge pull request #4655 from atom/bo-fix-dragging
Handle the case when the editor is destroyed while dragging
2014-12-16 15:05:58 -08:00
Ben Ogle aad5700418 Merge pull request #4652 from atom/bo-fix-unmount
Properly unmount the component when the shadow DOM is enabled
2014-12-16 14:52:37 -08:00
Ben Ogle 09a0773043 Handle editor destruction when dragging.
Closes #4622
2014-12-16 14:52:07 -08:00
Ben Ogle 0829da53b0 Properly unmount the component when the shadow DOM is enabled. 2014-12-16 14:36:51 -08:00
Kevin Sawicki 2ea92cf0e5 💄 2014-12-16 14:31:52 -08:00
Max Brunsfeld 9a2cc36c6b 💄 2014-12-16 14:27:57 -08:00
Max Brunsfeld 965a6243e1 Remove toBe parens 2014-12-16 14:27:57 -08:00
Max Brunsfeld 503fa30c28 Flesh out deprecation messages for Config::{is,set}Default
Also, simplify the shim in ::isDefault
2014-12-16 14:27:46 -08:00
Max Brunsfeld b8f239cd39 Deprecate Config::isDefault and ::getDefault 2014-12-16 14:00:57 -08:00
Max Brunsfeld 231da60e13 📝 new config APIs 2014-12-16 14:00:57 -08:00
Max Brunsfeld a47719eb53 Fix config priorities 2014-12-16 14:00:57 -08:00
Max Brunsfeld 9f851e55d1 Add Config::unset
Deprecate Config::restoreDefault
2014-12-16 14:00:57 -08:00
Max Brunsfeld ab89776f01 Throw when Config::set is called w/ source and no scope 2014-12-16 14:00:57 -08:00
Max Brunsfeld 2cea51b50e Take 'scope' option in Config::onDidChange
Deprecate passing the scope as an optional first argument
2014-12-16 14:00:57 -08:00
Max Brunsfeld 4e4794f3fd Take 'scope' option in Config::observe
Deprecate using the scope as an optional first argument
2014-12-16 14:00:57 -08:00
Max Brunsfeld ac6fbf100d Fix deprecation in package-manager-spec 2014-12-16 14:00:57 -08:00
Max Brunsfeld 8c8e866a97 Use a schema in all specs for Config::observeUserConfig
Before, values loaded from the config file were set in a
way that allowed any key to be set in the root object.
Now, these values are set in a way that's similar to how
::set works.
2014-12-16 14:00:56 -08:00
Max Brunsfeld f859ad5fc5 Allow null keyPath with options argument in ::get 2014-12-16 14:00:56 -08:00
Nathan Sobo d30cf35a16 Use ‘source’ option rather than internal state in Config spec 2014-12-16 14:00:56 -08:00
Nathan Sobo c35fb90653 Don’t return schema defaults when sources are specified in Config::get 2014-12-16 14:00:56 -08:00
Nathan Sobo 73df017d83 Add a ‘sources’ and ‘excludeSources’ options to Config::get
If the option is supplied, we will only retrieve values from the
specified sources.
2014-12-16 14:00:56 -08:00
Nathan Sobo 0e1ef201c1 Pass source to ::scopedSettingsStore on calls to ::set
Default it to the user’s config if no source is specified.
2014-12-16 14:00:56 -08:00
Nathan Sobo be4d23aa13 Use the user’s config.cson path as the default config source 2014-12-16 14:00:56 -08:00
Nathan Sobo c58606907a Make scope a trailing option to Config::get 2014-12-16 14:00:56 -08:00
Nathan Sobo c489a4662b Make scopeSelector a trailing option to Config::set 2014-12-16 14:00:56 -08:00
Kevin Sawicki 44fceaae20 Prepare 0.160 2014-12-16 13:15:19 -08:00
Kevin Sawicki 1b393e4f48 ⬆️ release-notes@0.39 2014-12-16 12:57:00 -08:00
Kevin Sawicki e84bd28c64 Add --rm flag 2014-12-16 12:38:34 -08:00
Kevin Sawicki bbf199fb60 ⬆️ release-notes@0.38 2014-12-16 11:38:28 -08:00
Ben Ogle 367a4c4bd3 Merge pull request #4630 from atom/bo-better-save-notification
Better save notifications
2014-12-16 11:07:34 -08:00
Kevin Sawicki 7d74f8179b ⬆️ apm@0.116 2014-12-16 10:56:05 -08:00
Kevin Sawicki bcafef385f Merge pull request #4632 from atom/ks-windows-atom-sh
Add atom.sh and apm.sh Windows scripts
2014-12-16 10:00:25 -08:00
Kevin Sawicki 83d5890962 Add missing .. segment 2014-12-16 09:40:16 -08:00
Kevin Sawicki 7ee3ccb43d Move up one more directory 2014-12-16 09:33:16 -08:00
Kevin Sawicki 9126f2e45c Include apm.sh 2014-12-16 09:19:40 -08:00
Kevin Sawicki 89ed95e2ae Add apm sh shim 2014-12-16 09:08:31 -08:00
Ben Ogle 27174b2880 Betta spec description 2014-12-16 09:07:44 -08:00
Kevin Sawicki ed1fbcc8e7 Use forward slashes in sh path 2014-12-16 09:02:09 -08:00
Kevin Sawicki 307ce4dc54 Write atom.sh to atom in bin folder 2014-12-15 17:52:56 -08:00
Kevin Sawicki 0833be4c27 Use correct variable name for sh text 2014-12-15 17:52:21 -08:00
Kevin Sawicki af116b2b8a Install atom.sh shim 2014-12-15 17:50:59 -08:00
Kevin Sawicki 59d582722b Add .sh extension 2014-12-15 17:48:04 -08:00
Kevin Sawicki 9239b95241 Use $0 instead of %~dp0 2014-12-15 17:47:01 -08:00
Kevin Sawicki ab8b5959d3 Add initial Windows atom wrapper script 2014-12-15 17:46:34 -08:00
Ben Ogle 5ff7a286fc 💄 2014-12-15 17:42:38 -08:00
Ben Ogle f199c71fa8 Specs for the eacces error 2014-12-15 17:42:27 -08:00
Ben Ogle 265601cbdb Nof 2014-12-15 17:20:13 -08:00
Ben Ogle 67b39845c8 Add a better error message when a directory cannot be written to.
Closes #4607
2014-12-15 17:19:54 -08:00
Ben Ogle a42505b6ae Handle is a directory error
Closes #4616
2014-12-15 17:08:46 -08:00
Nathan Sobo f026d30426 💄 Call deprecate on Grim local in Config 2014-12-15 17:06:02 -08:00
Max Brunsfeld b4db61a7e7 Fix Config::getSettings 2014-12-15 16:25:19 -08:00
Ben Ogle fad93b8d7e Remove fake catch of Q errors on open
Closes #4628
2014-12-15 15:47:10 -08:00
Max Brunsfeld feb72b38f8 ⬆️ snippets@0.59.0 2014-12-15 14:20:12 -08:00
Max Brunsfeld 23ce2cd1ac ⬆️ scoped-property-store and underscore-plus 2014-12-15 13:06:44 -08:00
Kevin Sawicki ee2509e90f ⬆️ notifications@0.18 2014-12-15 12:14:50 -08:00
Kevin Sawicki ca5e66bbd1 ⬆️ grammar-selector@0.38 2014-12-15 11:21:51 -08:00
Kevin Sawicki 3389555d71 ⬆️ encoding-selector@0.12 2014-12-15 11:19:09 -08:00
Kevin Sawicki 202426a85b Remove unneeded dotAtomPath assignment 2014-12-15 10:42:24 -08:00
Kevin Sawicki a6d68f8683 ⬆️ deprecation-cop@0.20 2014-12-15 10:18:33 -08:00
Kevin Sawicki 6674bfbf97 ⬆️ release-notes@0.37 2014-12-15 10:10:59 -08:00
Kevin Sawicki cd5309e494 ⬆️ incompatible-packages@0.16 2014-12-15 10:07:27 -08:00
Kevin Sawicki 11b2f4a18d ⬆️ image-view@0.44 2014-12-15 10:03:08 -08:00
Kevin Sawicki 88442ccb78 ⬆️ encoding-selector@0.11 2014-12-15 09:59:41 -08:00
Kevin Sawicki c4768cb266 ⬆️ spell-check@0.45 2014-12-15 09:41:17 -08:00
Kevin Sawicki cf772295fb ⬆️ autoflow@0.20 2014-12-15 09:39:36 -08:00
Kevin Sawicki dabedeb065 ⬆️ language-css@0.24 2014-12-15 09:35:35 -08:00
Kevin Sawicki 224e6cb5d4 ⬆️ styleguide@0.36 2014-12-15 09:31:01 -08:00
Kevin Sawicki 3f745e3d67 ⬆️ language-todo@0.15 2014-12-15 09:19:30 -08:00
Ben Ogle d9a5e3c7e1 Upgrade notifications to fix fatal notifications in windows 2014-12-12 16:33:04 -08:00
Ben Ogle d272606408 Upgrade tabs to fix exception 2014-12-12 16:32:37 -08:00
Kevin Sawicki 263567649d Only call log when deprecations exist 2014-12-12 15:37:49 -08:00
Kevin Sawicki c345532864 stdout -> stderr 2014-12-12 14:57:31 -08:00
Kevin Sawicki c0c4e65b5d Warnings to do stderr 2014-12-12 14:54:48 -08:00
Kevin Sawicki b441b3cd6f Remove prefix and suffix from deprecation lines 2014-12-12 14:01:33 -08:00
Kevin Sawicki 3a51228899 Label output 2014-12-12 13:53:52 -08:00
Kevin Sawicki 42d5d0ba87 Log deprecations from apm test output 2014-12-12 13:52:46 -08:00
Kevin Sawicki a1d0635d98 Start logging deprecations on CI 2014-12-12 13:24:10 -08:00
Kevin Sawicki b66e931a99 Only run package specs when project path exists
Closes #4579
2014-12-12 13:18:14 -08:00
Kevin Sawicki 0a7ea419a0 ⬆️ git-utils@2.2 2014-12-12 12:59:42 -08:00
Kevin Sawicki 91770f2885 Add buffer subscriptions to repo's subscriptions
Closes #4570
2014-12-12 12:26:09 -08:00
Kevin Sawicki d4c7fe4b47 ⬆️ keybinding-resolver@0.24 2014-12-12 12:22:29 -08:00
Kevin Sawicki 8b848c1853 Merge pull request #4560 from atom/ks-atom-windows-wrapper
Add better atom.cmd exe wrapper
2014-12-12 12:20:42 -08:00
Kevin Sawicki eef6532b8c atom.exe is now up one more directory 2014-12-12 12:11:38 -08:00
Kevin Sawicki 43de383b14 Use \r\n line endings for cmd shims 2014-12-12 12:11:38 -08:00
Kevin Sawicki 9d3aaad394 atom.exe is now up on more directory 2014-12-12 12:11:38 -08:00
Kevin Sawicki 3cf104444c Add missing resources segment 2014-12-12 12:11:38 -08:00
Kevin Sawicki f91741eec1 Install cli folder to resources directory 2014-12-12 12:11:37 -08:00
Kevin Sawicki 8f77d65aab Add --executed-from as first argument 2014-12-12 12:11:37 -08:00
Kevin Sawicki 3dced04aab Add -t and --test to expected output args 2014-12-12 12:11:37 -08:00
Kevin Sawicki bac9eac1fc Resolve atom path and executed-from in atom.js 2014-12-12 12:11:37 -08:00
Kevin Sawicki d3e53c5ada Use correct path variable 2014-12-12 12:11:37 -08:00
Kevin Sawicki cad8afe78b Use correct resources path 2014-12-12 12:11:37 -08:00
Kevin Sawicki a7f30c63cb Don't bundle atom.sh on Windows 2014-12-12 12:11:37 -08:00
Kevin Sawicki 1d0dd86041 Use new atom.cmd wrapper from installer 2014-12-12 12:11:37 -08:00
Kevin Sawicki 690ece3a9e Remove escaped slashes 2014-12-12 12:11:37 -08:00
Kevin Sawicki 100a1f5764 Parse output flags in atom.cmd 2014-12-12 12:11:37 -08:00
Kevin Sawicki 35f49be82a Pass through arguments 2014-12-12 12:11:36 -08:00
Kevin Sawicki 4225c25ad7 Add initial atom.cmd 2014-12-12 12:11:36 -08:00
Kevin Sawicki 330592e2bd Add atom.cmd 2014-12-12 12:11:36 -08:00
Kevin Sawicki d306876229 Remove disconnect call 2014-12-12 12:11:36 -08:00
Kevin Sawicki 47aa269de5 Exit main process 2014-12-12 12:11:36 -08:00
Kevin Sawicki 2a80762d5b Disconnect spawned process 2014-12-12 12:11:36 -08:00
Kevin Sawicki 42ab14c2cb Add initial atom.exe wrapper 2014-12-12 12:11:36 -08:00
Ben Ogle e83784e141 Merge pull request #4535 from mark-hahn/activateNowAPI
Fixed activateNow when no activation promise
2014-12-12 11:58:26 -08:00
Ben Ogle cedb41f4b0 Merge pull request #4581 from mnquintana/patch-2
Add OS default fonts for Ubuntu (Unity) and Fedora (GNOME 3)
2014-12-12 11:20:16 -08:00
Machiste N. Quintana d873f3d255 Add OS default fonts for Ubuntu (Unity) and Fedora (GNOME 3) 2014-12-12 14:01:57 -05:00
Ben Ogle 2781c24fce Upgrade solarized-dark-syntax to fix some punctuation 2014-12-12 10:52:38 -08:00
Ben Ogle 2a45bd7f69 Upgrade dev live reload to remove deprecations 2014-12-12 10:52:38 -08:00
Ben Ogle f4fab84869 Upgrade metrics to remove deprecations 2014-12-12 10:52:38 -08:00
Kevin Sawicki 204e5a6b46 Prepare 0.159 2014-12-12 09:40:23 -08:00
Kevin Sawicki 9459bd15a2 ⬆️ language-javascript@0.51 2014-12-12 09:23:43 -08:00
Ben Ogle 6cd96c8284 Upgrade deprecation-cop to remove deprecations 2014-12-11 17:27:06 -08:00
Ben Ogle 2ceced2b84 Upgrade notifications@0.16.0 2014-12-11 17:22:07 -08:00
Ben Ogle be78572d78 Upgrade notifications to fix errors with semicolons 2014-12-11 17:07:46 -08:00
Kevin Sawicki 61abda5166 ⬆️ tree-view@0.138 2014-12-11 16:54:24 -08:00
Kevin Sawicki 93f98ec14e ⬆️ styleguide@0.35 2014-12-11 16:39:34 -08:00
Kevin Sawicki d581c41c0e Update spec since { lines now outdent in JS 2014-12-11 16:35:21 -08:00
Nathan Sobo 252bef63bf Merge pull request #4566 from atom/mb-config-cleanup
Clean up config
2014-12-11 17:15:19 -07:00
Kevin Sawicki 9c63a4f517 ⬆️ language-javascript@0.50 2014-12-11 16:07:50 -08:00
Max Brunsfeld e7b0c3e519 Deprecate Config::getSettings
Also, remove support for getting all settings for a scope selector

Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-11 15:04:55 -08:00
Kevin Sawicki 697ccedbd3 Prepare 0.158 2014-12-11 14:18:09 -08:00
Nathan Sobo 87efc7e1df Only respond to stylesheet changes for mounted components
Refs #4493
2014-12-11 14:55:00 -07:00
Ben Ogle 6a0a694a7b Upgrade notifications to lessen noise 2014-12-11 13:53:05 -08:00
Kevin Sawicki be1f28b3d8 ⬆️ apm@0.114 2014-12-11 13:45:26 -08:00
Kevin Sawicki 32f7c72d28 ⬆️ language-javascript@0.49 2014-12-11 13:07:21 -08:00
Nathan Sobo d51a86e804 ⬆️ markdown-preview for deprecation fixes 2014-12-11 09:03:31 -07:00
Mark Hahn 93e3a5af2a Fixed activateNow when no activation promise 2014-12-10 23:00:14 -08:00
Ben Ogle 278a507653 Merge pull request #4531 from atom/bo-buffered-process-error
Better BufferedProcess error handling
2014-12-10 18:17:09 -08:00
Nathan Sobo 7422f4378e Add property filters to TextEditor::getDecorations methods
This makes it much easier to write tests that inspect the state of
decorations.
2014-12-10 19:11:50 -07:00
Ben Ogle f2ab14656b BufferedProcess::onDidThrowError -> ::onDidThrowError 2014-12-10 18:08:43 -08:00
Ben Ogle 453abf8b90 Update solarized-dark-syntax to fix ruby 2014-12-10 17:54:01 -08:00
Ben Ogle 7866f0819d Upgrade keybinding-resolver to fix the inability to unhide 2014-12-10 17:53:40 -08:00
Kevin Sawicki 921e3c581d ⬆️ keybinding-resolver@0.22 2014-12-10 17:29:17 -08:00
Max Brunsfeld 58aa87438d ⬆️ snippets@0.58.0
For deprecation fixes
2014-12-10 16:45:14 -08:00
Ben Ogle ad73902382 📝 Add docs 2014-12-10 16:27:05 -08:00
Ben Ogle bf63a9715c Add BufferedProcess::onDidThrowError() 2014-12-10 16:26:57 -08:00
Kevin Sawicki 06c52c6873 ⬆️ language-javascript@0.48 2014-12-10 16:21:33 -08:00
Kevin Sawicki 9ac27bc2f8 Grim.logDeprecationWarnings -> Grim.logDeprecations
Closes #4486
2014-12-10 16:05:36 -08:00
Ben Ogle 98caaf0d70 :up_arrow: fuzzy-finder@0.62.0 2014-12-10 15:30:29 -08:00
Ben Ogle a102d1e134 Upgrade styleguide to fix build 2014-12-10 15:14:36 -08:00
Ben Ogle 6caa86fb04 Upgrade styleguide to include colors 2014-12-10 14:54:12 -08:00
Max Brunsfeld b1e0c8132d ⬆️ tree-view@0.137.0 2014-12-10 14:39:05 -08:00
Kevin Sawicki f3947dd6e0 ⬆️ find-and-replace@0.152 2014-12-10 14:06:18 -08:00
Kevin Sawicki 27dbbabe09 Prepare 0.157 2014-12-10 13:34:06 -08:00
Max Brunsfeld 5950110860 ⬆️ status-bar@0.53.0
For new panel-like API
2014-12-10 12:31:46 -08:00
Kevin Sawicki ab5d71e6b5 ⬆️ encoding-selector@0.10 2014-12-10 12:25:43 -08:00
Kevin Sawicki 1ee2839245 📝 Mention config files 2014-12-10 09:22:51 -08:00
Max Brunsfeld a6f31ed791 Pass event to Cursor::onDidChangePosition callbacks 2014-12-09 17:21:03 -08:00
Max Brunsfeld e04b5a74d7 Fix position in Cursor::moveToBeginningOfPreviousParagraph
Also, remove unused parameters to private Cursor methods
2014-12-09 16:59:50 -08:00
Kevin Sawicki 4acf143f45 📝 Mention cuninst is not destructive 2014-12-09 16:50:28 -08:00
Kevin Sawicki 5ad5ce0841 📝 add or above 2014-12-09 16:40:53 -08:00
Kevin Sawicki 31d1ca12c1 📝 Add chocolatey uninstall doc 2014-12-09 16:37:54 -08:00
Kevin Sawicki ace3325db8 Remove chocolatey doc 2014-12-09 16:34:35 -08:00
Kevin Sawicki b718114fc4 📝 Tweak installer wording 2014-12-09 16:34:16 -08:00
Kevin Sawicki 1df8c77f41 Merge pull request #4322 from tsunamistate/upgrade-readme-windows
Upgrade Windows README
2014-12-09 16:31:56 -08:00
Kevin Sawicki 26e867d65e Remove squirrel logging 2014-12-09 16:02:36 -08:00
Nathan Sobo 2688761c29 ⬆️ keybinding-resolver for deprecation fixes 2014-12-09 16:38:51 -07:00
Nathan Sobo b64d9db198 ⬆️ image-view for deprecation fixes 2014-12-09 16:38:51 -07:00
Max Brunsfeld bc5b786bb2 ⬆️ styleguide@0.32.0
To fix build; avoid using devDependencies
2014-12-09 15:15:43 -08:00
Max Brunsfeld 13025c17f1 ⬆️ styleguide@0.31.0
For deprecation fixes
2014-12-09 14:59:40 -08:00
Max Brunsfeld 8b4b5230ab ⬆️ wrap-guide@0.26.0
For deprecation fixes
2014-12-09 14:57:15 -08:00
Kevin Sawicki 7d6d634ceb Prepare 0.156 2014-12-09 14:07:45 -08:00
Nathan Sobo b386b00bc0 Wait for next animation frame before measuring when stylesheets change
Fixes #4479
2014-12-09 14:56:33 -07:00
Kevin Sawicki 2028045254 ⬆️ incompatible-packages@0.15 2014-12-09 13:42:09 -08:00
Kevin Sawicki ca60dae630 ⬆️ incompatible-packages@0.14 2014-12-09 13:27:49 -08:00
Kevin Sawicki a5605bd408 ⬆️ incompatible-packages@0.13 2014-12-09 13:14:28 -08:00
Max Brunsfeld caf6fdd5ac Merge pull request #4478 from atom/mb-panel-markup
Allow PanelElements to be instantiated with markup
2014-12-09 13:05:35 -08:00
Kevin Sawicki 19872959bc ⬆️ incompatible-packages@0.12 2014-12-09 13:04:37 -08:00
Nathan Sobo 299ea18c58 Don’t try to upgrade CSS rules with no selector text
Fixes #4469
2014-12-09 13:41:33 -07:00
Nathan Sobo 966360e022 Set ::visible to false on panels when they are destroyed 2014-12-09 13:41:33 -07:00
Kevin Sawicki 70a2be849a ⬆️ symbols-view@0.70 2014-12-09 12:04:41 -08:00
Max Brunsfeld 1c7843d9b2 💄 2014-12-09 11:36:04 -08:00
Kevin Sawicki 5291f1c62c ⬆️ symbols-view@0.69 2014-12-09 11:32:47 -08:00
Max Brunsfeld c9e7cfc02c Allow PanelElements to be instantiated with markup 2014-12-09 11:24:59 -08:00
Ben Ogle e93ca3c901 Upgrade notifications to open issues on throwing repo 2014-12-09 11:19:34 -08:00
Kevin Sawicki 48bd330a5e ⬆️ encoding-selector@0.9 2014-12-09 11:17:57 -08:00
Nathan Sobo 6240bc1fc9 ⬆️ fuzzy-finder to fix deprecations 2014-12-09 11:24:35 -07:00
Nathan Sobo 6ccc60342f Remove deprecated Workspace::activePane references 2014-12-09 10:45:54 -07:00
Ben Ogle 03750d0b6c Upgrade notifications to fix activation time 2014-12-08 18:25:27 -08:00
Max Brunsfeld 03e31ad918 Merge pull request #4457 from atom/mb-text-editor-element-methods
Add `TextEditorElement` methods needed to replace deprecated APIs
2014-12-08 17:43:11 -08:00
Kevin Sawicki 610c07870a Prepare 0.155 2014-12-08 17:42:27 -08:00
Max Brunsfeld 5c37d208f5 Don't throw when ::getDefaultCharacterWidth is called while detached 2014-12-08 16:56:46 -08:00
Ben Ogle 88c119f4ad Upgrade find and replace for fixes 2014-12-08 16:54:30 -08:00
Max Brunsfeld d03cfda6c4 📝 new TextEditorElement methods 2014-12-08 16:38:57 -08:00
Max Brunsfeld 8f02b21d08 Add TextEditorElement::onDidAttach, ::onDidDetach 2014-12-08 16:21:59 -08:00
Max Brunsfeld 953f2c61f7 Add TextEditorElement::getDefaultCharacterWidth 2014-12-08 16:14:26 -08:00
Kevin Sawicki 15e95d0d21 ⬆️ apm@0.113 2014-12-08 16:10:50 -08:00
Ben Ogle 391a71fed0 Upgrade notifications to fix several things
* add stack trace toggle
* allow selection and copy / paste
* fix the escaping on the issue template
2014-12-08 15:08:51 -08:00
Kevin Sawicki 67ed490618 ⬆️ grunt-atom-shell-installer@0.13 2014-12-08 14:32:59 -08:00
Max Brunsfeld c812dfef9b Merge pull request #4455 from atom/mb-fix-redo
Don't use a transaction in cursor/selection movement commands
2014-12-08 13:23:19 -08:00
Max Brunsfeld 631bca6c89 Don't use a transaction in cursor/selection movement commands
Previously, a transaction was used to set an undo grouping interval
for every editor command except `undo` and `redo`. The problem is
that currently, moving a marker inside of a transaction causes the
buffer's redo stack to be cleared. For now, just don't use
transactions for commands that don't modify the buffer's contents."
2014-12-08 13:06:59 -08:00
Kevin Sawicki 095c1b74a7 ⬆️ status-bar@0.52 2014-12-08 12:50:15 -08:00
Kevin Sawicki 7e408ad268 ⬆️ status-bar@0.51 2014-12-08 12:45:09 -08:00
Kevin Sawicki 4945fd7aae Don't make atom.services public yet 2014-12-08 12:37:06 -08:00
Kevin Sawicki 0db5549b64 Merge pull request #4454 from andreicristianpetcu/master
use nodejs v0.10.33 and python 2.7.6
2014-12-08 12:17:06 -08:00
Andrei Cristian Petcu 96095f9c30 use nodejs v0.10.33 and python 2.7.6 2014-12-08 21:40:31 +02:00
Kevin Sawicki e2b4fcad65 ⬆️ markdown-preview@0.111 2014-12-08 11:23:38 -08:00
Nathan Sobo 3ea1c80fe7 :arrow-up: bracket-matcher to fix deprecations 2014-12-08 11:43:07 -07:00
Nathan Sobo 525b4ac3eb ⬆️ background-tips to fix deprecations 2014-12-08 11:37:19 -07:00
Nathan Sobo 6ffc750e18 :arrow-up: autocomplete for deprecation fixes 2014-12-08 11:34:35 -07:00
Nathan Sobo 66716db4d1 ⬆️ autosave for deprecation fixes 2014-12-08 11:30:52 -07:00
Nathan Sobo 95d03fc5fa ⬆️ autoflow for deprecation fixes 2014-12-08 11:30:52 -07:00
Kevin Sawicki b816fca75e ⬆️ language-c@0.33 2014-12-08 10:26:51 -08:00
Kevin Sawicki 6f148f681d ⬆️ language-yaml@0.21 2014-12-08 10:14:23 -08:00
Max Brunsfeld a489358f55 ⬆️ tree-view@0.136.0
For deprecation fixes
2014-12-08 10:06:11 -08:00
Kevin Sawicki 1cd0caeb2d ⬆️ language-less@0.21 2014-12-08 09:54:06 -08:00
Kevin Sawicki 310939338c ⬆️ language-sass@0.28 2014-12-08 09:52:49 -08:00
Kevin Sawicki e39d50972d ⬆️ language-python@0.26 2014-12-08 09:50:13 -08:00
Kevin Sawicki 9a5f3ab000 Merge pull request #4430 from steelbrain/patch-1
Updated README.md
2014-12-08 09:43:53 -08:00
Max Brunsfeld 9285f2605f ⬆️ update-package-dependencies@0.7.0
For deprecation fixes
2014-12-08 09:40:12 -08:00
Steel Brain b654209adb Updated README.md 2014-12-07 07:30:18 +05:00
Steel Brain 0c07166a8e Updated README.md
Fixes atom/atom#4427
2014-12-07 06:51:32 +05:00
Kevin Sawicki de36ceb00c Merge pull request #4337 from pwagland/master
Fix atom.sh when running from directory with space
2014-12-05 15:04:03 -08:00
Kevin Sawicki aa292874ec Add reload button to specs window 2014-12-05 15:03:16 -08:00
Ben Ogle 736b6f37e4 Upgrade notifications to make the max height larger 2014-12-05 15:01:19 -08:00
Ben Ogle 8d9098464c Merge pull request #4413 from atom/bo-notification-dismiss
Add dismissing to notifications
2014-12-05 15:00:00 -08:00
Paul Wagland eb6ce74a12 Use xargs -0 instead of sed, as this is easier to understand.
Fixed atom/atom#4337
Fixes atom/atom#4336
2014-12-05 23:53:07 +01:00
Ben Ogle 33ee1cb0de Upgrade notifications to use new APIs 2014-12-05 14:29:00 -08:00
Max Brunsfeld 11a07f41ac Merge pull request #4414 from atom/mb-convert-stack-trace
Fix line numbers in coffeescript stack traces for error hooks
2014-12-05 14:06:22 -08:00
Ben Ogle 5cf97db07c Add getNotifications() 2014-12-05 13:46:01 -08:00
Ben Ogle f095d38978 Add dismissing to notifications 2014-12-05 13:46:01 -08:00
Kevin Sawicki 218f6ab629 Guard against no stylesheet disposable 2014-12-05 13:32:37 -08:00
Ben Ogle 26edd40f14 Upgrade notifications to not show in dev mode 2014-12-05 13:15:53 -08:00
Max Brunsfeld 8241351143 Merge pull request #4407 from atom/ns-add-services-api
Add atom.services API
2014-12-05 13:13:50 -08:00
Max Brunsfeld 286361bf2b Fix line numbers in coffeescript stack traces for error hooks 2014-12-05 12:59:19 -08:00
Kevin Sawicki 3d5437c1e9 Merge pull request #4393 from envygeeks/patch-1
Move Debian alternatives entry up.
2014-12-05 10:47:11 -08:00
Ben Ogle 95b9140dcf Merge pull request #4405 from ryanpcmcquen/patch-1
🐧 add Slackware install method
2014-12-05 10:38:42 -08:00
Kevin Sawicki fc82e5ffd6 ⬆️ find-and-replace@0.150 2014-12-05 10:00:49 -08:00
Kevin Sawicki 20521ad487 ⬆️ git-diff@0.45 2014-12-05 09:48:49 -08:00
Nathan Sobo 99f91fac48 Add atom.services API 2014-12-05 09:46:52 -08:00
Nathan Sobo d4b0b33d86 📝 ability to pass DOM elements to atom.commands.add 2014-12-05 09:44:52 -08:00
Max Brunsfeld 790c125e0b Merge pull request #4406 from atom/mb-editor-text-content
Allow setting editor text content in HTML
2014-12-05 09:44:29 -08:00
Max Brunsfeld 4afe133f85 Allow setting editor text content in HTML 2014-12-05 09:30:33 -08:00
Kevin Sawicki 763e83584d ⬆️ language-python@0.25 2014-12-05 09:29:30 -08:00
Kevin Sawicki 62a671aae6 ⬆️ language-less@0.20 2014-12-05 09:28:29 -08:00
Kevin Sawicki c0eb5d0ebe Prepare 0.154 2014-12-05 09:02:44 -08:00
Kevin Sawicki d1e9ad3ed1 ⬆️ apm@0.111.1 2014-12-05 08:44:28 -08:00
Ryan P.C. McQuen 396b53b8dc add Slackware install method 2014-12-05 06:34:57 -08:00
Max Brunsfeld d87d98278e ⬆️ status-bar@0.50.0 2014-12-04 14:14:05 -08:00
Kevin Sawicki 682a4be285 ⬆️ language-sass@0.27 2014-12-04 12:47:32 -08:00
Kevin Sawicki 14c68a4280 ⬆️ package-generator@0.33 2014-12-04 12:42:58 -08:00
Ben Ogle ddfbc6c335 Update notifications to add repro steps to issue body 2014-12-04 12:23:22 -08:00
Max Brunsfeld 779642b3da ⬆️ command-palette
For deprecation fixes.

Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-04 12:13:05 -08:00
Max Brunsfeld 705c78bf18 ⬆️ tabs 2014-12-04 12:09:56 -08:00
Ben Ogle 07a21a15a1 Upgrade find-and-replace to fix tabbing between mini editors 2014-12-04 12:08:49 -08:00
Max Brunsfeld 287895c78c ⬆️ status-bar@0.49.0
For deprecation fixes

Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-04 12:06:39 -08:00
Kevin Sawicki fcf7b6747b ⬆️ git-diff@0.44 2014-12-04 11:30:47 -08:00
Kevin Sawicki 1af25ea401 ⬆️ exception-reporting@0.21 2014-12-04 11:28:41 -08:00
Max Brunsfeld aecd689593 Call Workspace::getActiveTextEditor, not ::getActiveEditor 2014-12-04 08:57:33 -08:00
Jordon Bedwell 8ad8a61aab Move Debian alternatives entry up.
Move the Debian alternatives entry up so it's below and grouped with
"no such file or directory" since it's an alternate solution to symlinking.
2014-12-04 02:49:05 -06:00
Max Brunsfeld 6a83246838 Use native DOM APIs for window drag/drop listeners
Otherwise, these event handlers will interfere with other
event handlers bound using other versions of jQuery
2014-12-03 20:26:36 -08:00
Ben Ogle a7fc1c4138 Upgrade tello@1.0.4 2014-12-03 17:03:00 -08:00
Max Brunsfeld c19aee5472 Carry over remaining tooltip disposal code from space-pen extensions
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-12-03 17:02:47 -08:00
Ben Ogle e9d49b1df3 📝 Add tooltip examples 2014-12-03 16:23:08 -08:00
Ben Ogle 5a456c8552 📝 Add arg to pane::destroyItem() 2014-12-03 16:11:29 -08:00
Kevin Sawicki 1179ced85c Remove duplicate require 2014-12-03 15:07:07 -08:00
Max Brunsfeld 7738472eb8 ⬆️ timecop@0.24.0
For deprecation fixes
2014-12-03 14:55:19 -08:00
Ben Ogle 45274eaad3 Merge pull request #4390 from atom/bo-panel-for-item
Add Workspace::panelForItem()
2014-12-03 14:15:33 -08:00
Ben Ogle 24f7638e8b Add Workspace::panelForItem() 2014-12-03 12:46:42 -08:00
Ben Ogle 6ec7b7b38d Update notifications to add:
* style tweaks
* remove deprecations
* Only show view issue button when the titles match
2014-12-03 12:20:00 -08:00
Kevin Sawicki 094a7e9a5f ⬆️ go-to-line@0.27 2014-12-03 11:23:16 -08:00
Kevin Sawicki 97181121c9 ⬆️ open-on-github@0.31 2014-12-03 11:12:54 -08:00
Kevin Sawicki 3e4c7a8ab7 ⬆️ link@0.28 2014-12-03 11:07:25 -08:00
Kevin Sawicki f4b08649a0 Use JSON example since package.json is target 2014-12-03 11:04:17 -08:00
Nathan Sobo c1a93395f5 Fix deprecated Workspace::getActiveEditor call 2014-12-03 12:02:47 -07:00
Nathan Sobo 53b538311e Add activationEvents deprecation warning 2014-12-03 12:00:53 -07:00
Kevin Sawicki 19ae78e062 ⬆️ link@0.27 2014-12-03 10:41:01 -08:00
Max Brunsfeld 5a93f14199 ⬇️ wrap-guide@0.24.0
Replacing WorkspaceView::eachEditorView with Workspace::observeTextEditors
doesn't quite work for this use case. Getting this package to work without
deprecated APIs will probably require further changes to core.
2014-12-02 17:05:43 -08:00
Ben Ogle d7dd0f3224 Upgrade solarized dark syntax to 025.0 2014-12-02 16:34:56 -08:00
Ben Ogle 37e6f03346 Fix tooltip command display when command has no keybinding 2014-12-02 16:31:38 -08:00
Ben Ogle 0aa3cd58c1 Upgrade find and replace to the deprecation-free 0.148.0 2014-12-02 15:53:01 -08:00
Ben Ogle ac23717f8c Only beep when there is a workspace
Some specs might not create one.
2014-12-02 15:52:37 -08:00
Nathan Sobo 491561db4a Merge pull request #4380 from atom/ns-upgrade-archive-view
Upgrade archive-view
2014-12-02 16:24:23 -07:00
Max Brunsfeld edfd67b093 ⬆️ welcome@0.21.0
For test-suite speed improvements
2014-12-02 15:15:36 -08:00
Nathan Sobo dd63d47c11 Add getters for decoration types in addition to ‘overlay’ 2014-12-02 15:59:12 -07:00
Nathan Sobo 067f5ea7e8 ⬆️ archive-view 2014-12-02 15:48:56 -07:00
Nathan Sobo eb223c4f21 ⬇️ archive-view until we can get the build passing on CI 2014-12-02 15:33:32 -07:00
Nathan Sobo f632b6fe79 ⬆️ event-kit and text-buffer to try to fix CI 2014-12-02 15:29:55 -07:00
Max Brunsfeld 5bdc8af850 ⬆️ welcome@0.20.0
For deprecation fixes
2014-12-02 13:50:20 -08:00
Nathan Sobo b03931371a ⬆️ bookmarks to remove deprecated API usage 2014-12-02 14:16:30 -07:00
Nathan Sobo c02755f59a ⬆️ archive-view to remove deprecated API usage 2014-12-02 14:04:03 -07:00
Kevin Sawicki e178b25f17 ⬆️ grunt-atom-shell-installer@0.12 2014-12-02 13:00:28 -08:00
Max Brunsfeld 96efb232ee ⬆️ whitespace@0.27.0
For deprecation fixes
2014-12-02 12:51:53 -08:00
Max Brunsfeld 714cbc9f4b Add deprecation warning for Workspace::getActiveEditor 2014-12-02 12:46:05 -08:00
Max Brunsfeld 64e4053a19 Deprecate delegated properties on workspace
* ::activePaneItem was already deprecated, but the stack
  trace was internal and confusing
* ::activePane is newly deprecated
2014-12-02 12:37:27 -08:00
Kevin Sawicki a7f1f90c1d ⬆️ language-javascript@0.47 2014-12-02 11:48:36 -08:00
Kevin Sawicki cacaba936b Add restart helper on Windows 2014-12-02 11:31:18 -08:00
Max Brunsfeld b20589fbb6 Decrease default undo grouping interval to 300ms 2014-12-02 11:19:31 -08:00
Kevin Sawicki d3f14d8939 ⬆️ language-less@0.19 2014-12-02 11:11:40 -08:00
Max Brunsfeld 094ba81758 ⬆️ wrap-guid@0.24.1
For deprecation fixes
2014-12-02 11:06:52 -08:00
Nathan Sobo 8a40be8345 Null guard container in Pane::destroyed 2014-12-02 11:57:38 -07:00
Nathan Sobo 2d8d330df7 Add Workspace::onDidDestroyPaneItem for symmetry with ::onDidDestroyPane 2014-12-02 11:57:38 -07:00
Nathan Sobo fbc9c05096 Add Workspace::onDidDestroyPane
This helps with the background-tips conversion
2014-12-02 11:57:38 -07:00
Nathan Sobo 1eab423a1c Clarify that we’re taking an event in the parameter name 2014-12-02 11:57:38 -07:00
Nathan Sobo cfca6ecc86 Add specs for PaneContainer::onDidAddPane 2014-12-02 11:57:38 -07:00
Kevin Sawicki fb96b01f30 Log from quitAndInstall 2014-12-02 10:42:46 -08:00
Nathan Sobo 625b95a6d9 Test TextEditorElement::setUpdatedSynchronously without waiting
Another attempt to fix flakiness.
2014-12-02 11:37:28 -07:00
Kevin Sawicki 0fe9dc6aa9 Spawn new atom.exe immediately on quitAndInstall 2014-12-02 10:30:58 -08:00
Nathan Sobo 38e6aee46d Un-f 2014-12-02 11:14:59 -07:00
Nathan Sobo 01f87d9678 Null guard workspace element for deprecated update-available dispatch 2014-12-02 11:14:33 -07:00
Nathan Sobo 93bf9357b0 Remove waitsForAnimationFrame spec helper
It doesn’t work reliably on CI.
2014-12-02 11:14:02 -07:00
Kevin Sawicki ed42a275ab 💄 2014-12-02 09:21:56 -08:00
Kevin Sawicki 6998337144 ⬆️ grunt-atom-shell-installer@0.11 2014-12-02 09:16:34 -08:00
Kevin Sawicki 8b92aef3ff Merge pull request #4246 from atom/ks-add-update-menus-on-windows
Add update menus on windows
2014-12-02 09:10:33 -08:00
Kevin Sawicki 66d6af54bf ⬆️ atom-shell@0.19.4 2014-12-02 08:58:00 -08:00
Kevin Sawicki 2a06ece3df ⬆️ atom-shell@0.19.3 2014-12-02 08:58:00 -08:00
Kevin Sawicki 1c0c8db042 Add unsupported state to update manager 2014-12-02 08:58:00 -08:00
Kevin Sawicki 9293ef766b Add update menus on Windows 2014-12-02 08:58:00 -08:00
Max Brunsfeld a7a9b3707f Merge pull request #4365 from atom/ns-view-registry-cleanup
Clean up view registry API
2014-12-02 08:55:00 -08:00
Kevin Sawicki 7e16e42b3f x out flaky spec 2014-12-02 08:39:52 -08:00
Kevin Sawicki 179fb2d274 Start bundling language-clojure
It is now MIT licensed which was the reason it was removed as a
bundled package originally.
2014-12-02 08:21:10 -08:00
Kevin Sawicki f804006d6c ⬆️ language-c@0.32 2014-12-01 17:54:10 -08:00
Nathan Sobo 9a9347e3a5 Simplify ViewRegistry::addViewProvider API
It now takes two arguments, a model constructor and a create view
callback that is passed the model.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-12-01 17:53:03 -08:00
Max Brunsfeld e4bcb96dcc Change ::setModel to ::initialize on all element classes 2014-12-01 17:52:19 -08:00
Kevin Sawicki 8a0992d689 ⬆️ language-gfm@0.55 2014-12-01 17:46:15 -08:00
Kevin Sawicki db17a6cba4 📝 Remove stray to 2014-12-01 17:42:14 -08:00
Kevin Sawicki 5449fc2e15 ⬆️ tree-view@0.135 2014-12-01 17:34:38 -08:00
Kevin Sawicki 0a84ad5307 Use .source.gfm as root selector
This matches the grammar's scope name and was an oversight from the
original CSS to Less conversion.
2014-12-01 17:23:37 -08:00
Max Brunsfeld 485c402661 ⬆️ text-buffer@3.8.1 2014-12-01 16:54:18 -08:00
Nathan Sobo 4591f00a65 Remove view registry references from the workspace model layer
Removed various ::getView methods from the model. Using the atom.views
global in the views for now, but going to switch them over to using a
locally assigned view registry instead in a subsequent commit.
2014-12-01 16:28:33 -08:00
Ben Ogle b635fa0c97 Use Grim.
Refs #3706
2014-12-01 10:58:23 -08:00
Kevin Sawicki 004103d579 ⬆️ bracket-matcher@0.63 2014-12-01 10:23:12 -08:00
Kevin Sawicki 2c952fad95 ⬆️ language-json@0.10 2014-12-01 10:21:24 -08:00
Kevin Sawicki adc983e8da ⬆️ language-java@0.13 2014-12-01 09:46:08 -08:00
Nathan Sobo 7dc9d0c8ce Add Workspace::onWillDestroyPaneItem
It is needed by the autosave package which previously relied on DOM
bubbling to coalesce events from various panes.
2014-12-01 10:39:29 -07:00
Kevin Sawicki 3d3521962c ⬆️ language-ruby@0.44 2014-12-01 09:32:22 -08:00
Kevin Sawicki 46a1f69ab1 ⬆️ language-todo@0.14 2014-12-01 09:24:29 -08:00
Kevin Sawicki 298d3e5fb6 ⬆️ language-objective-c@0.12 2014-12-01 09:14:33 -08:00
Kevin Sawicki 27291980cb ⬆️ language-mustache@0.11 2014-12-01 09:12:14 -08:00
Kevin Sawicki 64ae4bf6c3 ⬆️ language-json@0.9 2014-12-01 09:09:09 -08:00
Kevin Sawicki 90a71d1171 ⬆️ language-ruby@0.43 2014-12-01 08:51:36 -08:00
Kevin Sawicki a5b7d15bcc Remove screen line logging from spec 2014-12-01 08:39:09 -08:00
Kevin Sawicki be2d49a410 Remove unused subscriptions ivar
Closes #4343
2014-12-01 08:37:51 -08:00
Kevin Sawicki 8a9805cc6d ⬆️ language-java@0.12 2014-12-01 08:26:10 -08:00
Kevin Sawicki 196694e352 ⬆️ language-javascript@0.46 2014-12-01 08:20:56 -08:00
Max Brunsfeld 12683571e3 ⬆️ language-coffee-script@0.38.1 2014-11-29 10:34:31 -08:00
Max Brunsfeld c0991447ff ⬆️ language-css@0.23.1 2014-11-29 10:33:16 -08:00
Max Brunsfeld f9fcb9f2e2 ⬆️ language-gfm@0.54.1 2014-11-29 10:31:59 -08:00
Max Brunsfeld 1daab1b956 ⬆️ language-go@0.19.1 2014-11-29 10:29:33 -08:00
Max Brunsfeld fc7f922de0 ⬆️ language-html@0.26.1 2014-11-29 10:27:39 -08:00
Max Brunsfeld 5f1f2cd9be ⬆️ language-hyperlink@0.12.2 2014-11-29 10:25:01 -08:00
Max Brunsfeld dca0576496 ⬆️ language-javascript@0.45.1 2014-11-29 10:21:37 -08:00
Max Brunsfeld aa7d8fb382 ⬆️ language-less@0.18.1 2014-11-29 10:20:05 -08:00
Max Brunsfeld 08f20adc35 ⬆️ language-mustache@0.10.1 2014-11-29 09:55:43 -08:00
Max Brunsfeld c5f1165f61 ⬆️ language-python@0.24.1 2014-11-29 09:53:01 -08:00
Max Brunsfeld 58499aeec7 ⬆️ language-ruby@0.42.0 2014-11-29 09:49:07 -08:00
Max Brunsfeld 83c73fc94a ⬆️ language-sass@0.26.1 2014-11-29 09:46:16 -08:00
Max Brunsfeld b28a1aa5c7 ⬆️ language-shellscript@0.10.1 2014-11-28 16:51:24 -08:00
Max Brunsfeld bcb72394f9 ⬆️ language-toml@0.14.1 2014-11-28 16:48:58 -08:00
Max Brunsfeld efe7baf140 ⬆️ language-yaml@0.20.1 2014-11-28 16:40:11 -08:00
Max Brunsfeld 4b07103fcf ⬆️ pathwatcher@2.3.5 2014-11-28 16:38:54 -08:00
Max Brunsfeld 9d60fd2322 Deprecate changeFocus option to Workspace::open
Its documentation was already removed, and it was already
deprecated in ::openSync.
2014-11-28 11:42:01 -08:00
Max Brunsfeld 71228a5f45 Merge pull request #4340 from atom/mb-add-panel-getters
Add panel getter methods to workspace
2014-11-28 10:05:35 -08:00
Max Brunsfeld 6b3ba8e332 Add panel getter methods to workspace
This will make it easier to test packages that use panels
without using the DOM
2014-11-28 09:56:02 -08:00
Paul Wagland 5da4846fff Fix atom.sh when running from directory with space
Deal with ATOM_PATH having a space by proper quoting, and not passing
the directory name to dirname.

Fixes atom/atom#4336
2014-11-28 00:37:21 +01:00
Nathan Sobo de619a731b Merge pull request #4315 from atom/remove-deprecations
Remove deprecations from core
2014-11-27 12:16:35 -07:00
Nathan Sobo d2283b0567 ⬆️ text-buffer 2014-11-27 11:59:07 -07:00
Nathan Sobo 2a00acfdaf Remove call to begin/commitTransaction in text-editor-spec 2014-11-27 11:58:38 -07:00
Nathan Sobo b2025ebad0 Don’t openPath on window startup for spec windows
It causes specs to fail because the window loses focus somehow when
this gets run.
2014-11-27 11:13:46 -07:00
Nathan Sobo 0b44cee8db Separate IPC messages that don’t belong in the command palette
Path opening and update signaling were both using the command-sending
IPC mechanism, but neither is actually a command. This commit adds a
second “message” channel with custom handling on the render process
side for these messages, rather than attempting to route them through
commands.
2014-11-27 10:30:50 -07:00
Nathan Sobo 5fed6199ec 💄 grammar 2014-11-27 09:23:35 -07:00
Nathan Sobo ddc04f2278 Fix spec name 2014-11-27 09:11:21 -07:00
Nathan Sobo f64a813fc6 Remove deprecated Project::setPath call 2014-11-27 09:09:33 -07:00
Nathan Sobo 68bc3f6ead Add assertions and suppress deprecation warnings in theme-manager-spec
The new expected behavior is now tested. The deprecated behavior is
also tested until we remove it later.
2014-11-27 09:03:40 -07:00
Nathan Sobo ffbcddf063 Always focus pane element when pane model is activated
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-26 18:25:55 -07:00
Nathan Sobo b341749d54 Add TextEditorElement::setUpdatedSynchronously
To allow testing of async editor rendering in packages. This is helpful
for overlay decorations which behave differently when rendering is
async.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-26 18:13:12 -07:00
Max Brunsfeld d2ab75382a Merge pull request #4328 from atom/mb-fix-panel-attach-callbacks
In panel-element, call space pen attach hooks after attached
2014-11-26 16:20:29 -08:00
Max Brunsfeld b125565776 Call space pen attach hooks after attached 2014-11-26 15:09:20 -08:00
Ben Ogle 9cec02420c Suppress deprecations while testing legacy code path 2014-11-26 14:55:40 -08:00
Ben Ogle 6f82281b8f Use Project::getPaths() and Project::setPaths() 2014-11-26 14:55:40 -08:00
Ben Ogle ffda2386c3 Suppress deprecations for package loading. 2014-11-26 14:55:40 -08:00
Ben Ogle aefc647155 Use normalizeLineEndings: false hash 2014-11-26 14:55:39 -08:00
Ben Ogle 83455a7f3a Remove specs for deprecated methods that are tested elsewhere 2014-11-26 14:55:39 -08:00
Ben Ogle d8f64c15b8 Use project.getDirectories() 2014-11-26 14:55:39 -08:00
Ben Ogle c927e95c2c Suppress deprecations on pane-view
It’s going away anyway…
2014-11-26 14:55:39 -08:00
Ben Ogle 5b12646a44 Suppress deprecations on deprecated code path 2014-11-26 14:55:39 -08:00
Ben Ogle 68bb43ee7d Add onDidChangeTitle and onDidChangeModified methods to TestView 2014-11-26 14:55:39 -08:00
Ben Ogle 4048fb978c Suppress deprecations for package activation 2014-11-26 14:55:39 -08:00
Ben Ogle 2d885496a3 Update to new menu format 2014-11-26 14:55:39 -08:00
Ben Ogle 64222d3096 Suppress deprecations in configDefault test 2014-11-26 14:55:39 -08:00
Ben Ogle 2c7bbf8e9f Remove Project deserialize deprecation 2014-11-26 14:55:39 -08:00
Ben Ogle a45e9a1e8b Remove deprecations in config 2014-11-26 14:55:39 -08:00
Ben Ogle 3fd5ba9b3c Remove unnecessary workspaceView requires 2014-11-26 14:55:39 -08:00
Ben Ogle eb0e3df720 Suppress deprecations in workspaceView 2014-11-26 14:55:39 -08:00
Ben Ogle 60a49d9c81 nof 2014-11-26 14:55:39 -08:00
Ben Ogle 43ccf0a041 Convert require ‘atom’ to require '../src/space-pen-extensions' 2014-11-26 14:55:38 -08:00
Ben Ogle 1f6764e708 No longer require atom in the spec-helper 2014-11-26 14:55:38 -08:00
Ben Ogle 48f714d5fb Fix deprecation link colors 2014-11-26 14:54:49 -08:00
Nathan Sobo e2813b4dd9 📝 overlay decoration options in TextEditor::decorateMarker 2014-11-26 15:14:56 -07:00
Nathan Sobo 41b3d65e05 Merge pull request #4325 from atom/ns-tail-overlays
Add ‘position’ option to overlay decorations
2014-11-26 15:02:36 -07:00
Nathan Sobo 1e50985ec7 Add ‘position’ option to overlay decorations
By default overlays are positioned at the head of the given marker.
This option allows them to be positioned at the tail instead by passing
`position: ’tail’` when creating the decoration, which is useful for 
autocomplete.
2014-11-26 12:29:52 -07:00
Nathan Sobo 1d6087fcd3 Add TextEditor::getDecorations and ::getOverlayDecorations
Required for autocomplete upgrades.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-26 12:17:26 -07:00
Ben Ogle f2e74f216c Upgrade to solarized-dark-syntax to update to standard colors 2014-11-26 11:09:04 -08:00
Nathan Sobo b9950ef2df Match coordinate types when computing overlay pixel position
Heads up @benogle
2014-11-26 09:28:12 -07:00
Aleksandr Kalko 67f4d51774 Fixed link error 2014-11-26 09:44:50 +02:00
Aleksandr Kalko 1bf4db15b2 Updated README WIndows installing section, added Choclatey installation file 2014-11-26 09:42:32 +02:00
Nathan Sobo 28eb03ed29 ⬆️ command-palette to fix exception on call to ::command
Fixes #4318
2014-11-25 20:49:17 -07:00
Ben Ogle 2843af458b Merge pull request #4307 from atom/bo-add-parse-errors
Integrate notifications into core
2014-11-25 15:59:37 -08:00
Ben Ogle 163a7587f9 Upgrade notifications for issue searching and dupe handling 2014-11-25 15:44:14 -08:00
Ben Ogle 18f83e90f7 Add isEquals to notifications 2014-11-25 15:44:14 -08:00
Ben Ogle 7094701c66 Remove the font-family variable 2014-11-25 15:44:14 -08:00
Ben Ogle d7d23f7fc9 Upgrade snippets to display a notification
when there is a parse error
2014-11-25 15:44:14 -08:00
Ben Ogle bdbc850695 Add a @font-family-monospace 2014-11-25 15:44:14 -08:00
Ben Ogle 4e0ab92827 Fix Notification::getDetail 2014-11-25 15:44:14 -08:00
Ben Ogle b662281958 Upgrade notifications to remove menus, and fix styling 2014-11-25 15:44:14 -08:00
Ben Ogle 4d2cc86ada Add notifications package as a dependency 2014-11-25 15:44:14 -08:00
Ben Ogle 19fcc1c441 💄 on message 2014-11-25 15:44:14 -08:00
Ben Ogle 1f5fa27113 Trigger a notification when there is a keymap issue 2014-11-25 15:44:14 -08:00
Ben Ogle 362bd2e61a Use atom.notifications when there is a config file error 2014-11-25 15:44:13 -08:00
Ben Ogle 4cb80d3c7e Downgrade pathwatcher in an attempt to fix build 2014-11-25 15:26:50 -08:00
Ben Ogle 7f108dab38 Merge pull request #4286 from m0x72/patch-1
Wrong Reactionary dependence
2014-11-25 12:20:43 -08:00
Ben Ogle cec5a83eff 📝 Update restoreDefault to doc scopeSelector 2014-11-25 12:10:54 -08:00
Nathan Sobo a7c3c15885 Don’t assume presence of unsubscribe method in SpacePen callRemoveHooks 2014-11-25 10:01:27 -07:00
Nathan Sobo 1c16738969 ⬆️ pathwatcher for deprecation warning fix 2014-11-25 08:51:13 -07:00
Nathan Sobo b4a456d911 Fix misinformation in deprecation warning 2014-11-25 08:19:20 -07:00
Nathan Sobo c92f805e6e Remove deprecated requires from spec-helper 2014-11-25 08:18:26 -07:00
Nathan Sobo 859a4db242 ⬆️ UI themes now that status-bar has no redundant panel classes
The UI themes now style both the legacy panel classes and the new panel
elements. Views converted to to the new panels API should remove their
legacy classes.
2014-11-25 08:09:11 -07:00
Nathan Sobo 3a94b70270 ⬆️ status-bar to remove redundant panel classes 2014-11-25 07:48:11 -07:00
Nathan Sobo 85d6689344 Merge pull request #4305 from atom/ns-add-legacy-panel-classes
Add legacy panel classes for theme support
2014-11-25 07:43:17 -07:00
Max Brunsfeld e0726b0354 Merge pull request #4309 from atom/mb-fix-panel-order
Fix ordering of panels in panel containers
2014-11-24 17:40:25 -08:00
Max Brunsfeld 0abd25ad6f Fix ordering of panels in panel containers
An off-by-one error caused new panels to be inserted later
in the document than intended.
2014-11-24 17:29:31 -08:00
Max Brunsfeld 42522686d7 ⬆️ autocomplete@0.33.1 2014-11-24 16:22:15 -08:00
Nathan Sobo 1e9a8b92f2 Fix workspace model spec now that legacy panel class is added in view 2014-11-24 17:03:32 -07:00
Nathan Sobo dda2b2e893 Don’t apply ‘tool-panel’ class to modal panels 2014-11-24 16:46:47 -07:00
Ben Ogle e04c05ffee Merge pull request #4264 from atom/bo-messages
Messages API implementation
2014-11-24 15:39:57 -08:00
Nathan Sobo 8cb0197638 Add legacy ‘from-top’ class at the view layer, not the model
This blends in to our approach with the other legacy panel classes.
2014-11-24 16:38:04 -07:00
Nathan Sobo 73763d3e41 Add legacy panel classes to support old theme selectors
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-24 16:37:37 -07:00
Nathan Sobo 9d1c3124ee Prepare 0.153.0 release 2014-11-24 16:29:05 -07:00
Ben Ogle aaee54bd08 Remove unnecessary error flash classes 2014-11-24 14:58:21 -08:00
Ben Ogle 1ae8862a9c Notification::getTimestamp() 2014-11-24 14:58:21 -08:00
Ben Ogle f3dd757537 Export Notification, not Message 2014-11-24 14:58:21 -08:00
Ben Ogle 68693e3ca0 Remove issue related stuff 2014-11-24 14:58:21 -08:00
Ben Ogle e24a562387 Use bug icon for fatal errors 2014-11-24 14:58:21 -08:00
Ben Ogle 9c6a5fb4fa Messages -> notifications 2014-11-24 14:58:21 -08:00
Ben Ogle 25caaa92f1 Export Message 2014-11-24 14:58:21 -08:00
Ben Ogle 78ee02f0c6 nof 2014-11-24 14:58:21 -08:00
Ben Ogle e462fdc4ce Add specs for Message 2014-11-24 14:58:21 -08:00
Ben Ogle 96d8721c9e Add some things to Message 2014-11-24 14:58:21 -08:00
Ben Ogle 568151b1a5 📝 2014-11-24 14:58:21 -08:00
Ben Ogle 3d6c9ee554 Add a MessageManager to atom.messages 2014-11-24 14:58:20 -08:00
Ben Ogle d5d6422d28 Add beginning of message system 2014-11-24 14:58:20 -08:00
Nathan Sobo 8cf24bc7de ⬇️ UI themes so we can iron out selector issues
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-24 15:51:11 -07:00
Nathan Sobo 5727865b94 Prepare 0.152.0 release 2014-11-24 15:18:57 -07:00
Nathan Sobo b95b86396e ⬆️ text-buffer to publicize checkpoint methods
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-24 14:23:49 -07:00
Nathan Sobo d75c35285c Publicize checkpoint methods and deprecate open-ended transactions
On TextEditor

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-24 14:23:48 -07:00
Ben Ogle a7bc7c198d Suggest space-pen 4 rather than space-pen 3 2014-11-24 13:18:42 -08:00
Nathan Sobo d2f24615c1 Delete advanced/globals.md now that we cover them in the API docs 2014-11-24 12:20:45 -07:00
Nathan Sobo e4b942e991 Modernize advanced/configuration docs 2014-11-24 12:16:53 -07:00
Nathan Sobo c9f8ffc749 💄 create-a-package.md 2014-11-24 12:02:34 -07:00
Cheng Zhao c2086eee0e ⬆️ atom-shell@0.19.4 2014-11-24 11:38:26 +08:00
Max Brunsfeld d5a66c590a Merge pull request #4288 from atom/mb-paste-leading-whitespace
Preserve first line's leading whitespace on paste
2014-11-23 10:12:51 -08:00
Max Brunsfeld b374c1a11a Preserve 1st line's leading whitespace on paste 2014-11-22 09:43:23 -08:00
Martin Riedel 509d16b65a Updated deprecation msg to reactionary-atom-fork 2014-11-22 17:49:52 +01:00
m0x72 e8e13ca645 Wrong Reactionary dependence
exports/atom.coffee requires package `reactionary` while atom only has `reactionary-atom-fork` as a dependence (https://github.com/atom/atom/blob/master/package.json#L53). Should require `reactionary-atom-fork` instead.

It's clear that `Reactionary` will soon be omitted from atom's module exports, but as long as fallbacks are provided, the `reactionary` package reference should be corrected. :)
2014-11-22 16:00:40 +01:00
Nathan Sobo 35f8e6a5a7 ⬆️ deprecation-cop to fix specs 2014-11-21 21:48:11 -07:00
Nathan Sobo 36a9ad7d90 ⬆️ atom-light-ui for 1.0 selector upgrades 2014-11-21 21:32:08 -07:00
Nathan Sobo 6ff304094f ⬆️ deprecation-cop for atom-pane-container and atom-pane-axis deprecations 2014-11-21 21:10:59 -07:00
Nathan Sobo 0e51def6be ⬆️ atom-dark-ui for 1.0 selector compatibility 2014-11-21 20:54:25 -07:00
Nathan Sobo f366a67fee ⬆️ deprecation-cop for new panel selectors 2014-11-21 20:30:19 -07:00
Max Brunsfeld f30f0de45e ⬆️ text-buffer@3.7.1 2014-11-21 17:09:23 -08:00
Nathan Sobo 9e36cd705e ⬆️ atom-dark-syntax to remove deprecated selectors 2014-11-21 18:02:43 -07:00
Max Brunsfeld 2a5081f0e0 Remove normalizeIndentOnPaste from config schema 2014-11-21 14:51:44 -08:00
Kevin Sawicki 2c93b1459e ⬆️ image-view@0.42 2014-11-21 11:57:58 -08:00
Max Brunsfeld bf83fb7b10 ⬆️ text-buffer@3.7.0 for checkpoints
Also add methods on TextEditor to expose the new checkpoint
functionality
2014-11-21 11:06:43 -08:00
Kevin Sawicki f4cc8c31b3 ⬇️ image-view@0.40
Specs are failing
2014-11-21 10:51:12 -08:00
Nathan Sobo e62ecbab6b Work around chromium bug where focus gets stolen from shadow DOM
Fixes #4255
2014-11-21 11:04:42 -07:00
Kevin Sawicki 4cef3bfef5 ⬆️ image-view@0.41 2014-11-21 09:54:18 -08:00
Kevin Sawicki 85fae83195 ⬆️ language-xml@0.25 2014-11-21 08:41:43 -08:00
Ben Ogle f79b78054c Add title to TooltipManager args 2014-11-20 18:35:01 -08:00
Kevin Sawicki e803c06b28 ⬆️ tree-view@0.134 2014-11-20 17:00:18 -08:00
Kevin Sawicki 1963a7f437 ⬆️ tree-view@0.133 2014-11-20 16:12:20 -08:00
Ben Ogle 48eb5307e6 Upgrade status bar to use the new panel api 2014-11-20 15:20:26 -08:00
Nathan Sobo 95d6ab1d4f Add legacy ‘Syntax’ deserializer for GrammarRegistry 2014-11-20 15:28:37 -07:00
Kevin Sawicki 9224c86452 ⬆️ language-gfm@0.54 2014-11-20 14:15:34 -08:00
Kevin Sawicki 0fa2b4426a ⬆️ language-javascript@0.45 2014-11-20 13:41:44 -08:00
Kevin Sawicki 1e4e59ad1c Merge pull request #3745 from atom/document-apm-sort
Document sort params on atom.io package list
2014-11-20 13:21:43 -08:00
Nathan Sobo 97a56574e0 Merge pull request #4259 from atom/ns-deprecate-syntax-global
Rename atom.syntax to atom.grammars
2014-11-20 14:11:45 -07:00
Kevin Sawicki c06fefce14 Prepare 0.151 2014-11-20 12:38:08 -08:00
Kevin Sawicki 00027e892c ⬆️ language-javascript@0.44 2014-11-20 12:16:19 -08:00
Nathan Sobo d4dee07b41 Fix window-spec for key name change in deserialized state 2014-11-20 13:12:17 -07:00
Nathan Sobo f475552673 Fix local variable name 2014-11-20 13:10:51 -07:00
Ben Ogle 6e33f10050 Upgrade deprecation cop for markdown deps + fix 2014-11-20 12:07:10 -08:00
Ben Ogle 61651db0b0 Render the deprecations as markdown 2014-11-20 11:41:53 -08:00
Ben Ogle 982346b142 Remove view system docs. They are mis-information 2014-11-20 11:27:11 -08:00
Kevin Sawicki 92ba107c89 ⬆️ fs-plus@2.3.2 2014-11-20 11:15:10 -08:00
Kevin Sawicki 7b4a9aa2e4 Patch statSyncNoException to handle non-string args
Non-string values were being coerced to strings which can cause
unexpected results.

Refs atom/atom-shell#843
Closes #4247
2014-11-20 11:15:10 -08:00
Ben Ogle 446398ad01 Upgrade default themes to fix scrollbar issues. 2014-11-20 11:06:19 -08:00
Ben Ogle 8afbab311f Merge pull request #4248 from atom/bo-deprecate-workspace-view
Deprecate workspaceView
2014-11-20 10:53:19 -08:00
Nathan Sobo 32f2a95f07 Make GrammarRegistry::selectGrammar public since we use it in specs 2014-11-20 11:44:37 -07:00
Nathan Sobo d53d01d95b Replace atom.syntax with atom.grammars 2014-11-20 11:42:49 -07:00
Nathan Sobo 131522f93d Rename Syntax to GrammarRegistry 2014-11-20 11:38:01 -07:00
Kevin Sawicki 1601a1fbfa ⬆️ encoding-selector@0.8 2014-11-20 10:27:32 -08:00
Nathan Sobo 2c89a5c82a Merge pull request #4250 from atom/ns-tooltip-manager
Replace jQuery-based tooltip API with atom.tooltips global
2014-11-20 11:26:07 -07:00
Nathan Sobo e4ec932513 Merge pull request #4258 from atom/ns-fix-memory-leaks
Fix memory leaks introduced by changes for API freeze
2014-11-20 11:22:33 -07:00
Kevin Sawicki a834920fb7 ⬆️ spell-check@0.44 2014-11-20 10:19:31 -08:00
Nathan Sobo b5edefcae8 Trigger editor:will-be-removed from SpacePen shim, not component
By the time the component is getting unmounted, we have already called
remove hooks on the SpacePen shim so subscriptions to the event have
been removed.
2014-11-20 11:13:40 -07:00
Nathan Sobo 616a94a10e Only SpacePen callRemoveHooks on removed pane item view if destroyed 2014-11-20 11:12:50 -07:00
Nathan Sobo 7034fe3b36 ⬆️ space-pen to call cleanData in callRemoveHooks to stop leaks 2014-11-20 11:02:58 -07:00
Nathan Sobo 5f68af27f5 Fix memory leak in GitRepository and convert to CompositeDisposables
We were calling @unsubscribe with the TextBuffer, which previously
unsubscribed from that object. The problem is that we were no longer
subscribing to that object directly, but only adding subscriptions to
that object. This caused us to never unsubscribe from buffers.
2014-11-20 10:56:51 -07:00
Nathan Sobo ea207f0938 📝 returned disposable 2014-11-20 09:13:36 -07:00
Nathan Sobo 732f053d4a Add atom.tooltips global 2014-11-19 19:22:11 -07:00
Nathan Sobo 78e61c3ff9 Remove ability to add tooltip with selector
It’s incompatible with returning a disposable because there’s no way
to distinguish multiple tooltips added to the body with different
selectors. Maybe someday.
2014-11-19 19:20:48 -07:00
Nathan Sobo 22c9a222c9 Return a Disposable from TooltipManager::add 2014-11-19 19:19:05 -07:00
Nathan Sobo cc4ab0d36b 📝 Document TooltipManager 2014-11-19 19:13:33 -07:00
Nathan Sobo 7bdf3b1719 Add support for keyBindingTarget to TooltipManager::add 2014-11-19 19:10:36 -07:00
Nathan Sobo 175d7811b4 Add TooltipManager
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-19 18:57:08 -07:00
Ben Ogle 3f3fca872b Remove the unsubscribe spy
Sorry @nathansobo, this is making the window specs fail
2014-11-19 17:46:33 -08:00
Ben Ogle 421c64347e View -> Element in docs 2014-11-19 17:46:33 -08:00
Ben Ogle 557d277e9f Remove workspaceView references from the window-specs 2014-11-19 17:46:32 -08:00
Ben Ogle 3fc514659a Remove workspaceView references from ThemeManager 2014-11-19 17:46:32 -08:00
Ben Ogle 747398f2a5 Remove workspaceView from spec-helper 2014-11-19 17:46:32 -08:00
Ben Ogle 1f51317a10 Remove workspaceView references from atom.coffee 2014-11-19 17:46:32 -08:00
Ben Ogle f592a5d11f 📝 Remove workspaceView from doc 2014-11-19 17:46:32 -08:00
Ben Ogle fb223db958 Remove workspaceView from PackageManager specs 2014-11-19 17:46:32 -08:00
Ben Ogle 1d73c57f9e Remove reference to workspaceView in window-event-handler 2014-11-19 17:46:32 -08:00
Ben Ogle 016f32d62e Add a FIXME for this workspaceView bit 2014-11-19 17:46:32 -08:00
Ben Ogle 9ee4d334b2 Reflow paragraph 2014-11-19 17:46:32 -08:00
Ben Ogle ddb16dcc6f 📝 Update doc to remove workspaceView 2014-11-19 17:46:32 -08:00
Ben Ogle 8403e6583f Deprecate atom.workspaceView 2014-11-19 17:46:32 -08:00
Ben Ogle 6bdbabecbd Add jasmine.attachToDOM 2014-11-19 17:08:54 -08:00
Kevin Sawicki 2cda86efda Prepare 0.150 2014-11-19 17:07:06 -08:00
Daniel Hengeveld fc90a3c2ba Document search endpoint 2014-10-07 15:20:05 -07:00
Daniel Hengeveld 382a06028c Document sort params on package list 2014-10-07 12:08:37 -07:00
130 arquivos alterados com 3253 adições e 1486 exclusões
+1 -1
Ver Arquivo
@@ -1 +1 @@
v0.10.21
v0.10.33
+1
Ver Arquivo
@@ -0,0 +1 @@
2.7.6
+18 -9
Ver Arquivo
@@ -2,7 +2,7 @@
Atom is a hackable text editor for the 21st century, built on [atom-shell](http://github.com/atom/atom-shell), and based on everything we love about our favorite editors. We designed it to be deeply customizable, but still approachable using the default configuration.
Visit [atom.io](https://atom.io) to learn more.
Visit [atom.io](https://atom.io) to learn more or visit the [Atom forum](https://discuss.atom.io).
Visit [issue #3684](https://github.com/atom/atom/issues/3684) to learn more
about the Atom 1.0 roadmap.
@@ -17,16 +17,25 @@ Atom will automatically update when a new release is available.
### Windows
Install the [Atom chocolatey package](https://chocolatey.org/packages/Atom).
Download the latest [AtomSetup.exe installer](https://github.com/atom/atom/releases/latest).
1. Install [chocolatey](https://chocolatey.org).
2. Close and reopen your command prompt or PowerShell window.
3. Run `cinst Atom`
4. In the future run `cup Atom` to upgrade to the latest release.
Atom will automatically update when a new release is available.
You can also download a `.zip` file from the [releases page](https://github.com/atom/atom/releases/latest).
The Windows version does not currently automatically update so you will need to
manually upgrade to future releases by re-downloading the `.zip` file.
You can also download an `atom-windows.zip` file from the [releases page](https://github.com/atom/atom/releases/latest).
The `.zip` version will not automatically update.
#### Uninstalling Chocolatey Version
The recommended installation of Atom on Windows used to be using [Chocolatey](https://chocolatey.org/packages/Atom/).
This is no longer recommended now that the Atom Windows installer & auto-updater
exists.
To switch from Chocolatey to the new installer:
* Upgrade to Atom 0.155 or above by running `cup Atom`
* Run `cuninst Atom` to uninstall the Chocolatey version of Atom
* This will not delete any of your installed packages or Atom config files.
* Download the latest [AtomSetup.exe installer](https://github.com/atom/atom/releases/latest).
* Double-click the downloaded file to install Atom
### Debian Linux (Ubuntu)
+1 -1
Ver Arquivo
@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.111.0"
"atom-package-manager": "0.116.0"
}
}
+2 -2
Ver Arquivo
@@ -45,12 +45,12 @@ if [ $REDIRECT_STDERR ]; then
fi
if [ $OS == 'Mac' ]; then
ATOM_PATH=${ATOM_PATH:-/Applications} # Set ATOM_PATH unless it is already set
ATOM_PATH="${ATOM_PATH:-/Applications}" # Set ATOM_PATH unless it is already set
ATOM_APP_NAME=Atom.app
# If ATOM_PATH isn't a executable file, use spotlight to search for Atom
if [ ! -x "$ATOM_PATH/$ATOM_APP_NAME" ]; then
ATOM_PATH=$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | head -1 | xargs dirname)
ATOM_PATH="$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | head -1 | xargs -0 dirname)"
fi
# Exit if Atom can't be found
+2 -1
Ver Arquivo
@@ -1,7 +1,8 @@
require '../spec/spec-helper'
path = require 'path'
{$, Point} = require 'atom'
{$} = require '../src/space-pen-extensions'
{Point} = require 'atom'
_ = require 'underscore-plus'
fs = require 'fs-plus'
Project = require '../src/project'
+3 -1
Ver Arquivo
@@ -1,5 +1,7 @@
require './benchmark-helper'
{$, _, WorkspaceView} = require 'atom'
{$} = require '../src/space-pen-extensions'
_ = require 'underscore-plus'
{WorkspaceView} = require 'atom'
TokenizedBuffer = require '../src/tokenized-buffer'
describe "editorView.", ->
+2 -2
Ver Arquivo
@@ -12,7 +12,7 @@
"fs-plus": "2.x",
"github-releases": "~0.2.0",
"grunt": "~0.4.1",
"grunt-atom-shell-installer": "^0.10.0",
"grunt-atom-shell-installer": "^0.13.0",
"grunt-cli": "~0.1.9",
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
"grunt-contrib-coffee": "~0.9.0",
@@ -31,7 +31,7 @@
"request": "~2.27.0",
"rimraf": "~2.2.2",
"runas": "~1.0.1",
"tello": "1.0.3",
"tello": "1.0.4",
"temp": "~0.8.1",
"underscore-plus": "1.x",
"unzip": "~0.1.9",
+7 -5
Ver Arquivo
@@ -21,7 +21,9 @@ module.exports = (grunt) ->
mkdir appDir
cp 'atom.sh', path.join(appDir, 'atom.sh')
if process.platform isnt 'win32'
cp 'atom.sh', path.join(appDir, 'atom.sh')
cp 'package.json', path.join(appDir, 'package.json')
packageDirectories = []
@@ -149,10 +151,10 @@ module.exports = (grunt) ->
grunt.file.copy(sourcePath, path.resolve(appDir, '..', subDirectory, filename))
if process.platform is 'win32'
# Set up chocolatey ignore and gui files
fs.writeFileSync path.join(appDir, 'apm', 'node_modules', 'atom-package-manager', 'bin', 'node.exe.ignore'), ''
fs.writeFileSync path.join(appDir, 'node_modules', 'symbols-view', 'vendor', 'ctags-win32.exe.ignore'), ''
fs.writeFileSync path.join(shellAppDir, 'atom.exe.gui'), ''
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.sh'), path.join(shellAppDir, 'resources', 'cli', 'apm.sh')
dependencies = ['compile', 'generate-license:save', 'generate-module-cache', 'compile-packages-slug']
dependencies.push('copy-info-plist') if process.platform is 'darwin'
+9
Ver Arquivo
@@ -11,6 +11,13 @@ module.exports = (grunt) ->
packageSpecQueue = null
logDeprecations = (label, {stderr}={}) ->
if process.env.JANKY_SHA1 and stderr?.indexOf('Calls to deprecated functions') isnt -1
grunt.log.error(label)
stderr = stderr.replace(/^\[.*\] "/g, '')
stderr = stderr.replace(/source: .*$/g, '')
grunt.log.error(stderr)
getAppPath = ->
contentsDir = grunt.config.get('atom.contentsDir')
switch process.platform
@@ -54,6 +61,7 @@ module.exports = (grunt) ->
fs.unlinkSync(path.join(packagePath, 'ci.log'))
failedPackages.push path.basename(packagePath) if error
logDeprecations("#{path.basename(packagePath)} Specs", results)
callback()
modulesDirectory = path.resolve('node_modules')
@@ -87,6 +95,7 @@ module.exports = (grunt) ->
else
# TODO: Restore concurrency on Windows
packageSpecQueue.concurrency = concurrency
logDeprecations('Core Specs', results)
callback(null, error)
+25 -24
Ver Arquivo
@@ -11,32 +11,34 @@ value of a namespaced config key with `atom.config.get`:
@showInvisibles() if atom.config.get "editor.showInvisibles"
```
Or you can use the `::subscribe` with `atom.config.observe` to track changes
from any view object.
Or you can subscribe via `atom.config.observe` to track changes from any view
object.
```coffeescript
{View} = require 'space-pen'
class MyView extends View
initialize: ->
@subscribe atom.config.observe 'editor.fontSize', (newValue, {previous}) =>
@adjustFontSize()
attached: ->
@fontSizeObserveSubscription =
atom.config.observe 'editor.fontSize', (newValue, {previous}) =>
@adjustFontSize()
detached: ->
@fontSizeObserveSubscription.dispose()
```
The `atom.config.observe` method will call the given callback immediately with
the current value for the specified key path, and it will also call it in the
future whenever the value of that key path changes.
future whenever the value of that key path changes. If you only want to invoke
the callback when the next time the value changes, use `atom.config.onDidChange`
instead.
Subscriptions made with `::subscribe` are automatically canceled when the
view is removed. You can cancel config subscriptions manually via the
`off` method on the subscription object that `atom.config.observe` returns.
```coffeescript
fontSizeSubscription = atom.config.observe 'editor.fontSize', (newValue, {previous}) =>
@adjustFontSize()
# ... later on
fontSizeSubscription.off() # Stop observing
```
Subscription methods return *disposable* subscription objects. Note in the
example above how we save the subscription to the `@fontSizeObserveSubscription`
instance variable and dispose of it when the view is detached. To group multiple
subscriptions together, you can add them all to a
[`CompositeDisposable`][composite-disposable] that you dispose when the view is
detached.
### Writing Config Settings
@@ -48,10 +50,9 @@ but you can programmatically write to it with `atom.config.set`:
atom.config.set("core.showInvisibles", true)
```
You can also use `setDefaults`, which will assign default values for keys that
are always overridden by values assigned with `set`. Defaults are not written
out to the the `config.json` file to prevent it from becoming cluttered.
If you're exposing package configuration via specific key paths, you'll want to
associate them with a schema in your package's main module. Read more about
schemas in the [config API docs][config-api].
```coffeescript
atom.config.setDefaults("editor", fontSize: 18, showInvisibles: true)
```
[composite-disposable]: https://atom.io/docs/api/latest/CompositeDisposable
[config-api]: https://atom.io/docs/api/latest/Config
-34
Ver Arquivo
@@ -1,34 +0,0 @@
# Globals
Atom exposes several services through singleton objects accessible via the
`atom` global:
* atom
* workspace:
Manipulate and query the state of the user interface for the current
window. Open editors, manipulate panes.
* workspaceView:
Similar to workspace, but provides access to the root of all views in the
current window.
* project:
Access the directory associated with the current window. Load editors,
perform project-wide searches, register custom openers for special file
types.
* config:
Read, write, and observe user configuration settings.
* keymap:
Add and query the currently active keybindings.
* deserializers:
Deserialize instances from their state objects and register deserializers.
* packages:
Activate, deactivate, and query user packages.
* themes:
Activate, deactivate, and query user themes.
* contextMenu:
Register context menus.
* menu:
Register application menus.
* pasteboard:
Read from and write to the system pasteboard.
* syntax:
Assign and query syntactically-scoped properties.
-58
Ver Arquivo
@@ -1,58 +0,0 @@
## Atom's View System
### SpacePen Basics
Atom's view system is built around the [SpacePen] view framework. SpacePen
view objects inherit from the jQuery prototype, and wrap DOM nodes
View objects are actually jQuery wrappers around DOM fragments, supporting all
the typical jQuery traversal and manipulation methods. In addition, view objects
have methods that are view-specific. For example, you could call both general
and view-specific on the global `atom.workspaceView` instance:
```coffeescript
atom.workspaceView.find('atom-text-editor.active') # standard jQuery method
atom.workspaceView.getActiveEditor() # view-specific method
```
If you retrieve a jQuery wrapper for an element associated with a view, use the
`.view()` method to retrieve the element's view object:
```coffeescript
# this is a plain jQuery object; you can't call view-specific methods
editorElement = atom.workspaceView.find('atom-text-editor.active')
# get the view object by calling `.view()` to call view-specific methods
editorView = editorElement.view()
editorView.setCursorBufferPosition([1, 2])
```
Refer to the [SpacePen] documentation for more details.
### WorkspaceView
The root of Atom's view hierarchy is a global called `atom.workspaceView`, which is a
singleton instance of the `WorkspaceView` view class. The root view fills the entire
window, and contains every other view. If you open Atom's inspector with
`alt-cmd-i`, you can see the internal structure of `WorkspaceView`:
![WorkspaceView in the inspector][workspaceview-inspector]
#### Panes
The `WorkspaceView` contains `prependToBottom/Top/Left/Right` and
`appendToBottom/Top/Left/Right` methods, which are used to add Tool Panels. Tool
panels are elements that take up screen real estate not devoted to text editing.
In the example above, the `TreeView` is appended to the left, and the
`CommandPanel` is appended to the top.
```coffeescript
# place a view to the left of the panes
atom.workspaceView.appendToLeft(new MyView)
# place a view below the panes
atom.workspaceView.appendToBottom(new MyOtherView)
```
[spacepen]: http://github.com/nathansobo/space-pen
[workspaceView-inspector]: https://f.cloud.github.com/assets/1424/1091631/1932c2d6-166b-11e3-8adf-9690fe82d3b8.png
+16
Ver Arquivo
@@ -30,6 +30,8 @@ All requests that take parameters require `application/json`.
Parameters:
- **page** (optional)
- **sort** (optional, values: `created_at`, `updated_at`, `downloads`)
- **direction** (optional, values: `asc`, `desc`)
Returns a list of all packages in the following format:
```json
@@ -57,6 +59,20 @@ Link: <https://www.atom.io/api/packages?page=1>; rel="self",
<https://www.atom.io/api/packages?page=2>; rel="next"
```
By default, results are sorted by download count, descending.
#### GET /api/packages/search
Parameters:
- **q** String query to search
- **sort** (optional, values: `created_at`, `updated_at`, `downloads`)
- **direction** (optional, values: `asc`, `desc`)
Returns a list of all packages in the same format as `/api/packages`.
By default, results sorted by relevance to search query.
### Showing package details
#### GET /api/packages/:package_name
+13 -9
Ver Arquivo
@@ -29,6 +29,10 @@ Ubuntu LTS 12.04 64-bit is the recommended platform.
* `sudo pacman -S base-devel git nodejs libgnome-keyring python2`
* `export PYTHON=/usr/bin/python2` before building Atom.
### Slackware
* `sbopkg -k -i node -i atom`
## Instructions
If you have problems with permissions don't forget to prefix with `sudo`
@@ -121,6 +125,15 @@ have Node.js installed, or node isn't identified as Node.js on your machine.
If it's the latter, entering `sudo ln -s /usr/bin/nodejs /usr/bin/node` into
your terminal may fix the issue.
#### You can also use Alternatives
On some variants (mostly Debian based distros) it's preferable for you to use
Alternatives so that changes to the binary paths can be fixed or altered easily:
```sh
sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 1 --slave /usr/bin/js js /usr/bin/nodejs
```
### AttributeError: 'module' object has no attribute 'script_main'
If you get following error with a big traceback while building Atom:
@@ -137,15 +150,6 @@ On Fedora you would do the following:
sudo yum remove gyp
```
#### You can also use Alternatives
On some variants (mostly Debian based distros) it's preferable for you to use
Alternatives so that changes to the binary paths can be fixed or altered easily:
```sh
sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 1 --slave /usr/bin/js js /usr/bin/nodejs
```
### Linux build error reports in atom/atom
* Use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+label%3Alinux&type=Issues)
to get a list of reports about build errors on Linux.
+21 -20
Ver Arquivo
@@ -40,7 +40,7 @@ package.json files have their own additions.
- `main` (**Required**): the path to the CoffeeScript file that's the entry point
to your package
- `stylesheets` (**Optional**): an Array of Strings identifying the order of the
stylesheets your package needs to load. If not specified, stylesheets in the
style sheets your package needs to load. If not specified, style sheets in the
_stylesheets_ directory are added alphabetically.
- `keymaps`(**Optional**): an Array of Strings identifying the order of the
key mappings your package needs to load. If not specified, mappings in the
@@ -119,27 +119,27 @@ Also, please collaborate with us if you need an API that doesn't exist. Our goal
is to build out Atom's API organically based on the needs of package authors
like you.
## Stylesheets
## Style Sheets
Stylesheets for your package should be placed in the _stylesheets_ directory.
Any stylesheets in this directory will be loaded and attached to the DOM when
your package is activated. Stylesheets can be written as CSS or [LESS] (but LESS
is recommended).
Style sheets for your package should be placed in the _stylesheets_ directory.
Any style sheets in this directory will be loaded and attached to the DOM when
your package is activated. Style sheets can be written as CSS or [LESS] (but
LESS is recommended).
Ideally, you won't need much in the way of styling. We've provided a standard
set of components which define both the colors and UI elements for any package
that fits into Atom seamlessly. You can view all of Atom's UI components by opening
the styleguide: open the command palette (`cmd-shift-P`) and search for _styleguide_,
or just type `cmd-ctrl-shift-G`.
that fits into Atom seamlessly. You can view all of Atom's UI components by
opening the styleguide: open the command palette (`cmd-shift-P`) and search for
_styleguide_, or just type `cmd-ctrl-shift-G`.
If you _do_ need special styling, try to keep only structural styles in the package
stylesheets. If you _must_ specify colors and sizing, these should be taken from
the active theme's [ui-variables.less][ui-variables]. For more information, see the
[theme variables docs][theme-variables]. If you follow this guideline, your package
will look good out of the box with any theme!
If you _do_ need special styling, try to keep only structural styles in the
package style sheets. If you _must_ specify colors and sizing, these should be
taken from the active theme's [ui-variables.less][ui-variables]. For more
information, see the [theme variables docs][theme-variables]. If you follow this
guideline, your package will look good out of the box with any theme!
An optional `stylesheets` array in your _package.json_ can list the stylesheets
by name to specify a loading order; otherwise, stylesheets are loaded
An optional `stylesheets` array in your _package.json_ can list the style sheets
by name to specify a loading order; otherwise, style sheets are loaded
alphabetically.
## Keymaps
@@ -157,9 +157,9 @@ loaded in alphabetical order. An optional `keymaps` array in your _package.json_
can specify which keymaps to load and in what order.
Keybindings are executed by determining which element the keypress occurred on. In
the example above, `changer:magic` command is executed when pressing `ctrl-V` on
the `.tree-view-scroller` element.
Keybindings are executed by determining which element the keypress occurred on.
In the example above, `changer:magic` command is executed when pressing `ctrl-V`
on the `.tree-view-scroller` element.
See the [main keymaps documentation][keymaps] for more detailed information on
how keymaps work.
@@ -195,7 +195,8 @@ with your package that aren't tied to a specific element:
```
To add your own item to the application menu, simply create a top level `menu`
key in any menu configuration file in _menus_. This can be a JSON or [CSON] file.
key in any menu configuration file in _menus_. This can be a JSON or [CSON]
file.
The menu templates you specify are merged with all other templates provided
by other packages in the order which they were loaded.
+2
Ver Arquivo
@@ -59,6 +59,8 @@ window in dev mode. To open a Dev Mode Atom window run `atom --dev .` in the
terminal, use `cmd-shift-o` or use the _View > Developer > Open in Dev Mode_
menu. When you edit your theme, changes will instantly be reflected!
> Note: It's advised to _not_ specify a `font-family` in your syntax theme because it will override the Font Family field in Atom's settings. If you still like to recommend a font that goes well with your theme, we recommend you do so in your README.
## Creating an Interface Theme
Interface themes **must** provide a `ui-variables.less` file which contains all
-1
Ver Arquivo
@@ -118,7 +118,6 @@ You can open this file in an editor from the _Atom > Open Your Config_ menu.
- `cr`: Carriage return (for Microsoft-style line endings)
- `eol`: `\n` characters
- `space`: Leading and trailing space characters
- `normalizeIndentOnPaste`: Enable/disable conversion of pasted tabs to spaces
- `preferredLineLength`: Identifies the length of a line (defaults to `80`)
- `showInvisibles`: Whether to render placeholders for invisible characters (defaults to `false`)
- `showIndentGuide`: Show/hide indent indicators within the editor
-1
Ver Arquivo
@@ -18,7 +18,6 @@
* [Developing Node Modules](advanced/node-modules.md)
* [Keymaps](advanced/keymaps.md)
* [Serialization](advanced/serialization.md)
* [View System](advanced/view-system.md)
* [Scopes and Scope Descriptors](advanced/scopes-and-scope-descriptors.md)
### Upgrading to 1.0 APIs
+1 -1
Ver Arquivo
@@ -72,7 +72,7 @@ Writing Asynchronous specs can be tricky at first. Some examples.
atom.workspace.open 'c.coffee'
it "should be opened in an editor", ->
expect(atom.workspace.getActiveEditor().getPath()).toContain 'c.coffee'
expect(atom.workspace.getActiveTextEditor().getPath()).toContain 'c.coffee'
```
+12 -12
Ver Arquivo
@@ -49,7 +49,7 @@ Register the command in _lib/ascii-art.coffee_:
```coffeescript
module.exports =
activate: ->
atom.workspaceView.command "ascii-art:convert", => @convert()
atom.commands.add 'atom-workspace', "ascii-art:convert", => @convert()
convert: ->
# This assumes the active pane item is an editor
@@ -57,10 +57,10 @@ module.exports =
editor.insertText('Hello, World!')
```
The `atom.workspaceView.command` method takes a command name and a callback. The
callback executes when the command is triggered. In this case, when the command
is triggered the callback will call the `convert` method and insert 'Hello,
World!'.
The `atom.commands.add` method takes a selector, command name, and a callback.
The callback executes when the command is triggered on an element matching the
selector. In this case, when the command is triggered the callback will call the
`convert` method and insert 'Hello, World!'.
## Reload the Package
@@ -95,13 +95,13 @@ you don't need it anymore. When finished, the file will look like this:
'cmd-alt-a': 'ascii-art:convert'
```
Notice `atom-text-editor` on the first line. Just like CSS, keymap selectors *scope* key
bindings so they only apply to specific elements. In this case, our binding is
only active for elements matching the `atom-text-editor` selector. If the Tree View has
focus, pressing `cmd-alt-a` won't trigger the `ascii-art:convert` command. But
if the editor has focus, the `ascii-art:convert` method *will* be triggered.
More information on key bindings can be found in the
[keymaps](advanced/keymaps.html) documentation.
Notice `atom-text-editor` on the first line. Just like CSS, keymap selectors
*scope* key bindings so they only apply to specific elements. In this case, our
binding is only active for elements matching the `atom-text-editor` selector. If
the Tree View has focus, pressing `cmd-alt-a` won't trigger the
`ascii-art:convert` command. But if the editor has focus, the
`ascii-art:convert` method *will* be triggered. More information on key bindings
can be found in the [keymaps](advanced/keymaps.html) documentation.
Now reload the window and verify that the key binding works! You can also verify
that it **doesn't** work when the Tree View is focused.
+8 -7
Ver Arquivo
@@ -6,6 +6,7 @@ module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
GitRepository: require '../src/git-repository'
Notification: require '../src/notification'
Point: Point
Range: Range
Emitter: Emitter
@@ -32,7 +33,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
Object.defineProperty module.exports, 'WorkspaceView', get: ->
deprecate """
Requiring `WorkspaceView` from `atom` is no longer supported.
Use `atom.view.getView(atom.workspace)` instead.
Use `atom.views.getView(atom.workspace)` instead.
"""
require '../src/workspace-view'
@@ -43,7 +44,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
`{$} = require 'space-pen'`
or
`$ = require 'jquery'`
Add `"space-pen": "^3"` to your package dependencies.
Add `"space-pen": "^4"` to your package dependencies.
Or add `"jquery": "^2"` to your package dependencies.
"""
$
@@ -53,7 +54,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
Requiring `$$` from `atom` is no longer supported.
Please require `space-pen` instead:
`{$$} = require 'space-pen'`
Add `"space-pen": "^3"` to your package dependencies.
Add `"space-pen": "^4"` to your package dependencies.
"""
$$
@@ -62,7 +63,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
Requiring `$$$` from `atom` is no longer supported.
Please require `space-pen` instead:
`{$$$} = require 'space-pen'`
Add `"space-pen": "^3"` to your package dependencies.
Add `"space-pen": "^4"` to your package dependencies.
"""
$$$
@@ -71,7 +72,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
Requiring `View` from `atom` is no longer supported.
Please require `space-pen` instead:
`{View} = require 'space-pen'`
Add `"space-pen": "^3"` to your package dependencies.
Add `"space-pen": "^4"` to your package dependencies.
"""
View
@@ -118,8 +119,8 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
require 'react-atom-fork'
Object.defineProperty module.exports, 'Reactionary', get: ->
deprecate "Please require `reactionary` instead: `Reactionary = require 'reactionary'`. Add `\"reactionary\": \"^0.9\"` to your package dependencies."
require 'reactionary'
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'
Object.defineProperty module.exports, 'Git', get: ->
deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`"
+1 -1
Ver Arquivo
@@ -202,7 +202,7 @@
]
'context-menu':
'.overlayer': [
'atom-text-editor, .overlayer': [
{label: 'Undo', command: 'core:undo'}
{label: 'Redo', command: 'core:redo'}
{type: 'separator'}
+1 -1
Ver Arquivo
@@ -160,7 +160,7 @@
]
'context-menu':
'.overlayer': [
'atom-text-editor, .overlayer': [
{label: 'Undo', command: 'core:undo'}
{label: 'Redo', command: 'core:redo'}
{type: 'separator'}
+4 -1
Ver Arquivo
@@ -164,6 +164,9 @@
{ label: 'View &Terms of Use', command: 'application:open-terms-of-use' }
{ label: 'View &License', command: 'application:open-license' }
{ label: 'VERSION', enabled: false }
{ label: 'Restart and Install Update', command: 'application:install-update', visible: false}
{ label: 'Check for Update', command: 'application:check-for-update', visible: false}
{ label: 'Downloading Update', enabled: false, visible: false}
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
@@ -178,7 +181,7 @@
]
'context-menu':
'.overlayer': [
'atom-text-editor, .overlayer': [
{label: 'Undo', command: 'core:undo'}
{label: 'Redo', command: 'core:redo'}
{type: 'separator'}
+78 -74
Ver Arquivo
@@ -1,7 +1,7 @@
{
"name": "atom",
"productName": "Atom",
"version": "0.149.0",
"version": "0.164.0",
"description": "A hackable text editor for the 21st Century.",
"main": "./src/browser/main.js",
"repository": {
@@ -17,34 +17,35 @@
"url": "http://github.com/atom/atom/raw/master/LICENSE.md"
}
],
"atomShellVersion": "0.19.2",
"atomShellVersion": "0.19.4",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "^2.2.2",
"atom-keymap": "^2.3.0",
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
"clear-cut": "0.4.0",
"coffee-script": "1.7.0",
"coffeestack": "0.7.0",
"delegato": "^1",
"emissary": "^1.3.1",
"event-kit": "0.7.2",
"event-kit": "0.8.1",
"first-mate": "^2.2.0",
"fs-plus": "^2.3.1",
"fs-plus": "^2.3.2",
"fstream": "0.1.24",
"fuzzaldrin": "^2.1",
"git-utils": "^2.1.5",
"git-utils": "^2.2",
"grim": "0.12.0",
"guid": "0.0.10",
"jasmine-json": "~0.0",
"jasmine-tagged": "^1.1.2",
"jquery": "^2.1.1",
"less-cache": "0.19.0",
"marked": "^0.3",
"mixto": "^1",
"mkdirp": "0.3.5",
"nslog": "^1.0.1",
"oniguruma": "^3.0.4",
"optimist": "0.4.0",
"pathwatcher": "^2.3.2",
"pathwatcher": "^2.3.5",
"property-accessors": "^1",
"q": "^1.0.1",
"random-words": "0.0.1",
@@ -52,96 +53,99 @@
"reactionary-atom-fork": "^1.0.0",
"runas": "1.0.1",
"scandal": "1.0.3",
"scoped-property-store": "^0.15.0",
"scoped-property-store": "^0.15.4",
"scrollbar-style": "^1.0.2",
"season": "^1.0.2",
"semver": "2.2.1",
"serializable": "^1",
"space-pen": "3.8.1",
"service-hub": "^0.1.0",
"space-pen": "3.8.2",
"temp": "0.7.0",
"text-buffer": "^3.6.1",
"text-buffer": "^3.8.2",
"theorist": "^1.0.2",
"underscore-plus": "^1.6.1",
"underscore-plus": "^1.6.6",
"vm-compatibility-layer": "0.1.0"
},
"packageDependencies": {
"atom-dark-syntax": "0.22.0",
"atom-dark-ui": "0.39.0",
"atom-dark-syntax": "0.23.0",
"atom-dark-ui": "0.42.0",
"atom-light-syntax": "0.22.0",
"atom-light-ui": "0.33.0",
"atom-light-ui": "0.36.0",
"base16-tomorrow-dark-theme": "0.22.0",
"base16-tomorrow-light-theme": "0.5.0",
"solarized-dark-syntax": "0.23.0",
"solarized-dark-syntax": "0.29.0",
"solarized-light-syntax": "0.13.0",
"archive-view": "0.37.0",
"autocomplete": "0.33.0",
"autoflow": "0.18.0",
"autosave": "0.18.0",
"background-tips": "0.17.0",
"bookmarks": "0.30.0",
"bracket-matcher": "0.62.0",
"command-palette": "0.28.0",
"deprecation-cop": "0.14.0",
"dev-live-reload": "0.35.0",
"encoding-selector": "0.7.0",
"exception-reporting": "0.20.0",
"find-and-replace": "0.147.0",
"fuzzy-finder": "0.60.0",
"git-diff": "0.43.0",
"go-to-line": "0.26.0",
"grammar-selector": "0.37.0",
"image-view": "0.40.0",
"incompatible-packages": "0.10.0",
"keybinding-resolver": "0.20.0",
"link": "0.26.0",
"markdown-preview": "0.110.0",
"metrics": "0.39.0",
"open-on-github": "0.30.0",
"package-generator": "0.32.0",
"release-notes": "0.36.0",
"archive-view": "0.40.0",
"autocomplete": "0.34.0",
"autoflow": "0.20.0",
"autosave": "0.19.0",
"background-tips": "0.18.0",
"bookmarks": "0.31.0",
"bracket-matcher": "0.64.0",
"command-palette": "0.30.0",
"deprecation-cop": "0.20.0",
"dev-live-reload": "0.36.0",
"encoding-selector": "0.12.0",
"exception-reporting": "0.21.0",
"find-and-replace": "0.152.0",
"fuzzy-finder": "0.62.0",
"git-diff": "0.45.0",
"go-to-line": "0.27.0",
"grammar-selector": "0.40.0",
"image-view": "0.44.0",
"incompatible-packages": "0.16.0",
"keybinding-resolver": "0.24.0",
"link": "0.28.0",
"markdown-preview": "0.112.0",
"metrics": "0.40.0",
"notifications": "0.20.0",
"open-on-github": "0.31.0",
"package-generator": "0.34.0",
"release-notes": "0.43.0",
"settings-view": "0.161.0",
"snippets": "0.56.0",
"spell-check": "0.43.0",
"status-bar": "0.46.0",
"styleguide": "0.30.0",
"symbols-view": "0.68.0",
"tabs": "0.56.0",
"timecop": "0.23.0",
"tree-view": "0.132.0",
"update-package-dependencies": "0.6.0",
"welcome": "0.19.0",
"whitespace": "0.26.0",
"wrap-guide": "0.24.0",
"language-c": "0.31.0",
"language-coffee-script": "0.38.0",
"language-css": "0.23.0",
"language-gfm": "0.53.0",
"snippets": "0.60.0",
"spell-check": "0.45.0",
"status-bar": "0.54.0",
"styleguide": "0.36.0",
"symbols-view": "0.70.0",
"tabs": "0.58.0",
"timecop": "0.24.0",
"tree-view": "0.139.0",
"update-package-dependencies": "0.7.0",
"welcome": "0.21.0",
"whitespace": "0.27.0",
"wrap-guide": "0.27.0",
"language-c": "0.33.0",
"language-clojure": "0.9.0",
"language-coffee-script": "0.38.1",
"language-css": "0.24.0",
"language-gfm": "0.55.0",
"language-git": "0.9.0",
"language-go": "0.19.0",
"language-html": "0.26.0",
"language-hyperlink": "0.12.0",
"language-java": "0.11.0",
"language-javascript": "0.43.0",
"language-json": "0.8.0",
"language-less": "0.18.0",
"language-go": "0.19.1",
"language-html": "0.27.0",
"language-hyperlink": "0.12.2",
"language-java": "0.13.0",
"language-javascript": "0.51.0",
"language-json": "0.10.0",
"language-less": "0.21.0",
"language-make": "0.12.0",
"language-mustache": "0.10.0",
"language-objective-c": "0.11.0",
"language-mustache": "0.11.0",
"language-objective-c": "0.12.0",
"language-perl": "0.9.0",
"language-php": "0.18.0",
"language-property-list": "0.7.0",
"language-python": "0.24.0",
"language-ruby": "0.41.0",
"language-python": "0.26.0",
"language-ruby": "0.44.0",
"language-ruby-on-rails": "0.18.0",
"language-sass": "0.26.0",
"language-shellscript": "0.10.0",
"language-sass": "0.29.0",
"language-shellscript": "0.10.1",
"language-source": "0.8.0",
"language-sql": "0.11.0",
"language-text": "0.6.0",
"language-todo": "0.13.0",
"language-toml": "0.14.0",
"language-xml": "0.24.0",
"language-yaml": "0.20.0"
"language-todo": "0.15.0",
"language-toml": "0.14.1",
"language-xml": "0.25.0",
"language-yaml": "0.21.0"
},
"private": true,
"scripts": {
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
Package: <%= name %>
Version: <%= version %>
Depends: gconf2, gconf-service, libgtk2.0-0, libudev0 | libudev1, libgcrypt11, libnotify4, libxtst6, libnss3, python, gvfs-bin, xdg-utils
Depends: git, gconf2, gconf-service, libgtk2.0-0, libudev0 | libudev1, libgcrypt11, libnotify4, libxtst6, libnss3, python, gvfs-bin, xdg-utils
Suggests: libgnome-keyring0, gir1.2-gnomekeyring-1.0
Section: <%= section %>
Priority: optional
+3
Ver Arquivo
@@ -0,0 +1,3 @@
#!/bin/sh
"$0/../../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/../../app/apm/node_modules/atom-package-manager/lib/cli.js" "$@"
+22
Ver Arquivo
@@ -0,0 +1,22 @@
@echo off
SET EXPECT_OUTPUT=
FOR %%a IN (%*) DO (
IF /I "%%a"=="-f" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--foreground" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="-h" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--help" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="-t" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--test" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="-v" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--version" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="-w" SET EXPECT_OUTPUT=YES
IF /I "%%a"=="--wait" SET EXPECT_OUTPUT=YES
)
IF "%EXPECT_OUTPUT%"=="YES" (
"%~dp0\..\..\atom.exe" %*
) ELSE (
"%~dp0\..\app\apm\node_modules\atom-package-manager\bin\node.exe" "%~dp0\atom.js" %*
)
+9
Ver Arquivo
@@ -0,0 +1,9 @@
var path = require('path');
var spawn = require('child_process').spawn;
var atomCommandPath = path.resolve(__dirname, '..', '..', 'atom.exe');
var arguments = process.argv.slice(2);
arguments.unshift('--executed-from', process.cwd());
var options = {detached: true, stdio: 'ignore'};
spawn(atomCommandPath, arguments, options);
process.exit(0);
+22
Ver Arquivo
@@ -0,0 +1,22 @@
#!/bin/sh
while getopts ":fhtvw-:" opt; do
case "$opt" in
-)
case "${OPTARG}" in
foreground|help|test|version|wait)
EXPECT_OUTPUT=1
;;
esac
;;
f|h|t|v|w)
EXPECT_OUTPUT=1
;;
esac
done
if [ $EXPECT_OUTPUT ]; then
"$0/../../../atom.exe" "$@"
else
"$0/../../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/../atom.js" "$@"
fi
+2
Ver Arquivo
@@ -4,7 +4,9 @@ set -e
docker build -t atom-rpm .
docker run \
--rm \
--env JANKY_SHA1="$JANKY_SHA1" \
--env JANKY_BRANCH="$JANKY_BRANCH" \
--env ATOM_ACCESS_TOKEN="$BUILD_ATOM_RPM_ACCESS_TOKEN" \
atom-rpm /atom/script/rpmbuild
docker rmi atom-rpm
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
{$} = require 'atom'
{$} = require '../src/space-pen-extensions'
describe '"atom" protocol URL', ->
it 'sends the file relative in the package as response', ->
+7 -2
Ver Arquivo
@@ -3,6 +3,7 @@ _ = require 'underscore-plus'
{convertStackTrace} = require 'coffeestack'
{View, $, $$} = require '../src/space-pen-extensions'
grim = require 'grim'
marked = require 'marked'
sourceMaps = {}
formatStackTrace = (spec, message='', stackTrace) ->
@@ -37,7 +38,8 @@ module.exports =
class AtomReporter extends View
@content: ->
@div class: 'spec-reporter', =>
@div outlet: "suites"
@div class: 'padded pull-right', =>
@button outlet: 'reloadButton', class: 'btn btn-small reload-button', 'Reload Specs'
@div outlet: 'coreArea', class: 'symbol-area', =>
@div outlet: 'coreHeader', class: 'symbol-header'
@ul outlet: 'coreSummary', class: 'symbol-summary list-unstyled'
@@ -79,6 +81,8 @@ class AtomReporter extends View
@on 'click', '.stack-trace', ->
$(this).toggleClass('expanded')
@reloadButton.on 'click', -> require('ipc').send('call-window-method', 'restart')
reportRunnerResults: (runner) ->
@updateSpecCounts()
@status.addClass('alert-success').removeClass('alert-info') if @failedCount is 0
@@ -110,7 +114,8 @@ class AtomReporter extends View
for deprecation in deprecations
@deprecationList.append $$ ->
@div class: 'padded', =>
@div class: 'result-message fail deprecation-message', deprecation.message
@div class: 'result-message fail deprecation-message', =>
@raw marked(deprecation.message)
for stack in deprecation.stacks
fullStack = stack.map ({functionName, location}) ->
+13 -10
Ver Arquivo
@@ -1,13 +1,10 @@
{$, $$, WorkspaceView} = require 'atom'
{$, $$} = require '../src/space-pen-extensions'
Exec = require('child_process').exec
path = require 'path'
Package = require '../src/package'
ThemeManager = require '../src/theme-manager'
describe "the `atom` global", ->
beforeEach ->
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
describe 'window sizing methods', ->
describe '::getPosition and ::setPosition', ->
it 'sets the position of the window, and can retrieve the position just set', ->
@@ -33,10 +30,16 @@ describe "the `atom` global", ->
version = '36b5518'
expect(atom.isReleasedVersion()).toBe false
describe "window:update-available", ->
it "is triggered when the auto-updater sends the update-downloaded event", ->
describe "when an update becomes available", ->
subscription = null
afterEach ->
subscription?.dispose()
it "invokes onUpdateAvailable listeners", ->
updateAvailableHandler = jasmine.createSpy("update-available-handler")
atom.workspaceView.on 'window:update-available', updateAvailableHandler
subscription = atom.onUpdateAvailable updateAvailableHandler
autoUpdater = require('remote').require('auto-updater')
autoUpdater.emit 'update-downloaded', null, "notes", "version"
@@ -44,9 +47,9 @@ describe "the `atom` global", ->
updateAvailableHandler.callCount > 0
runs ->
[event, version, notes] = updateAvailableHandler.mostRecentCall.args
expect(notes).toBe 'notes'
expect(version).toBe 'version'
{releaseVersion, releaseNotes} = updateAvailableHandler.mostRecentCall.args[0]
expect(releaseVersion).toBe 'version'
expect(releaseNotes).toBe 'notes'
describe "loading default config", ->
it 'loads the default core config', ->
+75
Ver Arquivo
@@ -0,0 +1,75 @@
ChildProcess = require 'child_process'
path = require 'path'
BufferedProcess = require '../src/buffered-process'
describe "BufferedProcess", ->
describe "when a bad command is specified", ->
[oldOnError] = []
beforeEach ->
oldOnError = window.onerror
window.onerror = jasmine.createSpy()
afterEach ->
window.onerror = oldOnError
describe "when there is an error handler specified", ->
it "calls the error handler and does not throw an exception", ->
process = new BufferedProcess
command: 'bad-command-nope'
args: ['nothing']
options: {}
errorSpy = jasmine.createSpy().andCallFake (error) -> error.handle()
process.onWillThrowError(errorSpy)
waitsFor -> errorSpy.callCount > 0
runs ->
expect(window.onerror).not.toHaveBeenCalled()
expect(errorSpy).toHaveBeenCalled()
expect(errorSpy.mostRecentCall.args[0].error.message).toContain 'spawn bad-command-nope ENOENT'
describe "when there is not an error handler specified", ->
it "calls the error handler and does not throw an exception", ->
process = new BufferedProcess
command: 'bad-command-nope'
args: ['nothing']
options: {}
waitsFor -> window.onerror.callCount > 0
runs ->
expect(window.onerror).toHaveBeenCalled()
expect(window.onerror.mostRecentCall.args[0]).toContain 'Failed to spawn command `bad-command-nope`'
expect(window.onerror.mostRecentCall.args[4].name).toBe 'BufferedProcessError'
describe "on Windows", ->
originalPlatform = null
beforeEach ->
# Prevent any commands from actually running and affecting the host
originalSpawn = ChildProcess.spawn
spyOn(ChildProcess, 'spawn').andCallFake ->
# Just spawn something that won't actually modify the host
if originalPlatform is 'win32'
originalSpawn('dir')
else
originalSpawn('ls')
originalPlatform = process.platform
Object.defineProperty process, 'platform', value: 'win32'
afterEach ->
Object.defineProperty process, 'platform', value: originalPlatform
describe "when the explorer command is spawned on Windows", ->
it "doesn't quote arguments of the form /root,C...", ->
new BufferedProcess({command: 'explorer.exe', args: ['/root,C:\\foo']})
expect(ChildProcess.spawn.argsForCall[0][1][2]).toBe '"explorer.exe /root,C:\\foo"'
it "spawns the command using a cmd.exe wrapper", ->
new BufferedProcess({command: 'dir'})
expect(path.basename(ChildProcess.spawn.argsForCall[0][0])).toBe 'cmd.exe'
expect(ChildProcess.spawn.argsForCall[0][1][0]).toBe '/s'
expect(ChildProcess.spawn.argsForCall[0][1][1]).toBe '/c'
expect(ChildProcess.spawn.argsForCall[0][1][2]).toBe '"dir"'
+365 -173
Ver Arquivo
@@ -2,9 +2,9 @@ path = require 'path'
temp = require 'temp'
CSON = require 'season'
fs = require 'fs-plus'
Grim = require 'grim'
describe "Config", ->
dotAtomPath = path.join(temp.dir, 'dot-atom-dir')
dotAtomPath = null
beforeEach ->
@@ -35,6 +35,36 @@ describe "Config", ->
atom.config.setDefaults("bar", baz: 7)
expect(atom.config.get("bar.baz")).toEqual {a: 3}
describe "when a 'sources' option is specified", ->
it "only retrieves values from the specified sources", ->
atom.config.set("x.y", 1, scopeSelector: ".foo", source: "a")
atom.config.set("x.y", 2, scopeSelector: ".foo", source: "b")
atom.config.set("x.y", 3, scopeSelector: ".foo", source: "c")
atom.config.setSchema("x.y", type: "integer", default: 4)
expect(atom.config.get("x.y", sources: ["a"], scope: [".foo"])).toBe 1
expect(atom.config.get("x.y", sources: ["b"], scope: [".foo"])).toBe 2
expect(atom.config.get("x.y", sources: ["c"], scope: [".foo"])).toBe 3
# Schema defaults never match a specific source. We could potentially add a special "schema" source.
expect(atom.config.get("x.y", sources: ["x"], scope: [".foo"])).toBeUndefined()
expect(atom.config.get(null, sources: ['a'], scope: [".foo"]).x.y).toBe 1
describe "when an 'excludeSources' option is specified", ->
it "only retrieves values from the specified sources", ->
atom.config.set("x.y", 0)
atom.config.set("x.y", 1, scopeSelector: ".foo", source: "a")
atom.config.set("x.y", 2, scopeSelector: ".foo", source: "b")
atom.config.set("x.y", 3, scopeSelector: ".foo", source: "c")
atom.config.setSchema("x.y", type: "integer", default: 4)
expect(atom.config.get("x.y", excludeSources: ["a"], scope: [".foo"])).toBe 3
expect(atom.config.get("x.y", excludeSources: ["c"], scope: [".foo"])).toBe 2
expect(atom.config.get("x.y", excludeSources: ["b", "c"], scope: [".foo"])).toBe 1
expect(atom.config.get("x.y", excludeSources: ["b", "c", "a"], scope: [".foo"])).toBe 0
expect(atom.config.get("x.y", excludeSources: ["b", "c", "a", atom.config.getUserConfigPath()], scope: [".foo"])).toBe 4
expect(atom.config.get("x.y", excludeSources: [atom.config.getUserConfigPath()])).toBe 4
describe ".set(keyPath, value)", ->
it "allows a key path's value to be written", ->
expect(atom.config.set("foo.bar.baz", 42)).toBe true
@@ -51,7 +81,7 @@ describe "Config", ->
expect(observeHandler).toHaveBeenCalledWith 42
describe "when the value equals the default value", ->
it "does not store the value", ->
it "does not store the value in the user's config", ->
atom.config.setDefaults "foo",
same: 1
changes: 1
@@ -67,60 +97,84 @@ describe "Config", ->
atom.config.set('foo.null', undefined)
atom.config.set('foo.undefined', null)
atom.config.set('foo.sameObject', {b: 2, a: 1})
expect(atom.config.settings.foo).toEqual {changes: 2}
expect(atom.config.get("foo.same", sources: [atom.config.getUserConfigPath()])).toBeUndefined()
expect(atom.config.get("foo.changes", sources: [atom.config.getUserConfigPath()])).toBe 2
atom.config.set('foo.changes', 1)
expect(atom.config.settings.foo).toEqual {}
expect(atom.config.get("foo.changes", sources: [atom.config.getUserConfigPath()])).toBeUndefined()
describe ".getDefault(keyPath)", ->
it "returns a clone of the default value", ->
atom.config.setDefaults("foo", same: 1, changes: 1)
spyOn(Grim, 'deprecate')
expect(atom.config.getDefault('foo.same')).toBe 1
expect(atom.config.getDefault('foo.changes')).toBe 1
expect(Grim.deprecate.callCount).toBe 2
atom.config.set('foo.same', 2)
atom.config.set('foo.changes', 3)
expect(atom.config.getDefault('foo.same')).toBe 1
expect(atom.config.getDefault('foo.changes')).toBe 1
expect(Grim.deprecate.callCount).toBe 4
initialDefaultValue = [1, 2, 3]
atom.config.setDefaults("foo", bar: initialDefaultValue)
expect(atom.config.getDefault('foo.bar')).toEqual initialDefaultValue
expect(atom.config.getDefault('foo.bar')).not.toBe initialDefaultValue
expect(Grim.deprecate.callCount).toBe 6
describe "when scoped settings are used", ->
it "returns the global default when no scoped default set", ->
atom.config.setDefaults("foo", bar: baz: 10)
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 10
it "returns the scoped default when a scoped default is set", ->
spyOn(Grim, 'deprecate')
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 10
expect(Grim.deprecate).toHaveBeenCalled()
it "returns the scoped settings not including the user's config file", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 42
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
spyOn(Grim, 'deprecate')
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 42
expect(Grim.deprecate.callCount).toBe 1
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 42
expect(Grim.deprecate.callCount).toBe 2
describe ".isDefault(keyPath)", ->
it "returns true when the value of the key path is its default value", ->
atom.config.setDefaults("foo", same: 1, changes: 1)
spyOn(Grim, 'deprecate')
expect(atom.config.isDefault('foo.same')).toBe true
expect(atom.config.isDefault('foo.changes')).toBe true
expect(Grim.deprecate.callCount).toBe 2
atom.config.set('foo.same', 2)
atom.config.set('foo.same', 1)
atom.config.set('foo.changes', 3)
expect(atom.config.isDefault('foo.same')).toBe false
expect(atom.config.isDefault('foo.same')).toBe true
expect(atom.config.isDefault('foo.changes')).toBe false
expect(Grim.deprecate.callCount).toBe 4
describe "when scoped settings are used", ->
it "returns false when a scoped setting was set by the user", ->
spyOn(Grim, 'deprecate')
expect(atom.config.isDefault('.source.coffee', 'foo.bar.baz')).toBe true
expect(Grim.deprecate.callCount).toBe 1
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
expect(atom.config.isDefault('.source.coffee', 'foo.bar.baz')).toBe true
expect(Grim.deprecate.callCount).toBe 2
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
expect(atom.config.isDefault('.source.coffee', 'foo.bar.baz')).toBe false
expect(Grim.deprecate.callCount).toBe 3
describe ".setDefaults(keyPath)", ->
it "sets a default when the setting's key contains an escaped dot", ->
@@ -128,6 +182,12 @@ describe "Config", ->
expect(atom.config.get("foo")).toEqual 'a\\.b': 1, b: 2
describe ".toggle(keyPath)", ->
beforeEach ->
jasmine.snapshotDeprecations()
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it "negates the boolean value of the current key path value", ->
atom.config.set('foo.a', 1)
atom.config.toggle('foo.a')
@@ -145,17 +205,17 @@ describe "Config", ->
atom.config.toggle('foo.a')
expect(atom.config.get('foo.a')).toBe false
describe ".restoreDefault(keyPath)", ->
describe ".unset(keyPath, {scope})", ->
it "sets the value of the key path to its default", ->
atom.config.setDefaults('a', b: 3)
atom.config.set('a.b', 4)
expect(atom.config.get('a.b')).toBe 4
atom.config.restoreDefault('a.b')
atom.config.unset('a.b')
expect(atom.config.get('a.b')).toBe 3
atom.config.set('a.c', 5)
expect(atom.config.get('a.c')).toBe 5
atom.config.restoreDefault('a.c')
atom.config.unset('a.c')
expect(atom.config.get('a.c')).toBeUndefined()
it "calls ::save()", ->
@@ -163,43 +223,61 @@ describe "Config", ->
atom.config.set('a.b', 4)
atom.config.save.reset()
atom.config.restoreDefault('a.c')
atom.config.unset('a.c')
expect(atom.config.save.callCount).toBe 1
describe "when scoped settings are used", ->
it "restores the global default when no scoped default set", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 55
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 10
atom.config.unset('foo.bar.baz', scopeSelector: '.source.coffee')
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 10
it "restores the scoped default when a scoped default is set", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.set('.source.coffee', 'foo.bar.ok', 100)
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
atom.config.set('foo.bar.ok', 100, scopeSelector: '.source.coffee')
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 55
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 42
expect(atom.config.get(['.source.coffee'], 'foo.bar.ok')).toBe 100
atom.config.unset('foo.bar.baz', scopeSelector: '.source.coffee')
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 42
expect(atom.config.get('foo.bar.ok', scope: ['.source.coffee'])).toBe 100
it "calls ::save()", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
atom.config.save.reset()
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
atom.config.unset('foo.bar.baz', scopeSelector: '.source.coffee')
expect(atom.config.save.callCount).toBe 1
it "allows removing settings for a specific source and scope selector", ->
atom.config.set('foo.bar', 55, scopeSelector: '.source.coffee', source: "source-a")
atom.config.set('foo.bar', 65, scopeSelector: '.source.coffee', source: "source-b")
expect(atom.config.get('foo.bar', scope: ['.source.coffee'])).toBe 65
atom.config.unset('foo.bar', source: "source-b", scopeSelector: ".source.coffee")
expect(atom.config.get('foo.bar', scope: ['.source.coffee', '.string'])).toBe 55
it "allows removing all settings for a specific source", ->
atom.config.set('foo.bar', 55, scopeSelector: '.source.coffee', source: "source-a")
atom.config.set('foo.bar', 65, scopeSelector: '.source.coffee', source: "source-b")
atom.config.set('foo.baz', 65, scopeSelector: '.source.coffee', source: "source-b")
expect(atom.config.get('foo.bar', scope: ['.source.coffee'])).toBe 65
atom.config.unset(null, source: "source-b", scopeSelector: ".source.coffee")
expect(atom.config.get('foo.bar', scope: ['.source.coffee', '.string'])).toBe 55
expect(atom.config.get('foo.baz', scope: ['.source.coffee', '.string'])).toBe undefined
it "does not call ::save or add a scoped property when no value has been set", ->
# see https://github.com/atom/atom/issues/4175
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 10
atom.config.unset('foo.bar.baz', scopeSelector: '.source.coffee')
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 10
expect(atom.config.save).not.toHaveBeenCalled()
@@ -211,14 +289,14 @@ describe "Config", ->
jasmine.unspy atom.config, 'save'
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.set('.source.coffee', 'foo.bar.zfoo', 20)
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
atom.config.set('foo.bar.zfoo', 20, scopeSelector: '.source.coffee')
CSON.writeFileSync.reset()
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 55
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 10
expect(atom.config.get(['.source.coffee'], 'foo.bar.zfoo')).toBe 20
atom.config.unset('foo.bar.baz', scopeSelector: '.source.coffee')
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 10
expect(atom.config.get('foo.bar.zfoo', scope: ['.source.coffee'])).toBe 20
expect(CSON.writeFileSync).toHaveBeenCalled()
properties = CSON.writeFileSync.mostRecentCall.args[1]
expect(properties['.coffee.source']).toEqual
@@ -227,42 +305,41 @@ describe "Config", ->
zfoo: 20
CSON.writeFileSync.reset()
atom.config.restoreDefault('.source.coffee', 'foo.bar.zfoo')
atom.config.unset('foo.bar.zfoo', scopeSelector: '.source.coffee')
expect(CSON.writeFileSync).toHaveBeenCalled()
properties = CSON.writeFileSync.mostRecentCall.args[1]
expect(properties['.coffee.source']).toBeUndefined()
it "does not call ::save when the value is already at the default", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.set('foo.bar.baz', 55)
atom.config.save.reset()
atom.config.restoreDefault('.source.coffee', 'foo.bar.ok')
atom.config.unset('foo.bar.ok', scopeSelector: '.source.coffee')
expect(atom.config.save).not.toHaveBeenCalled()
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 55
it "deprecates passing a scope selector as the first argument", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set('foo.bar.baz', 55, scopeSelector: '.source.coffee')
spyOn(Grim, 'deprecate')
atom.config.unset('.source.coffee', 'foo.bar.baz')
expect(Grim.deprecate).toHaveBeenCalled()
expect(atom.config.get('foo.bar.baz', scope: ['.source.coffee'])).toBe 10
describe ".getSettings()", ->
it "returns all settings including defaults", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set("foo.ok", 12)
jasmine.snapshotDeprecations()
expect(atom.config.getSettings().foo).toEqual
ok: 12
bar:
baz: 10
describe "when scoped settings are used", ->
it "returns all the scoped settings including all the defaults", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set("foo.ok", 12)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: omg: 'omg')
expect(atom.config.getSettings(".source.coffee").foo).toEqual
ok: 12
bar:
baz: 42
omg: 'omg'
jasmine.restoreDeprecationsSnapshot()
describe ".pushAtKeyPath(keyPath, value)", ->
it "pushes the given value to the array at the key path and updates observers", ->
@@ -298,6 +375,12 @@ describe "Config", ->
expect(observeHandler).toHaveBeenCalledWith atom.config.get("foo.bar.baz")
describe ".getPositiveInt(keyPath, defaultValue)", ->
beforeEach ->
jasmine.snapshotDeprecations()
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it "returns the proper coerced value", ->
atom.config.set('editor.preferredLineLength', 0)
expect(atom.config.getPositiveInt('editor.preferredLineLength', 80)).toBe 1
@@ -321,56 +404,37 @@ describe "Config", ->
spyOn(CSON, 'writeFileSync')
jasmine.unspy atom.config, 'save'
describe "when ~/.atom/config.json exists", ->
it "writes any non-default properties to ~/.atom/config.json", ->
atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.json")
atom.config.set("a.b.c", 1)
atom.config.set("a.b.d", 2)
atom.config.set("x.y.z", 3)
atom.config.setDefaults("a.b", e: 4, f: 5)
it "writes properties from the user config path source to the user config path", ->
atom.config.configFilePath = "/fake/config/path"
atom.config.set("a.b.c", 1)
atom.config.set("a.b.d", 2)
atom.config.set("x.y.z", 3)
atom.config.set("x.y.q", 3, source: "/not/user/config")
atom.config.set('foo.bar', 'ruby', scopeSelector: '.source.ruby')
atom.config.set('foo.omg', 'wow', scopeSelector: '.source.ruby')
atom.config.set('foo.bar', 'coffee', scopeSelector: '.source.coffee')
CSON.writeFileSync.reset()
atom.config.save()
atom.config.setDefaults("a.b", e: 4, f: 5)
expect(CSON.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.json"))
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
expect(writtenConfig).toEqual global: atom.config.settings
CSON.writeFileSync.reset()
atom.config.save()
describe "when ~/.atom/config.json doesn't exist", ->
it "writes any non-default properties to ~/.atom/config.cson", ->
atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
atom.config.set("a.b.c", 1)
atom.config.set("a.b.d", 2)
atom.config.set("x.y.z", 3)
atom.config.setDefaults("a.b", e: 4, f: 5)
CSON.writeFileSync.reset()
atom.config.save()
expect(CSON.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.cson"))
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
expect(writtenConfig).toEqual global: atom.config.settings
describe "when scoped settings are defined", ->
it 'writes out explicitly set config settings', ->
atom.config.set('.source.ruby', 'foo.bar', 'ruby')
atom.config.set('.source.ruby', 'foo.omg', 'wow')
atom.config.set('.source.coffee', 'foo.bar', 'coffee')
CSON.writeFileSync.reset()
atom.config.save()
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
expect(writtenConfig).toEqualJson
global:
atom.config.settings
'.ruby.source':
foo:
bar: 'ruby'
omg: 'wow'
'.coffee.source':
foo:
bar: 'coffee'
expect(CSON.writeFileSync.argsForCall[0][0]).toBe atom.config.getUserConfigPath()
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
global.debug = true
expect(writtenConfig).toEqual
'global':
a: b:
c: 1
d: 2
x: y: z: 3
'.ruby.source':
foo:
bar: 'ruby'
omg: 'wow'
'.coffee.source':
foo:
bar: 'coffee'
describe ".setDefaults(keyPath, defaults)", ->
it "assigns any previously-unassigned keys to the object at the key path", ->
@@ -406,17 +470,26 @@ describe "Config", ->
it "fires the callback every time the observed value changes", ->
observeHandler.reset() # clear the initial call
atom.config.set('foo.bar.baz', "value 2")
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 2', oldValue: 'value 1', keyPath: 'foo.bar.baz'})
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 2', oldValue: 'value 1'})
observeHandler.reset()
atom.config.set('foo.bar.baz', "value 1")
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 1', oldValue: 'value 2', keyPath: 'foo.bar.baz'})
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 1', oldValue: 'value 2'})
observeHandler.reset()
atom.config.set('foo.bar', {baz: "value 3"})
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 3', oldValue: 'value 1'})
observeHandler.reset()
atom.config.set('foo.bar', null)
expect(observeHandler).toHaveBeenCalledWith({newValue: undefined, oldValue: 'value 3'})
observeHandler.reset()
describe 'when a keyPath is not specified', ->
beforeEach ->
observeHandler = jasmine.createSpy("observeHandler")
atom.config.set("foo.bar.baz", "value 1")
observeSubscription = atom.config.onDidChange observeHandler
atom.config.set("foo", bar: baz: "value 1")
observeSubscription = atom.config.onDidChange(observeHandler)
it "does not fire the given callback initially", ->
expect(observeHandler).not.toHaveBeenCalled()
@@ -424,15 +497,22 @@ describe "Config", ->
it "fires the callback every time any value changes", ->
observeHandler.reset() # clear the initial call
atom.config.set('foo.bar.baz', "value 2")
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 2', oldValue: 'value 1', keyPath: 'foo.bar.baz'})
expect(observeHandler).toHaveBeenCalled()
expect(observeHandler.mostRecentCall.args[0].newValue.foo.bar.baz).toBe("value 2")
expect(observeHandler.mostRecentCall.args[0].oldValue.foo.bar.baz).toBe("value 1")
observeHandler.reset()
atom.config.set('foo.bar.baz', "value 1")
expect(observeHandler).toHaveBeenCalledWith({newValue: 'value 1', oldValue: 'value 2', keyPath: 'foo.bar.baz'})
expect(observeHandler).toHaveBeenCalled()
expect(observeHandler.mostRecentCall.args[0].newValue.foo.bar.baz).toBe("value 1")
expect(observeHandler.mostRecentCall.args[0].oldValue.foo.bar.baz).toBe("value 2")
observeHandler.reset()
atom.config.set('foo.bar.int', 1)
expect(observeHandler).toHaveBeenCalledWith({newValue: 1, oldValue: undefined, keyPath: 'foo.bar.int'})
expect(observeHandler).toHaveBeenCalled()
expect(observeHandler.mostRecentCall.args[0].newValue.foo.bar.int).toBe(1)
expect(observeHandler.mostRecentCall.args[0].oldValue.foo.bar.int).toBe(undefined)
describe ".observe(keyPath)", ->
[observeHandler, observeSubscription] = []
@@ -440,7 +520,7 @@ describe "Config", ->
beforeEach ->
observeHandler = jasmine.createSpy("observeHandler")
atom.config.set("foo.bar.baz", "value 1")
observeSubscription = atom.config.observe "foo.bar.baz", observeHandler
observeSubscription = atom.config.observe("foo.bar.baz", observeHandler)
it "fires the given callback with the current value at the keypath", ->
expect(observeHandler).toHaveBeenCalledWith("value 1")
@@ -453,6 +533,25 @@ describe "Config", ->
atom.config.set('foo.bar.baz', "value 1")
expect(observeHandler).toHaveBeenCalledWith("value 1")
observeHandler.reset()
atom.config.set('foo.bar', {baz: "value 3"})
expect(observeHandler).toHaveBeenCalledWith("value 3")
observeHandler.reset()
atom.config.set('foo.bar', null)
expect(observeHandler).toHaveBeenCalledWith(undefined)
observeHandler.reset()
atom.config.set('foo.bar.baz.quux', "value 4")
expect(observeHandler).toHaveBeenCalledWith({quux: "value 4"})
atom.config.set('foo.bar.baz.buzz', "value 5")
expect(observeHandler).toHaveBeenCalledWith({quux: "value 4", buzz: "value 5"})
observeHandler.reset()
atom.config.loadUserConfig()
expect(observeHandler).toHaveBeenCalledWith(undefined)
it "fires the callback when the observed value is deleted", ->
observeHandler.reset() # clear the initial call
@@ -470,7 +569,7 @@ describe "Config", ->
it "does not fire the callback once the observe subscription is off'ed", ->
observeHandler.reset() # clear the initial call
observeSubscription.off()
observeSubscription.dispose()
atom.config.set('foo.bar.baz', "value 2")
expect(observeHandler).not.toHaveBeenCalled()
@@ -482,6 +581,51 @@ describe "Config", ->
atom.config.set('foo.bar.baz', "value 10")
expect(bazCatHandler).not.toHaveBeenCalled()
describe "observing scoped settings", ->
otherHandler = null
beforeEach ->
observeSubscription.dispose()
otherHandler = jasmine.createSpy('otherHandler')
it "allows settings to be observed in a specific scope", ->
atom.config.observe("foo.bar.baz", scope: [".some.scope"], observeHandler)
atom.config.observe("foo.bar.baz", scope: [".another.scope"], otherHandler)
atom.config.set('foo.bar.baz', "value 2", scopeSelector: ".some")
expect(observeHandler).toHaveBeenCalledWith("value 2")
expect(otherHandler).not.toHaveBeenCalledWith("value 2")
it "deprecates using a scope descriptor as the first argument", ->
spyOn(Grim, 'deprecate')
atom.config.observe([".some.scope"], "foo.bar.baz", observeHandler)
atom.config.observe([".another.scope"], "foo.bar.baz", otherHandler)
expect(Grim.deprecate).toHaveBeenCalled()
atom.config.set('foo.bar.baz', "value 2", scopeSelector: ".some")
expect(observeHandler).toHaveBeenCalledWith("value 2")
expect(otherHandler).not.toHaveBeenCalledWith("value 2")
describe ".transact(callback)", ->
changeSpy = null
beforeEach ->
changeSpy = jasmine.createSpy('onDidChange callback')
atom.config.onDidChange("foo.bar.baz", changeSpy)
it "allows only one change event for the duration of the given callback", ->
atom.config.transact ->
atom.config.set("foo.bar.baz", 1)
atom.config.set("foo.bar.baz", 2)
atom.config.set("foo.bar.baz", 3)
expect(changeSpy.callCount).toBe(1)
expect(changeSpy.argsForCall[0][0]).toEqual(newValue: 3, oldValue: undefined)
it "does not emit an event if no changes occur while paused", ->
atom.config.transact ->
expect(changeSpy).not.toHaveBeenCalled()
describe ".initializeConfigDirectory()", ->
beforeEach ->
if fs.existsSync(dotAtomPath)
@@ -514,6 +658,15 @@ describe "Config", ->
atom.config.configDirPath = dotAtomPath
atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
atom.config.setSchema 'foo',
type: 'object'
properties:
bar:
type: 'string'
default: 'def'
int:
type: 'integer'
default: 12
afterEach ->
fs.removeSync(dotAtomPath)
@@ -533,7 +686,7 @@ describe "Config", ->
it "updates the config data based on the file contents", ->
expect(atom.config.get("foo.bar")).toBe 'baz'
expect(atom.config.get(['.source.ruby'], "foo.bar")).toBe 'more-specific'
expect(atom.config.get("foo.bar", scope: ['.source.ruby'])).toBe 'more-specific'
describe "when the config file contains valid cson", ->
beforeEach ->
@@ -554,11 +707,13 @@ describe "Config", ->
describe "when the config file contains invalid cson", ->
beforeEach ->
spyOn(console, 'error')
spyOn(atom.notifications, 'addError')
fs.writeFileSync(atom.config.configFilePath, "{{{{{")
it "logs an error to the console and does not overwrite the config file on a subsequent save", ->
atom.config.loadUserConfig()
expect(console.error).toHaveBeenCalled()
expect(atom.notifications.addError.callCount).toBe 1
atom.config.set("hair", "blonde") # trigger a save
expect(atom.config.save).not.toHaveBeenCalled()
@@ -569,43 +724,42 @@ describe "Config", ->
expect(fs.existsSync(atom.config.configFilePath)).toBe true
expect(CSON.readFileSync(atom.config.configFilePath)).toEqual {}
describe "when a schema is specified", ->
describe "when the config file contains values that do not adhere to the schema", ->
warnSpy = null
beforeEach ->
schema =
type: 'object'
properties:
bar:
type: 'string'
default: 'def'
int:
type: 'integer'
default: 12
warnSpy = spyOn console, 'warn'
fs.writeFileSync atom.config.configFilePath, """
foo:
bar: 'baz'
int: 'bad value'
"""
atom.config.loadUserConfig()
atom.config.setSchema('foo', schema)
it "updates the only the settings that have values matching the schema", ->
expect(atom.config.get("foo.bar")).toBe 'baz'
expect(atom.config.get("foo.int")).toBe 12
describe "when the config file contains values that do not adhere to the schema", ->
warnSpy = null
beforeEach ->
warnSpy = spyOn console, 'warn'
fs.writeFileSync atom.config.configFilePath, """
foo:
bar: 'baz'
int: 'bad value'
"""
atom.config.loadUserConfig()
it "updates the only the settings that have values matching the schema", ->
expect(atom.config.get("foo.bar")).toBe 'baz'
expect(atom.config.get("foo.int")).toBe 12
expect(warnSpy).toHaveBeenCalled()
expect(warnSpy.mostRecentCall.args[0]).toContain "'foo.int' could not be set"
expect(warnSpy).toHaveBeenCalled()
expect(warnSpy.mostRecentCall.args[0]).toContain "foo.int"
describe ".observeUserConfig()", ->
updatedHandler = null
beforeEach ->
atom.config.setDefaults('foo', bar: 'def')
atom.config.setSchema 'foo',
type: 'object'
properties:
bar:
type: 'string'
default: 'def'
baz:
type: 'string'
scoped:
type: 'boolean'
int:
type: 'integer'
default: 12
atom.config.configDirPath = dotAtomPath
atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
@@ -638,32 +792,38 @@ describe "Config", ->
it "does not fire a change event for paths that did not change", ->
atom.config.onDidChange 'foo.bar', noChangeSpy = jasmine.createSpy()
fs.writeFileSync(atom.config.configFilePath, "foo: { bar: 'baz', omg: 'ok'}")
fs.writeFileSync(atom.config.configFilePath, "foo: { bar: 'baz', baz: 'ok'}")
waitsFor 'update event', -> updatedHandler.callCount > 0
runs ->
expect(noChangeSpy).not.toHaveBeenCalled()
expect(atom.config.get('foo.bar')).toBe 'baz'
expect(atom.config.get('foo.omg')).toBe 'ok'
expect(atom.config.get('foo.baz')).toBe 'ok'
describe 'when the default value is a complex value', ->
beforeEach ->
atom.config.setSchema 'foo.bar',
type: 'array'
items:
type: 'string'
fs.writeFileSync(atom.config.configFilePath, "foo: { bar: ['baz', 'ok']}")
waitsFor 'update event', -> updatedHandler.callCount > 0
runs -> updatedHandler.reset()
it "does not fire a change event for paths that did not change", ->
atom.config.onDidChange 'foo.bar', noChangeSpy = jasmine.createSpy()
noChangeSpy = jasmine.createSpy()
atom.config.onDidChange('foo.bar', noChangeSpy)
fs.writeFileSync(atom.config.configFilePath, "foo: { bar: ['baz', 'ok'], omg: 'another'}")
fs.writeFileSync(atom.config.configFilePath, "foo: { bar: ['baz', 'ok'], baz: 'another'}")
waitsFor 'update event', -> updatedHandler.callCount > 0
runs ->
expect(noChangeSpy).not.toHaveBeenCalled()
expect(atom.config.get('foo.bar')).toEqual ['baz', 'ok']
expect(atom.config.get('foo.omg')).toBe 'another'
expect(atom.config.get('foo.baz')).toBe 'another'
describe 'when scoped settings are used', ->
it "fires a change event for scoped settings that are removed", ->
atom.config.onDidChange ['.source.ruby'], 'foo.scoped', scopedSpy = jasmine.createSpy()
scopedSpy = jasmine.createSpy()
atom.config.onDidChange('foo.scoped', scope: ['.source.ruby'], scopedSpy)
fs.writeFileSync atom.config.configFilePath, """
global:
@@ -673,10 +833,11 @@ describe "Config", ->
waitsFor 'update event', -> updatedHandler.callCount > 0
runs ->
expect(scopedSpy).toHaveBeenCalled()
expect(atom.config.get(['.source.ruby'], 'foo.scoped')).toBe false
expect(atom.config.get('foo.scoped', scope: ['.source.ruby'])).toBe false
it "does not fire a change event for paths that did not change", ->
atom.config.onDidChange ['.source.ruby'], 'foo.scoped', noChangeSpy = jasmine.createSpy()
noChangeSpy = jasmine.createSpy()
atom.config.onDidChange('foo.scoped', scope: ['.source.ruby'], noChangeSpy)
fs.writeFileSync atom.config.configFilePath, """
global:
@@ -689,9 +850,8 @@ describe "Config", ->
waitsFor 'update event', -> updatedHandler.callCount > 0
runs ->
expect(noChangeSpy).not.toHaveBeenCalled()
expect(atom.config.get(['.source.ruby'], 'foo.bar')).toBe 'baz'
expect(atom.config.get(['.source.ruby'], 'foo.scoped')).toBe true
expect(atom.config.get('foo.bar', scope: ['.source.ruby'])).toBe 'baz'
expect(atom.config.get('foo.scoped', scope: ['.source.ruby'])).toBe true
describe "when the config file changes to omit a setting with a default", ->
it "resets the setting back to the default", ->
@@ -1094,8 +1254,8 @@ describe "Config", ->
it 'it respects the scoped defaults', ->
expect(atom.config.get('foo.bar.str')).toBe 'ok'
expect(atom.config.get(['.source.js'], 'foo.bar.str')).toBe 'omg'
expect(atom.config.get(['.source.coffee'], 'foo.bar.str')).toBe 'ok'
expect(atom.config.get('foo.bar.str', scope: ['.source.js'])).toBe 'omg'
expect(atom.config.get('foo.bar.str', scope: ['.source.coffee'])).toBe 'ok'
describe "scoped settings", ->
describe ".get(scopeDescriptor, keyPath)", ->
@@ -1104,29 +1264,29 @@ describe "Config", ->
atom.config.addScopedSettings("config", ".source .string.quoted.double", foo: bar: baz: 22)
atom.config.addScopedSettings("config", ".source", foo: bar: baz: 11)
expect(atom.config.get([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
expect(atom.config.get([".source.js", ".string.quoted.double.js"], "foo.bar.baz")).toBe 22
expect(atom.config.get([".source.js", ".variable.assignment.js"], "foo.bar.baz")).toBe 11
expect(atom.config.get([".text"], "foo.bar.baz")).toBeUndefined()
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee", ".string.quoted.double.coffee"])).toBe 42
expect(atom.config.get("foo.bar.baz", scope: [".source.js", ".string.quoted.double.js"])).toBe 22
expect(atom.config.get("foo.bar.baz", scope: [".source.js", ".variable.assignment.js"])).toBe 11
expect(atom.config.get("foo.bar.baz", scope: [".text"])).toBeUndefined()
it "favors the most recently added properties in the event of a specificity tie", ->
atom.config.addScopedSettings("config", ".source.coffee .string.quoted.single", foo: bar: baz: 42)
atom.config.addScopedSettings("config", ".source.coffee .string.quoted.double", foo: bar: baz: 22)
expect(atom.config.get([".source.coffee", ".string.quoted.single"], "foo.bar.baz")).toBe 42
expect(atom.config.get([".source.coffee", ".string.quoted.single.double"], "foo.bar.baz")).toBe 22
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee", ".string.quoted.single"])).toBe 42
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee", ".string.quoted.single.double"])).toBe 22
describe 'when there are global defaults', ->
it 'falls back to the global when there is no scoped property specified', ->
atom.config.setDefaults("foo", hasDefault: 'ok')
expect(atom.config.get([".source.coffee", ".string.quoted.single"], "foo.hasDefault")).toBe 'ok'
expect(atom.config.get("foo.hasDefault", scope: [".source.coffee", ".string.quoted.single"])).toBe 'ok'
describe 'setting priority', ->
describe 'when package settings are added after user settings', ->
it "returns the user's setting because the user's setting has higher priority", ->
atom.config.set(".source.coffee", "foo.bar.baz", 100)
atom.config.set("foo.bar.baz", 100, scopeSelector: ".source.coffee")
atom.config.addScopedSettings("some-package", ".source.coffee", foo: bar: baz: 1)
expect(atom.config.get([".source.coffee"], "foo.bar.baz")).toBe 100
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee"])).toBe 100
describe ".set(scope, keyPath, value)", ->
it "sets the value and overrides the others", ->
@@ -1134,10 +1294,10 @@ describe "Config", ->
atom.config.addScopedSettings("config", ".source .string.quoted.double", foo: bar: baz: 22)
atom.config.addScopedSettings("config", ".source", foo: bar: baz: 11)
expect(atom.config.get([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee", ".string.quoted.double.coffee"])).toBe 42
expect(atom.config.set(".source.coffee .string.quoted.double.coffee", "foo.bar.baz", 100)).toBe true
expect(atom.config.get([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 100
expect(atom.config.set("foo.bar.baz", 100, scopeSelector: ".source.coffee .string.quoted.double.coffee")).toBe true
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee", ".string.quoted.double.coffee"])).toBe 100
describe ".removeScopedSettingsForName(name)", ->
it "allows properties to be removed by name", ->
@@ -1145,12 +1305,13 @@ describe "Config", ->
disposable2 = atom.config.addScopedSettings("b", ".source .string.quoted.double", foo: bar: baz: 22)
disposable2.dispose()
expect(atom.config.get([".source.js", ".string.quoted.double.js"], "foo.bar.baz")).toBeUndefined()
expect(atom.config.get([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
expect(atom.config.get("foo.bar.baz", scope: [".source.js", ".string.quoted.double.js"])).toBeUndefined()
expect(atom.config.get("foo.bar.baz", scope: [".source.coffee", ".string.quoted.double.coffee"])).toBe 42
describe ".observe(scopeDescriptor, keyPath)", ->
it 'calls the supplied callback when the value at the descriptor/keypath changes', ->
atom.config.observe [".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz", changeSpy = jasmine.createSpy()
changeSpy = jasmine.createSpy()
atom.config.observe("foo.bar.baz", scope: [".source.coffee", ".string.quoted.double.coffee"], changeSpy)
expect(changeSpy).toHaveBeenCalledWith(undefined)
changeSpy.reset()
@@ -1181,28 +1342,59 @@ describe "Config", ->
describe ".onDidChange(scopeDescriptor, keyPath)", ->
it 'calls the supplied callback when the value at the descriptor/keypath changes', ->
keyPath = "foo.bar.baz"
atom.config.onDidChange [".source.coffee", ".string.quoted.double.coffee"], keyPath, changeSpy = jasmine.createSpy()
changeSpy = jasmine.createSpy('onDidChange callback')
atom.config.onDidChange keyPath, scope: [".source.coffee", ".string.quoted.double.coffee"], changeSpy
atom.config.set("foo.bar.baz", 12)
expect(changeSpy).toHaveBeenCalledWith({oldValue: undefined, newValue: 12, keyPath})
expect(changeSpy).toHaveBeenCalledWith({oldValue: undefined, newValue: 12})
changeSpy.reset()
disposable1 = atom.config.addScopedSettings("a", ".source .string.quoted.double", foo: bar: baz: 22)
expect(changeSpy).toHaveBeenCalledWith({oldValue: 12, newValue: 22, keyPath})
expect(changeSpy).toHaveBeenCalledWith({oldValue: 12, newValue: 22})
changeSpy.reset()
disposable2 = atom.config.addScopedSettings("b", ".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
expect(changeSpy).toHaveBeenCalledWith({oldValue: 22, newValue: 42, keyPath})
expect(changeSpy).toHaveBeenCalledWith({oldValue: 22, newValue: 42})
changeSpy.reset()
disposable2.dispose()
expect(changeSpy).toHaveBeenCalledWith({oldValue: 42, newValue: 22, keyPath})
expect(changeSpy).toHaveBeenCalledWith({oldValue: 42, newValue: 22})
changeSpy.reset()
disposable1.dispose()
expect(changeSpy).toHaveBeenCalledWith({oldValue: 22, newValue: 12, keyPath})
expect(changeSpy).toHaveBeenCalledWith({oldValue: 22, newValue: 12})
changeSpy.reset()
atom.config.set("foo.bar.baz", undefined)
expect(changeSpy).toHaveBeenCalledWith({oldValue: 12, newValue: undefined, keyPath})
expect(changeSpy).toHaveBeenCalledWith({oldValue: 12, newValue: undefined})
changeSpy.reset()
it 'deprecates using a scope descriptor as an optional first argument', ->
keyPath = "foo.bar.baz"
spyOn(Grim, 'deprecate')
atom.config.onDidChange [".source.coffee", ".string.quoted.double.coffee"], keyPath, changeSpy = jasmine.createSpy()
expect(Grim.deprecate).toHaveBeenCalled()
atom.config.set("foo.bar.baz", 12)
expect(changeSpy).toHaveBeenCalledWith({oldValue: undefined, newValue: 12})
changeSpy.reset()
disposable1 = atom.config.addScopedSettings("a", ".source .string.quoted.double", foo: bar: baz: 22)
expect(changeSpy).toHaveBeenCalledWith({oldValue: 12, newValue: 22})
changeSpy.reset()
disposable2 = atom.config.addScopedSettings("b", ".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
expect(changeSpy).toHaveBeenCalledWith({oldValue: 22, newValue: 42})
changeSpy.reset()
disposable2.dispose()
expect(changeSpy).toHaveBeenCalledWith({oldValue: 42, newValue: 22})
changeSpy.reset()
disposable1.dispose()
expect(changeSpy).toHaveBeenCalledWith({oldValue: 22, newValue: 12})
changeSpy.reset()
atom.config.set("foo.bar.baz", undefined)
expect(changeSpy).toHaveBeenCalledWith({oldValue: 12, newValue: undefined})
changeSpy.reset()
+28 -21
Ver Arquivo
@@ -1,4 +1,4 @@
{$$} = require 'atom'
{$$} = require '../src/space-pen-extensions'
ContextMenuManager = require '../src/context-menu-manager'
@@ -151,24 +151,31 @@ describe "ContextMenuManager", ->
shouldDisplay = false
expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual []
it "allows items to be specified in the legacy format for now", ->
contextMenu.add '.parent':
'A': 'a'
'Separator 1': '-'
'B':
'C': 'c'
'Separator 2': '-'
'D': 'd'
describe "when the menus are specified in a legacy format", ->
beforeEach ->
jasmine.snapshotDeprecations()
expect(contextMenu.templateForElement(parent)).toEqual [
{label: 'A', command: 'a'}
{type: 'separator'}
{
label: 'B'
submenu: [
{label: 'C', command: 'c'}
{type: 'separator'}
{label: 'D', command: 'd'}
]
}
]
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it "allows items to be specified in the legacy format for now", ->
contextMenu.add '.parent':
'A': 'a'
'Separator 1': '-'
'B':
'C': 'c'
'Separator 2': '-'
'D': 'd'
expect(contextMenu.templateForElement(parent)).toEqual [
{label: 'A', command: 'a'}
{type: 'separator'}
{
label: 'B'
submenu: [
{label: 'C', command: 'c'}
{type: 'separator'}
{label: 'D', command: 'd'}
]
}
]
+6
Ver Arquivo
@@ -1085,6 +1085,12 @@ describe "DisplayBuffer", ->
expect(oldProperties).toEqual decorationProperties
expect(newProperties).toEqual type: 'gutter', class: 'two', id: decoration.id
describe "::getDecorations(properties)", ->
it "returns decorations matching the given optional properties", ->
expect(displayBuffer.getDecorations()).toEqual [decoration]
expect(displayBuffer.getDecorations(class: 'two').length).toEqual 0
expect(displayBuffer.getDecorations(class: 'one').length).toEqual 1
describe "::setScrollTop", ->
beforeEach ->
displayBuffer.manageScrollPosition = true
@@ -9,5 +9,6 @@ module.exports =
atom.commands.add 'atom-workspace', 'activation-command', =>
@activationCommandCallCount++
atom.workspaceView.getActiveView()?.command 'activation-command', =>
editorView = atom.views.getView(atom.workspace.getActiveTextEditor())?.__spacePenView
editorView?.command 'activation-command', =>
@legacyActivationCommandCallCount++
@@ -3,5 +3,6 @@
]
'context-menu':
'.test-1':
'Menu item 1': 'command-1'
'.test-1': [
{label: 'Menu item 1', command: 'command-1'}
]
@@ -3,5 +3,6 @@
]
'context-menu':
'.test-1':
'Menu item 2': 'command-2'
'.test-1': [
{label: 'Menu item 2', command: 'command-2'}
]
@@ -1,3 +1,4 @@
'context-menu':
'.test-1':
'Menu item 3': 'command-3'
'.test-1': [
{label: 'Menu item 3', command: 'command-3'}
]
+5 -1
Ver Arquivo
@@ -132,7 +132,7 @@ describe "GitRepository", ->
atom.workspace.open(filePath)
runs ->
editor = atom.workspace.getActiveEditor()
editor = atom.workspace.getActiveTextEditor()
it "displays a confirmation dialog by default", ->
spyOn(atom, 'confirm').andCallFake ({buttons}) -> buttons.OK()
@@ -259,6 +259,10 @@ describe "GitRepository", ->
editor.getBuffer().emitter.emit 'did-change-path'
expect(statusHandler.callCount).toBe 1
it "stops listening to the buffer when the repository is destroyed (regression)", ->
atom.project.getRepositories()[0].destroy()
expect(-> editor.save()).not.toThrow()
describe "when a project is deserialized", ->
[buffer, project2] = []
+3
Ver Arquivo
@@ -25,6 +25,9 @@ module.exports.runSpecSuite = (specSuite, logFile, logErrors=true) ->
log(str)
onComplete: (runner) ->
fs.closeSync(logStream) if logStream?
if process.env.JANKY_SHA1
grim = require 'grim'
grim.logDeprecations() if grim.getDeprecationsLength() > 0
atom.exit(runner.results().failedCount > 0 ? 1 : 0)
else
AtomReporter = require './atom-reporter'
+57
Ver Arquivo
@@ -0,0 +1,57 @@
NotificationManager = require '../src/notification-manager'
describe "NotificationManager", ->
[manager] = []
beforeEach ->
manager = new NotificationManager
describe "the atom global", ->
it "has a notifications instance", ->
expect(atom.notifications instanceof NotificationManager).toBe true
describe "adding events", ->
addSpy = null
beforeEach ->
addSpy = jasmine.createSpy()
manager.onDidAddNotification(addSpy)
it "emits an event when a notification has been added", ->
manager.add('error', 'Some error!', icon: 'someIcon')
expect(addSpy).toHaveBeenCalled()
notification = addSpy.mostRecentCall.args[0]
expect(notification.getType()).toBe 'error'
expect(notification.getMessage()).toBe 'Some error!'
expect(notification.getIcon()).toBe 'someIcon'
it "emits a fatal error ::addFatalError has been called", ->
manager.addFatalError('Some error!', icon: 'someIcon')
expect(addSpy).toHaveBeenCalled()
notification = addSpy.mostRecentCall.args[0]
expect(notification.getType()).toBe 'fatal'
it "emits an error ::addError has been called", ->
manager.addError('Some error!', icon: 'someIcon')
expect(addSpy).toHaveBeenCalled()
notification = addSpy.mostRecentCall.args[0]
expect(notification.getType()).toBe 'error'
it "emits a warning notification ::addWarning has been called", ->
manager.addWarning('Something!', icon: 'someIcon')
expect(addSpy).toHaveBeenCalled()
notification = addSpy.mostRecentCall.args[0]
expect(notification.getType()).toBe 'warning'
it "emits an info notification ::addInfo has been called", ->
manager.addInfo('Something!', icon: 'someIcon')
expect(addSpy).toHaveBeenCalled()
notification = addSpy.mostRecentCall.args[0]
expect(notification.getType()).toBe 'info'
it "emits a success notification ::addSuccess has been called", ->
manager.addSuccess('Something!', icon: 'someIcon')
expect(addSpy).toHaveBeenCalled()
notification = addSpy.mostRecentCall.args[0]
expect(notification.getType()).toBe 'success'
+47
Ver Arquivo
@@ -0,0 +1,47 @@
Notification = require '../src/notification'
describe "Notification", ->
[notification] = []
describe "::getTimestamp()", ->
it "returns a Date object", ->
notification = new Notification('error', 'message!')
expect(notification.getTimestamp() instanceof Date).toBe true
describe "::getIcon()", ->
it "returns a default when no icon specified", ->
notification = new Notification('error', 'message!')
expect(notification.getIcon()).toBe 'flame'
it "returns the icon specified", ->
notification = new Notification('error', 'message!', icon: 'my-icon')
expect(notification.getIcon()).toBe 'my-icon'
describe "dismissing notifications", ->
describe "when the notfication is dismissable", ->
it "calls a callback when the notification is dismissed", ->
dismissedSpy = jasmine.createSpy()
notification = new Notification('error', 'message', dismissable: true)
notification.onDidDismiss dismissedSpy
expect(notification.isDismissable()).toBe true
expect(notification.isDismissed()).toBe false
notification.dismiss()
expect(dismissedSpy).toHaveBeenCalled()
expect(notification.isDismissed()).toBe true
describe "when the notfication is not dismissable", ->
it "does nothing when ::dismiss() is called", ->
dismissedSpy = jasmine.createSpy()
notification = new Notification('error', 'message')
notification.onDidDismiss dismissedSpy
expect(notification.isDismissable()).toBe false
expect(notification.isDismissed()).toBe true
notification.dismiss()
expect(dismissedSpy).not.toHaveBeenCalled()
expect(notification.isDismissed()).toBe true
+43 -32
Ver Arquivo
@@ -1,9 +1,10 @@
{$, $$, WorkspaceView} = require 'atom'
{$, $$} = require '../src/space-pen-extensions'
Package = require '../src/package'
describe "PackageManager", ->
workspaceElement = null
beforeEach ->
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
workspaceElement = atom.views.getView(atom.workspace)
describe "::loadPackage(name)", ->
it "continues if the package has an invalid package.json", ->
@@ -97,21 +98,29 @@ describe "PackageManager", ->
expect(atom.config.set('package-with-config-schema.numbers.one', '10')).toBe true
expect(atom.config.get('package-with-config-schema.numbers.one')).toBe 10
it "still assigns configDefaults from the module though deprecated", ->
expect(atom.config.get('package-with-config-defaults.numbers.one')).toBeUndefined()
describe "when a package has configDefaults", ->
beforeEach ->
jasmine.snapshotDeprecations()
waitsForPromise ->
atom.packages.activatePackage('package-with-config-defaults')
afterEach ->
jasmine.restoreDeprecationsSnapshot()
runs ->
expect(atom.config.get('package-with-config-defaults.numbers.one')).toBe 1
expect(atom.config.get('package-with-config-defaults.numbers.two')).toBe 2
it "still assigns configDefaults from the module though deprecated", ->
expect(atom.config.get('package-with-config-defaults.numbers.one')).toBeUndefined()
waitsForPromise ->
atom.packages.activatePackage('package-with-config-defaults')
runs ->
expect(atom.config.get('package-with-config-defaults.numbers.one')).toBe 1
expect(atom.config.get('package-with-config-defaults.numbers.two')).toBe 2
describe "when the package metadata includes `activationCommands`", ->
[mainModule, promise, workspaceCommandListener] = []
beforeEach ->
atom.workspaceView.attachToDom()
jasmine.attachToDOM(workspaceElement)
mainModule = require './fixtures/packages/package-with-activation-commands/index'
mainModule.legacyActivationCommandCallCount = 0
mainModule.activationCommandCallCount = 0
@@ -125,29 +134,29 @@ describe "PackageManager", ->
it "defers requiring/activating the main module until an activation event bubbles to the root view", ->
expect(promise.isFulfilled()).not.toBeTruthy()
atom.workspaceView[0].dispatchEvent(new CustomEvent('activation-command', bubbles: true))
workspaceElement.dispatchEvent(new CustomEvent('activation-command', bubbles: true))
waitsForPromise ->
promise
it "triggers the activation event on all handlers registered during activation", ->
waitsForPromise ->
atom.workspaceView.open()
atom.workspace.open()
runs ->
editorView = atom.workspaceView.getActiveView()
editorView = atom.views.getView(atom.workspace.getActiveTextEditor()).__spacePenView
legacyCommandListener = jasmine.createSpy("legacyCommandListener")
editorView.command 'activation-command', legacyCommandListener
editorCommandListener = jasmine.createSpy("editorCommandListener")
atom.commands.add 'atom-text-editor', 'activation-command', editorCommandListener
editorView[0].dispatchEvent(new CustomEvent('activation-command', bubbles: true))
atom.commands.dispatch(editorView[0], 'activation-command')
expect(mainModule.activate.callCount).toBe 1
expect(mainModule.legacyActivationCommandCallCount).toBe 1
expect(mainModule.activationCommandCallCount).toBe 1
expect(legacyCommandListener.callCount).toBe 1
expect(editorCommandListener.callCount).toBe 1
expect(workspaceCommandListener.callCount).toBe 1
editorView[0].dispatchEvent(new CustomEvent('activation-command', bubbles: true))
atom.commands.dispatch(editorView[0], 'activation-command')
expect(mainModule.legacyActivationCommandCallCount).toBe 2
expect(mainModule.activationCommandCallCount).toBe 2
expect(legacyCommandListener.callCount).toBe 2
@@ -349,8 +358,8 @@ describe "PackageManager", ->
atom.packages.activatePackage('package-with-grammars')
runs ->
expect(atom.syntax.selectGrammar('a.alot').name).toBe 'Alot'
expect(atom.syntax.selectGrammar('a.alittle').name).toBe 'Alittle'
expect(atom.grammars.selectGrammar('a.alot').name).toBe 'Alot'
expect(atom.grammars.selectGrammar('a.alittle').name).toBe 'Alittle'
describe "scoped-property loading", ->
it "loads the scoped properties", ->
@@ -358,26 +367,26 @@ describe "PackageManager", ->
atom.packages.activatePackage("package-with-scoped-properties")
runs ->
expect(atom.config.get ['.source.omg'], 'editor.increaseIndentPattern').toBe '^a'
expect(atom.config.get 'editor.increaseIndentPattern', scope: ['.source.omg']).toBe '^a'
describe "converted textmate packages", ->
it "loads the package's grammars", ->
expect(atom.syntax.selectGrammar("file.rb").name).toBe "Null Grammar"
expect(atom.grammars.selectGrammar("file.rb").name).toBe "Null Grammar"
waitsForPromise ->
atom.packages.activatePackage('language-ruby')
runs ->
expect(atom.syntax.selectGrammar("file.rb").name).toBe "Ruby"
expect(atom.grammars.selectGrammar("file.rb").name).toBe "Ruby"
it "loads the translated scoped properties", ->
expect(atom.config.get(['.source.ruby'], 'editor.commentStart')).toBeUndefined()
expect(atom.config.get('editor.commentStart', scope: ['.source.ruby'])).toBeUndefined()
waitsForPromise ->
atom.packages.activatePackage('language-ruby')
runs ->
expect(atom.config.get(['.source.ruby'], 'editor.commentStart')).toBe '# '
expect(atom.config.get('editor.commentStart', scope: ['.source.ruby'])).toBe '# '
describe "::deactivatePackage(id)", ->
afterEach ->
@@ -454,8 +463,8 @@ describe "PackageManager", ->
runs ->
atom.packages.deactivatePackage('package-with-grammars')
expect(atom.syntax.selectGrammar('a.alot').name).toBe 'Null Grammar'
expect(atom.syntax.selectGrammar('a.alittle').name).toBe 'Null Grammar'
expect(atom.grammars.selectGrammar('a.alot').name).toBe 'Null Grammar'
expect(atom.grammars.selectGrammar('a.alittle').name).toBe 'Null Grammar'
it "removes the package's keymaps", ->
waitsForPromise ->
@@ -484,21 +493,21 @@ describe "PackageManager", ->
atom.packages.activatePackage("package-with-scoped-properties")
runs ->
expect(atom.config.get ['.source.omg'], 'editor.increaseIndentPattern').toBe '^a'
expect(atom.config.get 'editor.increaseIndentPattern', scope: ['.source.omg']).toBe '^a'
atom.packages.deactivatePackage("package-with-scoped-properties")
expect(atom.config.get ['.source.omg'], 'editor.increaseIndentPattern').toBeUndefined()
expect(atom.config.get 'editor.increaseIndentPattern', scope: ['.source.omg']).toBeUndefined()
describe "textmate packages", ->
it "removes the package's grammars", ->
expect(atom.syntax.selectGrammar("file.rb").name).toBe "Null Grammar"
expect(atom.grammars.selectGrammar("file.rb").name).toBe "Null Grammar"
waitsForPromise ->
atom.packages.activatePackage('language-ruby')
runs ->
expect(atom.syntax.selectGrammar("file.rb").name).toBe "Ruby"
expect(atom.grammars.selectGrammar("file.rb").name).toBe "Ruby"
atom.packages.deactivatePackage('language-ruby')
expect(atom.syntax.selectGrammar("file.rb").name).toBe "Null Grammar"
expect(atom.grammars.selectGrammar("file.rb").name).toBe "Null Grammar"
it "removes the package's scoped properties", ->
waitsForPromise ->
@@ -506,13 +515,14 @@ describe "PackageManager", ->
runs ->
atom.packages.deactivatePackage('language-ruby')
expect(atom.config.get(['.source.ruby'], 'editor.commentStart')).toBeUndefined()
expect(atom.config.get('editor.commentStart', scope: ['.source.ruby'])).toBeUndefined()
describe "::activate()", ->
packageActivator = null
themeActivator = null
beforeEach ->
jasmine.snapshotDeprecations()
spyOn(console, 'warn')
atom.packages.loadPackages()
@@ -526,8 +536,9 @@ describe "PackageManager", ->
atom.packages.deactivatePackages()
atom.packages.unloadPackages()
Syntax = require '../src/syntax'
atom.syntax = window.syntax = new Syntax()
GrammarRegistry = require '../src/grammar-registry'
atom.grammars = window.syntax = new GrammarRegistry()
jasmine.restoreDeprecationsSnapshot()
it "activates all the packages, and none of the themes", ->
atom.packages.activate()
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
{$} = require 'atom'
{$} = require '../src/space-pen-extensions'
path = require 'path'
Package = require '../src/package'
ThemePackage = require '../src/theme-package'
+54
Ver Arquivo
@@ -148,3 +148,57 @@ describe "PaneContainer", ->
saved = container.confirmClose()
expect(saved).toBeFalsy()
expect(atom.confirm).toHaveBeenCalled()
describe "::onDidAddPane(callback)", ->
it "invokes the given callback when panes are added", ->
container = new PaneContainer
events = []
container.onDidAddPane (event) -> events.push(event)
pane1 = container.getActivePane()
pane2 = pane1.splitRight()
pane3 = pane2.splitDown()
expect(events).toEqual [{pane: pane2}, {pane: pane3}]
describe "::onDidDestroyPane(callback)", ->
it "invokes the given callback when panes are destroyed", ->
container = new PaneContainer
events = []
container.onDidDestroyPane (event) -> events.push(event)
pane1 = container.getActivePane()
pane2 = pane1.splitRight()
pane3 = pane2.splitDown()
pane2.destroy()
pane3.destroy()
expect(events).toEqual [{pane: pane2}, {pane: pane3}]
describe "::onWillDestroyPaneItem() and ::onDidDestroyPaneItem", ->
it "invokes the given callbacks when an item will be destroyed on any pane", ->
container = new PaneContainer
pane1 = container.getRoot()
item1 = new Object
item2 = new Object
item3 = new Object
pane1.addItem(item1)
events = []
container.onWillDestroyPaneItem (event) -> events.push(['will', event])
container.onDidDestroyPaneItem (event) -> events.push(['did', event])
pane2 = pane1.splitRight(items: [item2, item3])
pane1.destroyItem(item1)
pane2.destroyItem(item3)
pane2.destroyItem(item2)
expect(events).toEqual [
['will', {item: item1, pane: pane1, index: 0}]
['did', {item: item1, pane: pane1, index: 0}]
['will', {item: item3, pane: pane2, index: 1}]
['did', {item: item3, pane: pane2, index: 1}]
['will', {item: item2, pane: pane2, index: 0}]
['did', {item: item2, pane: pane2, index: 0}]
]
+4 -1
Ver Arquivo
@@ -3,7 +3,8 @@ temp = require 'temp'
PaneContainer = require '../src/pane-container'
PaneContainerView = require '../src/pane-container-view'
PaneView = require '../src/pane-view'
{$, View, $$} = require 'atom'
{Disposable} = require 'event-kit'
{$, View, $$} = require '../src/space-pen-extensions'
describe "PaneContainerView", ->
[TestView, container, pane1, pane2, pane3, deserializerDisposable] = []
@@ -18,6 +19,8 @@ describe "PaneContainerView", ->
getUri: -> path.join(temp.dir, @name)
save: -> @saved = true
isEqual: (other) -> @name is other?.name
onDidChangeTitle: -> new Disposable(->)
onDidChangeModified: -> new Disposable(->)
container = atom.views.getView(atom.workspace.paneContainer).__spacePenView
pane1 = container.getRoot()
+16 -7
Ver Arquivo
@@ -1,8 +1,8 @@
PaneContainer = require '../src/pane-container'
PaneView = require '../src/pane-view'
fs = require 'fs-plus'
{Emitter} = require 'event-kit'
{$, View} = require 'atom'
{Emitter, Disposable} = require 'event-kit'
{$, View} = require '../src/space-pen-extensions'
path = require 'path'
temp = require 'temp'
@@ -21,8 +21,11 @@ describe "PaneView", ->
@emitter.emit 'did-change-title', 'title'
onDidChangeTitle: (callback) ->
@emitter.on 'did-change-title', callback
onDidChangeModified: -> new Disposable(->)
beforeEach ->
jasmine.snapshotDeprecations()
deserializerDisposable = atom.deserializers.add(TestView)
container = atom.views.getView(new PaneContainer).__spacePenView
containerModel = container.model
@@ -41,6 +44,7 @@ describe "PaneView", ->
afterEach ->
deserializerDisposable.dispose()
jasmine.restoreDeprecationsSnapshot()
describe "when the active pane item changes", ->
it "hides all item views except the active one", ->
@@ -155,14 +159,19 @@ describe "PaneView", ->
expect(view1.is(':visible')).toBe true
describe "when the title of the active item changes", ->
describe 'when there is no onDidChangeTitle method', ->
describe 'when there is no onDidChangeTitle method (deprecated)', ->
beforeEach ->
jasmine.snapshotDeprecations()
view1.onDidChangeTitle = null
view2.onDidChangeTitle = null
pane.activateItem(view2)
pane.activateItem(view1)
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it "emits pane:active-item-title-changed", ->
activeItemTitleChangedHandler = jasmine.createSpy("activeItemTitleChangedHandler")
pane.on 'pane:active-item-title-changed', activeItemTitleChangedHandler
@@ -220,7 +229,7 @@ describe "PaneView", ->
beforeEach ->
pane2Model = paneModel.splitRight() # Can't destroy the last pane, so we add another
pane2 = containerModel.getView(pane2Model).__spacePenView
pane2 = atom.views.getView(pane2Model).__spacePenView
it "triggers a 'pane:removed' event with the pane", ->
removedHandler = jasmine.createSpy("removedHandler")
@@ -253,7 +262,7 @@ describe "PaneView", ->
beforeEach ->
pane2Model = paneModel.splitRight(items: [pane.copyActiveItem()])
pane2 = containerModel.getView(pane2Model).__spacePenView
pane2 = atom.views.getView(pane2Model).__spacePenView
expect(pane2Model.isActive()).toBe true
it "adds or removes the .active class as appropriate", ->
@@ -300,8 +309,8 @@ describe "PaneView", ->
pane2Model = pane1Model.splitRight(items: [pane1Model.copyActiveItem()])
pane3Model = pane2Model.splitDown(items: [pane2Model.copyActiveItem()])
pane2 = pane2Model._view
pane2 = containerModel.getView(pane2Model).__spacePenView
pane3 = containerModel.getView(pane3Model).__spacePenView
pane2 = atom.views.getView(pane2Model).__spacePenView
pane3 = atom.views.getView(pane3Model).__spacePenView
expect(container.find('> atom-pane-axis.horizontal > atom-pane').toArray()).toEqual [pane1[0]]
expect(container.find('> atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane').toArray()).toEqual [pane2[0], pane3[0]]
+59 -34
Ver Arquivo
@@ -1,11 +1,10 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelElement = require '../src/panel-element'
PanelContainer = require '../src/panel-container'
PanelContainerElement = require '../src/panel-container-element'
describe "PanelContainerElement", ->
[jasmineContent, element, container, viewRegistry] = []
[jasmineContent, element, container] = []
class TestPanelContainerItem
constructior: ->
@@ -13,25 +12,23 @@ describe "PanelContainerElement", ->
class TestPanelContainerItemElement extends HTMLElement
createdCallback: ->
@classList.add('test-root')
setModel: (@model) ->
initialize: (@model) ->
this
TestPanelContainerItemElement = document.registerElement 'atom-test-container-item-element', prototype: TestPanelContainerItemElement.prototype
beforeEach ->
jasmineContent = document.body.querySelector('#jasmine-content')
viewRegistry = new ViewRegistry
viewRegistry.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
viewRegistry.addViewProvider
modelConstructor: PanelContainer
viewConstructor: PanelContainerElement
viewRegistry.addViewProvider
modelConstructor: TestPanelContainerItem
viewConstructor: TestPanelContainerItemElement
atom.views.addViewProvider Panel, (model) ->
new PanelElement().initialize(model)
atom.views.addViewProvider PanelContainer, (model) ->
new PaneContainerElement().initialize(model)
atom.views.addViewProvider TestPanelContainerItem, (model) ->
new TestPanelContainerItemElement().initialize(model)
container = new PanelContainer({viewRegistry, location: 'left'})
element = container.getView()
container = new PanelContainer({location: 'left'})
element = atom.views.getView(container)
jasmineContent.appendChild(element)
it 'has a location class with value from the model', ->
@@ -43,23 +40,38 @@ describe "PanelContainerElement", ->
expect(element.parentNode).not.toBe jasmineContent
describe "adding and removing panels", ->
it "allows panels to be inserted at any position", ->
panel1 = new Panel({item: new TestPanelContainerItem(), priority: 10})
panel2 = new Panel({item: new TestPanelContainerItem(), priority: 5})
panel3 = new Panel({item: new TestPanelContainerItem(), priority: 8})
container.addPanel(panel1)
container.addPanel(panel2)
container.addPanel(panel3)
expect(element.childNodes[2].getModel()).toBe(panel1)
expect(element.childNodes[1].getModel()).toBe(panel3)
expect(element.childNodes[0].getModel()).toBe(panel2)
describe "when the container is at the left location", ->
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel1 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0]).toHaveClass 'left'
expect(element.childNodes[0]).toHaveClass 'tool-panel' # legacy selector support
expect(element.childNodes[0]).toHaveClass 'panel-left' # legacy selector support
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel2 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
expect(atom.views.getView(panel1).style.display).not.toBe 'none'
expect(atom.views.getView(panel2).style.display).not.toBe 'none'
panel1.destroy()
expect(element.childNodes.length).toBe 1
@@ -69,24 +81,26 @@ describe "PanelContainerElement", ->
describe "when the container is at the bottom location", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'bottom'})
element = container.getView()
container = new PanelContainer({location: 'bottom'})
element = atom.views.getView(container)
jasmineContent.appendChild(element)
it "adds atom-panel elements when a new panel is added to the container; removes them when the panels are destroyed", ->
expect(element.childNodes.length).toBe 0
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'one'})
panel1 = new Panel({item: new TestPanelContainerItem(), className: 'one'})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0]).toHaveClass 'bottom'
expect(element.childNodes[0]).toHaveClass 'tool-panel' # legacy selector support
expect(element.childNodes[0]).toHaveClass 'panel-bottom' # legacy selector support
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
expect(panel1.getView()).toHaveClass 'one'
expect(atom.views.getView(panel1)).toHaveClass 'one'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'two'})
panel2 = new Panel({item: new TestPanelContainerItem(), className: 'two'})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel2.getView()).toHaveClass 'two'
expect(atom.views.getView(panel2)).toHaveClass 'two'
panel1.destroy()
expect(element.childNodes.length).toBe 1
@@ -96,23 +110,34 @@ describe "PanelContainerElement", ->
describe "when the container is modal", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'modal'})
element = container.getView()
container = new PanelContainer({location: 'modal'})
element = atom.views.getView(container)
jasmineContent.appendChild(element)
it "allows only one panel to be visible at a time", ->
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel1 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(panel1.getView().style.display).not.toBe 'none'
expect(atom.views.getView(panel1).style.display).not.toBe 'none'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
panel2 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(panel1.getView().style.display).toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
expect(atom.views.getView(panel1).style.display).toBe 'none'
expect(atom.views.getView(panel2).style.display).not.toBe 'none'
panel1.show()
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).toBe 'none'
expect(atom.views.getView(panel1).style.display).not.toBe 'none'
expect(atom.views.getView(panel2).style.display).toBe 'none'
it "adds the 'modal' class to panels", ->
panel1 = new Panel({item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(atom.views.getView(panel1)).toHaveClass 'modal'
# legacy selector support
expect(atom.views.getView(panel1)).not.toHaveClass 'tool-panel'
expect(atom.views.getView(panel1)).toHaveClass 'overlay'
expect(atom.views.getView(panel1)).toHaveClass 'from-top'
+4 -6
Ver Arquivo
@@ -1,16 +1,14 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelContainer = require '../src/panel-container'
describe "PanelContainer", ->
[container, viewRegistry] = []
[container] = []
class TestPanelItem
constructior: ->
beforeEach ->
viewRegistry = new ViewRegistry
container = new PanelContainer({viewRegistry})
container = new PanelContainer
describe "::addPanel(panel)", ->
it 'emits an onDidAddPanel event with the index the panel was inserted at', ->
@@ -46,7 +44,7 @@ describe "PanelContainer", ->
[initialPanel] = []
beforeEach ->
# 'left' logic is the same as 'top'
container = new PanelContainer({viewRegistry, location: 'left'})
container = new PanelContainer({location: 'left'})
initialPanel = new Panel(item: new TestPanelItem())
container.addPanel(initialPanel)
@@ -75,7 +73,7 @@ describe "PanelContainer", ->
[initialPanel] = []
beforeEach ->
# 'bottom' logic is the same as 'right'
container = new PanelContainer({viewRegistry, location: 'right'})
container = new PanelContainer({location: 'right'})
initialPanel = new Panel(item: new TestPanelItem())
container.addPanel(initialPanel)
+16 -18
Ver Arquivo
@@ -1,9 +1,8 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelElement = require '../src/panel-element'
describe "PanelElement", ->
[jasmineContent, element, panel, viewRegistry] = []
[jasmineContent, element, panel] = []
class TestPanelItem
constructior: ->
@@ -11,23 +10,22 @@ describe "PanelElement", ->
class TestPanelItemElement extends HTMLElement
createdCallback: ->
@classList.add('test-root')
setModel: (@model) ->
initialize: (@model) ->
this
TestPanelItemElement = document.registerElement 'atom-test-item-element', prototype: TestPanelItemElement.prototype
beforeEach ->
jasmineContent = document.body.querySelector('#jasmine-content')
viewRegistry = new ViewRegistry
viewRegistry.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
viewRegistry.addViewProvider
modelConstructor: TestPanelItem
viewConstructor: TestPanelItemElement
atom.views.addViewProvider Panel, (model) ->
new PanelElement().initialize(model)
atom.views.addViewProvider TestPanelItem, (model) ->
new TestPanelItemElement().initialize(model)
it 'removes the element when the panel is destroyed', ->
panel = new Panel({viewRegistry, item: new TestPanelItem})
element = panel.getView()
panel = new Panel({item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element.parentNode).toBe jasmineContent
@@ -36,15 +34,15 @@ describe "PanelElement", ->
describe "changing panel visibility", ->
it 'initially renders panel created with visibile: false', ->
panel = new Panel({viewRegistry, visible: false, item: new TestPanelItem})
element = panel.getView()
panel = new Panel({visible: false, item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element.style.display).toBe 'none'
it 'hides and shows the panel element when Panel::hide() and Panel::show() are called', ->
panel = new Panel({viewRegistry, item: new TestPanelItem})
element = panel.getView()
panel = new Panel({item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element.style.display).not.toBe 'none'
@@ -57,8 +55,8 @@ describe "PanelElement", ->
describe "when a class name is specified", ->
it 'initially renders panel created with visibile: false', ->
panel = new Panel({viewRegistry, className: 'some classes', item: new TestPanelItem})
element = panel.getView()
panel = new Panel({className: 'some classes', item: new TestPanelItem})
element = atom.views.getView(panel)
jasmineContent.appendChild(element)
expect(element).toHaveClass 'some'
+4
Ver Arquivo
@@ -21,3 +21,7 @@ describe "Panel", ->
panel.show()
expect(panel.isVisible()).toBe true
expect(spy).toHaveBeenCalledWith(true)
panel.destroy()
expect(panel.isVisible()).toBe false
expect(spy).toHaveBeenCalledWith(false)
+5 -5
Ver Arquivo
@@ -170,30 +170,30 @@ describe "Project", ->
absolutePath = fs.absolute(__dirname)
expect(atom.project.resolve(absolutePath)).toBe absolutePath
describe ".setPath(path)", ->
describe ".setPaths(path)", ->
describe "when path is a file", ->
it "sets its path to the files parent directory and updates the root directory", ->
atom.project.setPaths([require.resolve('./fixtures/dir/a')])
expect(atom.project.getPaths()[0]).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
expect(atom.project.getRootDirectory().path).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
expect(atom.project.getDirectories()[0].path).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
describe "when path is a directory", ->
it "sets its path to the directory and updates the root directory", ->
directory = fs.absolute(path.join(__dirname, 'fixtures', 'dir', 'a-dir'))
atom.project.setPaths([directory])
expect(atom.project.getPaths()[0]).toEqual directory
expect(atom.project.getRootDirectory().path).toEqual directory
expect(atom.project.getDirectories()[0].path).toEqual directory
describe "when path is null", ->
it "sets its path and root directory to null", ->
atom.project.setPaths([])
expect(atom.project.getPaths()[0]?).toBeFalsy()
expect(atom.project.getRootDirectory()?).toBeFalsy()
expect(atom.project.getDirectories()[0]?).toBeFalsy()
it "normalizes the path to remove consecutive slashes, ., and .. segments", ->
atom.project.setPaths(["#{require.resolve('./fixtures/dir/a')}#{path.sep}b#{path.sep}#{path.sep}.."])
expect(atom.project.getPaths()[0]).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
expect(atom.project.getRootDirectory().path).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
expect(atom.project.getDirectories()[0].path).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
describe ".replace()", ->
[filePath, commentFilePath, sampleContent, sampleCommentContent] = []
+1 -1
Ver Arquivo
@@ -1,5 +1,5 @@
SelectListView = require '../src/select-list-view'
{$, $$} = require 'atom'
{$, $$} = require '../src/space-pen-extensions'
describe "SelectListView", ->
[selectList, items, list, filterEditorView] = []
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
{View, $, $$} = require 'atom'
{View, $, $$} = require '../src/space-pen-extensions'
describe "SpacePen extensions", ->
class TestView extends View
+25 -7
Ver Arquivo
@@ -9,12 +9,17 @@ _ = require 'underscore-plus'
fs = require 'fs-plus'
Grim = require 'grim'
KeymapManager = require '../src/keymap-extensions'
{$, WorkspaceView, Workspace} = require 'atom'
# FIXME: Remove jquery from this
{$} = require '../src/space-pen-extensions'
Config = require '../src/config'
{Point} = require 'text-buffer'
Project = require '../src/project'
Workspace = require '../src/workspace'
TextEditor = require '../src/text-editor'
TextEditorView = require '../src/text-editor-view'
TextEditorElement = require '../src/text-editor-element'
TokenizedBuffer = require '../src/tokenized-buffer'
TextEditorComponent = require '../src/text-editor-component'
pathwatcher = require 'pathwatcher'
@@ -76,13 +81,15 @@ beforeEach ->
atom.commands.restoreSnapshot(commandsToRestore)
atom.styles.restoreSnapshot(styleElementsToRestore)
atom.workspaceViewParentSelector = '#jasmine-content'
window.resetTimeouts()
atom.packages.packageStates = {}
serializedWindowState = null
spyOn(atom, 'saveSync')
atom.syntax.clearGrammarOverrides()
atom.grammars.clearGrammarOverrides()
spy = spyOn(atom.packages, 'resolvePackagePath').andCallFake (packageName) ->
if specPackageName and packageName is specPackageName
@@ -111,8 +118,7 @@ beforeEach ->
config.save.reset()
# make editor display updates synchronous
spyOn(TextEditorView.prototype, 'requestDisplayUpdate').andCallFake -> @updateDisplay()
TextEditorComponent.performSyncUpdates = true
TextEditorElement::setUpdatedSynchronously(true)
spyOn(atom, "setRepresentedFilename")
spyOn(window, "setTimeout").andCallFake window.fakeSetTimeout
@@ -135,8 +141,9 @@ afterEach ->
atom.menu.template = []
atom.contextMenu.clear()
atom.workspaceView?.remove?()
atom.workspaceView = null
atom.workspace?.destroy()
atom.workspace = null
atom.__workspaceView = null
delete atom.state.workspace
atom.project?.destroy()
@@ -150,7 +157,7 @@ afterEach ->
jasmine.unspy(atom, 'saveSync')
ensureNoPathSubscriptions()
atom.syntax.clearObservers()
atom.grammars.clearObservers()
waits(0) # yield to ui thread to make screen update more frequently
ensureNoPathSubscriptions = ->
@@ -191,6 +198,17 @@ jasmine.unspy = (object, methodName) ->
throw new Error("Not a spy") unless object[methodName].hasOwnProperty('originalValue')
object[methodName] = object[methodName].originalValue
jasmine.attachToDOM = (element) ->
jasmineContent = document.querySelector('#jasmine-content')
jasmineContent.appendChild(element) unless jasmineContent.contains(element)
deprecationsSnapshot = null
jasmine.snapshotDeprecations = ->
deprecationsSnapshot = Grim.getDeprecations() # suppress deprecations!!
jasmine.restoreDeprecationsSnapshot = ->
Grim.grimDeprecations = deprecationsSnapshot
addCustomMatchers = (spec) ->
spec.addMatchers
toBeInstanceOf: (expected) ->
+94
Ver Arquivo
@@ -0,0 +1,94 @@
ChildProcess = require 'child_process'
{EventEmitter} = require 'events'
fs = require 'fs-plus'
path = require 'path'
temp = require 'temp'
SquirrelUpdate = require '../src/browser/squirrel-update'
describe "Windows squirrel updates", ->
tempHomeDirectory = null
beforeEach ->
# Prevent the actually home directory from being manipulated
tempHomeDirectory = temp.mkdirSync('atom-temp-home-')
spyOn(fs, 'getHomeDirectory').andReturn(tempHomeDirectory)
# Prevent any commands from actually running and affecting the host
originalSpawn = ChildProcess.spawn
spyOn(ChildProcess, 'spawn').andCallFake (command, args) ->
if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut'
fs.writeFileSync(path.join(tempHomeDirectory, 'Desktop', 'Atom.lnk'), '')
# Just spawn something that won't actually modify the host
if process.platform is 'win32'
originalSpawn('dir')
else
originalSpawn('ls')
it "quits the app on all squirrel events", ->
app = quit: jasmine.createSpy('quit')
expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-install')).toBe true
waitsFor ->
app.quit.callCount is 1
runs ->
app.quit.reset()
expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-updated')).toBe true
waitsFor ->
app.quit.callCount is 1
runs ->
app.quit.reset()
expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-uninstall')).toBe true
waitsFor ->
app.quit.callCount is 1
runs ->
app.quit.reset()
expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-obsolete')).toBe true
waitsFor ->
app.quit.callCount is 1
runs ->
expect(SquirrelUpdate.handleStartupEvent(app, '--not-squirrel')).toBe false
it "keeps the desktop shortcut deleted on updates if it was previously deleted after install", ->
desktopShortcutPath = path.join(tempHomeDirectory, 'Desktop', 'Atom.lnk')
expect(fs.existsSync(desktopShortcutPath)).toBe false
app = quit: jasmine.createSpy('quit')
expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-install')).toBe true
waitsFor ->
app.quit.callCount is 1
runs ->
app.quit.reset()
expect(fs.existsSync(desktopShortcutPath)).toBe true
fs.removeSync(desktopShortcutPath)
expect(fs.existsSync(desktopShortcutPath)).toBe false
expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-updated')).toBe true
waitsFor ->
app.quit.callCount is 1
runs ->
expect(fs.existsSync(desktopShortcutPath)).toBe false
describe ".restartAtom", ->
it "quits the app and spawns a new one", ->
app = new EventEmitter()
app.quit = jasmine.createSpy('quit')
SquirrelUpdate.restartAtom(app)
expect(app.quit.callCount).toBe 1
expect(ChildProcess.spawn.callCount).toBe 0
app.emit('will-quit')
expect(ChildProcess.spawn.callCount).toBe 1
expect(path.basename(ChildProcess.spawn.argsForCall[0][0])).toBe 'atom.cmd'
+5
Ver Arquivo
@@ -105,3 +105,8 @@ describe "StylesElement", ->
document.querySelector('#jasmine-content').appendChild(element)
expect(element.firstChild.sheet.cssRules[0].selectorText).toBe ':host'
it "does not throw exceptions on rules with no selectors", ->
atom.styles.addStyleSheet """
@media screen {font-size: 10px;}
""", context: 'atom-text-editor'
+29 -56
Ver Arquivo
@@ -23,10 +23,10 @@ describe "the `syntax` global", ->
describe "serialization", ->
it "remembers grammar overrides by path", ->
filePath = '/foo/bar/file.js'
expect(atom.syntax.selectGrammar(filePath).name).not.toBe 'Ruby'
atom.syntax.setGrammarOverrideForPath(filePath, 'source.ruby')
syntax2 = atom.deserializers.deserialize(atom.syntax.serialize())
syntax2.addGrammar(grammar) for grammar in atom.syntax.grammars when grammar isnt atom.syntax.nullGrammar
expect(atom.grammars.selectGrammar(filePath).name).not.toBe 'Ruby'
atom.grammars.setGrammarOverrideForPath(filePath, 'source.ruby')
syntax2 = atom.deserializers.deserialize(atom.grammars.serialize())
syntax2.addGrammar(grammar) for grammar in atom.grammars.grammars when grammar isnt atom.grammars.nullGrammar
expect(syntax2.selectGrammar(filePath).name).toBe 'Ruby'
describe ".selectGrammar(filePath)", ->
@@ -35,15 +35,15 @@ describe "the `syntax` global", ->
atom.packages.activatePackage('language-git')
runs ->
expect(atom.syntax.selectGrammar("file.js").name).toBe "JavaScript" # based on extension (.js)
expect(atom.syntax.selectGrammar(path.join(temp.dir, '.git', 'config')).name).toBe "Git Config" # based on end of the path (.git/config)
expect(atom.syntax.selectGrammar("Rakefile").name).toBe "Ruby" # based on the file's basename (Rakefile)
expect(atom.syntax.selectGrammar("curb").name).toBe "Null Grammar"
expect(atom.syntax.selectGrammar("/hu.git/config").name).toBe "Null Grammar"
expect(atom.grammars.selectGrammar("file.js").name).toBe "JavaScript" # based on extension (.js)
expect(atom.grammars.selectGrammar(path.join(temp.dir, '.git', 'config')).name).toBe "Git Config" # based on end of the path (.git/config)
expect(atom.grammars.selectGrammar("Rakefile").name).toBe "Ruby" # based on the file's basename (Rakefile)
expect(atom.grammars.selectGrammar("curb").name).toBe "Null Grammar"
expect(atom.grammars.selectGrammar("/hu.git/config").name).toBe "Null Grammar"
it "uses the filePath's shebang line if the grammar cannot be determined by the extension or basename", ->
filePath = require.resolve("./fixtures/shebang")
expect(atom.syntax.selectGrammar(filePath).name).toBe "Ruby"
expect(atom.grammars.selectGrammar(filePath).name).toBe "Ruby"
it "uses the number of newlines in the first line regex to determine the number of lines to test against", ->
waitsForPromise ->
@@ -51,28 +51,28 @@ describe "the `syntax` global", ->
runs ->
fileContent = "first-line\n<html>"
expect(atom.syntax.selectGrammar("dummy.coffee", fileContent).name).toBe "CoffeeScript"
expect(atom.grammars.selectGrammar("dummy.coffee", fileContent).name).toBe "CoffeeScript"
fileContent = '<?xml version="1.0" encoding="UTF-8"?>'
expect(atom.syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Null Grammar"
expect(atom.grammars.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Null Grammar"
fileContent += '\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'
expect(atom.syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)"
expect(atom.grammars.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)"
it "doesn't read the file when the file contents are specified", ->
filePath = require.resolve("./fixtures/shebang")
filePathContents = fs.readFileSync(filePath, 'utf8')
spyOn(fs, 'read').andCallThrough()
expect(atom.syntax.selectGrammar(filePath, filePathContents).name).toBe "Ruby"
expect(atom.grammars.selectGrammar(filePath, filePathContents).name).toBe "Ruby"
expect(fs.read).not.toHaveBeenCalled()
it "allows the default grammar to be overridden for a path", ->
filePath = '/foo/bar/file.js'
expect(atom.syntax.selectGrammar(filePath).name).not.toBe 'Ruby'
atom.syntax.setGrammarOverrideForPath(filePath, 'source.ruby')
expect(atom.syntax.selectGrammar(filePath).name).toBe 'Ruby'
atom.syntax.clearGrammarOverrideForPath(filePath)
expect(atom.syntax.selectGrammar(filePath).name).not.toBe 'Ruby'
expect(atom.grammars.selectGrammar(filePath).name).not.toBe 'Ruby'
atom.grammars.setGrammarOverrideForPath(filePath, 'source.ruby')
expect(atom.grammars.selectGrammar(filePath).name).toBe 'Ruby'
atom.grammars.clearGrammarOverrideForPath(filePath)
expect(atom.grammars.selectGrammar(filePath).name).not.toBe 'Ruby'
describe "when multiple grammars have matching fileTypes", ->
it "selects the grammar with the longest fileType match", ->
@@ -82,8 +82,8 @@ describe "the `syntax` global", ->
scopeName: 'source1'
fileTypes: ['test']
)
grammar1 = atom.syntax.loadGrammarSync(grammarPath1)
expect(atom.syntax.selectGrammar('more.test', '')).toBe grammar1
grammar1 = atom.grammars.loadGrammarSync(grammarPath1)
expect(atom.grammars.selectGrammar('more.test', '')).toBe grammar1
grammarPath2 = temp.path(suffix: '.json')
fs.writeFileSync grammarPath2, JSON.stringify(
@@ -91,44 +91,17 @@ describe "the `syntax` global", ->
scopeName: 'source2'
fileTypes: ['test', 'more.test']
)
grammar2 = atom.syntax.loadGrammarSync(grammarPath2)
expect(atom.syntax.selectGrammar('more.test', '')).toBe grammar2
grammar2 = atom.grammars.loadGrammarSync(grammarPath2)
expect(atom.grammars.selectGrammar('more.test', '')).toBe grammar2
describe "when there is no file path", ->
it "does not throw an exception (regression)", ->
expect(-> atom.syntax.selectGrammar(null, '#!/usr/bin/ruby')).not.toThrow()
expect(-> atom.syntax.selectGrammar(null, '')).not.toThrow()
expect(-> atom.syntax.selectGrammar(null, null)).not.toThrow()
expect(-> atom.grammars.selectGrammar(null, '#!/usr/bin/ruby')).not.toThrow()
expect(-> atom.grammars.selectGrammar(null, '')).not.toThrow()
expect(-> atom.grammars.selectGrammar(null, null)).not.toThrow()
describe ".removeGrammar(grammar)", ->
it "removes the grammar, so it won't be returned by selectGrammar", ->
grammar = atom.syntax.selectGrammar('foo.js')
atom.syntax.removeGrammar(grammar)
expect(atom.syntax.selectGrammar('foo.js').name).not.toBe grammar.name
describe ".getProperty(scopeDescriptor)", ->
it "returns the property with the most specific scope selector", ->
atom.syntax.addProperties(".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
atom.syntax.addProperties(".source .string.quoted.double", foo: bar: baz: 22)
atom.syntax.addProperties(".source", foo: bar: baz: 11)
expect(atom.syntax.getProperty([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
expect(atom.syntax.getProperty([".source.js", ".string.quoted.double.js"], "foo.bar.baz")).toBe 22
expect(atom.syntax.getProperty([".source.js", ".variable.assignment.js"], "foo.bar.baz")).toBe 11
expect(atom.syntax.getProperty([".text"], "foo.bar.baz")).toBeUndefined()
it "favors the most recently added properties in the event of a specificity tie", ->
atom.syntax.addProperties(".source.coffee .string.quoted.single", foo: bar: baz: 42)
atom.syntax.addProperties(".source.coffee .string.quoted.double", foo: bar: baz: 22)
expect(atom.syntax.getProperty([".source.coffee", ".string.quoted.single"], "foo.bar.baz")).toBe 42
expect(atom.syntax.getProperty([".source.coffee", ".string.quoted.single.double"], "foo.bar.baz")).toBe 22
describe ".removeProperties(name)", ->
it "allows properties to be removed by name", ->
atom.syntax.addProperties("a", ".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
atom.syntax.addProperties("b", ".source .string.quoted.double", foo: bar: baz: 22)
atom.syntax.removeProperties("b")
expect(atom.syntax.getProperty([".source.js", ".string.quoted.double.js"], "foo.bar.baz")).toBeUndefined()
expect(atom.syntax.getProperty([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
grammar = atom.grammars.selectGrammar('foo.js')
atom.grammars.removeGrammar(grammar)
expect(atom.grammars.selectGrammar('foo.js').name).not.toBe grammar.name
+71 -34
Ver Arquivo
@@ -37,9 +37,9 @@ describe "TextEditorComponent", ->
wrapperView = new TextEditorView(editor, {lineOverdrawMargin})
wrapperView.attachToDom()
wrapperNode = wrapperView.element
wrapperNode.setUpdatedSynchronously(false)
{component} = wrapperView
component.performSyncUpdates = false
component.setFontFamily('monospace')
component.setLineHeight(1.3)
component.setFontSize(20)
@@ -302,7 +302,7 @@ describe "TextEditorComponent", ->
it "interleaves invisible line-ending characters with indent guides on empty lines", ->
component.setShowIndentGuide(true)
editor.setTextInBufferRange([[10, 0], [11, 0]], "\r\n", false)
editor.setTextInBufferRange([[10, 0], [11, 0]], "\r\n", normalizeLineEndings: false)
nextAnimationFrame()
expect(component.lineNodeForScreenRow(10).innerHTML).toBe '<span class="indent-guide"><span class="invisible-character">C</span><span class="invisible-character">E</span></span>'
@@ -1247,7 +1247,7 @@ describe "TextEditorComponent", ->
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
describe "when the marker is not empty", ->
it "renders at the head of the marker", ->
it "renders at the head of the marker by default", ->
marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
@@ -1269,6 +1269,17 @@ describe "TextEditorComponent", ->
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
it "renders at the tail of the marker when the 'position' option is 'tail'", ->
marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([2, 5])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
describe "positioning the overlay when near the edge of the editor", ->
[itemWidth, itemHeight] = []
beforeEach ->
@@ -1601,6 +1612,22 @@ describe "TextEditorComponent", ->
expect(nextAnimationFrame).toBe noAnimationFrame
expect(editor.getSelectedScreenRange()).toEqual [[2, 4], [6, 8]]
describe "when the editor is destroyed while dragging", ->
it "cleans up the handlers for window.mouseup and window.mousemove", ->
linesNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([2, 4]), which: 1))
linesNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenPosition([6, 8]), which: 1))
nextAnimationFrame()
spyOn(window, 'removeEventListener').andCallThrough()
linesNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenPosition([6, 10]), which: 1))
editor.destroy()
nextAnimationFrame()
call.args.pop() for call in window.removeEventListener.calls
expect(window.removeEventListener).toHaveBeenCalledWith('mouseup')
expect(window.removeEventListener).toHaveBeenCalledWith('mousemove')
describe "when a line is folded", ->
beforeEach ->
editor.foldBufferRow 4
@@ -1897,7 +1924,8 @@ describe "TextEditorComponent", ->
}
""", context: 'atom-text-editor'
nextAnimationFrame()
nextAnimationFrame() # handle stylesheet change event
nextAnimationFrame() # perform requested update
scrollbarCornerNode = componentNode.querySelector('.scrollbar-corner')
expect(verticalScrollbarNode.offsetWidth).toBe 8
@@ -2532,7 +2560,7 @@ describe "TextEditorComponent", ->
describe "grammar data attributes", ->
it "adds and updates the grammar data attribute based on the current grammar", ->
expect(wrapperNode.dataset.grammar).toBe 'source js'
editor.setGrammar(atom.syntax.nullGrammar)
editor.setGrammar(atom.grammars.nullGrammar)
expect(wrapperNode.dataset.grammar).toBe 'text plain null-grammar'
describe "encoding data attributes", ->
@@ -2565,9 +2593,9 @@ describe "TextEditorComponent", ->
describe 'soft wrap settings', ->
beforeEach ->
atom.config.set '.source.coffee', 'editor.softWrap', true
atom.config.set '.source.coffee', 'editor.preferredLineLength', 17
atom.config.set '.source.coffee', 'editor.softWrapAtPreferredLineLength', true
atom.config.set 'editor.softWrap', true, scopeSelector: '.source.coffee'
atom.config.set 'editor.preferredLineLength', 17, scopeSelector: '.source.coffee'
atom.config.set 'editor.softWrapAtPreferredLineLength', true, scopeSelector: '.source.coffee'
editor.setEditorWidthInChars(20)
coffeeEditor.setEditorWidthInChars(20)
@@ -2577,18 +2605,18 @@ describe "TextEditorComponent", ->
expect(coffeeEditor.lineTextForScreenRow(3)).toEqual ' return items '
it 'updates the wrapped lines when editor.preferredLineLength changes', ->
atom.config.set '.source.coffee', 'editor.preferredLineLength', 20
atom.config.set 'editor.preferredLineLength', 20, scopeSelector: '.source.coffee'
expect(coffeeEditor.lineTextForScreenRow(2)).toEqual ' return items if '
it 'updates the wrapped lines when editor.softWrapAtPreferredLineLength changes', ->
atom.config.set '.source.coffee', 'editor.softWrapAtPreferredLineLength', false
atom.config.set 'editor.softWrapAtPreferredLineLength', false, scopeSelector: '.source.coffee'
expect(coffeeEditor.lineTextForScreenRow(2)).toEqual ' return items if '
it 'updates the wrapped lines when editor.softWrap changes', ->
atom.config.set '.source.coffee', 'editor.softWrap', false
atom.config.set 'editor.softWrap', false, scopeSelector: '.source.coffee'
expect(coffeeEditor.lineTextForScreenRow(2)).toEqual ' return items if items.length <= 1'
atom.config.set '.source.coffee', 'editor.softWrap', true
atom.config.set 'editor.softWrap', true, scopeSelector: '.source.coffee'
expect(coffeeEditor.lineTextForScreenRow(3)).toEqual ' return items '
it 'updates the wrapped lines when the grammar changes', ->
@@ -2616,11 +2644,11 @@ describe "TextEditorComponent", ->
tab: 'F'
cr: 'E'
atom.config.set '.source.js', 'editor.showInvisibles', true
atom.config.set '.source.js', 'editor.invisibles', jsInvisibles
atom.config.set 'editor.showInvisibles', true, scopeSelector: '.source.js'
atom.config.set 'editor.invisibles', jsInvisibles, scopeSelector: '.source.js'
atom.config.set '.source.coffee', 'editor.showInvisibles', false
atom.config.set '.source.coffee', 'editor.invisibles', coffeeInvisibles
atom.config.set 'editor.showInvisibles', false, scopeSelector: '.source.coffee'
atom.config.set 'editor.invisibles', coffeeInvisibles, scopeSelector: '.source.coffee'
editor.setText " a line with tabs\tand spaces \n"
nextAnimationFrame()
@@ -2636,7 +2664,7 @@ describe "TextEditorComponent", ->
it "re-renders the invisibles when the invisible settings change", ->
jsGrammar = editor.getGrammar()
editor.setGrammar(coffeeEditor.getGrammar())
atom.config.set '.source.coffee', 'editor.showInvisibles', true
atom.config.set 'editor.showInvisibles', true, scopeSelector: '.source.coffee'
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe "#{coffeeInvisibles.space}a line with tabs#{coffeeInvisibles.tab}and spaces#{coffeeInvisibles.space}#{coffeeInvisibles.eol}"
@@ -2645,7 +2673,7 @@ describe "TextEditorComponent", ->
space: 'E'
tab: 'W'
cr: 'I'
atom.config.set '.source.coffee', 'editor.invisibles', newInvisibles
atom.config.set 'editor.invisibles', newInvisibles, scopeSelector: '.source.coffee'
nextAnimationFrame()
expect(component.lineNodeForScreenRow(0).textContent).toBe "#{newInvisibles.space}a line with tabs#{newInvisibles.tab}and spaces#{newInvisibles.space}#{newInvisibles.eol}"
@@ -2655,8 +2683,8 @@ describe "TextEditorComponent", ->
describe 'editor.showIndentGuide', ->
beforeEach ->
atom.config.set '.source.js', 'editor.showIndentGuide', true
atom.config.set '.source.coffee', 'editor.showIndentGuide', false
atom.config.set 'editor.showIndentGuide', true, scopeSelector: '.source.js'
atom.config.set 'editor.showIndentGuide', false, scopeSelector: '.source.coffee'
it "has an 'indent-guide' class when scoped editor.showIndentGuide is true, but not when scoped editor.showIndentGuide is false", ->
line1LeafNodes = getLeafNodes(component.lineNodeForScreenRow(1))
@@ -2677,7 +2705,7 @@ describe "TextEditorComponent", ->
expect(line1LeafNodes[0].classList.contains('indent-guide')).toBe true
expect(line1LeafNodes[1].classList.contains('indent-guide')).toBe false
atom.config.set '.source.js', 'editor.showIndentGuide', false
atom.config.set 'editor.showIndentGuide', false, scopeSelector: '.source.js'
line1LeafNodes = getLeafNodes(component.lineNodeForScreenRow(1))
expect(line1LeafNodes[0].textContent).toBe ' '
@@ -2685,26 +2713,35 @@ describe "TextEditorComponent", ->
expect(line1LeafNodes[1].classList.contains('indent-guide')).toBe false
describe "middle mouse paste on Linux", ->
it "pastes the previously selected text", ->
originalPlatform = null
beforeEach ->
originalPlatform = process.platform
Object.defineProperty process, 'platform', value: 'linux'
afterEach ->
Object.defineProperty process, 'platform', value: originalPlatform
it "pastes the previously selected text at the clicked location", ->
jasmine.unspy(window, 'setTimeout')
clipboardWrittenTo = false
spyOn(require('ipc'), 'send').andCallFake (eventName, selectedText) ->
if eventName is 'write-text-to-selection-clipboard'
require('clipboard').writeText(selectedText, 'selection')
clipboardWrittenTo = true
atom.clipboard.write('')
component.listenForMiddleMousePaste()
editor.setCursorBufferPosition([10, 0])
componentNode.querySelector('.scroll-view').dispatchEvent(buildMouseEvent('mouseup', which: 2))
expect(atom.clipboard.read()).toBe ''
expect(editor.lineTextForBufferRow(10)).toBe ''
component.trackSelectionClipboard()
editor.setSelectedBufferRange([[1, 6], [1, 10]])
editor.setCursorBufferPosition([10, 0])
componentNode.querySelector('.scroll-view').dispatchEvent(buildMouseEvent('mouseup', which: 2))
expect(atom.clipboard.read()).toBe 'sort'
expect(editor.lineTextForBufferRow(10)).toBe 'sort'
waitsFor ->
clipboardWrittenTo
runs ->
componentNode.querySelector('.scroll-view').dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([10, 0]), button: 1))
componentNode.querySelector('.scroll-view').dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenPosition([10, 0]), which: 2))
expect(atom.clipboard.read()).toBe 'sort'
expect(editor.lineTextForBufferRow(10)).toBe 'sort'
buildMouseEvent = (type, properties...) ->
properties = extend({bubbles: true, cancelable: true}, properties...)
+82
Ver Arquivo
@@ -20,6 +20,11 @@ describe "TextEditorElement", ->
element = jasmineContent.firstChild
expect(element.getModel().getPlaceholderText()).toBe 'testing'
it "honors the text content", ->
jasmineContent.innerHTML = "<atom-text-editor>testing</atom-text-editor>"
element = jasmineContent.firstChild
expect(element.getModel().getText()).toBe 'testing'
describe "when the model is assigned", ->
it "adds the 'mini' attribute if .isMini() returns true on the model", ->
element = new TextEditorElement
@@ -27,6 +32,31 @@ describe "TextEditorElement", ->
element.setModel(model)
expect(element.hasAttribute('mini')).toBe true
describe "when the editor is attached to the DOM", ->
describe "when the editor.useShadowDOM config option is true", ->
it "mounts the react component and unmounts when removed from the dom", ->
atom.config.set('editor.useShadowDOM', true)
element = new TextEditorElement
jasmine.attachToDOM(element)
component = element.component
expect(component.isMounted()).toBe true
element.getModel().destroy()
expect(component.isMounted()).toBe false
describe "when the editor.useShadowDOM config option is false", ->
it "mounts the react component and unmounts when removed from the dom", ->
atom.config.set('editor.useShadowDOM', false)
element = new TextEditorElement
jasmine.attachToDOM(element)
component = element.component
expect(component.isMounted()).toBe true
element.getModel().destroy()
expect(component.isMounted()).toBe false
describe "focus and blur handling", ->
describe "when the editor.useShadowDOM config option is true", ->
it "proxies focus/blur events to/from the hidden input inside the shadow root", ->
@@ -98,3 +128,55 @@ describe "TextEditorElement", ->
verticalScrollbarNode = element.querySelector(".vertical-scrollbar")
scrollbarWidth = verticalScrollbarNode.offsetWidth - verticalScrollbarNode.clientWidth
expect(scrollbarWidth).toEqual(8)
describe "::onDidAttach and ::onDidDetach", ->
it "invokes callbacks when the element is attached and detached", ->
element = new TextEditorElement
attachedCallback = jasmine.createSpy("attachedCallback")
detachedCallback = jasmine.createSpy("detachedCallback")
element.onDidAttach(attachedCallback)
element.onDidDetach(detachedCallback)
jasmine.attachToDOM(element)
expect(attachedCallback).toHaveBeenCalled()
expect(detachedCallback).not.toHaveBeenCalled()
attachedCallback.reset()
element.remove()
expect(attachedCallback).not.toHaveBeenCalled()
expect(detachedCallback).toHaveBeenCalled()
describe "::setUpdatedSynchronously", ->
it "controls whether the text editor is updated synchronously", ->
spyOn(window, 'requestAnimationFrame').andCallFake (fn) -> fn()
element = new TextEditorElement
jasmine.attachToDOM(element)
element.setUpdatedSynchronously(false)
expect(element.isUpdatedSynchronously()).toBe false
element.getModel().setText("hello")
expect(window.requestAnimationFrame).toHaveBeenCalled()
expect(element.shadowRoot.textContent).toContain "hello"
window.requestAnimationFrame.reset()
element.setUpdatedSynchronously(true)
element.getModel().setText("goodbye")
expect(window.requestAnimationFrame).not.toHaveBeenCalled()
expect(element.shadowRoot.textContent).toContain "goodbye"
describe "::getDefaultCharacterWidth", ->
it "returns null before the element is attached", ->
element = new TextEditorElement
expect(element.getDefaultCharacterWidth()).toBeNull()
it "returns the width of a character in the root scope", ->
element = new TextEditorElement
jasmine.attachToDOM(element)
expect(element.getDefaultCharacterWidth()).toBeGreaterThan(0)
+54 -76
Ver Arquivo
@@ -192,12 +192,18 @@ describe "TextEditor", ->
expect(editor.getCursorBufferPosition()).toEqual [1, 1]
it "emits an event with the old position, new position, and the cursor that moved", ->
editor.onDidChangeCursorPosition positionChangedHandler = jasmine.createSpy()
cursorCallback = jasmine.createSpy('cursor-changed-position')
editorCallback = jasmine.createSpy('editor-changed-cursor-position')
editor.getLastCursor().onDidChangePosition(cursorCallback)
editor.onDidChangeCursorPosition(editorCallback)
editor.setCursorBufferPosition([2, 4])
expect(positionChangedHandler).toHaveBeenCalled()
eventObject = positionChangedHandler.mostRecentCall.args[0]
expect(editorCallback).toHaveBeenCalled()
expect(cursorCallback).toHaveBeenCalled()
eventObject = editorCallback.mostRecentCall.args[0]
expect(cursorCallback.mostRecentCall.args[0]).toEqual(eventObject)
expect(eventObject.oldBufferPosition).toEqual [0, 0]
expect(eventObject.oldScreenPosition).toEqual [0, 0]
@@ -616,7 +622,7 @@ describe "TextEditor", ->
describe "when invisible characters are enabled with hard tabs", ->
it "moves to the first character of the current line without being confused by the invisible characters", ->
atom.config.set('editor.showInvisibles', true)
buffer.setTextInRange([[1, 0], [1, Infinity]], '\t\t\ta', false)
buffer.setTextInRange([[1, 0], [1, Infinity]], '\t\t\ta', normalizeLineEndings: false)
editor.setCursorScreenPosition [1,7]
editor.moveToFirstCharacterOfLine()
@@ -1321,7 +1327,7 @@ describe "TextEditor", ->
coffeeEditor.selectWordsContainingCursors()
expect(coffeeEditor.getSelectedBufferRange()).toEqual [[0, 6], [0, 15]]
atom.config.set '.source.coffee', 'editor.nonWordCharacters', 'qusort'
atom.config.set 'editor.nonWordCharacters', 'qusort', scopeSelector: '.source.coffee'
coffeeEditor.setCursorBufferPosition [0, 9]
coffeeEditor.selectWordsContainingCursors()
@@ -2607,69 +2613,44 @@ describe "TextEditor", ->
atom.clipboard.write(" z();")
editor.setCursorBufferPosition([1, Infinity])
editor.pasteText()
console.log JSON.stringify(editor.lineTextForBufferRow(1))
expect(editor.lineTextForBufferRow(1)).toBe(" y(); z();")
describe "when `autoIndentOnPaste` is false", ->
beforeEach ->
atom.config.set('editor.autoIndentOnPaste', false)
describe "when the inserted text contains no newlines", ->
it "does not adjust the indentation level of the text", ->
editor.setCursorBufferPosition([5, 2])
editor.insertText("foo", indentBasis: 5)
expect(editor.lineTextForBufferRow(5)).toBe " foo current = items.shift();"
describe "when the cursor is indented further than the original copied text", ->
it "increases the indentation of the copied lines to match", ->
editor.setSelectedBufferRange([[1, 2], [3, 0]])
editor.copySelectedText()
it "does not adjust the whitespace if there are preceding characters", ->
copyText(" foo")
editor.setCursorBufferPosition([5, 30])
editor.setCursorBufferPosition([5, 6])
editor.pasteText()
expect(editor.lineTextForBufferRow(5)).toBe " current = items.shift(); foo"
expect(editor.lineTextForBufferRow(5)).toBe " var sort = function(items) {"
expect(editor.lineTextForBufferRow(6)).toBe " if (items.length <= 1) return items;"
describe "when the inserted text contains newlines", ->
describe "when the cursor is preceded only by whitespace characters", ->
it "normalizes indented lines to each cursor's current indentation level", ->
editor.setSelectedBufferRanges([
[[1,2], [3,0]],
[[4,4], [6,0]]
])
editor.copySelectedText()
expect(atom.clipboard.read()).toEqual """
var sort = function(items) {
if (items.length <= 1) return items;
describe "when the cursor is indented less far than the original copied text", ->
it "decreases the indentation of the copied lines to match", ->
editor.setSelectedBufferRange([[6, 6], [8, 0]])
editor.copySelectedText()
while(items.length > 0) {
current = items.shift();
editor.setCursorBufferPosition([1, 2])
editor.pasteText()
"""
expect(editor.lineTextForBufferRow(1)).toBe " current < pivot ? left.push(current) : right.push(current);"
expect(editor.lineTextForBufferRow(2)).toBe "}"
editor.setCursorBufferPosition([0,0])
editor.insertNewlineAbove()
editor.setSelectedBufferRanges([
[[0,0], [0,0]],
[[1,0], [1,0]]
])
editor.pasteText()
describe "when the first copied line has leading whitespace", ->
it "preserves the line's leading whitespace", ->
editor.setSelectedBufferRange([[4, 0], [6, 0]])
editor.copySelectedText()
expect(editor.lineTextForBufferRow(0)).toBe "var sort = function(items) {"
console.log JSON.stringify(editor.lineTextForBufferRow(1))
expect(editor.lineTextForBufferRow(1)).toBe " if (items.length <= 1) return items;"
expect(editor.lineTextForBufferRow(2)).toBe ""
expect(editor.lineTextForBufferRow(3)).toBe "while(items.length > 0) {"
expect(editor.lineTextForBufferRow(4)).toBe " current = items.shift();"
editor.setCursorBufferPosition([0, 0])
editor.pasteText()
describe "when the cursor is preceded by non-whitespace characters", ->
it "normalizes the indentation level of all lines based on the level of the existing first line", ->
copyText(" while (true) {\n foo();\n }\n", {startColumn: 0})
editor.setCursorBufferPosition([1, Infinity])
editor.pasteText()
expect(editor.lineTextForBufferRow(1)).toBe " var sort = function(items) {while (true) {"
expect(editor.lineTextForBufferRow(2)).toBe " foo();"
expect(editor.lineTextForBufferRow(3)).toBe " }"
expect(editor.lineTextForBufferRow(4)).toBe ""
expect(editor.lineTextForBufferRow(0)).toBe " while(items.length > 0) {"
expect(editor.lineTextForBufferRow(1)).toBe " current = items.shift();"
describe 'when the clipboard has many selections', ->
beforeEach ->
@@ -3039,18 +3020,16 @@ describe "TextEditor", ->
expect(editor.isFoldedAtBufferRow(1)).toBeFalsy()
expect(editor.isFoldedAtBufferRow(2)).toBeTruthy()
describe "begin/commitTransaction()", ->
describe "::transact", ->
it "restores the selection when the transaction is undone/redone", ->
buffer.setText('1234')
editor.setSelectedBufferRange([[0, 1], [0, 3]])
editor.beginTransaction()
editor.delete()
editor.moveToEndOfLine()
editor.insertText('5')
expect(buffer.getText()).toBe '145'
editor.commitTransaction()
editor.transact ->
editor.delete()
editor.moveToEndOfLine()
editor.insertText('5')
expect(buffer.getText()).toBe '145'
editor.undo()
expect(buffer.getText()).toBe '1234'
@@ -3297,7 +3276,7 @@ describe "TextEditor", ->
atom.packages.unloadPackages()
it 'returns correct values based on the scope of the set grammars', ->
atom.config.set '.source.coffee', 'editor.tabLength', 6
atom.config.set 'editor.tabLength', 6, scopeSelector: '.source.coffee'
expect(editor.getTabLength()).toBe 2
expect(coffeeEditor.getTabLength()).toBe 6
@@ -3319,12 +3298,12 @@ describe "TextEditor", ->
expect(editor.getTabLength()).toBe 2
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2
atom.config.set '.source.js', 'editor.tabLength', 6
atom.config.set 'editor.tabLength', 6, scopeSelector: '.source.js'
expect(editor.getTabLength()).toBe 6
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 6
it 'updates the tab length when the grammar changes', ->
atom.config.set '.source.coffee', 'editor.tabLength', 6
atom.config.set 'editor.tabLength', 6, scopeSelector: '.source.coffee'
expect(editor.getTabLength()).toBe 2
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2
@@ -3357,17 +3336,17 @@ describe "TextEditor", ->
it "switches to the better-matched grammar and re-tokenizes the buffer", ->
editor.destroy()
jsGrammar = atom.syntax.selectGrammar('a.js')
atom.syntax.removeGrammar(jsGrammar)
jsGrammar = atom.grammars.selectGrammar('a.js')
atom.grammars.removeGrammar(jsGrammar)
waitsForPromise ->
atom.workspace.open('sample.js', autoIndent: false).then (o) -> editor = o
runs ->
expect(editor.getGrammar()).toBe atom.syntax.nullGrammar
expect(editor.getGrammar()).toBe atom.grammars.nullGrammar
expect(editor.tokenizedLineForScreenRow(0).tokens.length).toBe 1
atom.syntax.addGrammar(jsGrammar)
atom.grammars.addGrammar(jsGrammar)
expect(editor.getGrammar()).toBe jsGrammar
expect(editor.tokenizedLineForScreenRow(0).tokens.length).toBeGreaterThan 1
@@ -3425,7 +3404,6 @@ describe "TextEditor", ->
expect(editor.getCursorBufferPosition()).toEqual([7, 2])
editor.insertNewline()
editor.logScreenLines()
expect(editor.lineTextForBufferRow(8)).toBe(" ")
it "does not indent the line preceding the newline", ->
@@ -3442,11 +3420,11 @@ describe "TextEditor", ->
describe "when the cursor is before whitespace", ->
it "retains the whitespace following the cursor on the new line", ->
editor.setText(" var sort = function() {}")
editor.setCursorScreenPosition([0, 23])
editor.setCursorScreenPosition([0, 12])
editor.insertNewline()
expect(buffer.lineForRow(0)).toBe ' var sort = function()'
expect(buffer.lineForRow(1)).toBe ' {}'
expect(buffer.lineForRow(0)).toBe ' var sort ='
expect(buffer.lineForRow(1)).toBe ' function() {}'
expect(editor.getCursorScreenPosition()).toEqual [1, 2]
describe "when inserted text matches a decrease indent pattern", ->
@@ -3495,8 +3473,8 @@ describe "TextEditor", ->
atom.project.open('coffee.coffee', autoIndent: false).then (o) -> coffeeEditor = o
runs ->
atom.config.set('.source.js', 'editor.autoIndent', true)
atom.config.set('.source.coffee', 'editor.autoIndent', false)
atom.config.set('editor.autoIndent', true, scopeSelector: '.source.js')
atom.config.set('editor.autoIndent', false, scopeSelector: '.source.coffee')
afterEach: ->
atom.packages.deactivatePackages()
@@ -3787,7 +3765,7 @@ describe "TextEditor", ->
it "updates the grammar based on grammar overrides", ->
expect(editor.getGrammar().name).toBe 'JavaScript'
atom.syntax.setGrammarOverrideForPath(editor.getPath(), 'source.coffee')
atom.grammars.setGrammarOverrideForPath(editor.getPath(), 'source.coffee')
editor.reloadGrammar()
expect(editor.getGrammar().name).toBe 'CoffeeScript'
@@ -3805,7 +3783,7 @@ describe "TextEditor", ->
atom.packages.activatePackage('language-hyperlink')
runs ->
grammar = atom.syntax.selectGrammar("text.js")
grammar = atom.grammars.selectGrammar("text.js")
{tokens} = grammar.tokenizeLine("var i; // http://github.com")
expect(tokens[0].value).toBe "var"
+51 -11
Ver Arquivo
@@ -1,6 +1,6 @@
path = require 'path'
{$, $$, WorkspaceView} = require 'atom'
{$, $$} = require '../src/space-pen-extensions'
fs = require 'fs-plus'
temp = require 'temp'
@@ -20,8 +20,12 @@ describe "ThemeManager", ->
describe "theme getters and setters", ->
beforeEach ->
jasmine.snapshotDeprecations()
atom.packages.loadPackages()
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it 'getLoadedThemes get all the loaded themes', ->
themes = themeManager.getLoadedThemes()
expect(themes.length).toBeGreaterThan(2)
@@ -130,15 +134,24 @@ describe "ThemeManager", ->
expect(-> atom.packages.activatePackage('a-theme-that-will-not-be-found')).toThrow()
describe "::requireStylesheet(path)", ->
beforeEach ->
jasmine.snapshotDeprecations()
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it "synchronously loads css at the given path and installs a style tag for it in the head", ->
atom.styles.onDidAddStyleElement styleElementAddedHandler = jasmine.createSpy("styleElementAddedHandler")
themeManager.onDidChangeStylesheets stylesheetsChangedHandler = jasmine.createSpy("stylesheetsChangedHandler")
themeManager.onDidAddStylesheet stylesheetAddedHandler = jasmine.createSpy("stylesheetAddedHandler")
cssPath = atom.project.resolve('css.css')
lengthBefore = $('head style').length
themeManager.requireStylesheet(cssPath)
expect($('head style').length).toBe lengthBefore + 1
expect(styleElementAddedHandler).toHaveBeenCalled()
expect(stylesheetAddedHandler).toHaveBeenCalled()
expect(stylesheetsChangedHandler).toHaveBeenCalled()
@@ -148,8 +161,10 @@ describe "ThemeManager", ->
expect(element[0].sheet).toBe stylesheetAddedHandler.argsForCall[0][0]
# doesn't append twice
styleElementAddedHandler.reset()
themeManager.requireStylesheet(cssPath)
expect($('head style').length).toBe lengthBefore + 1
expect(styleElementAddedHandler).not.toHaveBeenCalled()
$('head style[id*="css.css"]').remove()
@@ -192,6 +207,7 @@ describe "ThemeManager", ->
disposable = themeManager.requireStylesheet(cssPath)
expect($(document.body).css('font-weight')).toBe("bold")
atom.styles.onDidRemoveStyleElement styleElementRemovedHandler = jasmine.createSpy("styleElementRemovedHandler")
themeManager.onDidRemoveStylesheet stylesheetRemovedHandler = jasmine.createSpy("stylesheetRemovedHandler")
themeManager.onDidChangeStylesheets stylesheetsChangedHandler = jasmine.createSpy("stylesheetsChangedHandler")
@@ -199,6 +215,7 @@ describe "ThemeManager", ->
expect($(document.body).css('font-weight')).not.toBe("bold")
expect(styleElementRemovedHandler).toHaveBeenCalled()
expect(stylesheetRemovedHandler).toHaveBeenCalled()
stylesheet = stylesheetRemovedHandler.argsForCall[0][0]
expect(stylesheet instanceof CSSStyleSheet).toBe true
@@ -207,14 +224,20 @@ describe "ThemeManager", ->
expect(stylesheetsChangedHandler).toHaveBeenCalled()
describe "base stylesheet loading", ->
workspaceElement = null
beforeEach ->
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.append $('<atom-text-editor>')
atom.workspaceView.attachToDom()
jasmine.snapshotDeprecations()
workspaceElement = atom.views.getView(atom.workspace)
jasmine.attachToDOM(workspaceElement)
workspaceElement.appendChild document.createElement('atom-text-editor')
waitsForPromise ->
themeManager.activateThemes()
beforeEach ->
jasmine.restoreDeprecationsSnapshot()
it "loads the correct values from the theme's ui-variables file", ->
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
atom.config.set('core.themes', ['theme-with-ui-variables', 'theme-with-syntax-variables'])
@@ -224,7 +247,7 @@ describe "ThemeManager", ->
runs ->
# an override loaded in the base css
expect(atom.workspaceView.css("background-color")).toBe "rgb(0, 0, 255)"
expect(getComputedStyle(workspaceElement)["background-color"]).toBe "rgb(0, 0, 255)"
# from within the theme itself
expect($("atom-text-editor").css("padding-top")).toBe "150px"
@@ -241,14 +264,14 @@ describe "ThemeManager", ->
runs ->
# an override loaded in the base css
expect(atom.workspaceView.css("background-color")).toBe "rgb(0, 0, 255)"
expect(getComputedStyle(workspaceElement)["background-color"]).toBe "rgb(0, 0, 255)"
# from within the theme itself
expect($("atom-text-editor").css("background-color")).toBe "rgb(0, 152, 255)"
describe "theme classes on the workspace", ->
it 'adds theme-* classes to the workspace for each active theme', ->
expect(atom.workspaceView).toHaveClass 'theme-atom-dark-ui'
expect(workspaceElement).toHaveClass 'theme-atom-dark-ui'
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
atom.config.set('core.themes', ['theme-with-ui-variables', 'theme-with-syntax-variables'])
@@ -258,13 +281,20 @@ describe "ThemeManager", ->
runs ->
# `theme-` twice as it prefixes the name with `theme-`
expect(atom.workspaceView).toHaveClass 'theme-theme-with-ui-variables'
expect(atom.workspaceView).toHaveClass 'theme-theme-with-syntax-variables'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-ui'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-syntax'
expect(workspaceElement).toHaveClass 'theme-theme-with-ui-variables'
expect(workspaceElement).toHaveClass 'theme-theme-with-syntax-variables'
expect(workspaceElement).not.toHaveClass 'theme-atom-dark-ui'
expect(workspaceElement).not.toHaveClass 'theme-atom-dark-syntax'
describe "when the user stylesheet changes", ->
beforeEach ->
jasmine.snapshotDeprecations()
afterEach ->
jasmine.restoreDeprecationsSnapshot()
it "reloads it", ->
[styleElementAddedHandler, styleElementRemovedHandler] = []
[stylesheetRemovedHandler, stylesheetAddedHandler, stylesheetsChangedHandler] = []
userStylesheetPath = path.join(temp.mkdirSync("atom"), 'styles.less')
fs.writeFileSync(userStylesheetPath, 'body {border-style: dotted !important;}')
@@ -274,6 +304,9 @@ describe "ThemeManager", ->
themeManager.activateThemes()
runs ->
atom.styles.onDidRemoveStyleElement styleElementRemovedHandler = jasmine.createSpy("styleElementRemovedHandler")
atom.styles.onDidAddStyleElement styleElementAddedHandler = jasmine.createSpy("styleElementAddedHandler")
themeManager.onDidChangeStylesheets stylesheetsChangedHandler = jasmine.createSpy("stylesheetsChangedHandler")
themeManager.onDidRemoveStylesheet stylesheetRemovedHandler = jasmine.createSpy("stylesheetRemovedHandler")
themeManager.onDidAddStylesheet stylesheetAddedHandler = jasmine.createSpy("stylesheetAddedHandler")
@@ -288,14 +321,19 @@ describe "ThemeManager", ->
runs ->
expect($(document.body).css('border-style')).toBe 'dashed'
expect(styleElementRemovedHandler).toHaveBeenCalled()
expect(styleElementRemovedHandler.argsForCall[0][0].textContent).toContain 'dotted'
expect(stylesheetRemovedHandler).toHaveBeenCalled()
expect(stylesheetRemovedHandler.argsForCall[0][0].cssRules[0].style.border).toBe 'dotted'
expect(styleElementAddedHandler).toHaveBeenCalled()
expect(styleElementAddedHandler.argsForCall[0][0].textContent).toContain 'dashed'
expect(stylesheetAddedHandler).toHaveBeenCalled()
expect(stylesheetAddedHandler.argsForCall[0][0].cssRules[0].style.border).toBe 'dashed'
expect(stylesheetsChangedHandler).toHaveBeenCalled()
styleElementRemovedHandler.reset()
stylesheetRemovedHandler.reset()
stylesheetsChangedHandler.reset()
fs.removeSync(userStylesheetPath)
@@ -304,6 +342,8 @@ describe "ThemeManager", ->
themeManager.loadUserStylesheet.callCount is 2
runs ->
expect(styleElementRemovedHandler).toHaveBeenCalled()
expect(styleElementRemovedHandler.argsForCall[0][0].textContent).toContain 'dashed'
expect(stylesheetRemovedHandler).toHaveBeenCalled()
expect(stylesheetRemovedHandler.argsForCall[0][0].cssRules[0].style.border).toBe 'dashed'
expect($(document.body).css('border-style')).toBe 'none'
+1 -1
Ver Arquivo
@@ -522,7 +522,7 @@ describe "TokenizedBuffer", ->
buffer = atom.project.bufferForPathSync()
buffer.setText "<div class='name'><%= User.find(2).full_name %></div>"
tokenizedBuffer = new TokenizedBuffer({buffer})
tokenizedBuffer.setGrammar(atom.syntax.selectGrammar('test.erb'))
tokenizedBuffer.setGrammar(atom.grammars.selectGrammar('test.erb'))
fullyTokenize(tokenizedBuffer)
{tokens} = tokenizedBuffer.tokenizedLineForRow(0)
+79
Ver Arquivo
@@ -0,0 +1,79 @@
TooltipManager = require '../src/tooltip-manager'
{$} = require '../src/space-pen-extensions'
describe "TooltipManager", ->
[manager, element] = []
beforeEach ->
manager = new TooltipManager
element = document.createElement('div')
element.classList.add('foo')
jasmine.attachToDOM(element)
hover = (element, fn) ->
$(element).trigger 'mouseenter'
advanceClock(manager.defaults.delay.show)
fn()
$(element).trigger 'mouseleave'
advanceClock(manager.defaults.delay.hide)
describe "::add(target, options)", ->
describe "when the target is an element", ->
it "creates a tooltip based on the given options when hovering over the target element", ->
manager.add element, title: "Title"
hover element, ->
expect(document.body.querySelector(".tooltip")).toHaveText("Title")
describe "when a keyBindingCommand is specified", ->
describe "when a title is specified", ->
it "appends the key binding corresponding to the command to the title", ->
atom.keymaps.add 'test',
'.foo': 'ctrl-x ctrl-y': 'test-command'
'.bar': 'ctrl-x ctrl-z': 'test-command'
manager.add element, title: "Title", keyBindingCommand: 'test-command'
hover element, ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement).toHaveText "Title ⌃X ⌃Y"
describe "when no title is specified", ->
it "shows the key binding corresponding to the command alone", ->
atom.keymaps.add 'test', '.foo': 'ctrl-x ctrl-y': 'test-command'
manager.add element, keyBindingCommand: 'test-command'
hover element, ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement).toHaveText "⌃X ⌃Y"
describe "when a keyBindingTarget is specified", ->
it "looks up the key binding relative to the target", ->
atom.keymaps.add 'test',
'.bar': 'ctrl-x ctrl-z': 'test-command'
'.foo': 'ctrl-x ctrl-y': 'test-command'
manager.add element, keyBindingCommand: 'test-command', keyBindingTarget: element
hover element, ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement).toHaveText "⌃X ⌃Y"
it "does not display the keybinding if there is nothing mapped to the specified keyBindingCommand", ->
manager.add element, title: 'A Title', keyBindingCommand: 'test-command', keyBindingTarget: element
hover element, ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement.textContent).toBe "A Title"
describe "when .dispose() is called on the returned disposable", ->
it "no longer displays the tooltip on hover", ->
disposable = manager.add element, title: "Title"
hover element, ->
expect(document.body.querySelector(".tooltip")).toHaveText("Title")
disposable.dispose()
hover element, ->
expect(document.body.querySelector(".tooltip")).toBeNull()
+19 -39
Ver Arquivo
@@ -25,47 +25,27 @@ describe "ViewRegistry", ->
describe "when passed a model object", ->
describe "when a view provider is registered matching the object's constructor", ->
describe "when the provider has a viewConstructor property", ->
it "constructs a view element and assigns the model on it", ->
class TestModel
it "constructs a view element and assigns the model on it", ->
class TestModel
class TestModelSubclass extends TestModel
class TestModelSubclass extends TestModel
class TestView
setModel: (@model) ->
class TestView
initialize: (@model) -> this
model = new TestModel
model = new TestModel
registry.addViewProvider
modelConstructor: TestModel
viewConstructor: TestView
registry.addViewProvider TestModel, (model) ->
new TestView().initialize(model)
view = registry.getView(model)
expect(view instanceof TestView).toBe true
expect(view.model).toBe model
view = registry.getView(model)
expect(view instanceof TestView).toBe true
expect(view.model).toBe model
subclassModel = new TestModelSubclass
view2 = registry.getView(subclassModel)
expect(view2 instanceof TestView).toBe true
expect(view2.model).toBe subclassModel
describe "when the provider has a createView method", ->
it "constructs a view element by calling the createView method with the model", ->
class TestModel
class TestView
setModel: (@model) ->
registry.addViewProvider
modelConstructor: TestModel
createView: (model) ->
view = new TestView
view.setModel(model)
view
model = new TestModel
view = registry.getView(model)
expect(view instanceof TestView).toBe true
expect(view.model).toBe model
subclassModel = new TestModelSubclass
view2 = registry.getView(subclassModel)
expect(view2 instanceof TestView).toBe true
expect(view2.model).toBe subclassModel
describe "when no view provider is registered for the object's constructor", ->
describe "when the object has a .getViewClass() method", ->
@@ -97,10 +77,10 @@ describe "ViewRegistry", ->
it "returns a disposable that can be used to remove the provider", ->
class TestModel
class TestView
setModel: (@model) ->
disposable = registry.addViewProvider
modelConstructor: TestModel
viewConstructor: TestView
initialize: (@model) -> this
disposable = registry.addViewProvider TestModel, (model) ->
new TestView().initialize(model)
expect(registry.getView(new TestModel) instanceof TestView).toBe true
disposable.dispose()
+15 -18
Ver Arquivo
@@ -1,4 +1,4 @@
{$, $$} = require 'atom'
{$, $$} = require '../src/space-pen-extensions'
path = require 'path'
TextEditor = require '../src/text-editor'
WindowEventHandler = require '../src/window-event-handler'
@@ -95,13 +95,13 @@ describe "Window", ->
describe ".unloadEditorWindow()", ->
it "saves the serialized state of the window so it can be deserialized after reload", ->
workspaceState = atom.workspace.serialize()
syntaxState = atom.syntax.serialize()
syntaxState = atom.grammars.serialize()
projectState = atom.project.serialize()
atom.unloadEditorWindow()
expect(atom.state.workspace).toEqual workspaceState
expect(atom.state.syntax).toEqual syntaxState
expect(atom.state.grammars).toEqual syntaxState
expect(atom.state.project).toEqual projectState
expect(atom.saveSync).toHaveBeenCalled()
@@ -112,9 +112,9 @@ describe "Window", ->
runs ->
buffer = atom.workspace.getActivePaneItem().buffer
pane = atom.workspaceView.getActivePaneView()
pane.splitRight(pane.copyActiveItem())
expect(atom.workspaceView.find('atom-text-editor').length).toBe 2
pane = atom.workspace.getActivePane()
pane.splitRight(copyActiveItem: true)
expect(atom.workspace.getTextEditors().length).toBe 2
atom.removeEditorWindow()
@@ -128,17 +128,15 @@ describe "Window", ->
setData: (key, value) -> @data[key] = value
getData: (key) -> @data[key]
event = $.Event(type)
event.originalEvent = { dataTransfer }
event.preventDefault = ->
event.stopPropagation = ->
event = new CustomEvent("drop")
event.dataTransfer = dataTransfer
event
describe "when a file is dragged to window", ->
it "opens it", ->
spyOn(atom, "open")
event = buildDragEvent("drop", [ {path: "/fake1"}, {path: "/fake2"} ])
$(document).trigger(event)
document.dispatchEvent(event)
expect(atom.open.callCount).toBe 1
expect(atom.open.argsForCall[0][0]).toEqual pathsToOpen: ['/fake1', '/fake2']
@@ -146,7 +144,7 @@ describe "Window", ->
it "does nothing", ->
spyOn(atom, "open")
event = buildDragEvent("drop", [])
$(document).trigger(event)
document.dispatchEvent(event)
expect(atom.open).not.toHaveBeenCalled()
describe "when a link is clicked", ->
@@ -259,24 +257,23 @@ describe "Window", ->
describe "when the opened path exists", ->
it "sets the project path to the opened path", ->
$(window).trigger('window:open-path', [{pathToOpen: __filename}])
atom.getCurrentWindow().send 'message', 'open-path', pathToOpen: __filename
expect(atom.project.getPaths()[0]).toBe __dirname
describe "when the opened path does not exist but its parent directory does", ->
it "sets the project path to the opened path's parent directory", ->
$(window).trigger('window:open-path', [{pathToOpen: path.join(__dirname, 'this-path-does-not-exist.txt')}])
pathToOpen = path.join(__dirname, 'this-path-does-not-exist.txt')
atom.getCurrentWindow().send 'message', 'open-path', {pathToOpen}
expect(atom.project.getPaths()[0]).toBe __dirname
describe "when the opened path is a file", ->
it "opens it in the workspace", ->
$(window).trigger('window:open-path', [{pathToOpen: __filename}])
atom.getCurrentWindow().send 'message', 'open-path', pathToOpen: __filename
expect(atom.workspace.open.mostRecentCall.args[0]).toBe __filename
describe "when the opened path is a directory", ->
it "does not open it in the workspace", ->
$(window).trigger('window:open-path', [{pathToOpen: __dirname}])
atom.getCurrentWindow().send 'message', 'open-path', pathToOpen: __dirname
expect(atom.workspace.open.callCount).toBe 0
+62 -10
Ver Arquivo
@@ -356,7 +356,7 @@ describe "Workspace", ->
atom.workspace.open('sample.coffee')
runs ->
atom.workspace.getActiveEditor().setText """
atom.workspace.getActiveTextEditor().setText """
i = /test/; #FIXME
"""
@@ -375,7 +375,7 @@ describe "Workspace", ->
describe "document.title", ->
describe "when the project has no path", ->
it "sets the title to 'untitled'", ->
atom.project.setPath(undefined)
atom.project.setPaths([])
expect(document.title).toBe 'untitled - Atom'
describe "when the project has a path", ->
@@ -458,46 +458,98 @@ describe "Workspace", ->
expect(atom.setDocumentEdited).toHaveBeenCalledWith(false)
describe "adding panels", ->
class TestPanel
constructior: ->
class TestItem
class TestItemElement extends HTMLElement
constructor: ->
initialize: (@model) -> this
getModel: -> @model
beforeEach ->
atom.views.addViewProvider TestItem, (model) ->
new TestItemElement().initialize(model)
describe '::addLeftPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getLeftPanels().length).toBe(0)
atom.workspace.panelContainers.left.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addLeftPanel(item: new TestPanel())
model = new TestItem
panel = atom.workspace.addLeftPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.views.getView(atom.workspace.getLeftPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addRightPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getRightPanels().length).toBe(0)
atom.workspace.panelContainers.right.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addRightPanel(item: new TestPanel())
model = new TestItem
panel = atom.workspace.addRightPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.views.getView(atom.workspace.getRightPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addTopPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getTopPanels().length).toBe(0)
atom.workspace.panelContainers.top.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addTopPanel(item: new TestPanel())
model = new TestItem
panel = atom.workspace.addTopPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.views.getView(atom.workspace.getTopPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addBottomPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getBottomPanels().length).toBe(0)
atom.workspace.panelContainers.bottom.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addBottomPanel(item: new TestPanel())
model = new TestItem
panel = atom.workspace.addBottomPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.views.getView(atom.workspace.getBottomPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addModalPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getModalPanels().length).toBe(0)
atom.workspace.panelContainers.modal.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addModalPanel(item: new TestPanel())
model = new TestItem
panel = atom.workspace.addModalPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
expect(panel.getClassName()).toBe 'overlay from-top' # the default
itemView = atom.views.getView(atom.workspace.getModalPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe "::panelForItem(item)", ->
it "returns the panel associated with the item", ->
item = new TestItem
panel = atom.workspace.addLeftPanel(item: item)
itemWithNoPanel = new TestItem
expect(atom.workspace.panelForItem(item)).toBe panel
expect(atom.workspace.panelForItem(itemWithNoPanel)).toBe null
+43 -1
Ver Arquivo
@@ -1,8 +1,9 @@
{$, $$, WorkspaceView, View} = require 'atom'
{$, $$, View} = require '../src/space-pen-extensions'
Q = require 'q'
path = require 'path'
temp = require 'temp'
TextEditorView = require '../src/text-editor-view'
Pane = require '../src/pane'
PaneView = require '../src/pane-view'
Workspace = require '../src/workspace'
@@ -10,6 +11,8 @@ describe "WorkspaceView", ->
pathToOpen = null
beforeEach ->
jasmine.snapshotDeprecations()
atom.project.setPaths([atom.project.resolve('dir')])
pathToOpen = atom.project.resolve('a')
atom.workspace = new Workspace
@@ -20,6 +23,9 @@ describe "WorkspaceView", ->
waitsForPromise ->
atom.workspace.open(pathToOpen)
afterEach ->
jasmine.restoreDeprecationsSnapshot()
describe "@deserialize()", ->
viewState = null
@@ -289,3 +295,39 @@ describe "WorkspaceView", ->
modalContainer = workspaceElement.querySelector('atom-panel-container.modal')
expect(modalContainer.parentNode).toBe workspaceElement
describe "::saveActivePaneItem()", ->
describe "when there is an error", ->
it "emits a warning notification when the file cannot be saved", ->
spyOn(Pane::, 'saveActiveItem').andCallFake ->
throw new Error("'/some/file' is a directory")
atom.notifications.onDidAddNotification addedSpy = jasmine.createSpy()
atom.workspace.saveActivePaneItem()
expect(addedSpy).toHaveBeenCalled()
expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
it "emits a warning notification when the directory cannot be written to", ->
spyOn(Pane::, 'saveActiveItem').andCallFake ->
throw new Error("ENOTDIR, not a directory '/Some/dir/and-a-file.js'")
atom.notifications.onDidAddNotification addedSpy = jasmine.createSpy()
atom.workspace.saveActivePaneItem()
expect(addedSpy).toHaveBeenCalled()
expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
it "emits a warning notification when the user does not have permission", ->
spyOn(Pane::, 'saveActiveItem').andCallFake ->
throw new Error("EACCES, permission denied '/Some/dir/and-a-file.js'")
atom.notifications.onDidAddNotification addedSpy = jasmine.createSpy()
atom.workspace.saveActivePaneItem()
expect(addedSpy).toHaveBeenCalled()
expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
it "emits a warning notification when the file cannot be saved", ->
spyOn(Pane::, 'saveActiveItem').andCallFake ->
throw new Error("no one knows")
save = -> atom.workspace.saveActivePaneItem()
expect(save).toThrow()
+70 -16
Ver Arquivo
@@ -11,6 +11,7 @@ _ = require 'underscore-plus'
{Emitter} = require 'event-kit'
{Model} = require 'theorist'
fs = require 'fs-plus'
{convertStackTrace, convertLine} = require 'coffeestack'
{$} = require './space-pen-extensions'
WindowEventHandler = require './window-event-handler'
@@ -33,6 +34,23 @@ class Atom extends Model
startTime = Date.now()
atom = @deserialize(@loadState(mode)) ? new this({mode, @version})
atom.deserializeTimings.atom = Date.now() - startTime
workspaceViewDeprecationMessage = """
atom.workspaceView is no longer available.
In most cases you will not need the view. See the Workspace docs for
alternatives: https://atom.io/docs/api/latest/Workspace.
If you do need the view, please use `atom.views.getView(atom.workspace)`,
which returns an HTMLElement.
"""
Object.defineProperty atom, 'workspaceView',
get: ->
deprecate(workspaceViewDeprecationMessage)
atom.__workspaceView
set: (newValue) ->
deprecate(workspaceViewDeprecationMessage)
atom.__workspaceView = newValue
atom
# Deserializes the Atom environment from a state object
@@ -116,6 +134,9 @@ class Atom extends Model
# Public: A {Clipboard} instance
clipboard: null
# A {ServiceHub} instance
services: null
# Public: A {ContextMenuManager} instance
contextMenu: null
@@ -125,11 +146,17 @@ class Atom extends Model
# Public: A {KeymapManager} instance
keymaps: null
# Public: A {TooltipManager} instance
tooltips: null
# Experimental: A {NotificationManager} instance
notifications: null
# Public: A {Project} instance
project: null
# Public: A {Syntax} instance
syntax: null
# Public: A {GrammarRegistry} instance
grammars: null
# Public: A {PackageManager} instance
packages: null
@@ -149,9 +176,6 @@ class Atom extends Model
# Public: A {Workspace} instance
workspace: null
# Public: A {WorkspaceView} instance
workspaceView: null
###
Section: Construction and Destruction
###
@@ -175,9 +199,16 @@ class Atom extends Model
unless @inDevMode() or @inSpecMode()
require('grim').deprecate = ->
sourceMapCache = {}
window.onerror = =>
@lastUncaughtError = Array::slice.call(arguments)
[message, url, line, column, originalError] = @lastUncaughtError
convertedLine = convertLine(url, line, column, sourceMapCache)
{line, column} = convertedLine if convertedLine?
originalError.stack = convertStackTrace(originalError.stack, sourceMapCache) if originalError
eventObject = {message, url, line, column, originalError}
openDevTools = true
@@ -201,9 +232,12 @@ class Atom extends Model
KeymapManager = require './keymap-extensions'
ViewRegistry = require './view-registry'
CommandRegistry = require './command-registry'
TooltipManager = require './tooltip-manager'
NotificationManager = require './notification-manager'
PackageManager = require './package-manager'
Clipboard = require './clipboard'
Syntax = require './syntax'
ServiceHub = require './service-hub'
GrammarRegistry = require './grammar-registry'
ThemeManager = require './theme-manager'
StyleManager = require './style-manager'
ContextMenuManager = require './context-menu-manager'
@@ -226,6 +260,9 @@ class Atom extends Model
@config = new Config({configDirPath, resourcePath})
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@keymaps.subscribeToFileReadFailure()
@tooltips = new TooltipManager
@notifications = new NotificationManager
@commands = new CommandRegistry
@views = new ViewRegistry
@packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode})
@@ -235,8 +272,13 @@ class Atom extends Model
@contextMenu = new ContextMenuManager({resourcePath, devMode})
@menu = new MenuManager({resourcePath})
@clipboard = new Clipboard()
@services = new ServiceHub
@syntax = @deserializers.deserialize(@state.syntax) ? new Syntax()
@grammars = @deserializers.deserialize(@state.grammars ? @state.syntax) ? new GrammarRegistry()
Object.defineProperty this, 'syntax', get: ->
deprecate "The atom.syntax global is deprecated. Use atom.grammars instead."
@grammars
@subscribe @packages.onDidActivateAll => @watchThemes()
@@ -299,6 +341,10 @@ class Atom extends Model
inDevMode: ->
@getLoadSettings().devMode
# Public: Is the current window in safe mode?
inSafeMode: ->
@getLoadSettings().safeMode
# Public: Is the current window running specs?
inSpecMode: ->
@getLoadSettings().isSpec
@@ -547,9 +593,9 @@ class Atom extends Model
@displayWindow({maximize})
unloadEditorWindow: ->
return if not @project and not @workspaceView
return if not @project
@state.syntax = @syntax.serialize()
@state.grammars = @grammars.serialize()
@state.project = @project.serialize()
@state.workspace = @workspace.serialize()
@packages.deactivatePackages()
@@ -558,10 +604,10 @@ class Atom extends Model
@windowState = null
removeEditorWindow: ->
return if not @project and not @workspaceView
return if not @project
@workspaceView?.remove()
@workspaceView = null
@workspace?.destroy()
@workspace = null
@project?.destroy()
@project = null
@@ -574,7 +620,7 @@ class Atom extends Model
# Essential: Visually and audibly trigger a beep.
beep: ->
shell.beep() if @config.get('core.audioBeep')
@workspaceView.trigger 'beep'
@__workspaceView?.trigger 'beep'
@emitter.emit 'did-beep'
# Essential: A flexible way to open a dialog akin to an alert dialog.
@@ -650,11 +696,13 @@ class Atom extends Model
startTime = Date.now()
@workspace = Workspace.deserialize(@state.workspace) ? new Workspace
@workspaceView = @views.getView(@workspace).__spacePenView
workspaceElement = @views.getView(@workspace)
@__workspaceView = workspaceElement.__spacePenView
@deserializeTimings.workspace = Date.now() - startTime
@keymaps.defaultTarget = @workspaceView[0]
$(@workspaceViewParentSelector).append(@workspaceView)
@keymaps.defaultTarget = workspaceElement
document.querySelector(@workspaceViewParentSelector).appendChild(workspaceElement)
deserializePackageStates: ->
@packages.packageStates = @state.packageStates ? {}
@@ -751,6 +799,12 @@ class Atom extends Model
else
window[key] = value
onUpdateAvailable: (callback) ->
@emitter.on 'update-available', callback
updateAvailable: (details) ->
@emitter.emit 'update-available', details
# Deprecated: Callers should be converted to use atom.deserializers
registerRepresentationClass: ->
deprecate("Callers should be converted to use atom.deserializers")
+8 -4
Ver Arquivo
@@ -140,14 +140,18 @@ class AtomApplication
# Registers basic application commands, non-idempotent.
handleEvents: ->
getLoadSettings = =>
devMode: @focusedWindow()?.devMode
safeMode: @focusedWindow()?.safeMode
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath, safeMode: @focusedWindow()?.safeMode)
@on 'application:run-benchmarks', -> @runBenchmarks()
@on 'application:quit', -> app.quit()
@on 'application:new-window', -> @openPath(windowDimensions: @focusedWindow()?.getDimensions())
@on 'application:new-window', -> @openPath(_.extend(windowDimensions: @focusedWindow()?.getDimensions(), getLoadSettings()))
@on 'application:new-file', -> (@focusedWindow() ? this).openPath()
@on 'application:open', -> @promptForPath(type: 'all')
@on 'application:open-file', -> @promptForPath(type: 'file')
@on 'application:open-folder', -> @promptForPath(type: 'folder')
@on 'application:open', -> @promptForPath(_.extend(type: 'all', getLoadSettings()))
@on 'application:open-file', -> @promptForPath(_.extend(type: 'file', getLoadSettings()))
@on 'application:open-folder', -> @promptForPath(_.extend(type: 'folder', getLoadSettings()))
@on 'application:open-dev', -> @promptForPath(devMode: true)
@on 'application:open-safe', -> @promptForPath(safeMode: true)
@on 'application:inspect', ({x,y, atomWindow}) ->
+8 -4
Ver Arquivo
@@ -18,7 +18,7 @@ class AtomWindow
isSpec: null
constructor: (settings={}) ->
{@resourcePath, pathToOpen, initialLine, initialColumn, @isSpec, @exitWhenDone, @safeMode} = settings
{@resourcePath, pathToOpen, initialLine, initialColumn, @isSpec, @exitWhenDone, @safeMode, @devMode} = settings
# Normalize to make sure drive letter case is consistent on Windows
@resourcePath = path.normalize(@resourcePath) if @resourcePath
@@ -38,6 +38,8 @@ class AtomWindow
loadSettings.windowState ?= '{}'
loadSettings.appVersion = app.getVersion()
loadSettings.resourcePath = @resourcePath
loadSettings.devMode ?= false
loadSettings.safeMode ?= false
# Only send to the first non-spec window created
if @constructor.includeShellLoadTime and not @isSpec
@@ -58,7 +60,7 @@ class AtomWindow
@browserWindow.loadUrl @getUrl(loadSettings)
@browserWindow.focusOnWebView() if @isSpec
@openPath(pathToOpen, initialLine, initialColumn)
@openPath(pathToOpen, initialLine, initialColumn) unless @isSpecWindow()
getUrl: (loadSettingsObj) ->
# Ignore the windowState when passing loadSettings via URL, since it could
@@ -143,10 +145,13 @@ class AtomWindow
openPath: (pathToOpen, initialLine, initialColumn) ->
if @loaded
@focus()
@sendCommand('window:open-path', {pathToOpen, initialLine, initialColumn})
@sendMessage 'open-path', {pathToOpen, initialLine, initialColumn}
else
@browserWindow.once 'window:loaded', => @openPath(pathToOpen, initialLine, initialColumn)
sendMessage: (message, detail) ->
@browserWindow.webContents.send 'message', message, detail
sendCommand: (command, args...) ->
if @isSpecWindow()
unless global.atomApplication.sendCommandToFirstResponder(command)
@@ -154,7 +159,6 @@ class AtomWindow
when 'window:reload' then @reload()
when 'window:toggle-dev-tools' then @toggleDevTools()
when 'window:close' then @close()
when 'window:update-available' then @sendCommandToBrowserWindow(command, args...) # For spec testing
else if @isWebViewFocused()
@sendCommandToBrowserWindow(command, args...)
else
+8 -1
Ver Arquivo
@@ -7,6 +7,7 @@ CheckingState = 'checking'
DownladingState = 'downloading'
UpdateAvailableState = 'update-available'
NoUpdateAvailableState = 'no-update-available'
UnsupportedState = 'unsupported'
ErrorState = 'error'
module.exports =
@@ -53,10 +54,16 @@ class AutoUpdateManager
unless /\w{7}/.test(@version)
@check(hidePopups: true)
switch process.platform
when 'win32'
@setState(UnsupportedState) unless autoUpdater.supportsUpdates()
when 'linux'
@setState(UnsupportedState)
emitUpdateAvailableEvent: (windows...) ->
return unless @releaseVersion? and @releaseNotes
for atomWindow in windows
atomWindow.sendCommand('window:update-available', [@releaseVersion, @releaseNotes])
atomWindow.sendMessage('update-available', {@releaseVersion, @releaseNotes})
setState: (state) ->
return if @state is state
+7 -14
Ver Arquivo
@@ -1,6 +1,5 @@
{EventEmitter} = require 'events'
_ = require 'underscore-plus'
shellAutoUpdater = require 'auto-updater'
SquirrelUpdate = require './squirrel-update'
class AutoUpdater
@@ -9,15 +8,10 @@ class AutoUpdater
setFeedUrl: (@updateUrl) ->
quitAndInstall: ->
unless SquirrelUpdate.existsSync()
shellAutoUpdater.quitAndInstall()
return
@installUpdate (error) ->
return if error?
SquirrelUpdate.spawn ['--processStart', 'atom.exe'], ->
shellAutoUpdater.quitAndInstall()
if SquirrelUpdate.existsSync()
SquirrelUpdate.restartAtom(require('app'))
else
require('auto-updater').quitAndInstall()
downloadUpdate: (callback) ->
SquirrelUpdate.spawn ['--download', @updateUrl], (error, stdout) ->
@@ -36,6 +30,9 @@ class AutoUpdater
installUpdate: (callback) ->
SquirrelUpdate.spawn(['--update', @updateUrl], callback)
supportsUpdates: ->
SquirrelUpdate.existsSync()
checkForUpdates: ->
throw new Error('Update URL is not set') unless @updateUrl
@@ -47,7 +44,6 @@ class AutoUpdater
@downloadUpdate (error, update) =>
if error?
console.log "Failed to download: #{error.message} - #{error.code} - #{error.stdout}"
@emit 'update-not-available'
return
@@ -57,12 +53,9 @@ class AutoUpdater
@installUpdate (error) =>
if error?
console.log "Failed to update: #{error.message} - #{error.code} - #{error.stdout}"
@emit 'update-not-available'
return
console.log "Updated to #{update.version}"
@emit 'update-available'
@emit 'update-downloaded', {}, update.releaseNotes, update.version, new Date(), 'https://atom.io', => @quitAndInstall()
+1 -1
Ver Arquivo
@@ -8,7 +8,7 @@ class ContextMenu
menu.popup(@atomWindow.browserWindow)
# It's necessary to build the event handlers in this process, otherwise
# closures are drug across processes and failed to be garbage collected
# closures are dragged across processes and failed to be garbage collected
# appropriately.
createClickHandlers: (template) ->
for item in template
+12 -1
Ver Arquivo
@@ -13,10 +13,21 @@ process.on 'uncaughtException', (error={}) ->
nslog(error.message) if error.message?
nslog(error.stack) if error.stack?
# Patch fs.statSyncNoException/fs.lstatSyncNoException to fail for non-strings
# https://github.com/atom/atom-shell/issues/843
{lstatSyncNoException, statSyncNoException} = fs
fs.statSyncNoException = (pathToStat) ->
return false unless pathToStat and typeof pathToStat is 'string'
statSyncNoException(pathToStat)
fs.lstatSyncNoException = (pathToStat) ->
return false unless pathToStat and typeof pathToStat is 'string'
lstatSyncNoException(pathToStat)
start = ->
if process.platform is 'win32'
SquirrelUpdate = require './squirrel-update'
return if SquirrelUpdate.handleStartupEvent()
squirrelCommand = process.argv[1]
return if SquirrelUpdate.handleStartupEvent(app, squirrelCommand)
args = parseCommandLine()
+55 -22
Ver Arquivo
@@ -1,9 +1,9 @@
app = require 'app'
ChildProcess = require 'child_process'
fs = require 'fs-plus'
path = require 'path'
rootAtomFolder = path.resolve(process.execPath, '..', '..')
appFolder = path.resolve(process.execPath, '..')
rootAtomFolder = path.resolve(appFolder, '..')
binFolder = path.join(rootAtomFolder, 'bin')
updateDotExe = path.join(rootAtomFolder, 'Update.exe')
exeName = path.basename(process.execPath)
@@ -36,7 +36,7 @@ spawn = (command, args, callback) ->
error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
error?.code ?= code
error?.stdout ?= stdout
callback(error, stdout)
callback?(error, stdout)
# Spawn reg.exe and callback when it completes
spawnReg = (args, callback) ->
@@ -111,22 +111,26 @@ uninstallContextMenu = (callback) ->
addCommandsToPath = (callback) ->
installCommands = (callback) ->
atomCommandPath = path.join(binFolder, 'atom.cmd')
relativeExePath = path.relative(binFolder, process.execPath)
atomCommand = """
@echo off
"%~dp0\\#{relativeExePath}" %*
"""
relativeAtomPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.cmd'))
atomCommand = "@echo off\r\n\"%~dp0\\#{relativeAtomPath}\" %*"
atomShCommandPath = path.join(binFolder, 'atom')
relativeAtomShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.sh'))
atomShCommand = "#!/bin/sh\r\n\"$0/../#{relativeAtomShPath.replace(/\\/g, '/')}\" \"$@\""
apmCommandPath = path.join(binFolder, 'apm.cmd')
relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'app', 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm.cmd'))
apmCommand = """
@echo off
"%~dp0\\#{relativeApmPath}" %*
"""
apmCommand = "@echo off\r\n\"%~dp0\\#{relativeApmPath}\" %*"
apmShCommandPath = path.join(binFolder, 'apm')
relativeApmShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'apm.sh'))
apmShCommand = "#!/bin/sh\r\n\"$0/../#{relativeApmShPath.replace(/\\/g, '/')}\" \"$@\""
fs.writeFile atomCommandPath, atomCommand, ->
fs.writeFile apmCommandPath, apmCommand, ->
callback()
fs.writeFile atomShCommandPath, atomShCommand, ->
fs.writeFile apmCommandPath, apmCommand, ->
fs.writeFile apmShCommandPath, apmShCommand, ->
callback()
addBinToPath = (pathSegments, callback) ->
pathSegments.push(binFolder)
@@ -159,15 +163,31 @@ removeCommandsFromPath = (callback) ->
else
callback()
# Create a desktop and start menu shortcut by using the command line API
# provided by Squirrel's Update.exe
createShortcut = (callback) ->
createShortcuts = (callback) ->
spawnUpdate(['--createShortcut', exeName], callback)
# Update the desktop and start menu shortcuts by using the command line API
# provided by Squirrel's Update.exe
updateShortcuts = (callback) ->
if homeDirectory = fs.getHomeDirectory()
desktopShortcutPath = path.join(homeDirectory, 'Desktop', 'Atom.lnk')
# Check if the desktop shortcut has been previously deleted and
# and keep it deleted if it was
fs.exists desktopShortcutPath, (desktopShortcutExists) ->
createShortcuts ->
if desktopShortcutExists
callback()
else
# Remove the unwanted desktop shortcut that was recreated
fs.unlink(desktopShortcutPath, callback)
else
createShortcuts(callback)
# Remove the desktop and start menu shortcuts by using the command line API
# provided by Squirrel's Update.exe
removeShortcut = (callback) ->
removeShortcuts = (callback) ->
spawnUpdate(['--removeShortcut', exeName], callback)
exports.spawn = spawnUpdate
@@ -176,17 +196,30 @@ exports.spawn = spawnUpdate
exports.existsSync = ->
fs.existsSync(updateDotExe)
# Restart Atom using the version pointed to by the atom.cmd shim
exports.restartAtom = (app) ->
if projectPath = global.atomApplication?.lastFocusedWindow?.projectPath
args = [projectPath]
app.once 'will-quit', -> spawn(path.join(binFolder, 'atom.cmd'), args)
app.quit()
# Handle squirrel events denoted by --squirrel-* command line arguments.
exports.handleStartupEvent = ->
switch process.argv[1]
when '--squirrel-install', '--squirrel-updated'
createShortcut ->
exports.handleStartupEvent = (app, squirrelCommand) ->
switch squirrelCommand
when '--squirrel-install'
createShortcuts ->
installContextMenu ->
addCommandsToPath ->
app.quit()
true
when '--squirrel-updated'
updateShortcuts ->
installContextMenu ->
addCommandsToPath ->
app.quit()
true
when '--squirrel-uninstall'
removeShortcut ->
removeShortcuts ->
uninstallContextMenu ->
removeCommandsFromPath ->
app.quit()
+61 -4
Ver Arquivo
@@ -1,5 +1,6 @@
_ = require 'underscore-plus'
ChildProcess = require 'child_process'
{Emitter} = require 'event-kit'
# Extended: A wrapper which provides standard error/output line buffering for
# Node's ChildProcess.
@@ -17,6 +18,10 @@ ChildProcess = require 'child_process'
# ```
module.exports =
class BufferedProcess
###
Section: Construction
###
# Public: Runs the given command by spawning a new child process.
#
# * `options` An {Object} with the following keys:
@@ -39,14 +44,15 @@ class BufferedProcess
# * `exit` The callback {Function} which receives a single argument
# containing the exit status (optional).
constructor: ({command, args, options, stdout, stderr, exit}={}) ->
@emitter = new Emitter
options ?= {}
# Related to joyent/node#2318
if process.platform is "win32"
if process.platform is 'win32'
# Quote all arguments and escapes inner quotes
if args?
cmdArgs = args.filter (arg) -> arg?
cmdArgs = cmdArgs.map (arg) ->
if command in ['explorer.exe', 'explorer'] and /^\/[a-zA-Z]+,.*$/.test(arg)
cmdArgs = cmdArgs.map (arg) =>
if @isExplorerCommand(command) and /^\/[a-zA-Z]+,.*$/.test(arg)
# Don't wrap /root,C:\folder style arguments to explorer calls in
# quotes since they will not be interpreted correctly if they are
arg
@@ -61,7 +67,7 @@ class BufferedProcess
cmdArgs = ['/s', '/c', "\"#{cmdArgs.join(' ')}\""]
cmdOptions = _.clone(options)
cmdOptions.windowsVerbatimArguments = true
@process = ChildProcess.spawn(process.env.comspec or 'cmd.exe', cmdArgs, cmdOptions)
@process = ChildProcess.spawn(@getCmdPath(), cmdArgs, cmdOptions)
else
@process = ChildProcess.spawn(command, args, options)
@killed = false
@@ -94,6 +100,41 @@ class BufferedProcess
processExited = true
triggerExitCallback()
@process.on 'error', (error) =>
handled = false
handle = -> handled = true
@emitter.emit 'will-throw-error', {error, handle}
if error.code is 'ENOENT' and error.syscall.indexOf('spawn') is 0
error = new Error("Failed to spawn command `#{command}`. Make sure `#{command}` is installed and on your PATH", error.path)
error.name = 'BufferedProcessError'
throw error unless handled
###
Section: Event Subscription
###
# Public: Will call your callback when an error will be raised by the process.
# Usually this is due to the command not being available or not on the PATH.
# You can call `handle()` on the object passed to your callback to indicate
# that you have handled this error.
#
# * `callback` {Function} callback
# * `errorObject` {Object}
# * `error` {Object} the error object
# * `handle` {Function} call this to indicate you have handled the error.
# The error will not be thrown if this function is called.
#
# Returns a {Disposable}
onWillThrowError: (callback) ->
@emitter.on 'will-throw-error', callback
###
Section: Helper Methods
###
# Helper method to pass data line by line.
#
# * `stream` The Stream to read from.
@@ -150,6 +191,22 @@ class BufferedProcess
@process?.kill()
@process = null
isExplorerCommand: (command) ->
if command is 'explorer.exe' or command is 'explorer'
true
else if process.env.SystemRoot
command is path.join(process.env.SystemRoot, 'explorer.exe') or command is path.join(process.env.SystemRoot, 'explorer')
else
false
getCmdPath: ->
if process.env.comspec
process.env.compec
else if process.env.SystemRoot
path.join(process.env.SystemRoot, 'System32', 'cmd.exe')
else
'cmd.exe'
# Public: Terminate the process.
kill: ->
return if @killed
+9 -6
Ver Arquivo
@@ -54,9 +54,10 @@ class CommandRegistry
#
# ## Arguments: Registering One Command
#
# * `selector` A {String} containing a CSS selector matching elements on which
# you want to handle the commands. The `,` combinator is not currently
# supported.
# * `target` A {String} containing a CSS selector or a DOM element. If you
# pass a selector, the command will be globally associated with all matching
# elements. The `,` combinator is not currently supported. If you pass a
# DOM element, the command will be associated with just that element.
# * `commandName` A {String} containing the name of a command you want to
# handle such as `user:insert-date`.
# * `callback` A {Function} to call when the given command is invoked on an
@@ -67,9 +68,11 @@ class CommandRegistry
#
# ## Arguments: Registering Multiple Commands
#
# * `selector` A {String} containing a CSS selector matching elements on which
# you want to handle the commands. The `,` combinator is not currently
# supported.
# * `target` A {String} containing a CSS selector or a DOM element. If you
# pass a selector, the commands will be globally associated with all
# matching elements. The `,` combinator is not currently supported.
# If you pass a DOM element, the command will be associated with just that
# element.
# * `commands` An {Object} mapping command names like `user:insert-date` to
# listener {Function}s.
#
+1 -4
Ver Arquivo
@@ -119,9 +119,6 @@ module.exports =
autoIndentOnPaste:
type: 'boolean'
default: true
normalizeIndentOnPaste:
type: 'boolean'
default: true
nonWordCharacters:
type: 'string'
default: "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"
@@ -152,7 +149,7 @@ module.exports =
default: false
undoGroupingInterval:
type: 'integer'
default: 500
default: 300
minimum: 0
description: 'Time interval in milliseconds within which operations will be grouped together in the undo history'
useHardwareAcceleration:
+252 -195
Ver Arquivo
@@ -6,7 +6,7 @@ CSON = require 'season'
path = require 'path'
async = require 'async'
pathWatcher = require 'pathwatcher'
{deprecate} = require 'grim'
Grim = require 'grim'
ScopedPropertyStore = require 'scoped-property-store'
ScopeDescriptor = require './scope-descriptor'
@@ -314,10 +314,12 @@ class Config
@settings = {}
@scopedSettingsStore = new ScopedPropertyStore
@usersScopedSettings = new CompositeDisposable
@usersScopedSettingPriority = {priority: 1000}
@configFileHasErrors = false
@configFilePath = fs.resolve(@configDirPath, 'config', ['json', 'cson'])
@configFilePath ?= path.join(@configDirPath, 'config.cson')
@transactDepth = 0
@prioritiesBySource = {}
@prioritiesBySource[@getUserConfigPath()] = 1000
###
Section: Config Subscription
@@ -337,32 +339,36 @@ class Config
# # do stuff with value
# ```
#
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples.
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` {String} name of the key to observe
# * `options` {Object}
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples.
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `callback` {Function} to call when the value of the key changes.
# * `value` the new value of the key
#
# Returns a {Disposable} with the following keys on which you can call
# `.dispose()` to unsubscribe.
observe: (scopeDescriptor, keyPath, options, callback) ->
args = Array::slice.call(arguments)
if args.length is 2
# observe(keyPath, callback)
[keyPath, callback, scopeDescriptor, options] = args
else if args.length is 3 and (Array.isArray(scopeDescriptor) or scopeDescriptor instanceof ScopeDescriptor)
# observe(scopeDescriptor, keyPath, callback)
[scopeDescriptor, keyPath, callback, options] = args
else if args.length is 3 and _.isString(scopeDescriptor) and _.isObject(keyPath)
# observe(keyPath, options, callback) # Deprecated!
[keyPath, options, callback, scopeDescriptor] = args
message = ""
message = "`callNow` was set to false. Use ::onDidChange instead. Note that ::onDidChange calls back with different arguments." if options.callNow == false
deprecate "Config::observe no longer supports options; see https://atom.io/docs/api/latest/Config. #{message}"
observe: ->
if arguments.length is 2
[keyPath, callback] = arguments
else if arguments.length is 3 and (_.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor)
Grim.deprecate """
Passing a scope descriptor as the first argument to Config::observe is deprecated.
Pass a `scope` in an options hash as the third argument instead.
"""
[scopeDescriptor, keyPath, callback] = arguments
else if arguments.length is 3 and (_.isString(arguments[0]) and _.isObject(arguments[1]))
[keyPath, options, callback] = arguments
scopeDescriptor = options.scope
if options.callNow?
Grim.deprecate """
Config::observe no longer takes a `callNow` option. Use ::onDidChange instead.
Note that ::onDidChange passes its callback different arguments.
See https://atom.io/docs/api/latest/Config
"""
else
console.error 'An unsupported form of Config::observe is being used. See https://atom.io/docs/api/latest/Config for details'
return
@@ -375,13 +381,14 @@ class Config
# Essential: Add a listener for changes to a given key path. If `keyPath` is
# not specified, your callback will be called on changes to any key.
#
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples.
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` (optional) {String} name of the key to observe. Must be
# specified if `scopeDescriptor` is specified.
# * `optional` (optional) {Object}
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples.
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `callback` {Function} to call when the value of the key changes.
# * `event` {Object}
# * `newValue` the new value of the key
@@ -390,12 +397,20 @@ class Config
#
# Returns a {Disposable} with the following keys on which you can call
# `.dispose()` to unsubscribe.
onDidChange: (scopeDescriptor, keyPath, callback) ->
args = Array::slice.call(arguments)
onDidChange: ->
if arguments.length is 1
[callback, scopeDescriptor, keyPath] = args
[callback] = arguments
else if arguments.length is 2
[keyPath, callback, scopeDescriptor] = args
[keyPath, callback] = arguments
else if _.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor
Grim.deprecate """
Passing a scope descriptor as the first argument to Config::onDidChange is deprecated.
Pass a `scope` in an options hash as the third argument instead.
"""
[scopeDescriptor, keyPath, callback] = arguments
else
[keyPath, options, callback] = arguments
scopeDescriptor = options.scope
if scopeDescriptor?
@onDidChangeScopedKeyPath(scopeDescriptor, keyPath, callback)
@@ -446,24 +461,40 @@ class Config
# atom.config.get(scopeDescriptor, 'editor.tabLength') # => 2
# ```
#
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` The {String} name of the key to retrieve.
# * `options` (optional) {Object}
# * `sources` (optional) {Array} of {String} source names. If provided, only
# values that were associated with these sources during {::set} will be used.
# * `excludeSources` (optional) {Array} of {String} source names. If provided,
# values that were associated with these sources during {::set} will not
# be used.
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
#
# Returns the value from Atom's default settings, the user's configuration
# file in the type specified by the configuration schema.
get: (scopeDescriptor, keyPath) ->
if arguments.length == 1
# cannot assign to keyPath for the sake of v8 optimization
globalKeyPath = scopeDescriptor
@getRawValue(globalKeyPath)
get: ->
if arguments.length > 1
if typeof arguments[0] is 'string' or not arguments[0]?
[keyPath, options] = arguments
{scope} = options
else
Grim.deprecate """
Passing a scope descriptor as the first argument to Config::get is deprecated.
Pass a `scope` in an options hash as the final argument instead.
"""
[scope, keyPath] = arguments
else
value = @getRawScopedValue(scopeDescriptor, keyPath)
value ?= @getRawValue(keyPath)
value
[keyPath] = arguments
if scope?
value = @getRawScopedValue(scope, keyPath, options)
value ? @getRawValue(keyPath, options)
else
@getRawValue(keyPath, options)
# Essential: Sets the value for a configuration setting.
#
@@ -494,60 +525,90 @@ class Config
# atom.config.get(['source.js'], 'editor.tabLength') # => 4
# ```
#
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` The {String} name of the key.
# * `value` The value of the setting. Passing `undefined` will revert the
# setting to the default value.
# * `options` (optional) {Object}
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `source` (optional) {String} The name of a file with which the setting
# is associated. Defaults to the user's config file.
#
# Returns a {Boolean}
# * `true` if the value was set.
# * `false` if the value was not able to be coerced to the type specified in the setting's schema.
set: (scopeSelector, keyPath, value) ->
if arguments.length < 3
value = keyPath
keyPath = scopeSelector
scopeSelector = undefined
set: ->
if arguments[0]?[0] is '.'
Grim.deprecate """
Passing a scope selector as the first argument to Config::set is deprecated.
Pass a `scopeSelector` in an options hash as the final argument instead.
"""
[scopeSelector, keyPath, value] = arguments
else
[keyPath, value, options] = arguments
scopeSelector = options?.scopeSelector
source = options?.source
unless value == undefined
source ?= @getUserConfigPath()
unless value is undefined
try
value = @makeValueConformToSchema(keyPath, value)
catch e
return false
if scopeSelector?
@setRawScopedValue(scopeSelector, keyPath, value)
@setRawScopedValue(source, scopeSelector, keyPath, value)
else
@setRawValue(keyPath, value)
@setRawValue(source, keyPath, value)
@emitChangeEvent()
@save() unless @configFileHasErrors
true
# Extended: Restore the global setting at `keyPath` to its default value.
# Essential: Restore the setting at `keyPath` to its default value.
#
# * `keyPath` The {String} name of the key.
# * `options` (optional) {Object}
# * `scopeSelector` (optional) {String}. See {::set}
# * `source` (optional) {String}. See {::set}
unset: (keyPath, options) ->
if typeof options is 'string'
Grim.deprecate """
Passing a scope selector as the first argument to Config::unset is deprecated.
Pass a `scopeSelector` in an options hash as the second argument instead.
"""
scopeSelector = keyPath
keyPath = options
else
{scopeSelector, source} = options ? {}
source ?= @getUserConfigPath()
if scopeSelector?
if keyPath?
settings = @scopedSettingsStore.propertiesForSourceAndSelector(source, scopeSelector)
if _.valueForKeyPath(settings, keyPath)?
@scopedSettingsStore.removePropertiesForSourceAndSelector(source, scopeSelector)
_.setValueForKeyPath(settings, keyPath, undefined)
settings = withoutEmptyObjects(settings)
@addScopedSettings(source, scopeSelector, settings, priority: @usersScopedSettingPriority) if settings?
@save() unless @configFileHasErrors
else
@scopedSettingsStore.removePropertiesForSource(source)
else
@set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath))
# Deprecated: Restore the global setting at `keyPath` to its default value.
#
# Returns the new value.
restoreDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
Grim.deprecate("Use ::unset instead.")
@unset(scopeSelector, keyPath)
@get(keyPath)
if scopeSelector?
settings = @scopedSettingsStore.propertiesForSourceAndSelector('user-config', scopeSelector)
if _.valueForKeyPath(settings, keyPath)?
@scopedSettingsStore.removePropertiesForSourceAndSelector('user-config', scopeSelector)
_.setValueForKeyPath(settings, keyPath, undefined)
settings = withoutEmptyObjects(settings)
@addScopedSettings('user-config', scopeSelector, settings, @usersScopedSettingPriority) if settings?
@save() unless @configFileHasErrors
@getDefault(scopeSelector, keyPath)
else
@set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath))
@get(keyPath)
# Extended: Get the global default value of the key path. _Please note_ that in most
# Deprecated: Get the global default value of the key path. _Please note_ that in most
# cases calling this is not necessary! {::get} returns the default value when
# a custom value is not specified.
#
@@ -555,35 +616,31 @@ class Config
# * `keyPath` The {String} name of the key.
#
# Returns the default value.
getDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
if scopeSelector?
defaultValue = @scopedSettingsStore.getPropertyValue(scopeSelector, keyPath, excludeSources: ['user-config'])
defaultValue ?= _.valueForKeyPath(@defaultSettings, keyPath)
getDefault: ->
Grim.deprecate("Use `::get(keyPath, {scope, excludeSources: [atom.config.getUserConfigPath()]})` instead")
if arguments.length is 1
[keyPath] = arguments
else
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
_.deepClone(defaultValue)
[scopeSelector, keyPath] = arguments
scope = [scopeSelector]
@get(keyPath, {scope, excludeSources: [@getUserConfigPath()]})
# Extended: Is the value at `keyPath` its default value?
# Deprecated: Is the value at `keyPath` its default value?
#
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
# * `keyPath` The {String} name of the key.
#
# Returns a {Boolean}, `true` if the current value is the default, `false`
# otherwise.
isDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
if scopeSelector?
settings = @scopedSettingsStore.propertiesForSourceAndSelector('user-config', scopeSelector)
not _.valueForKeyPath(settings, keyPath)?
isDefault: ->
Grim.deprecate("Use `not ::get(keyPath, {scope, sources: [atom.config.getUserConfigPath()]})?` instead")
if arguments.length is 1
[keyPath] = arguments
scopeSelector = '*'
else
not _.valueForKeyPath(@settings, keyPath)?
[scopeSelector, keyPath] = arguments
not @get(keyPath, {scope: [scopeSelector], sources: [@getUserConfigPath()]})?
# Extended: Retrieve the schema for a specific key path. The schema will tell
# you what type the keyPath expects, and other metadata about the config
@@ -601,47 +658,53 @@ class Config
schema = schema.properties[key]
schema
# Extended: Returns a new {Object} containing all of the global settings and
# Deprecated: Returns a new {Object} containing all of the global settings and
# defaults. Returns the scoped settings when a `scopeSelector` is specified.
#
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
getSettings: (scopeSelector) ->
settings = _.deepExtend(@settings, @defaultSettings)
if scopeSelector?
scopedSettings = @scopedSettingsStore.propertiesForSelector(scopeSelector)
settings = _.deepExtend(scopedSettings, settings)
settings
getSettings: ->
Grim.deprecate "Use ::get(keyPath) instead"
_.deepExtend({}, @defaultSettings, @scopedSettingsStore.getProperties('.xxx')...)
# Extended: Get the {String} path to the config file being used.
getUserConfigPath: ->
@configFilePath
# Extended: Suppress calls to handler functions registered with {::onDidChange}
# and {::observe} for the duration of `callback`. After `callback` executes,
# handlers will be called once if the value for their key-path has changed.
#
# * `callback` {Function} to execute while suppressing calls to handlers.
transact: (callback) ->
@transactDepth++
try
callback()
finally
@transactDepth--
@emitChangeEvent()
###
Section: Deprecated
###
getInt: (keyPath) ->
deprecate '''Config::getInt is no longer necessary. Use ::get instead.
Grim.deprecate '''Config::getInt is no longer necessary. Use ::get instead.
Make sure the config option you are accessing has specified an `integer`
schema. See the schema section of
https://atom.io/docs/api/latest/Config for more info.'''
parseInt(@get(keyPath))
getPositiveInt: (keyPath, defaultValue=0) ->
deprecate '''Config::getPositiveInt is no longer necessary. Use ::get instead.
Grim.deprecate '''Config::getPositiveInt is no longer necessary. Use ::get instead.
Make sure the config option you are accessing has specified an `integer`
schema with `minimum: 1`. See the schema section of
https://atom.io/docs/api/latest/Config for more info.'''
Math.max(@getInt(keyPath), 0) or defaultValue
toggle: (keyPath) ->
deprecate 'Config::toggle is no longer supported. Please remove from your code.'
Grim.deprecate 'Config::toggle is no longer supported. Please remove from your code.'
@set(keyPath, !@get(keyPath))
unobserve: (keyPath) ->
deprecate 'Config::unobserve no longer does anything. Call `.dispose()` on the object returned by Config::observe instead.'
Grim.deprecate 'Config::unobserve no longer does anything. Call `.dispose()` on the object returned by Config::observe instead.'
###
Section: Internal methods used by core
@@ -721,71 +784,64 @@ class Config
@configFileHasErrors = false
catch error
@configFileHasErrors = true
console.error "Failed to load user config '#{@configFilePath}'", error.message
console.error error.stack
@notifyFailure('Failed to load config.cson', error)
observeUserConfig: ->
try
@watchSubscription ?= pathWatcher.watch @configFilePath, (eventType) =>
@loadUserConfig() if eventType is 'change' and @watchSubscription?
catch error
console.error "Failed to watch user config '#{@configFilePath}'", error.message
console.error error.stack
@notifyFailure('Failed to watch user config', error)
unobserveUserConfig: ->
@watchSubscription?.close()
@watchSubscription = null
notifyFailure: (errorMessage, error) ->
message = "#{errorMessage}"
detail = error.stack
atom.notifications.addError(message, {detail, dismissable: true})
console.error message
console.error detail
save: ->
allSettings = global: @settings
allSettings = _.extend allSettings, @scopedSettingsStore.propertiesForSource('user-config')
CSON.writeFileSync(@configFilePath, allSettings)
settings = @scopedSettingsStore.propertiesForSource(@getUserConfigPath())
settings.global = settings['*']
delete settings['*']
CSON.writeFileSync(@configFilePath, settings)
###
Section: Private methods managing global settings
###
resetUserSettings: (newSettings) ->
@scopedSettingsStore.removePropertiesForSource(@getUserConfigPath())
unless isPlainObject(newSettings)
@settings = {}
@emitter.emit 'did-change'
@emitChangeEvent()
return
if newSettings.global?
scopedSettings = newSettings
newSettings = newSettings.global
delete scopedSettings.global
@resetUserScopedSettings(scopedSettings)
unless newSettings.global?
newSettings = {global: newSettings}
unsetUnspecifiedValues = (keyPath, value) =>
if isPlainObject(value)
keys = splitKeyPath(keyPath)
for key, childValue of value
continue unless value.hasOwnProperty(key)
unsetUnspecifiedValues(keys.concat([key]).join('.'), childValue)
for selector, settings of newSettings
unless settings is undefined
try
settings = @makeValueConformToSchema(null, settings)
catch e
continue
if selector is 'global'
@setRawValue(@getUserConfigPath(), null, settings)
else
@setRawValue(keyPath, undefined) unless _.valueForKeyPath(newSettings, keyPath)?
return
@setRawScopedValue(@getUserConfigPath(), selector, null, settings)
@setRecursive(null, newSettings)
unsetUnspecifiedValues(null, @settings)
@emitChangeEvent()
setRecursive: (keyPath, value) ->
if isPlainObject(value)
keys = splitKeyPath(keyPath)
for key, childValue of value
continue unless value.hasOwnProperty(key)
@setRecursive(keys.concat([key]).join('.'), childValue)
else
try
value = @makeValueConformToSchema(keyPath, value)
@setRawValue(keyPath, value)
catch e
console.warn("'#{keyPath}' could not be set. Attempted value: #{JSON.stringify(value)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")
getRawValue: (keyPath) ->
value = _.valueForKeyPath(@settings, keyPath)
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
getRawValue: (keyPath, options) ->
value = @getRawScopedValue(['xxx'], keyPath, options)
unless options?.sources?.length > 0
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
if value?
value = _.deepClone(value)
@@ -795,23 +851,17 @@ class Config
value
setRawValue: (keyPath, value) ->
setRawValue: (source, keyPath, value) ->
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
value = undefined if _.isEqual(defaultValue, value)
oldValue = _.clone(@get(keyPath))
_.setValueForKeyPath(@settings, keyPath, value)
newValue = @get(keyPath)
@emitter.emit 'did-change', {oldValue, newValue, keyPath} unless _.isEqual(newValue, oldValue)
@setRawScopedValue(source, '*', keyPath, value)
@emitChangeEvent()
observeKeyPath: (keyPath, options, callback) ->
callback(_.clone(@get(keyPath))) unless options.callNow == false
@emitter.on 'did-change', (event) =>
callback(event.newValue) if keyPath? and @isSubKeyPath(keyPath, event?.keyPath)
@observeScopedKeyPath(["xxx"], keyPath, callback)
onDidChangeKeyPath: (keyPath, callback) ->
@emitter.on 'did-change', (event) =>
callback(event) if not keyPath? or (keyPath? and @isSubKeyPath(keyPath, event?.keyPath))
@onDidChangeScopedKeyPath(["xxx"], keyPath, callback)
isSubKeyPath: (keyPath, subKeyPath) ->
return false unless keyPath? and subKeyPath?
@@ -820,10 +870,8 @@ class Config
_.isEqual(pathTokens, pathSubTokens)
setRawDefault: (keyPath, value) ->
oldValue = _.clone(@get(keyPath))
_.setValueForKeyPath(@defaultSettings, keyPath, value)
newValue = @get(keyPath)
@emitter.emit 'did-change', {oldValue, newValue, keyPath} unless _.isEqual(newValue, oldValue)
@emitChangeEvent()
setDefaults: (keyPath, defaults) ->
if defaults? and isPlainObject(defaults)
@@ -835,6 +883,7 @@ class Config
try
defaults = @makeValueConformToSchema(keyPath, defaults)
@setRawDefault(keyPath, defaults)
@emitChangeEvent()
catch e
console.warn("'#{keyPath}' could not set the default. Attempted default: #{JSON.stringify(defaults)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")
@@ -881,56 +930,45 @@ class Config
Section: Private Scoped Settings
###
resetUserScopedSettings: (newScopedSettings) ->
@usersScopedSettings?.dispose()
@usersScopedSettings = new CompositeDisposable
@usersScopedSettings.add @scopedSettingsStore.addProperties('user-config', newScopedSettings, @usersScopedSettingPriority)
@emitter.emit 'did-change'
emitChangeEvent: ->
@emitter.emit 'did-change' unless @transactDepth > 0
addScopedSettings: (source, selector, value, options) ->
settingsBySelector = {}
settingsBySelector[selector] = value
disposable = @scopedSettingsStore.addProperties(source, settingsBySelector, options)
@emitter.emit 'did-change'
@emitChangeEvent()
new Disposable =>
disposable.dispose()
@emitter.emit 'did-change'
@emitChangeEvent()
setRawScopedValue: (selector, keyPath, value) ->
setRawScopedValue: (source, selector, keyPath, value) ->
if keyPath?
newValue = {}
_.setValueForKeyPath(newValue, keyPath, value)
setValueAtKeyPath(newValue, keyPath, value)
value = newValue
settingsBySelector = {}
settingsBySelector[selector] = value
@usersScopedSettings.add @scopedSettingsStore.addProperties('user-config', settingsBySelector, @usersScopedSettingPriority)
@emitter.emit 'did-change'
@usersScopedSettings.add @scopedSettingsStore.addProperties(source, settingsBySelector, priority: @prioritiesBySource[source])
getRawScopedValue: (scopeDescriptor, keyPath) ->
getRawScopedValue: (scopeDescriptor, keyPath, options) ->
scopeDescriptor = ScopeDescriptor.fromObject(scopeDescriptor)
@scopedSettingsStore.getPropertyValue(scopeDescriptor.getScopeChain(), keyPath)
value = @scopedSettingsStore.getPropertyValue(scopeDescriptor.getScopeChain(), keyPath, options)
value
observeScopedKeyPath: (scopeDescriptor, keyPath, callback) ->
oldValue = @get(scopeDescriptor, keyPath)
observeScopedKeyPath: (scope, keyPath, callback) ->
callback(@get(keyPath, {scope}))
@onDidChangeScopedKeyPath scope, keyPath, ({newValue}) ->
callback(newValue)
callback(oldValue)
didChange = =>
newValue = @get(scopeDescriptor, keyPath)
callback(newValue) unless _.isEqual(oldValue, newValue)
oldValue = newValue
@emitter.on 'did-change', didChange
onDidChangeScopedKeyPath: (scopeDescriptor, keyPath, callback) ->
oldValue = @get(scopeDescriptor, keyPath)
didChange = =>
newValue = @get(scopeDescriptor, keyPath)
callback({oldValue, newValue, keyPath}) unless _.isEqual(oldValue, newValue)
oldValue = newValue
@emitter.on 'did-change', didChange
onDidChangeScopedKeyPath: (scope, keyPath, callback) ->
oldValue = _.deepClone(@get(keyPath, {scope}))
@emitter.on 'did-change', (event) =>
newValue = @get(keyPath, {scope})
unless _.isEqual(newValue, oldValue)
callback({newValue, oldValue})
oldValue = _.deepClone(newValue)
# TODO: figure out how to change / remove this. The return value is awkward.
# * language mode uses it for one thing.
@@ -996,7 +1034,11 @@ Config.addSchemaEnforcers
for prop, childSchema of schema.properties
continue unless value.hasOwnProperty(prop)
try
newValue[prop] = @executeSchemaEnforcers("#{keyPath}.#{prop}", value[prop], childSchema)
newKeyPath = if keyPath?
"#{keyPath}.#{prop}"
else
prop
newValue[prop] = @executeSchemaEnforcers(newKeyPath, value[prop], childSchema)
catch error
console.warn "Error setting item in object: #{error.message}"
newValue
@@ -1049,6 +1091,21 @@ splitKeyPath = (keyPath) ->
keyPathArray.push keyPath.substr(startIndex, keyPath.length)
keyPathArray
getValueAtKeyPath = (object, keyPath) ->
keys = splitKeyPath(keyPath)
for key in keys
object = object[key]
return unless object?
object
setValueAtKeyPath = (object, keyPath, value) ->
keys = splitKeyPath(keyPath)
while keys.length > 1
key = keys.shift()
object[key] ?= {}
object = object[key]
object[keys.shift()] = value
withoutEmptyObjects = (object) ->
resultObject = undefined
if isPlainObject(object)
+7 -7
Ver Arquivo
@@ -45,7 +45,7 @@ class Cursor extends Model
cursor: this
@emit 'moved', movedEvent
@emitter.emit 'did-change-position'
@emitter.emit 'did-change-position', movedEvent
@editor.cursorMoved(movedEvent)
@marker.onDidDestroy =>
@destroyed = true
@@ -202,7 +202,7 @@ class Cursor extends Model
[before, after] = @editor.getTextInBufferRange(range)
return false if /\s/.test(before) or /\s/.test(after)
nonWordCharacters = atom.config.get(@getScopeDescriptor(), 'editor.nonWordCharacters').split('')
nonWordCharacters = atom.config.get('editor.nonWordCharacters', scope: @getScopeDescriptor()).split('')
_.contains(nonWordCharacters, before) isnt _.contains(nonWordCharacters, after)
# Public: Returns whether this cursor is between a word's start and end.
@@ -476,7 +476,7 @@ class Cursor extends Model
endOfWordPosition or currentBufferPosition
getMoveNextWordBoundaryBufferPosition: (options) ->
deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead'
Grim.deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead'
@getNextWordBoundaryBufferPosition(options)
# Public: Retrieves the buffer position of where the current word starts.
@@ -636,7 +636,7 @@ class Cursor extends Model
# Returns a {RegExp}.
wordRegExp: ({includeNonWordCharacters}={}) ->
includeNonWordCharacters ?= true
nonWordCharacters = atom.config.get(@getScopeDescriptor(), 'editor.nonWordCharacters')
nonWordCharacters = atom.config.get('editor.nonWordCharacters', scope: @getScopeDescriptor())
segments = ["^[\t ]*$"]
segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+")
if includeNonWordCharacters
@@ -665,7 +665,7 @@ class Cursor extends Model
autoscroll: (options) ->
@editor.scrollToScreenRange(@getScreenRange(), options)
getBeginningOfNextParagraphBufferPosition: (editor) ->
getBeginningOfNextParagraphBufferPosition: ->
start = @getBufferPosition()
eof = @editor.getEofBufferPosition()
scanRange = [start, eof]
@@ -679,8 +679,8 @@ class Cursor extends Model
stop()
@editor.screenPositionForBufferPosition(position)
getBeginningOfPreviousParagraphBufferPosition: (editor) ->
start = @editor.getCursorBufferPosition()
getBeginningOfPreviousParagraphBufferPosition: ->
start = @getBufferPosition()
{row, column} = start
scanRange = [[row-1, column], [0,0]]
+27 -10
Ver Arquivo
@@ -67,24 +67,24 @@ class DisplayBuffer extends Model
oldConfigSettings = @configSettings
@configSettings =
scrollPastEnd: atom.config.get(scopeDescriptor, 'editor.scrollPastEnd')
softWrap: atom.config.get(scopeDescriptor, 'editor.softWrap')
softWrapAtPreferredLineLength: atom.config.get(scopeDescriptor, 'editor.softWrapAtPreferredLineLength')
preferredLineLength: atom.config.get(scopeDescriptor, 'editor.preferredLineLength')
scrollPastEnd: atom.config.get('editor.scrollPastEnd', scope: scopeDescriptor)
softWrap: atom.config.get('editor.softWrap', scope: scopeDescriptor)
softWrapAtPreferredLineLength: atom.config.get('editor.softWrapAtPreferredLineLength', scope: scopeDescriptor)
preferredLineLength: atom.config.get('editor.preferredLineLength', scope: scopeDescriptor)
subscriptions.add atom.config.onDidChange scopeDescriptor, 'editor.softWrap', ({newValue}) =>
subscriptions.add atom.config.onDidChange 'editor.softWrap', scope: scopeDescriptor, ({newValue}) =>
@configSettings.softWrap = newValue
@updateWrappedScreenLines()
subscriptions.add atom.config.onDidChange scopeDescriptor, 'editor.softWrapAtPreferredLineLength', ({newValue}) =>
subscriptions.add atom.config.onDidChange 'editor.softWrapAtPreferredLineLength', scope: scopeDescriptor, ({newValue}) =>
@configSettings.softWrapAtPreferredLineLength = newValue
@updateWrappedScreenLines() if @isSoftWrapped()
subscriptions.add atom.config.onDidChange scopeDescriptor, 'editor.preferredLineLength', ({newValue}) =>
subscriptions.add atom.config.onDidChange 'editor.preferredLineLength', scope: scopeDescriptor, ({newValue}) =>
@configSettings.preferredLineLength = newValue
@updateWrappedScreenLines() if @isSoftWrapped() and atom.config.get(scopeDescriptor, 'editor.softWrapAtPreferredLineLength')
@updateWrappedScreenLines() if @isSoftWrapped() and atom.config.get('editor.softWrapAtPreferredLineLength', scope: scopeDescriptor)
subscriptions.add atom.config.observe scopeDescriptor, 'editor.scrollPastEnd', (value) =>
subscriptions.add atom.config.observe 'editor.scrollPastEnd', scope: scopeDescriptor, (value) =>
@configSettings.scrollPastEnd = value
@updateWrappedScreenLines() if oldConfigSettings? and not _.isEqual(oldConfigSettings, @configSettings)
@@ -883,12 +883,29 @@ class DisplayBuffer extends Model
decorationForId: (id) ->
@decorationsById[id]
getDecorations: ->
getDecorations: (propertyFilter) ->
allDecorations = []
for markerId, decorations of @decorationsByMarkerId
allDecorations = allDecorations.concat(decorations) if decorations?
if propertyFilter?
allDecorations = allDecorations.filter (decoration) ->
for key, value of propertyFilter
return false unless decoration.properties[key] is value
true
allDecorations
getLineDecorations: (propertyFilter) ->
@getDecorations(propertyFilter).filter (decoration) -> decoration.isType('line')
getGutterDecorations: (propertyFilter) ->
@getDecorations(propertyFilter).filter (decoration) -> decoration.isType('gutter')
getHighlightDecorations: (propertyFilter) ->
@getDecorations(propertyFilter).filter (decoration) -> decoration.isType('highlight')
getOverlayDecorations: (propertyFilter) ->
@getDecorations(propertyFilter).filter (decoration) -> decoration.isType('overlay')
decorationsForScreenRowRange: (startScreenRow, endScreenRow) ->
decorationsByMarkerId = {}
for marker in @findMarkers(intersectsScreenRowRange: [startScreenRow, endScreenRow])
+18 -11
Ver Arquivo
@@ -1,9 +1,8 @@
{basename, join} = require 'path'
_ = require 'underscore-plus'
{Subscriber} = require 'emissary'
EmitterMixin = require('emissary').Emitter
{Emitter} = require 'event-kit'
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
fs = require 'fs-plus'
GitUtils = require 'git-utils'
{deprecate} = require 'grim'
@@ -45,7 +44,6 @@ Task = require './task'
module.exports =
class GitRepository
EmitterMixin.includeInto(this)
Subscriber.includeInto(this)
@exists: (path) ->
if git = @open(path)
@@ -75,6 +73,8 @@ class GitRepository
constructor: (path, options={}) ->
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@repo = GitUtils.open(path)
unless @repo?
throw new Error("No Git repository found searching path: #{path}")
@@ -88,13 +88,15 @@ class GitRepository
refreshOnWindowFocus ?= true
if refreshOnWindowFocus
{$} = require './space-pen-extensions'
@subscribe $(window), 'focus', =>
onWindowFocus = =>
@refreshIndex()
@refreshStatus()
window.addEventListener 'focus', onWindowFocus
@subscriptions.add new Disposable(-> window.removeEventListener 'focus', onWindowFocus)
if @project?
@subscribe @project.eachBuffer (buffer) => @subscribeToBuffer(buffer)
@subscriptions.add @project.eachBuffer (buffer) => @subscribeToBuffer(buffer)
# Public: Destroy this {GitRepository} object.
#
@@ -109,7 +111,7 @@ class GitRepository
@repo.release()
@repo = null
@unsubscribe()
@subscriptions.dispose()
###
Section: Event Subscription
@@ -403,10 +405,15 @@ class GitRepository
if path = buffer.getPath()
@getPathStatus(path)
@subscribe buffer.onDidSave(getBufferPathStatus)
@subscribe buffer.onDidReload(getBufferPathStatus)
@subscribe buffer.onDidChangePath(getBufferPathStatus)
@subscribe buffer.onDidDestroy => @unsubscribe(buffer)
bufferSubscriptions = new CompositeDisposable
bufferSubscriptions.add buffer.onDidSave(getBufferPathStatus)
bufferSubscriptions.add buffer.onDidReload(getBufferPathStatus)
bufferSubscriptions.add buffer.onDidChangePath(getBufferPathStatus)
bufferSubscriptions.add buffer.onDidDestroy =>
bufferSubscriptions.dispose()
@subscriptions.remove(bufferSubscriptions)
@subscriptions.add(bufferSubscriptions)
return
# Subscribes to editor view event.
checkoutHeadForEditor: (editor) ->
@@ -2,7 +2,8 @@ _ = require 'underscore-plus'
{deprecate} = require 'grim'
{specificity} = require 'clear-cut'
{Subscriber} = require 'emissary'
{GrammarRegistry, ScopeSelector} = require 'first-mate'
FirstMate = require 'first-mate'
{ScopeSelector} = FirstMate
ScopedPropertyStore = require 'scoped-property-store'
PropertyAccessors = require 'property-accessors'
@@ -11,20 +12,22 @@ Token = require './token'
# Extended: Syntax class holding the grammars used for tokenizing.
#
# An instance of this class is always available as the `atom.syntax` global.
# An instance of this class is always available as the `atom.grammars` global.
#
# The Syntax class also contains properties for things such as the
# language-specific comment regexes. See {::getProperty} for more details.
module.exports =
class Syntax extends GrammarRegistry
class GrammarRegistry extends FirstMate.GrammarRegistry
PropertyAccessors.includeInto(this)
Subscriber.includeInto(this)
atom.deserializers.add(this)
@deserialize: ({grammarOverridesByPath}) ->
syntax = new Syntax()
syntax.grammarOverridesByPath = grammarOverridesByPath
syntax
grammarRegistry = new GrammarRegistry()
grammarRegistry.grammarOverridesByPath = grammarOverridesByPath
grammarRegistry
atom.deserializers.add(this)
atom.deserializers.add(name: 'Syntax', deserialize: @deserialize) # Support old serialization
constructor: ->
super(maxTokensPerLine: 100)
@@ -34,6 +37,17 @@ class Syntax extends GrammarRegistry
createToken: (value, scopes) -> new Token({value, scopes})
# Extended: Select a grammar for the given file path and file contents.
#
# This picks the best match by checking the file path and contents against
# each grammar.
#
# * `filePath` A {String} file path.
# * `fileContents` A {String} of text for the file path.
#
# Returns a {Grammar}, never null.
selectGrammar: (filePath, fileContents) -> super
# Deprecated: Used by settings-view to display snippets for packages
@::accessor 'propertyStore', ->
deprecate("Do not use this. Use a public method on Config")
+4
Ver Arquivo
@@ -23,6 +23,10 @@ KeymapManager::loadUserKeymap = ->
if fs.isFileSync(userKeymapPath)
@loadKeymap(userKeymapPath, watch: true, suppressErrors: true)
KeymapManager::subscribeToFileReadFailure = ->
this.onDidFailToReadFile (error) ->
atom.notifications.addError('Failed to load keymap.cson', {detail: error.stack, dismissable: true})
# This enables command handlers registered via jQuery to call
# `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler.
jQuery.Event::abortKeyBinding = ->
+1 -1
Ver Arquivo
@@ -316,7 +316,7 @@ class LanguageMode
@editor.setIndentationForBufferRow(bufferRow, desiredIndentLevel)
getRegexForProperty: (scopeDescriptor, property) ->
if pattern = atom.config.get(scopeDescriptor, property)
if pattern = atom.config.get(property, scope: scopeDescriptor)
new OnigRegExp(pattern)
increaseIndentRegexForScopeDescriptor: (scopeDescriptor) ->
+50
Ver Arquivo
@@ -0,0 +1,50 @@
{Emitter, Disposable} = require 'event-kit'
Notification = require '../src/notification'
# Experimental: Allows messaging the user. This will likely change, dont use
# quite yet!
module.exports =
class NotificationManager
constructor: ->
@notifications = []
@emitter = new Emitter
###
Section: Events
###
onDidAddNotification: (callback) ->
@emitter.on 'did-add-notification', callback
###
Section: Adding Notifications
###
addSuccess: (message, options) ->
@addNotification(new Notification('success', message, options))
addInfo: (message, options) ->
@addNotification(new Notification('info', message, options))
addWarning: (message, options) ->
@addNotification(new Notification('warning', message, options))
addError: (message, options) ->
@addNotification(new Notification('error', message, options))
addFatalError: (message, options) ->
@addNotification(new Notification('fatal', message, options))
add: (type, message, options) ->
@addNotification(new Notification(type, message, options))
addNotification: (notification) ->
@notifications.push(notification)
@emitter.emit('did-add-notification', notification)
notification
###
Section: Getting Notifications
###
getNotifications: -> @notifications
+46
Ver Arquivo
@@ -0,0 +1,46 @@
{Emitter} = require 'event-kit'
# Experimental: This will likely change, do not use.
module.exports =
class Notification
constructor: (@type, @message, @options={}) ->
@emitter = new Emitter
@timestamp = new Date()
@dismissed = true
@dismissed = false if @isDismissable()
onDidDismiss: (callback) ->
@emitter.on 'did-dismiss', callback
getOptions: -> @options
getType: -> @type
getMessage: -> @message
getTimestamp: -> @timestamp
getDetail: -> @options.detail
isEqual: (other) ->
@getMessage() == other.getMessage() \
and @getType() == other.getType() \
and @getDetail() == other.getDetail()
dismiss: ->
return unless @isDismissable() and not @isDismissed()
@dismissed = true
@emitter.emit 'did-dismiss'
isDismissed: -> @dismissed
isDismissable: -> !!@options.dismissable
getIcon: ->
return @options.icon if @options.icon?
switch @type
when 'fatal' then 'bug'
when 'error' then 'flame'
when 'warning' then 'alert'
when 'info' then 'info'
when 'success' then 'check'
+5 -2
Ver Arquivo
@@ -7,9 +7,12 @@ class OverlayManager
{editor, overlayDecorations, lineHeightInPixels} = props
existingDecorations = null
for markerId, {isMarkerReversed, headPixelPosition, decorations} of overlayDecorations
for markerId, {headPixelPosition, tailPixelPosition, decorations} of overlayDecorations
for decoration in decorations
@renderOverlay(editor, decoration, headPixelPosition, lineHeightInPixels)
pixelPosition =
if decoration.position is 'tail' then tailPixelPosition else headPixelPosition
@renderOverlay(editor, decoration, pixelPosition, lineHeightInPixels)
existingDecorations ?= {}
existingDecorations[decoration.id] = true
+4 -2
Ver Arquivo
@@ -329,7 +329,8 @@ class PackageManager
@packageActivators.push([activator, types])
activatePackages: (packages) ->
@activatePackage(pack.name) for pack in packages
atom.config.transact =>
@activatePackage(pack.name) for pack in packages
@observeDisabledPackages()
# Activate a single package by name
@@ -344,7 +345,8 @@ class PackageManager
# Deactivate all packages
deactivatePackages: ->
@deactivatePackage(pack.name) for pack in @getLoadedPackages()
atom.config.transact =>
@deactivatePackage(pack.name) for pack in @getLoadedPackages()
@unobserveDisabledPackages()
# Deactivate the package with the given name
+14 -4
Ver Arquivo
@@ -156,7 +156,7 @@ class Package
catch e
console.warn "Failed to activate package named '#{@name}'", e.stack
@activationDeferred.resolve()
@activationDeferred?.resolve()
activateConfig: ->
return if @configActivated
@@ -254,7 +254,7 @@ class Package
grammarPaths = fs.listSync(grammarsDirPath, ['json', 'cson'])
for grammarPath in grammarPaths
try
grammar = atom.syntax.readGrammarSync(grammarPath)
grammar = atom.grammars.readGrammarSync(grammarPath)
grammar.packageName = @name
@grammars.push(grammar)
grammar.activate()
@@ -268,7 +268,7 @@ class Package
return Q() if @grammarsLoaded
loadGrammar = (grammarPath, callback) =>
atom.syntax.readGrammar grammarPath, (error, grammar) =>
atom.grammars.readGrammar grammarPath, (error, grammar) =>
if error?
console.warn("Failed to load grammar: #{grammarPath}", error.stack ? error)
else
@@ -338,7 +338,7 @@ class Package
reloadStylesheets: ->
oldSheets = _.clone(@stylesheets)
@loadStylesheets()
@stylesheetDisposables.dispose()
@stylesheetDisposables?.dispose()
@stylesheetDisposables = new CompositeDisposable
@stylesheetsActivated = false
@activateStylesheets()
@@ -408,6 +408,16 @@ class Package
@activationCommands[selector].push(commands...)
if @metadata.activationEvents?
deprecate """
Use `activationCommands` instead of `activationEvents` in your package.json
Commands should be grouped by selector as follows:
```json
"activationCommands": {
"atom-workspace": ["foo:bar", "foo:baz"],
"atom-text-editor": ["foo:quux"]
}
```
"""
if _.isArray(@metadata.activationEvents)
for eventName in @metadata.activationEvents
@activationCommands['atom-workspace'] ?= []
+4 -3
Ver Arquivo
@@ -8,7 +8,7 @@ class PaneAxisElement extends HTMLElement
detachedCallback: ->
@subscriptions.dispose()
setModel: (@model) ->
initialize: (@model) ->
@subscriptions.add @model.onDidAddChild(@childAdded.bind(this))
@subscriptions.add @model.onDidRemoveChild(@childRemoved.bind(this))
@subscriptions.add @model.onDidReplaceChild(@childReplaced.bind(this))
@@ -20,14 +20,15 @@ class PaneAxisElement extends HTMLElement
@classList.add('horizontal', 'pane-row')
when 'vertical'
@classList.add('vertical', 'pane-column')
this
childAdded: ({child, index}) ->
view = @model.getView(child)
view = atom.views.getView(child)
@insertBefore(view, @children[index])
callAttachHooks(view) # for backward compatibility with SpacePen views
childRemoved: ({child}) ->
view = @model.getView(child)
view = atom.views.getView(child)
view.remove()
childReplaced: ({index, oldChild, newChild}) ->
-3
Ver Arquivo
@@ -39,9 +39,6 @@ class PaneAxis extends Model
getOrientation: -> @orientation
getView: (object) ->
@container.getView(object)
getChildren: -> @children.slice()
getPanes: ->
+4 -3
Ver Arquivo
@@ -11,15 +11,16 @@ class PaneContainerElement extends HTMLElement
PaneContainerView ?= require './pane-container-view'
@__spacePenView = new PaneContainerView(this)
setModel: (@model) ->
initialize: (@model) ->
@subscriptions.add @model.observeRoot(@rootChanged.bind(this))
@__spacePenView.setModel(@model)
this
rootChanged: (root) ->
focusedElement = document.activeElement if @hasFocus()
@firstChild?.remove()
if root?
view = @model.getView(root)
view = atom.views.getView(root)
@appendChild(view)
callAttachHooks(view)
focusedElement?.focus()
@@ -45,7 +46,7 @@ class PaneContainerElement extends HTMLElement
y = pointB.y - pointA.y
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))
paneView = @model.getView(@model.getActivePane())
paneView = atom.views.getView(@model.getActivePane())
box = @boundingBoxForPaneView(paneView)
paneViews = _.toArray(@querySelectorAll('atom-pane'))
+3 -3
Ver Arquivo
@@ -23,7 +23,7 @@ class PaneContainerView extends View
@subscriptions.add @model.onDidChangeActivePaneItem(@onActivePaneItemChanged)
getRoot: ->
view = @model.getView(@model.getRoot())
view = atom.views.getView(@model.getRoot())
view.__spacePenView ? view
onActivePaneItemChanged: (activeItem) =>
@@ -55,7 +55,7 @@ class PaneContainerView extends View
@getActivePaneView()
getActivePaneView: ->
@model.getView(@model.getActivePane()).__spacePenView
atom.views.getView(@model.getActivePane()).__spacePenView
getActivePaneItem: ->
@model.getActivePaneItem()
@@ -64,7 +64,7 @@ class PaneContainerView extends View
@getActivePaneView()?.activeView
paneForUri: (uri) ->
@model.getView(@model.paneForUri(uri)).__spacePenView
atom.views.getView(@model.paneForUri(uri)).__spacePenView
focusNextPaneView: ->
@model.activateNextPane()

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais