Comparar commits

...

673 Commits

Autor SHA1 Mensagem Data
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
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
Kevin Sawicki 46ff794c8b Don't set the update query param on Windows 2014-11-19 15:58:51 -08:00
Ben Ogle 1406fbfe03 Merge pull request #4243 from atom/bo-remove-space-pen-docs
Remove space pen views from docs
2014-11-19 14:33:53 -08:00
Ben Ogle dde13a5d4e 💄 2014-11-19 14:33:24 -08:00
Ben Ogle bfc7995aee Blacklist space pen docs from making it into our docs. 2014-11-19 14:15:43 -08:00
Ben Ogle 7fd9c75d24 Hide the space pen views in the docs 2014-11-19 14:15:18 -08:00
Nathan Sobo 677be2df82 Merge pull request #4223 from atom/ns-deprecate-style-sheet-events
Deprecate style sheet event methods on ThemeManager
2014-11-19 14:59:20 -07:00
Kevin Sawicki b3bf47dd69 Prepare 0.149 2014-11-19 12:17:49 -08:00
Ben Ogle a25920da72 Merge pull request #4225 from atom/bo-error-events
Add onWillThrowError
2014-11-19 11:55:45 -08:00
Kevin Sawicki 9b28e7a47c Merge pull request #4240 from atom/ks-write-text-async-to-selection-clipboard
Write text async to selection clipboard
2014-11-19 11:52:46 -08:00
Ben Ogle db811cfa9e Upgrade metrics to use the new onDidThrowError arg 2014-11-19 11:38:50 -08:00
Kevin Sawicki 6d0be70dbc Spy on ipc.send and make it synchronous 2014-11-19 11:32:20 -08:00
Ben Ogle 74966bd547 Emit an event object from atom.onDidThrowError 2014-11-19 11:28:01 -08:00
Kevin Sawicki 488abc8c24 📝 Mention why ipc is used 2014-11-19 11:19:55 -08:00
Kevin Sawicki 362d7712ad Add selection type 2014-11-19 11:19:55 -08:00
Kevin Sawicki 6ed3626133 Remove sync call 2014-11-19 11:19:55 -08:00
Kevin Sawicki fc87c98261 Use async ipc call to write to selection clipboard 2014-11-19 11:19:55 -08:00
Max Brunsfeld 46a7ea5936 Merge pull request #4239 from atom/mb-always-normalize-indent-on-paste
Remove the `normalizeIndentOnPaste` setting. Always do it.
2014-11-19 11:14:31 -08:00
Max Brunsfeld f412d88edd ⬆️ language-sass@0.26.0 2014-11-19 09:33:24 -08:00
Nathan Sobo 49471070a3 Move public stylesheet related methods off of atom.themes
* Move atom.themes.getUserStylesheetPath to 
  atom.styles.getUserStyleSheetPath
* Deprecate atom.themes.requireStylesheet
2014-11-19 10:31:03 -07:00
Max Brunsfeld 0ca9d7b97e Remove the normalizeIndentOnPaste setting. Always do it. 2014-11-19 09:13:30 -08:00
Max Brunsfeld d42878164a ⬆️ language-yaml@0.20.0 2014-11-19 08:40:46 -08:00
Max Brunsfeld 9adad17e27 📝 Doc fullLine parameter to Selection::{copy,cut} 2014-11-18 22:38:20 -08:00
Max Brunsfeld be420b042c Merge pull request #4233 from atom/mb-paste-full-line
Add special paste behavior when copying/cutting w/ no selection
2014-11-18 22:26:23 -08:00
Max Brunsfeld 270642b2ea Add special paste behavior when copying/cutting w/ no selection 2014-11-18 18:58:25 -08:00
Max Brunsfeld 9a080bfd1b Merge pull request #4231 from atom/mb-fix-newline-indent
Restore correct indent behavior when inserting newlines
2014-11-18 17:38:55 -08:00
Max Brunsfeld 7c43ea7a0f Restore correct indent behavior when inserting newlines
When explicitly auto-indenting and when pasting, indentation is based
on the previous non-blank line. When simply inserting newlines,
the previous line is used, even if it is blank.

Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-18 17:27:43 -08:00
Kevin Sawicki 28c5bd7814 Use .ico icon URL 2014-11-18 16:58:57 -08:00
Kevin Sawicki 8c3bae4275 Kill the comma in the authors tag 2014-11-18 16:57:35 -08:00
Kevin Sawicki 71e3ab9d2b Try using comma entity 2014-11-18 16:50:12 -08:00
Kevin Sawicki a1634b2f9b ⬆️ grunt-atom-shell-installer@0.10 2014-11-18 16:44:43 -08:00
Kevin Sawicki fb6351d9d7 ⬆️ grunt-atom-shell-installer@0.9 2014-11-18 16:32:03 -08:00
Kevin Sawicki 90041b7115 Match author field to company name and cert 2014-11-18 16:25:30 -08:00
Kevin Sawicki d6ba6067b8 💄 2014-11-18 16:06:03 -08:00
Kevin Sawicki aface45084 Merge pull request #4224 from atom/ks-squirrel-events
Port chocolatey install actions to squirrel events
2014-11-18 15:37:04 -08:00
Kevin Sawicki 16fc52b351 Compute reg/setx paths once 2014-11-18 15:23:07 -08:00
Kevin Sawicki 56184be6fe Add missing comma 2014-11-18 15:23:07 -08:00
Kevin Sawicki 8f623db092 Add path argument to context menu commands 2014-11-18 15:23:07 -08:00
Kevin Sawicki 081c2efc98 Use reg/setx from %SystemRoot%\System32 folder 2014-11-18 15:23:07 -08:00
Kevin Sawicki 3296674605 📝 Doc spawn 2014-11-18 15:23:07 -08:00
Kevin Sawicki 1e18e2b4e5 📝 Doc removeCommandsFromPath 2014-11-18 15:23:07 -08:00
Kevin Sawicki 13b28c26f0 Add example reg query output 2014-11-18 15:23:07 -08:00
Kevin Sawicki 760f6d280a Remove bin folder from path on uninstall 2014-11-18 15:23:07 -08:00
Kevin Sawicki f39ca3ea48 Always return on error 2014-11-18 15:23:06 -08:00
Kevin Sawicki d379582248 Map a query exit code of 1 to the Path not being set 2014-11-18 15:23:06 -08:00
Kevin Sawicki 84f160f88e Capture stderr 2014-11-18 15:23:06 -08:00
Kevin Sawicki c3d1dd82f0 Handle empty path correctly 2014-11-18 15:23:06 -08:00
Kevin Sawicki 32ff599a61 stdoutg -> stdout 2014-11-18 15:23:06 -08:00
Kevin Sawicki cbdf93b075 Log path lookup 2014-11-18 15:23:06 -08:00
Kevin Sawicki c721300be4 📝 Add more comments 2014-11-18 15:23:06 -08:00
Kevin Sawicki 6630147b69 Spawn setx directly 2014-11-18 15:23:06 -08:00
Kevin Sawicki 08076a4af1 Only call callback once 2014-11-18 15:23:06 -08:00
Kevin Sawicki b9897d8b34 apm not atom 2014-11-18 15:23:06 -08:00
Kevin Sawicki 68fbff59d8 Add apm command stub 2014-11-18 15:23:05 -08:00
Kevin Sawicki 0b2bd468b5 Disable echo in atom.cmd 2014-11-18 15:23:05 -08:00
Kevin Sawicki a36eae8e4d Use setx to set path 2014-11-18 15:23:05 -08:00
Kevin Sawicki ed23058af0 Disable echo in command shim 2014-11-18 15:23:05 -08:00
Kevin Sawicki c3d8f4843a Use root atom folder in bin folder path 2014-11-18 15:23:05 -08:00
Kevin Sawicki 085933c55e Add logging 2014-11-18 15:23:05 -08:00
Kevin Sawicki 01987cb762 Use fs-plus 2014-11-18 15:23:05 -08:00
Kevin Sawicki 75a6c51ac7 Install atom command stub 2014-11-18 15:23:05 -08:00
Kevin Sawicki 1575ee9037 Return early on errors 2014-11-18 15:23:05 -08:00
Kevin Sawicki 64612d4734 Remove logging 2014-11-18 15:23:04 -08:00
Kevin Sawicki 3aac342c21 💄 2014-11-18 15:23:04 -08:00
Kevin Sawicki 69d3b3cfa2 Add missing /d argument 2014-11-18 15:23:04 -08:00
Kevin Sawicki 84232d76de Add missing /v argument 2014-11-18 15:23:04 -08:00
Kevin Sawicki dc69b07045 Log updates 2014-11-18 15:23:04 -08:00
Kevin Sawicki 971539c438 Add bin to path during install 2014-11-18 15:23:04 -08:00
Kevin Sawicki c36be85dd6 Ignore empty lines 2014-11-18 15:23:04 -08:00
Kevin Sawicki 4bbc498d1d Split on all newline characters 2014-11-18 15:23:04 -08:00
Kevin Sawicki 3ac992d5d5 Spawn command argument 2014-11-18 15:23:04 -08:00
Kevin Sawicki ddbedcee3e Add more logging 2014-11-18 15:23:04 -08:00
Kevin Sawicki ba8cc9e1c0 Call callback 2014-11-18 15:23:03 -08:00
Kevin Sawicki ec4a2a468e Call getPath from updatePath 2014-11-18 15:23:03 -08:00
Kevin Sawicki f09423e020 Log path from registry 2014-11-18 15:23:03 -08:00
Kevin Sawicki 7e34e8c4ed Call addToRegisry from installMenu 2014-11-18 15:23:03 -08:00
Kevin Sawicki cc785de974 Implementing uninstalling context menus 2014-11-18 15:23:03 -08:00
Kevin Sawicki a8c4d2e4ca Remove unused methods 2014-11-18 15:23:03 -08:00
Kevin Sawicki d918eb6fa7 Install directory menus 2014-11-18 15:23:03 -08:00
Kevin Sawicki 69efdc2292 Remove logging 2014-11-18 15:23:03 -08:00
Kevin Sawicki fc891f8706 Add missing callback params 2014-11-18 15:23:03 -08:00
Kevin Sawicki 9fc96ba7d4 Add more logging 2014-11-18 15:23:02 -08:00
Kevin Sawicki b8a263c570 Ignore errors 2014-11-18 15:23:02 -08:00
Kevin Sawicki c9a9b51238 Add add argument 2014-11-18 15:23:02 -08:00
Kevin Sawicki 13d16b4723 Log arguments 2014-11-18 15:23:02 -08:00
Kevin Sawicki ddacfd7d5f Use code when signal is not set 2014-11-18 15:23:02 -08:00
Kevin Sawicki 932207b106 Log errors 2014-11-18 15:23:02 -08:00
Kevin Sawicki 2c39f3515b Add force option 2014-11-18 15:23:02 -08:00
Kevin Sawicki 8e53b2d507 Add Open with Atom file context menu 2014-11-18 15:23:02 -08:00
Ben Ogle 9bd7141359 Upgrade deprecation cop for some issue fixes 2014-11-18 15:09:43 -08:00
Ben Ogle e534997bf9 Specs for the error handler. 2014-11-18 14:42:03 -08:00
Ben Ogle db9de34993 Add onWillThrowError 2014-11-18 14:42:03 -08:00
Max Brunsfeld 6f95f51da2 ⬆️ language-coffee-script@0.38.0 2014-11-18 11:05:02 -08:00
Max Brunsfeld a67743b5cd ⬆️ language-python@0.24.0 2014-11-18 11:04:27 -08:00
Ben Ogle 2a56e70110 Fix logCursorScopes
Close #4204
2014-11-18 11:00:11 -08:00
Ben Ogle eaedb14942 Upgrade command-palette to use new APIs 2014-11-18 10:50:57 -08:00
Kevin Sawicki c7cd084e24 ⬆️ settings-view@0.161 2014-11-18 10:47:12 -08:00
Kevin Sawicki 685a2c088b Prepare 0.148 2014-11-18 10:14:48 -08:00
Nathan Sobo be7111f007 Deprecate style sheet events on ThemeManager
They are now supplanted by methods on the StyleManager located at
`atom.styles`.
2014-11-18 10:57:07 -07:00
Nathan Sobo 59c28c0f76 Clarify documentation 2014-11-18 10:56:28 -07:00
Nathan Sobo 27331cb379 Publicize and document StyleManager 2014-11-18 10:50:55 -07:00
Nathan Sobo 52b5fff537 Make link more specific in guide doc 2014-11-18 10:36:14 -07:00
Kevin Sawicki 6fbd9fb8f8 Add loading gif for installer 2014-11-18 09:05:13 -08:00
Max Brunsfeld 5996fcbc83 Merge pull request #4219 from atom/mb-normalize-multicursor-indent
Normalize indent on paste with multiple selections
2014-11-17 20:08:17 -08:00
Max Brunsfeld e34eb151ca Respect 'normalizeIndentOnPaste even w/ multiple selections 2014-11-17 19:24:37 -08:00
Max Brunsfeld 4ee1987af4 Don't rely on clipboard metadata format in editor specs
In order to fix indent-normalization with multiple selections,
I want to change the format of this metadata
2014-11-17 19:23:02 -08:00
Nathan Sobo 91652e1174 Fix link, add link 2014-11-17 20:02:44 -07:00
Ben Ogle cbf22201e6 Merge pull request #3922 from atom/bo-deprecate-exports
Deprecate exports
2014-11-17 18:00:57 -08:00
Kevin Sawicki 040b99b2ff ⬆️ rcedit@0.3 2014-11-17 17:54:23 -08:00
Max Brunsfeld c4eecbb380 💄 2014-11-17 17:47:22 -08:00
Kevin Sawicki d235180547 ⬆️ rcedit@0.2 to handle spawn errors 2014-11-17 17:39:28 -08:00
Ben Ogle a42b560c24 Dont allow TextEditor export in tasks 2014-11-17 17:38:11 -08:00
Kevin Sawicki 2894d87ff8 Listen for spawn error events and log them 2014-11-17 17:34:54 -08:00
Ben Ogle b15e101b20 Merge pull request #4214 from atom/upgrading-themes
Upgrading theme guides
2014-11-17 17:23:46 -08:00
Max Brunsfeld 6cf52a7fb7 Merge branch 'mb-cleanup-editor-spec' 2014-11-17 17:10:40 -08:00
Kevin Sawicki 8cf20a6996 Merge pull request #4215 from atom/ks-toggle-menu-bar
Support automatically hiding the menu bar
2014-11-17 17:07:04 -08:00
Max Brunsfeld 24432018ec Reorganize editor auto-indent specs 2014-11-17 16:59:57 -08:00
Max Brunsfeld 5ec38f84c5 Reorganize editor normalizeIndentOnPaste specs 2014-11-17 16:59:56 -08:00
Kevin Sawicki 40ffe2a306 📝 Swap OS order 2014-11-17 16:52:48 -08:00
Ben Ogle b1eceb03dc Export TextEditor 2014-11-17 16:51:29 -08:00
Ben Ogle dde69f8da4 Remove the docs readme
It is not used and just displays mis-information
2014-11-17 16:50:33 -08:00
Ben Ogle a525d5267b Deprecate the Workspace classes 2014-11-17 16:50:33 -08:00
Ben Ogle f7951aa57c Update messages so they are less painful in specs 2014-11-17 16:50:33 -08:00
Ben Ogle a63e058fa5 Deprecate all the views 2014-11-17 16:50:32 -08:00
Ben Ogle 09327eae75 Add jquery to dependencies. 2014-11-17 16:50:32 -08:00
Ben Ogle edd48d71ae Add event-kit to exports 2014-11-17 16:50:02 -08:00
Ben Ogle 2faf8bc57b Deprecate exported react 2014-11-17 16:50:02 -08:00
Ben Ogle aac3d7a559 Deprecate space-pen exports 2014-11-17 16:50:02 -08:00
Ben Ogle d914ae2a62 Use new panel classes 2014-11-17 16:46:56 -08:00
Ben Ogle 2710d40403 Change link titles 2014-11-17 16:46:56 -08:00
Ben Ogle d327d4923f Stylesheets -> Selectors 2014-11-17 16:46:56 -08:00
Ben Ogle dd0bed9bff Add .overlay to the list 2014-11-17 16:46:56 -08:00
Ben Ogle ff78a5b075 Add bit about deprecation cop 2014-11-17 16:46:56 -08:00
Ben Ogle 856370f522 Add one more bullet point 2014-11-17 16:46:56 -08:00
Ben Ogle 041d3f5c4c Fix link 2014-11-17 16:46:56 -08:00
Ben Ogle 3969c71932 Add some comments to the examples for clarity 2014-11-17 16:46:56 -08:00
Ben Ogle 133bf0cedb Update title to reference packages too 2014-11-17 16:46:56 -08:00
Ben Ogle f168aafc33 Tiny 💄 change 2014-11-17 16:46:56 -08:00
Ben Ogle d237b3448c Add theme guides to the index 2014-11-17 16:46:56 -08:00
Nathan Sobo bbaf908bb2 Add example links 2014-11-17 16:46:56 -08:00
Nathan Sobo 9d947d994e Add syntax theme upgrade guide 2014-11-17 16:46:56 -08:00
Nathan Sobo e2ecff5e23 Talk about context-targeted style sheets 2014-11-17 16:46:56 -08:00
Nathan Sobo decae9e34c Start on upgrading UI theme guide 2014-11-17 16:46:55 -08:00
Kevin Sawicki 4896741f0c 📝 Mention Alt toggles 2014-11-17 16:40:15 -08:00
Kevin Sawicki c360ccc62b Only register command on Windows & Linux 2014-11-17 16:40:15 -08:00
Kevin Sawicki 913c002ee4 🐧 Add Toggle Menu Bar to View menu 2014-11-17 16:40:15 -08:00
Kevin Sawicki 59c405d846 Mention Alt shows the menu bar 2014-11-17 16:40:15 -08:00
Kevin Sawicki a9826653e1 Set autoHideMenuBar on properties object 2014-11-17 16:40:15 -08:00
Kevin Sawicki b47d52d919 Always set menu bar visibility when changing autohide 2014-11-17 16:40:15 -08:00
Kevin Sawicki 7422f0ab1b Set menu bar visible when no longer autohiding 2014-11-17 16:40:15 -08:00
Kevin Sawicki 18c6c84d35 ⬆️ donna@1.0.7 2014-11-17 16:40:15 -08:00
Kevin Sawicki 7bcf92e55a Implement menu bar toggling 2014-11-17 16:40:14 -08:00
Kevin Sawicki ee7d4003de Add toggle menu bar item 2014-11-17 16:40:14 -08:00
Kevin Sawicki 79e50084a9 Set description, not title 2014-11-17 16:40:14 -08:00
Kevin Sawicki 73a70d430f Add core.autoHideMenuBar 2014-11-17 16:40:14 -08:00
Kevin Sawicki 503b4ce2a4 ⬆️ legal-eagle@0.6 2014-11-17 16:40:03 -08:00
Ben Ogle 094ccbc1f2 Upgrade themes to fix git-status tree-view colors 2014-11-17 16:37:21 -08:00
Ben Ogle 434ab5174b Merge pull request #4216 from atom/bo-panel-classes
Use classes on atom-panels rather than location attributes
2014-11-17 16:20:23 -08:00
Ben Ogle 1b85810735 Use classes rather than location attributes 2014-11-17 16:07:53 -08:00
Ben Ogle 0c75a4fd9c Upgrade deprecation-cop
Fixes suggestion to use .editor[mini] to suggest
atom-text-editor
2014-11-17 15:57:03 -08:00
Nathan Sobo d3f2798472 💄 2014-11-17 16:55:30 -07:00
Kevin Sawicki c88c18c042 ⬆️ legal-eagle@0.5 2014-11-17 15:40:03 -08:00
Kevin Sawicki cb7d4c8638 Call exit on process global 2014-11-17 15:40:03 -08:00
Max Brunsfeld 4a9d0ab4d3 Merge pull request #4192 from atom/mb-auto-indent-on-paste
Add auto-indent when pasting
2014-11-17 15:22:15 -08:00
Kevin Sawicki ac029d300a Merge pull request #4196 from atom/atom-shell-v0.19.2
Upgrade to atom-shell@0.19.2
2014-11-17 13:37:30 -08:00
Max Brunsfeld 8fe0b7fb7b Update description of 'autoIndent' config option 2014-11-17 11:02:22 -08:00
Max Brunsfeld c6c58ebc3e Remove extra blank line 2014-11-17 11:00:24 -08:00
Max Brunsfeld 32ac99fd3e Add description to 'editor.autoIndent' config option 2014-11-17 10:47:58 -08:00
Max Brunsfeld 175a8b6968 Provide separate config option for auto-indent on paste
This way, this option (`autoIndentOnPaste`) can be turned off for
indentation-sensitive languages like coffeescript.
2014-11-17 10:30:13 -08:00
Kevin Sawicki 6708388c29 Merge pull request #4211 from atom/ks-middle-paste-on-linux
Support middle mouse paste on Linux
2014-11-17 09:59:32 -08:00
Kevin Sawicki 958b19bd83 Cover empty clipboard case 2014-11-17 09:08:29 -08:00
Kevin Sawicki e40dc5c4a6 💄 2014-11-17 08:54:41 -08:00
Kevin Sawicki 12ff54c0bd Add spec for middle mouse paste 2014-11-17 08:54:37 -08:00
Max Brunsfeld 83040d13c7 Base suggested indent level on previous non-blank row
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-17 08:53:29 -08:00
Max Brunsfeld ebc9a6bf51 Don't auto-indent current line when pasting after non-whitespace characters
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-17 08:53:14 -08:00
Max Brunsfeld c8ad232c31 Respect the editor.autoIndent option when pasting
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-17 08:52:51 -08:00
Kevin Sawicki cfd918977b Only paste on middle mouse button 2014-11-17 08:43:16 -08:00
Kevin Sawicki e7efaeaf17 Listen for middle mouse paste on linux 2014-11-17 08:39:56 -08:00
Kevin Sawicki e849fc45ff Merge pull request #4209 from stramel/patch-1
Update linux.md
2014-11-17 08:39:02 -08:00
Kevin Sawicki 9054c7a120 ⬆️ language-c@0.31 2014-11-17 08:38:24 -08:00
Michael Stramel 60c042bd81 Update linux.md
Update `git fetch` command to include the prune flag which will remove remote branches that no longer exist.
2014-11-17 10:25:04 -06:00
Cheng Zhao 495ba3571e ⬆️ atom-shell@0.19.2 2014-11-15 17:14:10 +08:00
Ben Ogle b8776425fd Merge pull request #4194 from atom/bo-fix-scoped-config-default
Fix resetting scoped config defaults
2014-11-14 15:41:04 -08:00
Ben Ogle 693fd43449 Fix resetting scoped config defaults
It would write an empty object for the parent key when there were no
other objects in the parent key.

Closes #4175
2014-11-14 15:11:43 -08:00
Kevin Sawicki 71f80809c0 Assign buildDir at top of function 2014-11-14 14:59:06 -08:00
Kevin Sawicki db13a40f0a Remove outdated markdown task 2014-11-14 14:47:25 -08:00
Kevin Sawicki edf7e06b8d Merge pull request #4191 from atom/ks-upload-windows-installer
Upload Squirrel Windows assets to releases
2014-11-14 14:44:50 -08:00
Kevin Sawicki 442abece14 Create windows installer on CI 2014-11-14 14:17:07 -08:00
Kevin Sawicki 5c143bfc6e Return assets 2014-11-14 14:14:16 -08:00
Kevin Sawicki 51354f2326 Upload RELEASES and .nupkg files 2014-11-14 14:13:44 -08:00
Kevin Sawicki 1177508a45 Add missing ) 2014-11-14 12:02:15 -08:00
Kevin Sawicki 4bbffd3589 Upload AtomSetup.exe on Windows 2014-11-14 12:00:20 -08:00
Ben Ogle 2266c794b4 Upgrade tabs and themes
Scrolls when lots of tabs
2014-11-14 11:06:42 -08:00
Max Brunsfeld 562ee58506 Merge pull request #4188 from atom/mb-small-cleanup
Clean up TextEditor::pasteText
2014-11-14 10:00:22 -08:00
Max Brunsfeld fa96adc2ce Clean up TextEditor::pasteText 2014-11-14 09:33:48 -08:00
Nathan Sobo c46088e89a Merge pull request #4165 from atom/ns-shadow-dom-style-updates
Make it easier to style atom-text-editor from outside its shadow root
2014-11-14 08:18:35 -07:00
Kevin Sawicki 131ae0f9f7 Add visible to picked keys 2014-11-13 17:54:14 -08:00
Kevin Sawicki 49828b9681 Merge pull request #3815 from atom/squirrel-win-updates
Set up auto-updates on Windows
2014-11-13 17:53:29 -08:00
Kevin Sawicki 141430ab0a 💄 2014-11-13 17:37:29 -08:00
Kevin Sawicki 807b4b223b Remove update menu items on Windows
These will be re-added before the first release where squirrel update
assets are available on the release.
2014-11-13 17:31:40 -08:00
Kevin Sawicki 89246f213a ⬆️ to grunt-atom-shell-installer@0.7 2014-11-13 17:31:07 -08:00
Kevin Sawicki a6fa2ff30a Use installUpdate 2014-11-13 17:31:07 -08:00
Kevin Sawicki 7f32c9a3f7 Don't auto check when setting feed URL 2014-11-13 17:31:07 -08:00
Kevin Sawicki 18b2433a99 Remove call to deleted function 2014-11-13 17:31:07 -08:00
Kevin Sawicki 51b9964f7e Don't wrap in cmd.exe 2014-11-13 17:31:07 -08:00
Kevin Sawicki 9084122a5c cmdArgs -> args 2014-11-13 17:31:07 -08:00
Kevin Sawicki 9ff07e0fc2 💄 2014-11-13 17:31:07 -08:00
Kevin Sawicki 7ba47840d8 Consolidate squirrel update code 2014-11-13 17:31:07 -08:00
Kevin Sawicki 327e8476dd 💄 2014-11-13 17:31:06 -08:00
Kevin Sawicki 18eaec374c Spawn Update.exe through cmd.exe /s /c 2014-11-13 17:31:06 -08:00
Kevin Sawicki 430a36ac42 Call spawn on ChildProcess 2014-11-13 17:31:06 -08:00
Kevin Sawicki 508ca12be9 spawn -> spawnUpdate 2014-11-13 17:31:06 -08:00
Kevin Sawicki adf7e17fce Use spawn instead of execFile 2014-11-13 17:31:06 -08:00
Kevin Sawicki 9c675f387a Use spawn instead of execFile for squirrel events 2014-11-13 17:31:06 -08:00
Kevin Sawicki 5770366c00 Just use first argv value 2014-11-13 17:31:06 -08:00
Kevin Sawicki f2581e8d96 Add missing -- prefix 2014-11-13 17:31:06 -08:00
Kevin Sawicki d7d678c082 Parse squirrel event from process.argv 2014-11-13 17:31:06 -08:00
Kevin Sawicki 44181457c5 Add/remove shorcuts on install/uninstall 2014-11-13 17:31:06 -08:00
Kevin Sawicki f9b27aecf5 Pop instead of reversing 2014-11-13 17:31:06 -08:00
Kevin Sawicki ddbb0ae1db Log when updated 2014-11-13 17:31:05 -08:00
Kevin Sawicki fec2567283 📝 release -> releases 2014-11-13 17:31:05 -08:00
Kevin Sawicki ad8a020c29 Trim output 2014-11-13 17:31:05 -08:00
Kevin Sawicki 06c04779bf Delete installer dir during build 2014-11-13 17:31:05 -08:00
Kevin Sawicki 1a047a8e14 Use skinny arrow 2014-11-13 17:31:05 -08:00
Kevin Sawicki 0cf8666286 Expect JSON from --download output 2014-11-13 17:31:05 -08:00
Kevin Sawicki 7c02b7e431 Remove chocolatey logging message 2014-11-13 17:31:05 -08:00
Kevin Sawicki 6c55cff603 Use default auto updater when no update.exe 2014-11-13 17:31:05 -08:00
Kevin Sawicki c64895a621 Check for updates when feed URL is set 2014-11-13 17:31:05 -08:00
Kevin Sawicki 9dc3f2c909 Add missing @ before emit calls 2014-11-13 17:31:05 -08:00
Kevin Sawicki 1dc2ee743e Handle command line squirrel events 2014-11-13 17:31:05 -08:00
Kevin Sawicki 1f7967d17f Export instance of AutoUpdater 2014-11-13 17:31:05 -08:00
Kevin Sawicki 916729fbd5 Match param and ivar names 2014-11-13 17:31:04 -08:00
Kevin Sawicki 1922536927 💄 2014-11-13 17:31:04 -08:00
Kevin Sawicki de89f90700 update-downloaded expects multiple arguments, not an object 2014-11-13 17:31:04 -08:00
Kevin Sawicki 09f1dff502 Make releaseDate a Date 2014-11-13 17:31:04 -08:00
Kevin Sawicki 9a0414da6f Invoke quitAndInstall from quiteAndUpdate callback 2014-11-13 17:31:04 -08:00
Kevin Sawicki 119fc7f4f2 DRY up Update.exe path computing 2014-11-13 17:31:04 -08:00
Kevin Sawicki 481e0b8b6c Use execFile from child_process
This will make it easier to extract to Atom Shell since BufferedProcess
is internal to Atom.
2014-11-13 17:31:04 -08:00
Kevin Sawicki 1b69f2db46 💄 2014-11-13 17:31:04 -08:00
Kevin Sawicki 1b877c76b9 path.dirName -> path.dirname 2014-11-13 17:31:04 -08:00
Daniel Hengeveld 1fa791fc7a Fix relative import for auto-updater 2014-11-13 17:31:04 -08:00
Paul Betts e8a4867ff7 Come Correct with requires 2014-11-13 17:31:04 -08:00
Paul Betts 629717caea Add updates to menu 2014-11-13 17:31:03 -08:00
Paul Betts 0d6253555b copy pasta mistake 2014-11-13 17:31:03 -08:00
Paul Betts 63d9edcc40 First hack at a Win32 auto-updater 2014-11-13 17:31:03 -08:00
Paul Betts bc2f217e7c Handle progress output (by ignoring it) 2014-11-13 17:31:03 -08:00
Paul Betts 7381bd09b1 Save point before Boss Fight 2014-11-13 17:31:03 -08:00
Paul Betts 379bd852d2 Disable the updates shim on Win32, include our own JS version 2014-11-13 17:31:03 -08:00
Max Brunsfeld a9ee6e5d43 ⬆️ deprecation-cop
for new deprecated selectors list
2014-11-13 16:47:05 -08:00
Max Brunsfeld 2bef377e99 ⬆️ text-buffer to throw exceptions for invalid tx operations 2014-11-13 16:30:45 -08:00
Nathan Sobo 7f326421d7 Upgrade existing selectors after attaching atom-styles element
Style elements don’t have a .sheet property until they are actually
attached to the DOM.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-13 16:04:57 -08:00
Nathan Sobo 3546f21af7 Spy on console.warn to prevent spamming in the specs 2014-11-13 16:04:57 -08:00
Nathan Sobo 441dcfb56a Add specs for atom-text-editor shadow DOM selector upgrades
And cover one more case with `.editor` plus pseudo-classes

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-13 16:04:57 -08:00
Nathan Sobo 42d9ef397d Automatically upgrade syntax themes for shadow DOM compatibility
If a given selector in a stylesheet targeting the atom-text-editor
context references `.editor` or `.editor-colors`, we automatically
replace these with the appropriate `:host` pseudo-class expressions.
If the selector already contains the :host pseudo-class, we perform no
upgrade.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-13 16:04:57 -08:00
Nathan Sobo 10eb89f078 ⬆️ less-cache to fix import detection bug 2014-11-13 16:04:57 -08:00
Nathan Sobo 8b2482af22 ⬆️ atom-dark-ui for scrollbar styling across shadow boundaries 2014-11-13 16:04:57 -08:00
Nathan Sobo a2ca59bf05 ⬆️ less-cache for /deep/ combinator support 2014-11-13 16:04:57 -08:00
Nathan Sobo 91f11868ea ⬆️ Bundled UI themes to support editor shadow DOM 2014-11-13 16:04:57 -08:00
Nathan Sobo 2c19e6a6a4 ⬆️ settings-view to support shadow DOM in mini editors 2014-11-13 16:04:57 -08:00
Nathan Sobo e7ebe0a5c4 Upgrade bundled themes to support the shadow DOM 2014-11-13 16:04:57 -08:00
Nathan Sobo 95ec0d8162 Replaces usages of .mini selector with [mini] 2014-11-13 16:04:57 -08:00
Nathan Sobo 0a4f5a365a Add missing less imports to pass lesslint 2014-11-13 16:04:57 -08:00
Nathan Sobo b6b6b6d12b Add ‘mini’ attribute to TextEditorElement if .isMini() is true on model 2014-11-13 16:04:57 -08:00
Nathan Sobo 9f194ff4df Create an empty TextBuffer if needed in TextEditor constructor 2014-11-13 16:04:57 -08:00
Nathan Sobo ed6ca9cd06 Remove .editor class to force themes to style background via :host
The goal is to allow the editor’s styling to be overridden as follows:

atom-text-editor {
  background: black;
  color: white;
}

If we retain these classes, themes will continue to style the root
element of the editor and destroy the ability to style the editor in
this way. You would instead have to do the following:

atom-text-editor::shadow .editor {
  background: black;
  color: white;
}

This is way less intuitive and confusing for people.
2014-11-13 16:04:57 -08:00
Nathan Sobo 08971562cd Store useShadowDOM setting when TextEditorElement is created
Rather than reading it repeatedly, since the value could potentially
change over time.
2014-11-13 16:04:56 -08:00
Nathan Sobo 263ff21cc1 Clean up shadow-DOM-specific text editor style sheet 2014-11-13 16:04:24 -08:00
Nathan Sobo 99b08826dd Style non-shadow DOM editor with it’s own style sheet
Trying to style both modes of the text editor with the same style sheet
is proving to be more trouble than it’s worth. This prepares the shadow
DOM style sheet to diverge more radically to enable the background color
to be overridden from the outside more easily.
2014-11-13 16:04:24 -08:00
Ben Ogle 417e00b938 Upgrade find and replace to 0.147.0 2014-11-13 16:00:32 -08:00
Kevin Sawicki f8bb40c48f Merge pull request #4170 from atom/ks-use-grunt-installer-plugin
Use Grunt plugin to build Windows installer
2014-11-13 09:07:06 -08:00
Kevin Sawicki 01b75c4393 Use buildDir to build setup exe path 2014-11-13 08:46:25 -08:00
Kevin Sawicki 9f1ffeee25 Sign AtomSetup.exe 2014-11-13 08:46:25 -08:00
Kevin Sawicki c55faac0a9 ⬆️ grunt-atom-shell-installer@0.6 2014-11-13 08:46:25 -08:00
Kevin Sawicki aaa50bae90 ⬆️ grunt-atom-shell-installer@0.5 2014-11-13 08:46:25 -08:00
Kevin Sawicki b0c4910815 Add community 2014-11-13 08:46:25 -08:00
Kevin Sawicki 654f84a26c Add authors 2014-11-13 08:46:25 -08:00
Kevin Sawicki ff10ea601c Use root app dir 2014-11-13 08:46:24 -08:00
Kevin Sawicki 88bfba9fb2 ⬆️ grunt-atom-shell-installer@0.4 2014-11-13 08:46:24 -08:00
Kevin Sawicki f11168df8e Load installer task 2014-11-13 08:46:24 -08:00
Kevin Sawicki 4ce056180c Remove installer code now handled by grunt plugin 2014-11-13 08:46:24 -08:00
Kevin Sawicki 8718828869 Add initial Windows installer task 2014-11-13 08:46:23 -08:00
Kevin Sawicki edfcc134ec Add missing close import 2014-11-13 08:42:10 -08:00
Ben Ogle 6a34b88f79 Update wrap-guide to update when font-size is changed 2014-11-12 15:40:50 -08:00
Ben Ogle e596bf6ef9 Merge pull request #4144 from atom/bo-overlay-decoration
Overlay decorations
2014-11-12 15:02:40 -08:00
Ben Ogle b369a1085c Use headPixelPosition in overlay decoration rendering 2014-11-12 14:43:52 -08:00
Ben Ogle 2e7e90a8aa Update spec names 2014-11-12 14:43:26 -08:00
Ben Ogle eae80ca46d Add a check for negative bounds when translating the overlay 2014-11-12 11:50:22 -08:00
Kevin Sawicki fe7505745d Prepare 0.147 2014-11-12 10:55:14 -08:00
Max Brunsfeld 2ee3ab8577 Merge pull request #4162 from atom/mb-fix-copy-without-selection
Don't select the copied line when copying with no selection
2014-11-12 10:25:38 -08:00
Max Brunsfeld 3521b96611 Don't select the copied line when copying with no selection 2014-11-12 10:12:26 -08:00
Kevin Sawicki 7abfd45baf Default to using hard tabs in Makefile files
This is a temporary solution until scoped settings supports this
type of restriction.

Closes atom/language-make#3
2014-11-12 09:31:12 -08:00
Ben Ogle 4141b456db Merge pull request #4157 from AgentAntelope/master
Make cmd-delete delete to end of line.
2014-11-12 09:14:50 -08:00
Agent Antelope f86dc6b0a6 Revert change to cmd-shift-backspace 2014-11-12 17:09:42 +00:00
Agent Antelope 87be5af1ec Make cmd-delete delete to end of line.
This also affects cmd-shift-backspace.

The expected behaviour of cmd-delete is that it deletes to end of line,
with cmd acting as a modifier to delete/shift-backspace.
2014-11-12 13:41:32 +00:00
Ben Ogle 12b9f232c2 💄 2014-11-11 16:39:30 -08:00
Kevin Sawicki 19995df367 💄 Use two space indent 2014-11-11 16:39:24 -08:00
Ben Ogle 97a671cb49 Works with the shadow DOM disabled. 2014-11-11 16:30:22 -08:00
Ben Ogle 9acea88101 Change verbiage in spec names 2014-11-11 15:52:44 -08:00
Ben Ogle b29c0ca2f7 nof 2014-11-11 15:52:21 -08:00
Ben Ogle a4a3577163 💄 2014-11-11 15:50:34 -08:00
Ben Ogle 9dfaa8a4e5 Add bounds checking for overlay decorations 2014-11-11 15:46:27 -08:00
Ben Ogle 661b09ab1c Don’t need this 2014-11-11 15:45:57 -08:00
Nathan Sobo e238292075 Remove WorkspaceElement::handleWindowFocus
We were getting stack traces in specs when the window got focused caused
by this subscription never getting disposed. We investigated, and can’t
find a case where removing this causes any issues.

Tested:
* Loading/reloading empty window
* Loading/reloading window with pane splits
* Opening/closing dev tools
* Switching focus between atom windows
* Switching focus between applications

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo 9fd52f600e Dispose of WorkspaceElement subscriptions when detached
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo c75e692269 Don’t add undefined context menus when activating package resources
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo 6770570f13 Don't call Grim.deprecate for undefined context menus
This preserves the original behavior, in which passing undefined to
atom.contextMenu.add was a no-op that returned a no-op disposable.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 16:24:02 -07:00
Nathan Sobo 9875b069bc Merge pull request #4152 from atom/ns-highlight-region-classes
Add private API for adding classes to highlight regions for backward compatibility
2014-11-11 15:20:47 -07:00
Ben Ogle 9399e00033 Properly display when a marker is reversed 2014-11-11 13:32:13 -08:00
Ben Ogle 67d5d997c9 💄 in 📝 2014-11-11 13:08:27 -08:00
Ben Ogle 40c11410f0 Add Cursor::getMarker() method 2014-11-11 13:08:19 -08:00
Ben Ogle 307108ec6c Specs for positioning the overlay decorations 2014-11-11 13:08:05 -08:00
Ben Ogle 0bb173b646 Add spec for creation and removal of overlay 2014-11-11 11:25:36 -08:00
Ben Ogle 6538da22a6 Fix linter error 2014-11-11 11:25:36 -08:00
Ben Ogle c79db992d9 Overlay decorations render 2014-11-11 11:25:36 -08:00
Ben Ogle 89ab0becc2 💄 2014-11-11 11:25:36 -08:00
Ben Ogle 58892be6f7 Use proper verbiage for the docs 2014-11-11 11:24:46 -08:00
Ben Ogle 2aaa025d72 Add deprecated getMoveNextWordBoundaryBufferPosition
Closes #4151
2014-11-11 11:24:10 -08:00
Max Brunsfeld 1474aa2116 Merge pull request #4148 from atom/mb-cut-line
Cut whole lines when no text is selected
2014-11-11 11:13:51 -08:00
Nathan Sobo 2de8046f99 Add deprecatedRegionClass option to highlight decorations
This adds a class to each of the contained regions so we can make
existing bundled packages backward-compatible with themes.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 12:11:26 -07:00
Nathan Sobo a58af721f1 Assign highlight decoration React keys based on decoration id instead of class
@benogle: I think this should be fine now that we assign id’s, right?

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-11 12:11:26 -07:00
Kevin Sawicki 3a0bce0618 ⬆️ settings-view@0.159 2014-11-11 10:57:54 -08:00
Kevin Sawicki 658dc8e9c3 Merge pull request #4141 from atom/ks-file-encoding-config
Default buffer encoding to core.fileEncoding config
2014-11-11 10:07:53 -08:00
Max Brunsfeld 7a87c22c7d Cut/copy whole lines when no text is selected
Closes #3643
2014-11-11 10:02:17 -08:00
Kevin Sawicki e36eaa56cb Add windows1252 2014-11-11 09:47:34 -08:00
Kevin Sawicki 84a74d68cf Remove windows1250 duplicate 2014-11-11 09:47:34 -08:00
Kevin Sawicki 5946590a66 Add spec for default file encoding 2014-11-11 09:47:34 -08:00
Kevin Sawicki 268a3649b6 Use core.fileEncoding as default buffer encoding 2014-11-11 09:47:34 -08:00
Kevin Sawicki 3e67766d1a Add core.fileEncoding config schema 2014-11-11 09:47:34 -08:00
Kevin Sawicki 1038684014 Prepare 0.146 2014-11-11 09:47:07 -08:00
Kevin Sawicki 43acb99f86 ⬆️ encoding-selector@0.7 2014-11-11 09:02:19 -08:00
Nathan Sobo 8dccc8e07c Merge pull request #4143 from atom/ns-fix-scrollbar-regression
Always re-render scrollbars after themes load/reload
2014-11-10 19:50:13 -07:00
Max Brunsfeld 3c800b00f5 Always re-render scrollbars after themes load/reload
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-10 17:59:41 -08:00
Kevin Sawicki cb0f531b9a ⬆️ find-and-replace@0.146 2014-11-10 16:55:50 -08:00
Kevin Sawicki 5e61c7b38a ⬆️ symbols-view@0.68 2014-11-10 15:53:19 -08:00
Nathan Sobo 57f85e1720 Add regression coverage for “hidden pane item after dragging” bug #4112
Refs bad0504e1d
2014-11-10 15:55:21 -07:00
Kevin Sawicki f4ced3b078 Autoscroll when selecting the entire line
Closes #4032
2014-11-10 14:51:03 -08:00
Ben Ogle 9553c46030 Override the default styling of .highlight in the editor.
Closes #4136
2014-11-10 14:34:50 -08:00
Kevin Sawicki 14e73e0c63 pane -> Pane 2014-11-10 14:31:21 -08:00
Ben Ogle 5c5c6e77fd Move method to be with similar methods in the docs. 2014-11-10 14:18:35 -08:00
Ben Ogle e9678a15f1 Add more docs for getPrev/NextWordBoundary methods 2014-11-10 14:18:15 -08:00
Ben Ogle f0135adb62 Fix method name 2014-11-10 14:17:48 -08:00
Ben Ogle 58fe92a41b Merge pull request #4135 from atom/bo-tab-reorder
Tab reorder
2014-11-10 14:00:45 -08:00
Kevin Sawicki 5689fbf7cc Suggest keyring dependencies
apm now gracefully fails without them being installed and they
are only used for publishing and starring packages.
2014-11-10 13:35:48 -08:00
Ben Ogle af052c79a7 nof 2014-11-10 13:32:58 -08:00
Kevin Sawicki f431bb6396 Add more complete list of Debian dependencies
This list was taken from the webupd8 .deb file

Closes #4114
2014-11-10 13:32:20 -08:00
Ben Ogle e21cc17a7b Add tab-moving key bindings for windows 2014-11-10 13:31:18 -08:00
Ben Ogle 1247e40e88 Add tab-moving key bindings for mac 2014-11-10 13:31:12 -08:00
Ben Ogle 6159209d49 moveItemTo* -> moveItem* 2014-11-10 13:28:15 -08:00
Kevin Sawicki d8263a1fcd ⬆️ apm@0.111 2014-11-10 13:21:23 -08:00
Ardeshir Javaherchi 5e3b88f42d Add another test for moveItemToLeft 2014-11-10 11:25:17 -08:00
Ardeshir Javaherchi a0e4d8b582 Add test for reordering tabs in linux 2014-11-10 11:25:17 -08:00
Ardeshir Javaherchi ff80545285 🐧 Add keymap implementation to reorder tabs in linux 2014-11-10 11:25:16 -08:00
Ben Ogle 3462d99675 Upgrade atom-dark-syntax 2014-11-10 11:16:34 -08:00
Kevin Sawicki 11ec0c579d ⬆️ language-css@0.23 2014-11-10 11:04:11 -08:00
Kevin Sawicki 0de9f54e3c ⬆️ apm@0.110 2014-11-10 11:04:11 -08:00
Ben Ogle 75e499004d Merge pull request #4119 from je-allard/master
🐛 load the bootstrap style for thumbnails
2014-11-10 10:34:38 -08:00
Nathan Sobo 11a817c442 :arrow_up settings-view to revert previous change 2014-11-10 11:16:29 -07:00
Nathan Sobo 8db843a57c ⬆️ settings-view to fix styling 2014-11-10 11:07:11 -07:00
Nathan Sobo 08dd51a12f Merge pull request #4121 from atom/mb-inline-commands-in-palette
Include inline commands in the command palette
2014-11-10 10:25:36 -07:00
Nathan Sobo 3f869ec191 Merge pull request #4105 from atom/ld-doc-update
Remove obsolete jQuery reference in documentation
2014-11-10 10:18:42 -07:00
Nathan Sobo 0fba8ba402 Subscribe to ‘window:open-path’ as a command 2014-11-10 10:10:53 -07:00
Nathan Sobo 7756f4b945 Don’t run ‘beforeunload’ listeners through atom.commands 2014-11-10 10:10:53 -07:00
Nathan Sobo 832e7113f7 Include all inline commands on the bubble path in ::findCommands 2014-11-10 10:10:52 -07:00
Nathan Sobo aa46e3d26f Add atom-pane commands via atom.commands again 2014-11-10 10:10:52 -07:00
Nathan Sobo d48719ab1c Ignore jQuery and duplicates in CommandRegistry::findCommands
Now that jQuery has been patched to add inline listeners and inline
listeners are reported from findCommands, there’s no reason to include
commands based on $.fn.events. Also, we need to ensure the same command
doesn’t get added to the list twice since it could get added by both
inline and selector-based listeners.
2014-11-10 10:09:24 -07:00
Max Brunsfeld 0c40a1ef92 Include inline commands in command palette 2014-11-10 10:09:24 -07:00
Nathan Sobo bad0504e1d Attach active pane item view before showing/hiding
Fixes #4112
2014-11-10 10:06:12 -07:00
Nathan Sobo 01fdd83c6c ⬆️ markdown-preview to fix exception when modifying w/ splits 2014-11-10 08:22:13 -07:00
Nathan Sobo 0a92b6b681 Add Workspace::paneForItem 2014-11-10 08:20:59 -07:00
Nathan Sobo 167467339a Merge pull request #4129 from atom/ns-fix-pane-close
Prompt to save modified items when closing a pane via pane:close
2014-11-10 08:17:56 -07:00
Nathan Sobo efd3329c50 Prompt to save modified items when closing a pane via pane:close
Fixes #4094
2014-11-10 07:55:37 -07:00
Jeremy Allard a140787252 🐛 load the bootstrap style for thumbnails 2014-11-09 01:40:49 -05:00
Lee Dohm d09c4010f6 Remove obsolete jQuery reference
Noticed that "soon" is now
2014-11-07 22:23:12 -08:00
Kevin Sawicki e2f1a245b0 💄 2014-11-07 20:54:03 -08:00
Kevin Sawicki 682045ef16 Prepare 0.145 2014-11-07 20:26:29 -08:00
Kevin Sawicki dc6e825edd ⬆️ encoding-selector@0.6 2014-11-07 19:57:23 -08:00
Nathan Sobo 481e444ffe Reassign context to undefined because CoffeeScript needs a var keyword
Fixes #4100
2014-11-07 18:00:38 -07:00
Nathan Sobo 5193fa698f Merge pull request #4103 from atom/ns-fix-active-pane-deserialization
Make deserialization of the active pane more tolerant and add assertions to catch invalid states
2014-11-07 16:00:40 -07:00
Nathan Sobo b8d2bd6c30 Disallow activation of panes that aren't in the PaneContainer
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-07 15:46:47 -07:00
Nathan Sobo 33fde29acb Disallow activation of destroyed panes
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-07 15:45:21 -07:00
Nathan Sobo 6934b83acc Fall back to first pane if activePaneId is invalid
When deserializing PaneContainer.

Fixes #4069

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-07 15:44:59 -07:00
Nathan Sobo 330988ad16 Merge pull request #4101 from atom/mb-fix-styles
Fix user stylesheet regression due to shadow DOM PR
2014-11-07 14:56:26 -07:00
Nathan Sobo 058ef0a5a8 Fix autocomplete specs 2014-11-07 14:43:02 -07:00
Max Brunsfeld 003c101f14 W/o shadow-dom, don't add global atom-styles element for text editor
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-07 13:05:46 -08:00
Max Brunsfeld 98d602628a Render all stylesheets in atom-styles elements without contexts
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-07 12:56:32 -08:00
Kevin Sawicki 46efc52a22 ⬆️ language-shellscript@0.10 2014-11-07 12:42:13 -08:00
Kevin Sawicki f78891b600 Fetch draft assets from assets URL
This will include assets in a bad state that should still be deleted
and aren't returned from the main release URL.
2014-11-07 12:07:16 -08:00
Kevin Sawicki 05e3bbde45 ⬆️ settings-view@0.156 2014-11-07 11:54:58 -08:00
Ben Ogle 4dc4a022ab Upgrade find-and-replace to use atom-text-editor 2014-11-07 11:09:03 -08:00
Ben Ogle 226ae374c1 Upgrade bookmarks to work with shadow dom 2014-11-07 11:06:03 -08:00
Kevin Sawicki fbfe1c7224 Fully fetch draft release
Assets in a bad state aren't returned from the releases listing
endpoint.
2014-11-07 10:58:53 -08:00
Kevin Sawicki 53f8ae3055 ⬆️ language-sass@0.25 2014-11-07 10:48:24 -08:00
Ben Ogle 1634b3acfc Upgrade git-diff to use atom-text-editor 2014-11-07 10:46:15 -08:00
Kevin Sawicki 3067323564 ⬆️ language-css@0.22 2014-11-07 10:41:36 -08:00
Kevin Sawicki c410b79af0 ⬆️ language-python@0.23 2014-11-07 10:34:45 -08:00
Ben Ogle f09fc23fdc Merge branch 'master' of github.com:atom/atom 2014-11-07 10:16:16 -08:00
Kevin Sawicki a9262b18c2 Prepare 0.144 2014-11-07 10:14:27 -08:00
Ben Ogle ef129f9491 Add more relevant (but contrived) example in init.coffee.
Closes #4089
2014-11-07 10:02:07 -08:00
Ben Ogle b4d38d14e3 Add padding to panel headings 2014-11-07 09:44:32 -08:00
Ben Ogle 97a21d7bbf Merge pull request #4087 from philipgiuliani/patch-1
📝 Update .workspace class with custom element
2014-11-07 09:34:32 -08:00
Nathan Sobo ab395952a9 Dispose of ::scopedConfigSubscriptions when Editor is destroyed 2014-11-07 10:13:38 -07:00
Nathan Sobo 6e55c80d3c Dispose of ::scopedConfigSubscriptions when DisplayBuffer is destroyed 2014-11-07 10:09:55 -07:00
Philip Giuliani f1079056cf Update .workspace class with custom element
Because of the update with the custom elements, i noticed that `.workspace` hasn't been updated in the `keymap.cson`, but `.editor` has (to `atom-text-editor`).
2014-11-07 09:43:46 +01:00
Ben Ogle b29a61ec87 Update deprecation warning test 2014-11-06 15:19:49 -08:00
Max Brunsfeld 4894849adc ⬆️ atom-keymap for multi-modifier keystroke fix
Signed-off-by: Nathan Sobo <nathan@github.com>
2014-11-06 15:01:34 -08:00
Ben Ogle cf78b01d45 Upgrade find-and-replace to use new APIs 2014-11-06 14:49:13 -08:00
Ben Ogle 1ed927f213 Remove getPath() deprecation in project::scan 2014-11-06 14:49:13 -08:00
Nathan Sobo b978b4f8c7 ⬆️ space-pen for interoperable $.fn.view method
Previously, the SpacePen view was associated with its elements
via $.fn.data, but this only works across a single instance
of jQuery. Now we store a ::spacePenView property as an expando
property directly on elements.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-06 15:28:49 -07:00
Nathan Sobo baea6fcb49 Don’t assume SpacePen views implement ::unsubscribe
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-06 15:28:20 -07:00
Nathan Sobo 7e06e10fcf Don’t require a specific jQuery instance for jasmine jQuery matchers
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-06 15:27:45 -07:00
Nathan Sobo 0bcfa591f6 Always throw exceptions when translating rows on destroyed DisplayBuffer
Previously we only threw exceptions on non-release builds, but we
haven’t seen bundled packages cause issues in a while. Time to see what
third party packages cause problems.

Refs #3192
2014-11-06 12:56:01 -07:00
Ben Ogle f2532b1a35 Upgrade metrics to reduce the noise a bit 2014-11-06 11:46:12 -08:00
Nathan Sobo e0f8d6f365 Fix disappearing editor when folding all
Also: simplify the editor stylesheet a bit. Still some more to do but
fixing this issue is more important.
2014-11-06 12:36:14 -07:00
Ben Ogle 50c705fea4 Remove unnecessary code
cc @nathansobo as you meant to remove this originally
2014-11-06 10:16:11 -08:00
Max Brunsfeld 8bfea240ea Merge pull request #4071 from atom/mb-editor-grouped-undo
Add grouped undo for all text editor commands
2014-11-06 10:13:04 -08:00
Max Brunsfeld 4099828525 ⬆️ text-buffer@3.6.0 2014-11-06 09:55:31 -08:00
Max Brunsfeld 26983adbdf Reduce ambiguity in config description 2014-11-06 09:42:20 -08:00
Kevin Sawicki ede703453a ⬆️ settings-view@0.155 2014-11-06 09:38:36 -08:00
Max Brunsfeld d97c81bf6a Make undo grouping interval configurable 2014-11-06 09:25:10 -08:00
Kevin Sawicki bd76242851 Prepare 0.143 2014-11-06 09:03:35 -08:00
Max Brunsfeld d85c07e7e2 Don't wrap undo/redo calls in transactions 2014-11-05 16:59:06 -08:00
Max Brunsfeld 4077e791c9 Update signature of calls to TextBuffer::transact 2014-11-05 15:58:13 -08:00
Max Brunsfeld e7eef89fa5 Remove TextEditor::withGroupingInterval
Just use ::transact
2014-11-05 15:58:13 -08:00
Max Brunsfeld 5437236304 Use undo grouping in editor command listeners 2014-11-05 15:58:13 -08:00
Max Brunsfeld b7aa421e4e Add TextEditor::withGroupingInterval
This method temporarily instructs the editor to apply undo grouping with
a given interval. This way, undo grouping can be made optional without
adding optional arguments to every buffer manipulation method.
2014-11-05 15:58:12 -08:00
Ben Ogle 9458db0c1f Fix issue removing panels 2014-11-05 15:37:47 -08:00
Ben Ogle 80c15513bb Fix typos 2014-11-05 15:36:39 -08:00
Ben Ogle 951289f67f Upgrade metrics for cohorts, commands, and exceptions 2014-11-05 15:05:31 -08:00
Kevin Sawicki 1e7ba12e60 ⬆️ markdown-preview@0.109 2014-11-05 14:44:22 -08:00
Kevin Sawicki 9a423359c4 ⬆️ markdown-preview@0.108 2014-11-05 14:40:50 -08:00
Kevin Sawicki bb56c6badc ⬆️ language-python@0.22 2014-11-05 12:49:21 -08:00
Nathan Sobo ae461b21a4 ⬆️ find-and-replace for shadow DOM support
@benogle heads-up. Not sure if you didn’t want to update this yet but
I’m assuming it’s fine.
2014-11-05 11:26:56 -07:00
Nathan Sobo 670b44f250 Only set both height and width of editor when shadow DOM is used
These work inside a shadow root, but break the flexbox behavior when
the shadow DOM is disabled.
2014-11-05 11:21:29 -07:00
Kevin Sawicki d330a8fac5 Merge pull request #4006 from atom/atom-shell-v0.19.0
Upgrade to atom-shell@0.19.0
2014-11-05 09:45:31 -08:00
Kevin Sawicki 8bd2650d01 Merge pull request #4064 from atom/pass-path-env
Pass $PATH by command line
2014-11-05 09:40:04 -08:00
Ben Ogle 560d9387dc Upgrade text-buffer to remove deprecations 2014-11-05 09:23:44 -08:00
Nathan Sobo 39cc463e24 Add .editor and .editor-colors classes regardless of shadow DOM setting 2014-11-05 09:57:13 -07:00
Nathan Sobo 2c83c3fe17 Merge pull request #3943 from atom/ns-text-editor-shadow-dom
Render text editor contents inside shadow DOM
2014-11-05 09:42:07 -07:00
Nathan Sobo 07505ea82a Support any instance of jQuery in view registry logic 2014-11-05 09:33:31 -07:00
Nathan Sobo 47d3b3edf3 Add jQueryTrigger: true to command detail in $.fn.trigger patch
Attention: @benogle
References: atom/metrics#32
2014-11-05 09:28:35 -07:00
Ben Ogle 3d394e854e Add 'application:open-dev' binding for windows. 2014-11-05 08:19:24 -08:00
Ben Ogle a37b8ff632 Merge pull request #4068 from jpelgrom/master
Keyboard shortcut to open folder on Windows
2014-11-05 08:18:00 -08:00
jpelgrom f8a05dd8e0 Keyboard shortcut to open folder on Windows
Based on Linux behaviour
2014-11-05 16:05:55 +01:00
Cheng Zhao 6a58f6054a Pass $PATH by command line 2014-11-05 12:11:42 +08:00
Ben Ogle ddd4a9a968 Merge pull request #4063 from atom/bo-unify-panel-styling
Unify panel styling
2014-11-04 17:12:49 -08:00
Ben Ogle 743c50014f Do not import overlay 2014-11-04 16:59:02 -08:00
Ben Ogle af761fb004 All panel styling into panels.less 2014-11-04 15:39:25 -08:00
Nathan Sobo badf1725fa Handle focus on hidden input when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:29 -07:00
Nathan Sobo 2b2149bca1 Add config schema for editor.useShadowDOM
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo e1d6d55311 Enable editor.useShadowDOM in all specs 2014-11-04 16:37:28 -07:00
Nathan Sobo 670a710753 Test editor focus/blur handling with shadow DOM enabled/disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo dd1e5338c6 Focus the root TextEditorElement in spec instead of component node
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo 100af7d27d Fix corner cases related to lifecycle state of EditorComponent on events
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo 9b70cf2044 Make blur event on text editor element work with shadow DOM disabled
When the shadow DOM is enabled, this happens organically because the
focus is abstracted across the shadow boundary. Without that abstraction
boundary, we need to pretend that a blur of the hidden input is actually
a blur of the entire editor.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:28 -07:00
Nathan Sobo 7fe9c14772 💄 2014-11-04 16:37:28 -07:00
Nathan Sobo 9690e44ffe Correctly handle focus when shadow DOM is disabled
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo 0e57ede712 Only create a shadow root if editor.useShadowDOM config setting is true
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Nathan Sobo dd7335c30b Simplify focus/blur handling
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2014-11-04 16:37:27 -07:00
Ben Ogle 4537e9bd1a Fix specs 2014-11-04 16:37:27 -07:00
Nathan Sobo 0488fc21da ⬆️ autocomplete for shadow DOM fix with auto-selecting 1 option 2014-11-04 16:37:27 -07:00
Nathan Sobo 160bb29034 Null-guard component in blur handler 2014-11-04 16:37:27 -07:00
Nathan Sobo 497b4a4e24 Toggle quotes back 2014-11-04 16:37:27 -07:00
Nathan Sobo dd4e7d6921 Wait for promise resolution on all calls to activatePackage
This avoids a race condition where stylesheets would be added after all
packages were deactivated and leak into the next spec.
2014-11-04 16:37:26 -07:00
Nathan Sobo d060ecdc24 Assign package stylesheet context based on double-extension in file name
If stylesheet files are named with 2 extensions, the first extension is
used as the context argument when the package’s stylesheets are loaded.
This allows people to target the text editor by naming their stylesheet
`index.atom-text-editor.less`.
2014-11-04 16:37:26 -07:00
Nathan Sobo 84d1101903 Upgrade package-generator to fix specs with shadow DOM 2014-11-04 16:37:26 -07:00
Nathan Sobo 6f3c53a17a Only cancel focus events if the editor is or contains the related target 2014-11-04 16:37:26 -07:00
Nathan Sobo dd17e8f018 Replace focusout event handlers on hiddenInput shim with blur handlers
The focusout event doesn’t seem to work for elements in the shadow DOM.
Other people seem to share this experience:

https://code.google.com/p/chromium/issues/detail?id=378163#c7
2014-11-04 16:37:26 -07:00
Nathan Sobo cf3f1aa2eb Don’t handle text editor focus when it already has focus 2014-11-04 16:37:26 -07:00
Nathan Sobo adaf1829da Determine focus using document.activeElement instead of component state 2014-11-04 16:37:26 -07:00
Nathan Sobo 7863db480e Override jQuery.contains instead of jQuery.fn.position
Turns out the problems with position inside the shadow DOM are due to
the fact that elements in the light DOM don’t claim to contain elements
from a shadow DOM, causing jQuery.fn.offset to bail out early and
misreport positions inside the editor.
2014-11-04 16:37:26 -07:00
Nathan Sobo 5cc243ec11 Inject both underlayer and overlayer via shadow DOM insertion points 2014-11-04 16:37:25 -07:00
Nathan Sobo 2e46cf9b8d Refefine $.fn.position in terms of offsetTop/Left to work w/ shadow DOM
The default implementation of position seems to barf when things are in
the shadow DOM. This seems to be a suitable replacement that doesn’t.
2014-11-04 16:37:25 -07:00
Nathan Sobo 5e8655fa60 Don’t use :focus selector to store previously focused element 2014-11-04 16:37:25 -07:00
Nathan Sobo c64a4b7ca9 Fallback to light DOM in TextEditorView::find if nothing found in shadow 2014-11-04 16:37:25 -07:00
Nathan Sobo bda1429293 Trigger ‘blur’ on select list editor instead of ‘focusut’ on its input 2014-11-04 16:37:25 -07:00
Nathan Sobo eb19989ecd Handle focus at the host element level
Detecting focus and blur at the level of the input is creating problems
when we blur and then immediately refocus. This is simpler.
2014-11-04 16:37:25 -07:00
Nathan Sobo 62c0db11ee Define enter as ‘core:confirm’ in select-list mini editors
We were leaving this to packages to define, and they were getting it
wrong by selecting into the ‘input’ which is now in shadow.
2014-11-04 16:37:25 -07:00
Nathan Sobo 8aeabe5fe5 Listen for ‘blur’ on mini editor of select list rather than ‘focusout’
The focusout handler on the mini editor’s hidden input wasn’t being
triggered, but we can listen for blur directly on the editor now that
the shadow DOM abstracts the focus.
2014-11-04 16:37:25 -07:00
Nathan Sobo ab846a2495 Put views appended via appendToLinesView in the light DOM
This adds an insertion point to the lines div via a <content> tag,
allowing immediate children of the editor tag to be positioned relative
to the lines div but still be styled via global CSS.
2014-11-04 16:37:24 -07:00
Nathan Sobo 7202908780 Split editor stylesheet into light and shadow DOM versions
This prevents the need for a :host pseudo-class in the editor CSS which
breaks linting. It also fits selectors targeting the host element in a
more intuitive spot in the cascade.
2014-11-04 16:37:24 -07:00
Nathan Sobo c4cfac5615 Use event capture for pane focus/blur events
Focusin/focusout don’t seem to bubble properly across shadow DOM
boundaries, so capturing is a more reliable alternative.
2014-11-04 16:37:24 -07:00
Nathan Sobo 866f2d9a76 Fix appendToLinesView 2014-11-04 16:37:24 -07:00
Nathan Sobo 3b455c00d3 Proxy TextEditorView::find calls to the root inside the shadow DOM 2014-11-04 16:37:24 -07:00
Nathan Sobo 1f777addd9 Sample font styling when font config values change
We previously could do it whenever stylesheets changed, but these values
end up getting assigned to the global stylesheet for cascading reasons
and we’re only watching the local stylesheet. We poll the host elements
DOM properties, but forcing a sync poll when the config values change
makes behavior synchronous for specs and more responsive when changing
these values.
2014-11-04 16:37:24 -07:00
Nathan Sobo 58744f6b7b Account for shadow DOM when asserting on focus 2014-11-04 16:37:24 -07:00
Nathan Sobo 7badd9ba25 Don’t rely on :focus selector for toHaveFocus matcher
:focus doesn’t work properly when focus is inside the shadow DOM of
an element, but document.activeElement does.
2014-11-04 16:37:23 -07:00
Nathan Sobo e8d7058383 Go back to the plain “theme” group for theme stylesheets 2014-11-04 16:37:23 -07:00
Nathan Sobo 42fc54f716 Protect against stylesheets changing while detached 2014-11-04 16:37:23 -07:00
Nathan Sobo c11675dca1 Don’t recycle the same composite disposable for stylesheet activation 2014-11-04 16:37:23 -07:00
Nathan Sobo cdb62812d2 Don’t use syntax themes in spec because they are inserted in shadow DOM 2014-11-04 16:37:23 -07:00
Nathan Sobo 2d3d64f399 Call reloadStylesheets instead of reloadStylesheet in spec 2014-11-04 16:37:23 -07:00
Nathan Sobo 2321aa2bee Get SpacePen outlet shims from inside shadow DOM 2014-11-04 16:37:23 -07:00
Nathan Sobo fa733c85ad Fix setEditorHeightInLines shim now that we’ve dropped .react class 2014-11-04 16:37:23 -07:00
Nathan Sobo 158bbef38f Account for shadow dom when asserting active element 2014-11-04 16:37:22 -07:00
Nathan Sobo b2bc09c13d Apply stylesheets with atom-editor-context in text editor specs 2014-11-04 16:37:22 -07:00
Nathan Sobo 268fceb073 Specify border-box sizing for the cursor to fix specs 2014-11-04 16:37:22 -07:00
Nathan Sobo 5be21d6743 Avoid traversing through shadow root on mousewheel events 2014-11-04 16:37:22 -07:00
Nathan Sobo 5d3602d37b Get node once to attach event handlers 2014-11-04 16:37:22 -07:00
Nathan Sobo b86f6870c5 Use native event handlers instead of React
React event handlers don’t work because of the shadow DOM
2014-11-04 16:37:22 -07:00
Nathan Sobo 2ab5fa405c Apply mini and is-focused class to both editor host element and root
This preserves existing theming behavior
2014-11-04 16:37:22 -07:00
Nathan Sobo 5f4fb23057 Initialize atom-styles element in editor shadow dom before measuring 2014-11-04 16:37:22 -07:00
Nathan Sobo 22f6268116 Assign StylesElement::context on attachment 2014-11-04 16:37:21 -07:00
Nathan Sobo 65f40d6f7b Move font styling to host element so font preferences work 2014-11-04 16:37:21 -07:00
Nathan Sobo 596987fbce Fix sourcePath on text editor stylesheet loading 2014-11-04 16:37:21 -07:00
Nathan Sobo 2b218d2e01 Only update atom-styles children on context attribute change if attached 2014-11-04 16:37:21 -07:00
Nathan Sobo 582066915b Apply syntax theme stylesheets in text editor shadow DOM via atom.styles 2014-11-04 16:37:21 -07:00
Nathan Sobo 1a98cb7070 Use atom.styles to activate stylesheets in packages 2014-11-04 16:37:21 -07:00
Nathan Sobo c2d0b6d4f5 Load editor stylesheet in shadow root with style manager context param 2014-11-04 16:37:21 -07:00
Nathan Sobo 2affff30ff Handle events with native handlers to avoid shadow DOM issues with React 2014-11-04 16:37:21 -07:00
Nathan Sobo 3b6189e94b Create WeakMap on element creation to support ‘context’ attribute change 2014-11-04 16:37:21 -07:00
Nathan Sobo 4e8e5a84c4 Support context attribute in <atom-styles> 2014-11-04 16:37:20 -07:00
Nathan Sobo 087387e633 Style mini editor font sizes on atom-text-editor host element
…instead of via the shadow DOM. We always honor the computed font
styles of the host element.
2014-11-04 16:37:20 -07:00
Nathan Sobo 769c6c52bb Make atom-text-editor have “display: block” 2014-11-04 16:37:20 -07:00
Nathan Sobo 963c92eb4e Hack: Add editor stylesheets to atom-text-editor shadow root 2014-11-04 16:37:20 -07:00
Nathan Sobo 22212be90d Give atom-text-editor elements a shadow root
Themes aren’t applying correctly and there are issues with mini editors
but this basically works. I’m leaving the .editor node in the shadow
DOM for theme compatibility and because React still wants to render
into a wrapper element.
2014-11-04 16:37:20 -07:00
Ben Ogle 8a640b35e0 Merge pull request #4061 from atom/bo-modal-panel
Modal panel API
2014-11-04 15:34:43 -08:00
Ben Ogle df9a0dc7a3 hideAllPanelsExcept 2014-11-04 15:22:32 -08:00
Ben Ogle 5251183410 Dispose panel emitter on destroy() 2014-11-04 15:21:32 -08:00
Ben Ogle 5bd028b24e Enforce modal 2014-11-04 14:58:00 -08:00
Ben Ogle 8485831f40 Add the location attr. Need it for styling! 2014-11-04 14:22:15 -08:00
Ben Ogle da30b66ffa Fix tests 2014-11-04 14:10:58 -08:00
Ben Ogle 3da11bf478 Update styles for modal panels. 2014-11-04 14:04:15 -08:00
Ben Ogle 9b1d5e1864 Add addModalPanel to atom.workspace. 2014-11-04 13:48:48 -08:00
Ben Ogle 1f445acc12 Merge pull request #4060 from atom/bo-remove-some-bootstrap
Only load the bootstrap styles we need
2014-11-04 13:47:44 -08:00
Ben Ogle 022bc2e2a5 Only load the bootstrap styles we need! 2014-11-04 12:28:53 -08:00
Cheng Zhao da18db754f ⬆️ atom-shell@0.19.1 2014-11-04 21:02:46 +08:00
Cheng Zhao c20403d983 ⬆️ atom-shell@0.19.0 2014-11-04 21:02:46 +08:00
Ben Ogle 78dc87d4b6 Add new event method for unhandled errors. 2014-11-03 16:18:20 -08:00
Kevin Sawicki 5dd310f9ac ⬆️ language-shellscript@0.9 2014-11-03 10:42:04 -08:00
Kevin Sawicki 427a32c336 ⬆️ language-javascript@0.43 2014-10-31 16:13:34 -07:00
Kevin Sawicki f3d4a3ad45 ⬆️ language-c@0.30 2014-10-31 16:09:55 -07:00
Ben Ogle ba642682ca Merge pull request #4014 from atom/bo-undo-skip
Pass options through to TextBuffer::setTextInRange
2014-10-31 12:19:28 -07:00
Ben Ogle b1a0258ad4 Clean up spec name 2014-10-31 11:39:56 -07:00
Kevin Sawicki 44112f2ecd Merge pull request #4023 from atom/ks-map-assets-directory-to-atom-protocol
Load atom://assets/ urls from ~/.atom/assets
2014-10-31 11:39:39 -07:00
Ben Ogle 54b8aa4a02 Add spec for skip 2014-10-31 11:38:24 -07:00
Ben Ogle 5791548ac4 Upgrade to text-buffer@3.5.0 2014-10-31 11:33:03 -07:00
Kevin Sawicki 26f21abcf3 Remove ivar only used in constructor 2014-10-31 11:24:26 -07:00
Kevin Sawicki ab0f9e88a7 Add dot atom directory ivar 2014-10-31 10:56:03 -07:00
Kevin Sawicki 6d8b891b65 💄 2014-10-31 10:43:07 -07:00
Kevin Sawicki afdb96e1b1 Don't load from ~/.atom/dev when in safe mode 2014-10-31 10:42:27 -07:00
Kevin Sawicki 9c1ca86cb0 Load atom://assets/ urls from ~/.atom/assets 2014-10-31 10:35:15 -07:00
Kevin Sawicki 4e95977fbd Merge pull request #4018 from ardeshirj/mkrpm
Remove rpm package dependencies
2014-10-31 09:48:34 -07:00
Kevin Sawicki 4a8a379891 ⬆️ symbols-view@0.67 2014-10-31 09:05:32 -07:00
Ardeshir Javaherchi fb0387f43e Remove rpm package dependencies 2014-10-30 23:26:52 -07:00
Ben Ogle 5231a548e3 Pass options through to the text buffer 2014-10-30 17:49:43 -07:00
Kevin Sawicki a466d6cdaf ⬆️ tree-view@0.132 2014-10-30 17:00:36 -07:00
Kevin Sawicki 19b0f760a1 Only re-tokenize lines when tab length changes
Closes #3929
2014-10-30 16:20:05 -07:00
Kevin Sawicki 228ba5f96a ⬆️ language-php@0.18 2014-10-30 15:43:14 -07:00
Kevin Sawicki 25922872f0 Remove trailing whitespace 2014-10-30 14:00:53 -07:00
Ben Ogle 15a1982e8c Merge pull request #4012 from atom/bo-move-view-registry
Move the ViewRegistry to atom.views
2014-10-30 13:56:52 -07:00
Ben Ogle fcca61c2b2 📝 Update docs 2014-10-30 13:56:03 -07:00
Ben Ogle ee4116536d Move the ViewRegistry to atom.views 2014-10-30 13:42:27 -07:00
Kevin Sawicki c217c6544a Prepare 0.142 2014-10-30 13:35:40 -07:00
Kevin Sawicki 205095a198 ⬆️ encoding-selector@0.5 2014-10-30 11:03:35 -07:00
Kevin Sawicki 4326898d5f ⬆️ grammar-selector@0.37 2014-10-30 11:02:15 -07:00
Kevin Sawicki b8285a00b0 Require path after setting start time 2014-10-30 10:49:08 -07:00
Kevin Sawicki 025967193a Add path require to top 2014-10-30 10:48:51 -07:00
Kevin Sawicki 75627f50a2 Normalize process.resourcesPath on load
This ensures the drive letter is consistent on Windows for when
package paths are compared to the resources path to determine
whether to use the metadata cache for a bundled package.

Closes #3932
2014-10-30 10:31:37 -07:00
Kevin Sawicki 9fca1d26f1 ⬆️ dev-live-reload@0.35 2014-10-30 10:22:26 -07:00
Kevin Sawicki 6e827434fd Log a warning when a enabled theme isn't installed 2014-10-30 10:04:38 -07:00
Kevin Sawicki b3f6b3af4b Merge pull request #3968 from lee-dohm/default-themes
Load the default themes when configured themes don't exist
2014-10-30 09:38:11 -07:00
Kevin Sawicki 63a33bd1e7 Merge pull request #3997 from atom/ks-remove-feedback-package
Remove feedback package
2014-10-30 09:26:17 -07:00
Kevin Sawicki a153f1e244 Move items around in help menu a bit 2014-10-30 09:11:06 -07:00
Kevin Sawicki 037a7f435c Add search issues to help menu 2014-10-30 09:11:06 -07:00
Kevin Sawicki 7641f1d1e4 Sync help menus on Linux/Windows 2014-10-30 09:11:06 -07:00
Kevin Sawicki 05c1ae71e1 Add report issue to Help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki cefabd4eb8 Add FAQ to help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki 9f80be4570 Add roadmap to help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki 61f75b0764 Add discussions to Help menu 2014-10-30 09:11:05 -07:00
Kevin Sawicki ae2f4ac36e Remove feedback package 2014-10-30 09:11:05 -07:00
Lee Dohm d20e91897a Load the default themes when configured themes don't exist 2014-10-29 19:42:42 -07:00
Kevin Sawicki 2e0bb66a9a Remove unneeded add encoding attr call 2014-10-29 16:03:57 -07:00
Kevin Sawicki d205c4d664 Add data attribute for encoding
Mirrors the grammar data attribute
2014-10-29 16:03:10 -07:00
Kevin Sawicki 8db5ea7bc7 ⬆️ encoding-selector@0.4 2014-10-29 14:59:26 -07:00
Nathan Sobo 3c7eecbb6a Dispose of scoped config subscriptions when TextEditorComponent unmounts
Fixes #3998
2014-10-29 15:04:39 -06:00
Kevin Sawicki 8dab3d90b3 ⬆️ grammar-selector@0.36 2014-10-29 13:58:29 -07:00
Kevin Sawicki 44bc470a00 ⬆️ encoding-selector@0.3 2014-10-29 13:39:26 -07:00
Kevin Sawicki 498631725a Store menu template even if window isn't focused
update may be called before the window gains focus to store its
template so it is updated correcltly once the window gains focus.
2014-10-29 13:06:57 -07:00
Kevin Sawicki 945345b0c7 📝 Update documentation styleguide 2014-10-29 11:59:25 -07:00
Kevin Sawicki 6576ec5cde Merge pull request #3987 from atom/ks-encodings
Add support for changing editor encoding
2014-10-29 11:58:31 -07:00
Kevin Sawicki ce8143f8e6 Add TextEditor::onDidChangeEncoding spec 2014-10-29 11:33:01 -07:00
Kevin Sawicki e993175205 💄 2014-10-29 11:33:01 -07:00
Kevin Sawicki 4242ac0911 🔨 Add jschardet license override 2014-10-29 11:33:01 -07:00
Kevin Sawicki f22e741a9b Bundle encoding-selector package 2014-10-29 11:33:01 -07:00
Kevin Sawicki a41b582032 ⬆️ text-buffer@3.4 2014-10-29 11:33:01 -07:00
Kevin Sawicki a24279d0b9 ⬆️ pathwatcher@2.3.2 2014-10-29 11:33:01 -07:00
Kevin Sawicki 5985175b07 📝 Fix typo 2014-10-29 11:33:01 -07:00
Kevin Sawicki d2ef888f22 Add TextEditor::onDidChangeEncoding 2014-10-29 11:33:01 -07:00
Kevin Sawicki 35925ed349 Add encoding getter and setter 2014-10-29 11:33:01 -07:00
Kevin Sawicki 490ec1aac7 ⬆️ pathwatcher@2.3.1 2014-10-29 11:33:01 -07:00
Kevin Sawicki 25eea7d19b Remove TextEditor::setEncoding 2014-10-29 11:33:01 -07:00
Kevin Sawicki 4c9e71770a Add initial TextEditor::setEncoding 2014-10-29 11:33:00 -07:00
Kevin Sawicki 4032d96b13 ⬆️ image-view@0.40 2014-10-29 11:32:49 -07:00
Kevin Sawicki c5aa3eb441 ⬆️ image-view@0.39 2014-10-29 11:27:55 -07:00
Kevin Sawicki 68bb765304 ⬆️ settings-view@0.154 2014-10-29 11:03:58 -07:00
Kevin Sawicki bd7996e071 Remove open profile 2014-10-29 10:55:46 -07: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
147 arquivos alterados com 4272 adições e 2095 exclusões
+6 -13
Ver Arquivo
@@ -101,30 +101,23 @@ For more information on how to work with Atom's official packages, see
## Documentation Styleguide
* Use [TomDoc](http://tomdoc.org).
* Use [AtomDoc](https://github.com/atom/atomdoc).
* Use [Markdown](https://daringfireball.net/projects/markdown).
* Reference methods and classes in markdown with the custom `{}` notation:
* Reference classes with `{ClassName}`
* Reference instance methods with `{ClassName::methodName}`
* Reference class methods with `{ClassName.methodName}`
* Delegate to comments elsewhere with `{Delegates to: ClassName.methodName}`
style notation.
### Example
```coffee
# Public: Disable the package with the given name.
#
# This method emits multiple events:
#
# * `package-will-be-disabled` - before the package is disabled.
# * `package-disabled` - after the package is disabled.
#
# name - The {String} name of the package to disable.
# options - The {Object} with disable options (default: {}):
# :trackTime - `true` to track the amount of time disabling took.
# :ignoreErrors - `true` to catch and ignore errors thrown.
# callback - The {Function} to call after the package has been disabled.
# * `name` The {String} name of the package to disable.
# * `options` (optional) The {Object} with disable options (default: {}):
# * `trackTime` A {Boolean}, `true` to track the amount of time taken.
# * `ignoreErrors` A {Boolean}, `true` to catch and ignore errors thrown.
# * `callback` The {Function} to call after the package has been disabled.
#
# Returns `undefined`.
disablePackage: (name, options, callback) ->
+1 -1
Ver Arquivo
@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.109.0"
"atom-package-manager": "0.111.0"
}
}
+1 -1
Ver Arquivo
@@ -63,7 +63,7 @@ if [ $OS == 'Mac' ]; then
"$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/Atom" --executed-from="$(pwd)" --pid=$$ "$@"
exit $?
else
open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ "$@"
open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ --path-environment="$PATH" "$@"
fi
elif [ $OS == 'Linux' ]; then
SCRIPT=$(readlink -f "$0")
+1 -1
Ver Arquivo
@@ -7,7 +7,7 @@ describe "editorView.", ->
beforeEach ->
atom.workspaceViewParentSelector = '#jasmine-content'
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.attachToDom()
atom.workspaceView.width(1024)
+9 -22
Ver Arquivo
@@ -6,7 +6,6 @@ os = require 'os'
# modules work under node v0.11.x.
require 'vm-compatibility-layer'
fm = require 'json-front-matter'
_ = require 'underscore-plus'
packageJson = require '../package.json'
@@ -22,9 +21,9 @@ module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-contrib-csslint')
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-less')
grunt.loadNpmTasks('grunt-markdown')
grunt.loadNpmTasks('grunt-shell')
grunt.loadNpmTasks('grunt-download-atom-shell')
grunt.loadNpmTasks('grunt-atom-shell-installer')
grunt.loadNpmTasks('grunt-peg')
grunt.loadTasks('tasks')
@@ -194,32 +193,19 @@ module.exports = (grunt) ->
'static/**/*.less'
]
markdown:
guides:
files: [
expand: true
cwd: 'docs'
src: '**/*.md'
dest: 'docs/output/'
ext: '.html'
]
options:
template: 'docs/template.jst'
templateContext:
tag: "v#{major}.#{minor}"
markdownOptions:
gfm: true
preCompile: (src, context) ->
parsed = fm.parse(src)
_.extend(context, parsed.attributes)
parsed.body
'download-atom-shell':
version: packageJson.atomShellVersion
outputDir: 'atom-shell'
downloadDir: atomShellDownloadDir
rebuild: true # rebuild native modules after atom-shell is updated
'create-windows-installer':
appDirectory: shellAppDir
outputDirectory: path.join(buildDir, 'installer')
authors: 'GitHub Inc.'
loadingGif: path.resolve(__dirname, '..', 'resources', 'win', 'loading.gif')
iconUrl: 'https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico'
shell:
'kill-atom':
command: killCommand
@@ -237,6 +223,7 @@ module.exports = (grunt) ->
ciTasks.push('dump-symbols') if process.platform isnt 'win32'
ciTasks.push('set-version', 'check-licenses', 'lint')
ciTasks.push('mkdeb') if process.platform is 'linux'
ciTasks.push('create-windows-installer') if process.platform is 'win32'
ciTasks.push('test') if process.platform is 'darwin'
ciTasks.push('codesign')
ciTasks.push('publish-build')
+4 -7
Ver Arquivo
@@ -7,11 +7,12 @@
},
"dependencies": {
"async": "~0.2.9",
"donna": "1.0.6",
"donna": "1.0.7",
"formidable": "~1.0.14",
"fs-plus": "2.x",
"github-releases": "~0.2.0",
"grunt": "~0.4.1",
"grunt-atom-shell-installer": "^0.10.0",
"grunt-cli": "~0.1.9",
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
"grunt-contrib-coffee": "~0.9.0",
@@ -20,17 +21,13 @@
"grunt-cson": "0.10.0",
"grunt-download-atom-shell": "~0.10.0",
"grunt-lesslint": "0.13.0",
"grunt-markdown": "~0.4.0",
"grunt-peg": "~1.1.0",
"grunt-shell": "~0.3.1",
"harmony-collections": "~0.3.8",
"json-front-matter": "~0.1.3",
"legal-eagle": "~0.4.0",
"legal-eagle": "~0.6.0",
"minidump": "~0.8",
"normalize-package-data": "0.2.12",
"npm": "~1.4.5",
"rcedit": "~0.1.2",
"read-package-json": "1.1.8",
"rcedit": "~0.3.0",
"request": "~2.27.0",
"rimraf": "~2.2.2",
"runas": "~1.0.1",
+1
Ver Arquivo
@@ -11,6 +11,7 @@ module.exports = (grunt) ->
appDir = grunt.config.get('atom.appDir')
rm shellAppDir
rm path.join(buildDir, 'installer')
mkdir path.dirname(buildDir)
if process.platform is 'darwin'
+1 -2
Ver Arquivo
@@ -1,4 +1,3 @@
module.exports = (grunt) ->
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
legalEagle = require 'legal-eagle'
@@ -13,7 +12,7 @@ module.exports = (grunt) ->
legalEagle options, (err, summary) ->
if err?
console.error(err)
exit 1
process.exit 1
for key of summary
delete summary[key] if key.match /^atom@/
+1 -1
Ver Arquivo
@@ -36,7 +36,7 @@ module.exports = (grunt) ->
spawn {cmd, args}, (error) ->
return callback(error) if error?
setupExePath = path.join(grunt.config.get('atom.shellAppDir'), '..', 'Releases', 'setup.exe')
setupExePath = path.resolve(grunt.config.get('atom.buildDir'), 'installer', 'AtomSetup.exe')
if fs.isFileSync(setupExePath)
args = [setupExePath]
spawn {cmd, args}, (error) -> callback(error)
-46
Ver Arquivo
@@ -1,46 +0,0 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
module.exports = (grunt) ->
{spawn, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'create-installer', 'Create the Windows installer', ->
return unless process.platform is 'win32'
done = @async()
buildDir = grunt.config.get('atom.buildDir')
atomDir = path.join(buildDir, 'Atom')
releasesDir = path.join(buildDir, 'Releases')
atomGitHubToken = process.env.ATOM_ACCESS_TOKEN
packageInfo = grunt.file.readJSON(path.join(atomDir, 'resources', 'app', 'package.json'))
inputTemplate = grunt.file.read(path.join('build', 'windows', 'atom.nuspec.erb'))
# NB: Build server has some sort of stamp on the version number
packageInfo.version = packageInfo.version.replace(/-.*$/, '')
targetNuspecPath = path.join(buildDir, 'atom.nuspec')
grunt.file.write(targetNuspecPath, _.template(inputTemplate, packageInfo))
# We use the previous releases to build deltas for the current release,
# sync down the existing releases directory by rolling through GitHub releases
cmd = 'build/windows/SyncGitHubReleases.exe'
args = ['-r', releasesDir, '-u', 'https://github.com/atom/atom', '-t', atomGitHubToken]
spawn {cmd, args}, (error, result, code) ->
if error?
grunt.log.error "ATOM_ACCESS_TOKEN environment variable not set or invalid, can't download old releases; continuing anyways"
cmd = 'build/windows/nuget.exe'
args = ['pack', targetNuspecPath, '-BasePath', atomDir, '-OutputDirectory', buildDir]
spawn {cmd, args}, (error, result, code) ->
return done(error) if error?
pkgs = pkg for pkg in fs.readdirSync(buildDir) when path.extname(pkg) is '.nupkg'
cmd = 'build/windows/update.com'
args = ['--releasify', path.join(buildDir, pkgs), '-r', releasesDir, '-g', 'build/windows/install-spinner.gif']
spawn {cmd, args}, (error, result, code) -> done(error)
+5
Ver Arquivo
@@ -6,12 +6,17 @@ _ = require 'underscore-plus'
donna = require 'donna'
tello = require 'tello'
moduleBlacklist = [
'space-pen'
]
module.exports = (grunt) ->
getClassesToInclude = ->
modulesPath = path.resolve(__dirname, '..', '..', 'node_modules')
classes = {}
fs.traverseTreeSync modulesPath, (modulePath) ->
return false if modulePath.match(/node_modules/g).length > 1 # dont need the dependencies of the dependencies
return false if path.basename(modulePath) in moduleBlacklist
return true unless path.basename(modulePath) is 'package.json'
return true unless fs.isFileSync(modulePath)
+15
Ver Arquivo
@@ -60,3 +60,18 @@ module.exports =
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
'jschardet@1.1.0':
license: 'LGPL'
source: 'README.md in the repository'
sourceText: """
JsChardet
=========
Port of python's chardet (http://chardet.feedparser.org/).
License
-------
LGPL
"""
+26 -10
Ver Arquivo
@@ -54,6 +54,11 @@ module.exports = (gruntObject) ->
uploadAssets(release, buildDir, assets, done)
getAssets = ->
{cp} = require('./task-helpers')(grunt)
{version} = grunt.file.readJSON('package.json')
buildDir = grunt.config.get('atom.buildDir')
switch process.platform
when 'darwin'
[
@@ -62,16 +67,16 @@ getAssets = ->
{assetName: 'atom-api.json', sourcePath: 'atom-api.json'}
]
when 'win32'
[
{assetName: 'atom-windows.zip', sourcePath: 'Atom'}
]
assets = [{assetName: 'atom-windows.zip', sourcePath: 'Atom'}]
for squirrelAsset in ['AtomSetup.exe', 'RELEASES', "atom-#{version}-full.nupkg"]
cp path.join(buildDir, 'installer', squirrelAsset), path.join(buildDir, squirrelAsset)
assets.push({assetName: squirrelAsset, sourcePath: assetName})
assets
when 'linux'
buildDir = grunt.config.get('atom.buildDir')
if process.arch is 'ia32'
arch = 'i386'
else
arch = 'amd64'
{version} = grunt.file.readJSON('package.json')
# Check for a Debian build
sourcePath = "#{buildDir}/atom-#{version}-#{arch}.deb"
@@ -87,7 +92,6 @@ getAssets = ->
arch = 'x86_64'
assetName = "atom.#{arch}.rpm"
{cp} = require('./task-helpers')(grunt)
cp sourcePath, path.join(buildDir, assetName)
[
@@ -123,10 +127,22 @@ getAtomDraftRelease = (callback) ->
logError('Fetching atom/atom releases failed', error, releases)
callback(error)
else
for release in releases when release.draft
callback(null, release)
return
callback(new Error('No draft release in atom/atom repo'))
[firstDraft] = releases.filter ({draft}) -> draft
if firstDraft?
options =
uri: firstDraft.assets_url
method: 'GET'
headers: defaultHeaders
json: true
request options, (error, response, assets=[]) ->
if error? or response.statusCode isnt 200
logError('Fetching draft release assets failed', error, assets)
callback(error ? new Error(response.statusCode))
else
firstDraft.assets = assets
callback(null, firstDraft)
else
callback(new Error('No draft release in atom/atom repo'))
deleteRelease = (release) ->
options =
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
-32
Ver Arquivo
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id><%= name %></id>
<version><%= version %></version>
<authors>The Atom Community</authors>
<owners>The Atom Community</owners>
<iconUrl>https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description><%= description %></description>
</metadata>
<files>
<file src="locales\**" target="lib\net45\locales" />
<file src="resources\**" target="lib\net45\resources" />
<file src="*.pak" target="lib\net45" />
<file src="atom.exe" target="lib\net45\atom.exe" />
<file src="atom.exe.gui" target="lib\net45\atom.exe.gui" />
<file src="chromiumcontent.dll" target="lib\net45\chromiumcontent.dll" />
<file src="d3dcompiler_43.dll" target="lib\net45\d3dcompiler_43.dll" />
<file src="ffmpegsumo.dll" target="lib\net45\ffmpegsumo.dll" />
<file src="icudtl.dat" target="lib\net45\icudtl.dat" />
<file src="libEGL.dll" target="lib\net45\libEGL.dll" />
<file src="libGLESv2.dll" target="lib\net45\libGLESv2.dll" />
<file src="LICENSE" target="lib\net45\LICENSE" />
<file src="msvcp120.dll" target="lib\net45\msvcp120.dll" />
<file src="msvcr120.dll" target="lib\net45\msvcr120.dll" />
<file src="vccorlib120.dll" target="lib\net45\vccorlib120.dll" />
<file src="version" target="lib\net45\version" />
<file src="xinput1_3.dll" target="lib\net45\xinput1_3.dll" />
</files>
</package>
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 43 KiB

+2 -57
Ver Arquivo
@@ -1,60 +1,5 @@
# Welcome to the Atom API Documentation
# Welcome to the Atom Docs
![Atom](https://cloud.githubusercontent.com/assets/72919/2874231/3af1db48-d3dd-11e3-98dc-6066f8bc766f.png)
## FAQ
### Where do I start?
Check out [EditorView][EditorView] and [Editor][Editor] classes for a good
overview of the main editor API.
### How do I access these classes?
Check out the [Atom][Atom] class docs to see what globals are available and
what they provide.
You can also require many of these classes in your package via:
```coffee
{EditorView} = require 'atom'
```
The classes available from `require 'atom'` are:
* [BufferedProcess][BufferedProcess]
* [BufferedNodeProcess][BufferedNodeProcess]
* [EditorView][EditorView]
* [Git][Git]
* [Point][Point]
* [Range][Range]
* [ScrollView][ScrollView]
* [SelectListView][SelectListView]
* [View][View]
* [WorkspaceView][WorkspaceView]
* [Workspace][Workspace]
### How do I create a package?
You probably want to read the [creating a package][creating-a-package]
doc first and come back here when you are done.
### Where are the node docs?
Atom ships with node 0.11.10 and the comprehensive node API docs are available
[here][node-docs].
[Atom]: ../classes/Atom.html
[BufferedProcess]: ../classes/BufferedProcess.html
[BufferedNodeProcess]: ../classes/BufferedNodeProcess.html
[Editor]: ../classes/Editor.html
[EditorView]: ../classes/EditorView.html
[Git]: ../classes/Git.html
[Point]: ../classes/Point.html
[Range]: ../classes/Range.html
[ScrollView]: ../classes/ScrollView.html
[SelectListView]: ../classes/SelectListView.html
[View]: ../classes/View.html
[WorkspaceView]: ../classes/WorkspaceView.html
[Workspace]: ../classes/Workspace.html
[creating-a-package]: https://atom.io/docs/latest/creating-a-package
[node-docs]: http://nodejs.org/docs/v0.11.10/api
TODO: Write when docs move to a dedicated repo.
+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.
+3 -3
Ver Arquivo
@@ -16,7 +16,7 @@ keystrokes pass through `atom-text-editor` elements:
'ctrl-shift-e': 'editor:select-to-end-of-line'
'cmd-left': 'editor:move-to-first-character-of-line'
'atom-text-editor:not(.mini)'
'atom-text-editor:not([mini])'
'cmd-alt-[': 'editor:fold-current-row'
'cmd-alt-]': 'editor:unfold-current-row'
```
@@ -27,8 +27,8 @@ patterns* to *commands*. When an element with the `atom-text-editor` class is fo
`editor:delete-to-beginning-of-line` is emitted on the `atom-text-editor` element.
The second selector group also targets editors, but only if they don't have the
`.mini` class. In this example, the commands for code folding don't really make
sense on mini-editors, so the selector restricts them to regular editors.
`mini` attribute. In this example, the commands for code folding don't really
make sense on mini-editors, so the selector restricts them to regular editors.
### Keystroke Patterns
-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
+1 -1
Ver Arquivo
@@ -43,7 +43,7 @@ If you have problems with permissions don't forget to prefix with `sudo`
2. Checkout the latest Atom release:
```sh
git fetch
git fetch -p
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
```
+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.
+1 -2
Ver Arquivo
@@ -63,7 +63,7 @@ built-in keymaps:
'atom-text-editor':
'enter': 'editor:newline'
'atom-text-editor.mini input':
'atom-text-editor[mini] input':
'enter': 'core:confirm'
```
@@ -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
+5 -1
Ver Arquivo
@@ -18,5 +18,9 @@
* [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
* [Upgrading Your UI Theme Or Package Selectors](upgrading/upgrading-your-ui-theme.md)
* [Upgrading Your Syntax Theme](upgrading/upgrading-your-syntax-theme.md)
-150
Ver Arquivo
@@ -1,150 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="../../assets/js/html5shiv.js"></script>
<script src="../../assets/js/respond.min.js"></script>
<![endif]-->
<title>Atom - <%= title %></title>
<style>
/*github.com style (c) Vasily Polovnyov <vast@whiteants.net>*/
pre code {
display: block; padding: 0.5em;
color: #333;
background: #f8f8ff
}
pre .comment,
pre .template_comment,
pre .diff .header,
pre .javadoc {
color: #998;
font-style: italic
}
pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .nginx .title,
pre .subst,
pre .request,
pre .status {
color: #333;
font-weight: bold
}
pre .number,
pre .hexcolor,
pre .ruby .constant {
color: #099;
}
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula {
color: #d14
}
pre .title,
pre .id {
color: #900;
font-weight: bold
}
pre .javascript .title,
pre .lisp .title,
pre .clojure .title,
pre .subst {
font-weight: normal
}
pre .class .title,
pre .haskell .type,
pre .vhdl .literal,
pre .tex .command {
color: #458;
font-weight: bold
}
pre .tag,
pre .tag .title,
pre .rules .property,
pre .django .tag .keyword {
color: #000080;
font-weight: normal
}
pre .attribute,
pre .variable,
pre .lisp .body {
color: #008080
}
pre .regexp {
color: #009926
}
pre .class {
color: #458;
font-weight: bold
}
pre .symbol,
pre .ruby .symbol .string,
pre .lisp .keyword,
pre .tex .special,
pre .prompt {
color: #990073
}
pre .built_in,
pre .lisp .title,
pre .clojure .built_in {
color: #0086b3
}
pre .preprocessor,
pre .pi,
pre .doctype,
pre .shebang,
pre .cdata {
color: #999;
font-weight: bold
}
pre .deletion {
background: #fdd
}
pre .addition {
background: #dfd
}
pre .diff .change {
background: #0086b3
}
pre .chunk {
color: #aaa
}
body {
padding-top: 50px;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/<%= tag %>/index.html">Atom Documentation</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/docs/api/<%= tag %>/api/index.html">API</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<%= content %>
</div>
</body>
</html>
@@ -0,0 +1,27 @@
# Upgrading Your Syntax Theme
Text editor content is now rendered in the shadow DOM, which shields it from being styled by global style sheets to protect against accidental style pollution. For more background on the shadow DOM, check out the [Shadow DOM 101][shadow-dom-101] on HTML 5 Rocks.
Syntax themes are specifically intended to style only text editor content, so they are automatically loaded directly into the text editor's shadow DOM when it is enabled. This happens automatically when the the theme's `package.json` contains a `theme: "syntax"` declaration, so you don't need to change anything to target the appropriate context.
When theme style sheets are loaded into the text editor's shadow DOM, selectors intended to target the editor from the *outside* no longer make sense. Styles targeting the `.editor` and `.editor-colors` classes instead need to target the `:host` pseudo-element, which matches against the containing `atom-text-editor` node. Check out the [Shadow DOM 201][host-pseudo-element] article for more information about the `:host` pseudo-element.
Here's an example from Atom's light syntax theme. Note that the previous selectors intended to target the editor from the outside have been retained to allow the theme to keep working during the transition phase when it is possible to disable the shadow DOM.
```css
.editor-colors, :host { /* :host added */
background-color: @syntax-background-color;
color: @syntax-text-color;
}
.editor, :host { /* :host added */
.invisible-character {
color: @syntax-invisible-character-color;
}
/* more nested selectors... */
}
```
[shadow-dom-101]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom
[host-pseudo-element]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201#toc-style-host
+137
Ver Arquivo
@@ -0,0 +1,137 @@
# Upgrading Your UI Theme Or Package Selectors
In addition to changes in Atom's scripting API, we'll also be making some breaking changes to Atom's DOM structure, requiring stylesheets and keymaps in both packages and themes to be updated.
## Deprecation Cop
Deprecation cop will list usages of deprecated selector patterns to guide you. You can access it via the command palette (`cmd-shift-p`, then search for `Deprecation`). It breaks the deprecations down by package:
![dep-cop](https://cloud.githubusercontent.com/assets/69169/5078860/d38a5df4-6e64-11e4-95b6-eb585ee9bbfc.png)
## Custom Tags
Rather than adding classes to standard HTML elements to indicate their role, Atom now uses custom element names. For example, `<div class="workspace">` has now been replaced with `<atom-workspace>`. Selectors should be updated accordingly. Note that tag names have lower specificity than classes in CSS, so you'll need to take care in converting things.
Old Selector | New Selector
--------------------|--------------------------------
`.editor` | `atom-text-editor`
`.editor.mini` | `atom-text-editor[mini]`
`.workspace` | `atom-workspace`
`.horizontal` | `atom-workspace-axis.horizontal`
`.vertical` | `atom-workspace-axis.vertical`
`.pane-container` | `atom-pane-conatiner`
`.pane` | `atom-pane`
`.tool-panel` | `atom-panel`
`.panel-top` | `atom-panel.top`
`.panel-bottom` | `atom-panel.bottom`
`.panel-left` | `atom-panel.left`
`.panel-right` | `atom-panel.right`
`.overlay` | `atom-panel.modal`
## Supporting the Shadow DOM
Text editor content is now rendered in the shadow DOM, which shields it from being styled by global style sheets to protect against accidental style pollution. For more background on the shadow DOM, check out the [Shadow DOM 101][shadow-dom-101] on HTML 5 Rocks. If you need to style text editor content in a UI theme, you'll need to circumvent this protection for any rules that target the text editor's content. Some examples of the kinds of UI theme styles needing to be updated:
* Highlight decorations
* Gutter decorations
* Line decorations
* Scrollbar styling
* Anything targeting a child selector of `.editor`
During a transition phase, it will be possible to enable or disable the text editor's shadow DOM in the settings, so themes will need to be compatible with both approaches.
### Shadow DOM Selectors
Chromium provides two tools for bypassing shadow boundaries, the `::shadow` pseudo-element and the `/deep/` combinator. For an in-depth explanation of styling the shadow DOM, see the [Shadow DOM 201][shadow-dom-201] article on HTML 5 Rocks.
#### ::shadow
The `::shadow` pseudo-element allows you to bypass a single shadow root. For example, say you want to update a highlight decoration for a linter package. Initially, the style looks as follows:
```css
// Without shadow DOM support
atom-text-editor .highlight.my-linter {
background: hotpink;
}
```
In order for this style to apply with the shadow DOM enabled, you will need to add a second selector with the `::shadow` pseudo-element. You should leave the original selector in place so your theme continues to work with the shadow DOM disabled during the transition period.
```css
// With shadow DOM support
atom-text-editor .highlight.my-linter,
atom-text-editor::shadow .highlight.my-linter {
background: hotpink;
}
```
Check out the [find-and-replace][find-and-replace] package for another example of using `::shadow` to pierce the shadow DOM.
#### /deep/
The `/deep/` combinator overrides *all* shadow boundaries, making it useful for rules you want to apply globally such as scrollbar styling. Here's a snippet containing scrollbar styling for the Atom Dark UI theme before shadow DOM support:
```css
// Without shadow DOM support
.scrollbars-visible-always {
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
background: @scrollbar-background-color;
}
::-webkit-scrollbar-thumb {
background: @scrollbar-color;
border-radius: 5px;
box-shadow: 0 0 1px black inset;
}
}
```
To style scrollbars even inside of the shadow DOM, each rule needs to be prefixed with `/deep/`. We use `/deep/` instead of `::shadow` because we don't care about the selector of the host element in this case. We just want our styling to apply everywhere.
```css
// With shadow DOM support using /deep/
.scrollbars-visible-always {
/deep/ ::-webkit-scrollbar {
width: 8px;
height: 8px;
}
/deep/ ::-webkit-scrollbar-track,
/deep/ ::-webkit-scrollbar-corner {
background: @scrollbar-background-color;
}
/deep/ ::-webkit-scrollbar-thumb {
background: @scrollbar-color;
border-radius: 5px;
box-shadow: 0 0 1px black inset;
}
}
```
### Context-Targeted Style Sheets
The selector features discussed above allow you to target shadow DOM content with specific selectors, but Atom also allows you to target a specific shadow DOM context with an entire style sheet. The context into which a style sheet is loaded is based on the file name. If you want to load a style sheet into the editor, name it with the `.atom-text-editor.less` or `.atom-text-editor.css` extensions.
```
my-ui-theme/
stylesheets/
index.less # loaded globally
index.atom-text-editor.less # loaded in the text editor shadow DOM
```
Check out this [style sheet](https://github.com/atom/decoration-example/blob/master/stylesheets/decoration-example.atom-text-editor.less) from the decoration-example package for an example of context-targeting.
Inside a context-targeted style sheet, there's no need to use the `::shadow` or `/deep/` expressions. If you want to refer to the element containing the shadow root, you can use the `::host` pseudo-element.
During the transition phase, style sheets targeting the `atom-text-editor` context will *also* be loaded globally. Make sure you update your selectors in a way that maintains compatibility with the shadow DOM being disabled. That means if you use a `::host` pseudo element, you should also include the same style rule matches against `atom-text-editor`.
[shadow-dom-101]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom
[shadow-dom-201]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201#toc-style-cat-hat
[find-and-replace]: https://github.com/atom/find-and-replace/blob/95351f261bc384960a69b66bf12eae8002da63f9/stylesheets/find-and-replace.less#L10
+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.
+4 -7
Ver Arquivo
@@ -4,11 +4,8 @@
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
# An example hack to log to the console when each text editor is saved.
#
# path = require 'path'
#
# atom.workspaceView.eachEditorView (editorView) ->
# editor = editorView.getEditor()
# if path.extname(editor.getPath()) is '.md'
# editor.setSoftWrapped(true)
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# console.log "Saved! #{editor.getPath()}"
+1 -1
Ver Arquivo
@@ -12,7 +12,7 @@
# 'atom-text-editor':
# 'enter': 'editor:newline'
#
# '.workspace':
# 'atom-workspace':
# 'ctrl-shift-p': 'core:move-up'
# 'ctrl-p': 'core:move-down'
#
+107 -16
Ver Arquivo
@@ -1,4 +1,5 @@
{Point, Range} = require 'text-buffer'
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
{deprecate} = require 'grim'
module.exports =
@@ -7,29 +8,119 @@ module.exports =
GitRepository: require '../src/git-repository'
Point: Point
Range: Range
Emitter: Emitter
Disposable: Disposable
CompositeDisposable: CompositeDisposable
# The following classes can't be used from a Task handler and should therefore
# only be exported when not running as a child node process
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
module.exports.Task = require '../src/task'
module.exports.TextEditor = require '../src/text-editor'
{$, $$, $$$, View} = require '../src/space-pen-extensions'
module.exports.$ = $
module.exports.$$ = $$
module.exports.$$$ = $$$
module.exports.TextEditorView = require '../src/text-editor-view'
module.exports.ScrollView = require '../src/scroll-view'
module.exports.SelectListView = require '../src/select-list-view'
module.exports.Task = require '../src/task'
module.exports.View = View
module.exports.WorkspaceView = require '../src/workspace-view'
module.exports.Workspace = require '../src/workspace'
module.exports.React = require 'react-atom-fork'
module.exports.Reactionary = require 'reactionary-atom-fork'
Object.defineProperty module.exports, 'Workspace', get: ->
deprecate """
Requiring `Workspace` from `atom` is no longer supported.
If you need this, please open an issue on
https://github.com/atom/atom/issues/new
And let us know what you are using it for.
"""
require '../src/workspace'
Object.defineProperty module.exports, 'WorkspaceView', get: ->
deprecate """
Requiring `WorkspaceView` from `atom` is no longer supported.
Use `atom.view.getView(atom.workspace)` instead.
"""
require '../src/workspace-view'
Object.defineProperty module.exports, '$', get: ->
deprecate """
Requiring `$` from `atom` is no longer supported.
If you are using `space-pen`, please require `$` from `space-pen`. Otherwise require `jquery` instead:
`{$} = require 'space-pen'`
or
`$ = require 'jquery'`
Add `"space-pen": "^4"` to your package dependencies.
Or add `"jquery": "^2"` to your package dependencies.
"""
$
Object.defineProperty module.exports, '$$', get: ->
deprecate """
Requiring `$$` from `atom` is no longer supported.
Please require `space-pen` instead:
`{$$} = require 'space-pen'`
Add `"space-pen": "^4"` to your package dependencies.
"""
$$
Object.defineProperty module.exports, '$$$', get: ->
deprecate """
Requiring `$$$` from `atom` is no longer supported.
Please require `space-pen` instead:
`{$$$} = require 'space-pen'`
Add `"space-pen": "^4"` to your package dependencies.
"""
$$$
Object.defineProperty module.exports, 'View', get: ->
deprecate """
Requiring `View` from `atom` is no longer supported.
Please require `space-pen` instead:
`{View} = require 'space-pen'`
Add `"space-pen": "^4"` to your package dependencies.
"""
View
Object.defineProperty module.exports, 'EditorView', get: ->
deprecate """
Requiring `EditorView` from `atom` is no longer supported.
Please require `TextEditorView` from `atom-space-pen-view` instead:
`{TextEditorView} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^0"` to your package dependencies.
"""
require '../src/text-editor-view'
Object.defineProperty module.exports, 'TextEditorView', get: ->
deprecate """
Requiring `TextEditorView` from `atom` is no longer supported.
Please require `TextEditorView` from `atom-space-pen-view` instead:
`{TextEditorView} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^0"` to your package dependencies.
"""
require '../src/text-editor-view'
Object.defineProperty module.exports, 'ScrollView', get: ->
deprecate """
Requiring `ScrollView` from `atom` is no longer supported.
Please require `ScrollView` from `atom-space-pen-view` instead:
`{ScrollView} = require 'atom-space-pen-views'`
Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views
Add `"atom-space-pen-views": "^0"` to your package dependencies.
"""
require '../src/scroll-view'
Object.defineProperty module.exports, 'SelectListView', get: ->
deprecate """
Requiring `SelectListView` from `atom` is no longer supported.
Please require `SelectListView` from `atom-space-pen-view` instead:
`{SelectListView} = require 'atom-space-pen-views'`
Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views
Add `"atom-space-pen-views": "^0"` to your package dependencies.
"""
require '../src/select-list-view'
Object.defineProperty module.exports, 'React', get: ->
deprecate "Please require `react-atom-fork` instead: `React = require 'react-atom-fork'`. Add `\"react-atom-fork\": \"^0.11\"` to your package dependencies."
require 'react-atom-fork'
Object.defineProperty module.exports, 'Reactionary', get: ->
deprecate "Please require `reactionary` instead: `Reactionary = require 'reactionary'`. Add `\"reactionary\": \"^0.9\"` to your package dependencies."
require 'reactionary'
Object.defineProperty module.exports, 'Git', get: ->
deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`"
module.exports.GitRepository
Object.defineProperty module.exports, 'EditorView', get: ->
deprecate "Please require `TextEditorView` instead of `EditorView`: `{TextEditorView} = require 'atom'`"
module.exports.TextEditorView
+5 -2
Ver Arquivo
@@ -5,7 +5,7 @@
'shift-home': 'editor:select-to-first-character-of-line'
'shift-end': 'editor:select-to-end-of-line'
'atom-text-editor:not(.mini)':
'atom-text-editor:not([mini])':
# Atom Specific
'ctrl-C': 'editor:copy-path'
@@ -15,10 +15,13 @@
'shift-tab': 'editor:outdent-selected-rows'
'ctrl-K': 'editor:delete-line'
'.select-list atom-text-editor[mini]':
'enter': 'core:confirm'
'.tool-panel.panel-left, .tool-panel.panel-right':
'escape': 'tool-panel:unfocus'
'atom-text-editor !important, atom-text-editor.mini !important':
'atom-text-editor !important, atom-text-editor[mini] !important':
'escape': 'editor:consolidate-selections'
# allow standard input fields to work correctly
+4 -2
Ver Arquivo
@@ -29,6 +29,8 @@
'ctrl-alt-cmd-l': 'window:reload'
'alt-cmd-i': 'window:toggle-dev-tools'
'cmd-alt-ctrl-p': 'window:run-package-specs'
'ctrl-shift-left': 'pane:move-item-left'
'ctrl-shift-right': 'pane:move-item-right'
# Sublime Parity
'cmd-,': 'application:show-settings'
@@ -110,7 +112,7 @@
# Apple Specific
'cmd-backspace': 'editor:delete-to-beginning-of-line'
'cmd-shift-backspace': 'editor:delete-to-beginning-of-line'
'cmd-delete': 'editor:delete-to-beginning-of-line'
'cmd-delete': 'editor:delete-to-end-of-line'
'ctrl-A': 'editor:select-to-first-character-of-line'
'ctrl-E': 'editor:select-to-end-of-line'
'cmd-left': 'editor:move-to-first-character-of-line'
@@ -134,7 +136,7 @@
'cmd-l': 'editor:select-line'
'ctrl-t': 'editor:transpose'
'atom-workspace atom-text-editor:not(.mini)':
'atom-workspace atom-text-editor:not([mini])':
# Atom specific
'alt-cmd-z': 'editor:checkout-head-revision'
'cmd-<': 'editor:scroll-to-cursor'
+3 -1
Ver Arquivo
@@ -12,6 +12,8 @@
'ctrl-alt-s': 'application:run-all-specs'
'ctrl-alt-o': 'application:open-dev'
'ctrl-shift-o': 'application:open-folder'
'ctrl-shift-pageup': 'pane:move-item-left'
'ctrl-shift-pagedown': 'pane:move-item-right'
'F11': 'window:toggle-full-screen'
# Sublime Parity
@@ -99,7 +101,7 @@
'ctrl-k ctrl-l': 'editor:lower-case'
'ctrl-l': 'editor:select-line'
'atom-workspace atom-text-editor:not(.mini)':
'atom-workspace atom-text-editor:not([mini])':
# Atom specific
'alt-ctrl-z': 'editor:checkout-head-revision'
'ctrl-<': 'editor:scroll-to-cursor'
+5 -1
Ver Arquivo
@@ -14,6 +14,10 @@
'ctrl-alt-i': 'window:toggle-dev-tools'
'ctrl-alt-p': 'window:run-package-specs'
'ctrl-alt-s': 'application:run-all-specs'
'ctrl-alt-o': 'application:open-dev'
'ctrl-shift-o': 'application:open-folder'
'ctrl-shift-left': 'pane:move-item-left'
'ctrl-shift-right': 'pane:move-item-right'
'F11': 'window:toggle-full-screen'
# Sublime Parity
@@ -94,7 +98,7 @@
'ctrl-k ctrl-l': 'editor:lower-case'
'ctrl-l': 'editor:select-line'
'atom-workspace atom-text-editor:not(.mini)':
'atom-workspace atom-text-editor:not([mini])':
# Atom specific
'alt-ctrl-z': 'editor:checkout-head-revision'
'ctrl-<': 'editor:scroll-to-cursor'
+6
Ver Arquivo
@@ -190,6 +190,12 @@
submenu: [
{ label: 'Terms of Use', command: 'application:open-terms-of-use' }
{ label: 'Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
{ type: 'separator' }
{ label: 'Community Discussions', command: 'application:open-discussions' }
{ label: 'Report Issue', command: 'application:report-issue' }
{ label: 'Search Issues', command: 'application:search-issues' }
{ type: 'separator' }
]
}
+7
Ver Arquivo
@@ -94,6 +94,7 @@
submenu: [
{ label: '&Reload', command: 'window:reload' }
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
{ label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' }
{
label: 'Developer'
submenu: [
@@ -147,6 +148,12 @@
{ label: "VERSION", enabled: false }
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
{ type: 'separator' }
{ label: 'Community Discussions', command: 'application:open-discussions' }
{ label: 'Report Issue', command: 'application:report-issue' }
{ label: 'Search Issues', command: 'application:search-issues' }
{ type: 'separator' }
]
}
+9 -2
Ver Arquivo
@@ -93,6 +93,7 @@
submenu: [
{ label: '&Reload', command: 'window:reload' }
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
{ label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' }
{
label: 'Panes'
submenu: [
@@ -109,7 +110,7 @@
{ label: 'Focus Pane On Left', command: 'window:focus-pane-on-left' }
{ label: 'Focus Pane On Right', command: 'window:focus-pane-on-right' }
{ type: 'separator' }
{ label: 'Close pane', command: 'pane:close' }
{ label: 'Close Pane', command: 'pane:close' }
]
}
{
@@ -162,9 +163,15 @@
submenu: [
{ label: 'View &Terms of Use', command: 'application:open-terms-of-use' }
{ label: 'View &License', command: 'application:open-license' }
{ label: "VERSION", enabled: false }
{ label: 'VERSION', enabled: false }
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Roadmap', command: 'application:open-roadmap' }
{ label: 'Frequently Asked Questions', command: 'application:open-faq' }
{ type: 'separator' }
{ label: 'Community Discussions', command: 'application:open-discussions' }
{ label: 'Report Issue', command: 'application:report-issue' }
{ label: 'Search Issues', command: 'application:search-issues' }
{ type: 'separator' }
]
}
+50 -48
Ver Arquivo
@@ -1,7 +1,7 @@
{
{
"name": "atom",
"productName": "Atom",
"version": "0.141.0",
"version": "0.151.0",
"description": "A hackable text editor for the 21st Century.",
"main": "./src/browser/main.js",
"repository": {
@@ -17,10 +17,10 @@
"url": "http://github.com/atom/atom/raw/master/LICENSE.md"
}
],
"atomShellVersion": "0.18.2",
"atomShellVersion": "0.19.4",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "^2.2.1",
"atom-keymap": "^2.2.2",
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
"clear-cut": "0.4.0",
"coffee-script": "1.7.0",
@@ -29,7 +29,7 @@
"emissary": "^1.3.1",
"event-kit": "0.7.2",
"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",
@@ -37,13 +37,15 @@
"guid": "0.0.10",
"jasmine-json": "~0.0",
"jasmine-tagged": "^1.1.2",
"less-cache": "0.17.0",
"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.1.3",
"pathwatcher": "^2.3.2",
"property-accessors": "^1",
"q": "^1.0.1",
"random-words": "0.0.1",
@@ -56,91 +58,91 @@
"season": "^1.0.2",
"semver": "2.2.1",
"serializable": "^1",
"space-pen": "3.8.0",
"space-pen": "3.8.2",
"temp": "0.7.0",
"text-buffer": "^3.3.0",
"text-buffer": "^3.7.2",
"theorist": "^1.0.2",
"underscore-plus": "^1.6.1",
"vm-compatibility-layer": "0.1.0"
},
"packageDependencies": {
"atom-dark-syntax": "0.20.0",
"atom-dark-ui": "0.35.0",
"atom-light-syntax": "0.21.0",
"atom-light-ui": "0.30.0",
"base16-tomorrow-dark-theme": "0.21.0",
"base16-tomorrow-light-theme": "0.4.0",
"solarized-dark-syntax": "0.22.0",
"solarized-light-syntax": "0.12.0",
"atom-dark-syntax": "0.23.0",
"atom-dark-ui": "0.41.0",
"atom-light-syntax": "0.22.0",
"atom-light-ui": "0.35.0",
"base16-tomorrow-dark-theme": "0.22.0",
"base16-tomorrow-light-theme": "0.5.0",
"solarized-dark-syntax": "0.23.0",
"solarized-light-syntax": "0.13.0",
"archive-view": "0.37.0",
"autocomplete": "0.32.0",
"autocomplete": "0.33.0",
"autoflow": "0.18.0",
"autosave": "0.18.0",
"background-tips": "0.17.0",
"bookmarks": "0.28.0",
"bookmarks": "0.30.0",
"bracket-matcher": "0.62.0",
"command-palette": "0.27.0",
"deprecation-cop": "0.11.0",
"dev-live-reload": "0.34.0",
"command-palette": "0.28.0",
"deprecation-cop": "0.18.0",
"dev-live-reload": "0.35.0",
"encoding-selector": "0.8.0",
"exception-reporting": "0.20.0",
"feedback": "0.33.0",
"find-and-replace": "0.141.0",
"find-and-replace": "0.147.0",
"fuzzy-finder": "0.60.0",
"git-diff": "0.42.0",
"git-diff": "0.43.0",
"go-to-line": "0.26.0",
"grammar-selector": "0.35.0",
"image-view": "0.38.0",
"grammar-selector": "0.37.0",
"image-view": "0.42.0",
"incompatible-packages": "0.10.0",
"keybinding-resolver": "0.20.0",
"link": "0.26.0",
"markdown-preview": "0.107.0",
"metrics": "0.36.0",
"markdown-preview": "0.110.0",
"metrics": "0.39.0",
"open-on-github": "0.30.0",
"package-generator": "0.31.0",
"package-generator": "0.32.0",
"release-notes": "0.36.0",
"settings-view": "0.153.0",
"settings-view": "0.161.0",
"snippets": "0.56.0",
"spell-check": "0.43.0",
"status-bar": "0.46.0",
"spell-check": "0.44.0",
"status-bar": "0.47.0",
"styleguide": "0.30.0",
"symbols-view": "0.66.0",
"tabs": "0.55.0",
"symbols-view": "0.68.0",
"tabs": "0.56.0",
"timecop": "0.23.0",
"tree-view": "0.131.0",
"tree-view": "0.134.0",
"update-package-dependencies": "0.6.0",
"welcome": "0.19.0",
"whitespace": "0.26.0",
"wrap-guide": "0.23.0",
"language-c": "0.29.0",
"language-coffee-script": "0.37.0",
"language-css": "0.21.0",
"language-gfm": "0.53.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.54.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.42.0",
"language-javascript": "0.45.0",
"language-json": "0.8.0",
"language-less": "0.18.0",
"language-make": "0.12.0",
"language-mustache": "0.10.0",
"language-objective-c": "0.11.0",
"language-perl": "0.9.0",
"language-php": "0.17.0",
"language-php": "0.18.0",
"language-property-list": "0.7.0",
"language-python": "0.21.0",
"language-python": "0.24.0",
"language-ruby": "0.41.0",
"language-ruby-on-rails": "0.18.0",
"language-sass": "0.24.0",
"language-shellscript": "0.8.0",
"language-sass": "0.26.0",
"language-shellscript": "0.10.0",
"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.19.0"
"language-xml": "0.25.0",
"language-yaml": "0.20.0"
},
"private": true,
"scripts": {
+2 -1
Ver Arquivo
@@ -1,6 +1,7 @@
Package: <%= name %>
Version: <%= version %>
Depends: python (>= 2.6), libc6
Depends: 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
Architecture: <%= arch %>
-3
Ver Arquivo
@@ -4,9 +4,6 @@ Release: 0.1%{?dist}
Summary: Atom is a hackable text editor for the 21st century
License: MIT
URL: https://atom.io/
BuildConflicts: gyp
BuildRequires: make, gcc, gcc-c++, glibc-devel, git-core, libgnome-keyring-devel
Requires: libgnome-keyring
AutoReqProv: no # Avoid libchromiumcontent.so missing dependency
%description
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 274 KiB

+3
Ver Arquivo
@@ -34,6 +34,9 @@ exports.safeSpawn = function(command, args, options, callback) {
var child = childProcess.spawn(command, args, options);
child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);
child.on('error', function(error) {
console.error('Command \'' + command + '\' failed: ' + error.message);
});
child.on('exit', function(code) {
if (code != 0)
process.exit(code);
+3 -1
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) ->
@@ -110,7 +111,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}) ->
+72 -3
Ver Arquivo
@@ -5,9 +5,6 @@ Package = require '../src/package'
ThemeManager = require '../src/theme-manager'
describe "the `atom` global", ->
beforeEach ->
atom.workspaceView = atom.workspace.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', ->
@@ -35,6 +32,9 @@ describe "the `atom` global", ->
describe "window:update-available", ->
it "is triggered when the auto-updater sends the update-downloaded event", ->
# FIXME: We need to figure out a way minus workspaceView to handle update-available events.
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
updateAvailableHandler = jasmine.createSpy("update-available-handler")
atom.workspaceView.on 'window:update-available', updateAvailableHandler
autoUpdater = require('remote').require('auto-updater')
@@ -52,3 +52,72 @@ describe "the `atom` global", ->
it 'loads the default core config', ->
expect(atom.config.get('core.excludeVcsIgnoredPaths')).toBe true
expect(atom.config.get('editor.showInvisibles')).toBe false
describe "window onerror handler", ->
beforeEach ->
spyOn atom, 'openDevTools'
spyOn atom, 'executeJavaScriptInDevTools'
it "will open the dev tools when an error is triggered", ->
try
a + 1
catch e
window.onerror.call(window, e.toString(), 'abc', 2, 3, e)
expect(atom.openDevTools).toHaveBeenCalled()
expect(atom.executeJavaScriptInDevTools).toHaveBeenCalled()
describe "::onWillThrowError", ->
willThrowSpy = null
beforeEach ->
willThrowSpy = jasmine.createSpy()
it "is called when there is an error", ->
error = null
atom.onWillThrowError(willThrowSpy)
try
a + 1
catch e
error = e
window.onerror.call(window, e.toString(), 'abc', 2, 3, e)
delete willThrowSpy.mostRecentCall.args[0].preventDefault
expect(willThrowSpy).toHaveBeenCalledWith
message: error.toString()
url: 'abc'
line: 2
column: 3
originalError: error
it "will not show the devtools when preventDefault() is called", ->
willThrowSpy.andCallFake (errorObject) -> errorObject.preventDefault()
atom.onWillThrowError(willThrowSpy)
try
a + 1
catch e
window.onerror.call(window, e.toString(), 'abc', 2, 3, e)
expect(willThrowSpy).toHaveBeenCalled()
expect(atom.openDevTools).not.toHaveBeenCalled()
expect(atom.executeJavaScriptInDevTools).not.toHaveBeenCalled()
describe "::onDidThrowError", ->
didThrowSpy = null
beforeEach ->
didThrowSpy = jasmine.createSpy()
it "is called when there is an error", ->
error = null
atom.onDidThrowError(didThrowSpy)
try
a + 1
catch e
error = e
window.onerror.call(window, e.toString(), 'abc', 2, 3, e)
expect(didThrowSpy).toHaveBeenCalledWith
message: error.toString()
url: 'abc'
line: 2
column: 3
originalError: error
+9 -1
Ver Arquivo
@@ -1,4 +1,5 @@
CommandRegistry = require '../src/command-registry'
_ = require 'underscore-plus'
describe "CommandRegistry", ->
[registry, parent, child, grandchild] = []
@@ -154,8 +155,15 @@ describe "CommandRegistry", ->
registry.add '.grandchild', 'namespace:command-3', ->
registry.add '.grandchild.no-match', 'namespace:command-4', ->
expect(registry.findCommands(target: grandchild)[0..2]).toEqual [
registry.add grandchild, 'namespace:inline-command-1', ->
registry.add child, 'namespace:inline-command-2', ->
commands = registry.findCommands(target: grandchild)
nonJqueryCommands = _.reject commands, (cmd) -> cmd.jQuery
expect(nonJqueryCommands).toEqual [
{name: 'namespace:inline-command-1', displayName: 'Namespace: Inline Command 1'}
{name: 'namespace:command-3', displayName: 'Namespace: Command 3'}
{name: 'namespace:inline-command-2', displayName: 'Namespace: Inline Command 2'}
{name: 'namespace:command-2', displayName: 'Namespace: Command 2'}
{name: 'namespace:command-1', displayName: 'Namespace: Command 1'}
]
+46
Ver Arquivo
@@ -195,6 +195,52 @@ describe "Config", ->
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.save.callCount).toBe 1
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
expect(atom.config.save).not.toHaveBeenCalled()
scopedProperties = atom.config.scopedSettingsStore.propertiesForSource('user-config')
expect(scopedProperties['.coffee.source']).toBeUndefined()
it "removes the scoped value when it was the only set value on the object", ->
spyOn(CSON, 'writeFileSync')
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)
CSON.writeFileSync.reset()
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).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
expect(CSON.writeFileSync).toHaveBeenCalled()
properties = CSON.writeFileSync.mostRecentCall.args[1]
expect(properties['.coffee.source']).toEqual
foo:
bar:
zfoo: 20
CSON.writeFileSync.reset()
atom.config.restoreDefault('.source.coffee', 'foo.bar.zfoo')
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.save.reset()
atom.config.restoreDefault('.source.coffee', 'foo.bar.ok')
expect(atom.config.save).not.toHaveBeenCalled()
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
describe ".getSettings()", ->
it "returns all settings including defaults", ->
atom.config.setDefaults("foo", bar: baz: 10)
@@ -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.getActiveEditor())?.__spacePenView
editorView?.command 'activation-command', =>
@legacyActivationCommandCallCount++
@@ -0,0 +1 @@
a { color: red }
@@ -0,0 +1,4 @@
{
"theme": "syntax",
"stylesheets": ["editor.less"]
}
+3 -2
Ver Arquivo
@@ -96,12 +96,13 @@ describe "LanguageMode", ->
buffer.setText("//this is a single line comment")
expect(languageMode.rowRangeForCommentAtBufferRow(0)).toBeUndefined()
describe "suggestedIndentForBufferRow", ->
it "returns the suggested indentation based on auto-indent/outdent rules", ->
describe ".suggestedIndentForBufferRow", ->
it "bases indentation off of the previous non-blank line", ->
expect(languageMode.suggestedIndentForBufferRow(0)).toBe 0
expect(languageMode.suggestedIndentForBufferRow(1)).toBe 1
expect(languageMode.suggestedIndentForBufferRow(2)).toBe 2
expect(languageMode.suggestedIndentForBufferRow(9)).toBe 1
expect(languageMode.suggestedIndentForBufferRow(11)).toBe 1
describe "rowRangeForParagraphAtBufferRow", ->
describe "with code and comments", ->
+101 -55
Ver Arquivo
@@ -2,8 +2,9 @@
Package = require '../src/package'
describe "PackageManager", ->
workspaceElement = null
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
workspaceElement = atom.views.getView(atom.workspace)
describe "::loadPackage(name)", ->
it "continues if the package has an invalid package.json", ->
@@ -48,9 +49,10 @@ describe "PackageManager", ->
describe "when called multiple times", ->
it "it only calls activate on the package once", ->
spyOn(Package.prototype, 'activateNow').andCallThrough()
atom.packages.activatePackage('package-with-index')
atom.packages.activatePackage('package-with-index')
waitsForPromise ->
atom.packages.activatePackage('package-with-index')
waitsForPromise ->
atom.packages.activatePackage('package-with-index')
waitsForPromise ->
atom.packages.activatePackage('package-with-index')
@@ -110,7 +112,7 @@ describe "PackageManager", ->
[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
@@ -124,29 +126,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.getActiveEditor()).__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
@@ -182,8 +184,10 @@ describe "PackageManager", ->
pack.mainModule.someNumber = 77
atom.packages.deactivatePackage("package-with-serialization")
spyOn(pack.mainModule, 'activate').andCallThrough()
atom.packages.activatePackage("package-with-serialization")
expect(pack.mainModule.activate).toHaveBeenCalledWith({someNumber: 77})
waitsForPromise ->
atom.packages.activatePackage("package-with-serialization")
runs ->
expect(pack.mainModule.activate).toHaveBeenCalledWith({someNumber: 77})
it "logs warning instead of throwing an exception if the package fails to load", ->
atom.config.set("core.disabledPackages", [])
@@ -202,11 +206,13 @@ describe "PackageManager", ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])).toHaveLength 0
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
atom.packages.activatePackage("package-with-keymaps")
waitsForPromise ->
atom.packages.activatePackage("package-with-keymaps")
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
runs ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
describe "when the metadata contains a 'keymaps' manifest", ->
it "loads only the keymaps specified by the manifest, in the specified order", ->
@@ -215,11 +221,13 @@ describe "PackageManager", ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0
atom.packages.activatePackage("package-with-keymaps-manifest")
waitsForPromise ->
atom.packages.activatePackage("package-with-keymaps-manifest")
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
runs ->
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0
describe "menu loading", ->
beforeEach ->
@@ -232,14 +240,16 @@ describe "PackageManager", ->
expect(atom.contextMenu.templateForElement(element)).toEqual []
atom.packages.activatePackage("package-with-menus")
waitsForPromise ->
atom.packages.activatePackage("package-with-menus")
expect(atom.menu.template.length).toBe 2
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[2].label).toBe "Menu item 3"
runs ->
expect(atom.menu.template.length).toBe 2
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[2].label).toBe "Menu item 3"
describe "when the metadata contains a 'menus' manifest", ->
it "loads only the menus specified by the manifest, in the specified order", ->
@@ -247,13 +257,15 @@ describe "PackageManager", ->
expect(atom.contextMenu.templateForElement(element)).toEqual []
atom.packages.activatePackage("package-with-menus-manifest")
waitsForPromise ->
atom.packages.activatePackage("package-with-menus-manifest")
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[2]).toBeUndefined()
runs ->
expect(atom.menu.template[0].label).toBe "Second to Last"
expect(atom.menu.template[1].label).toBe "Last"
expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 2"
expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 1"
expect(atom.contextMenu.templateForElement(element)[2]).toBeUndefined()
describe "stylesheet loading", ->
describe "when the metadata contains a 'stylesheets' manifest", ->
@@ -270,33 +282,67 @@ describe "PackageManager", ->
expect(atom.themes.stylesheetElementForId(two)).toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
atom.packages.activatePackage("package-with-stylesheets-manifest")
waitsForPromise ->
atom.packages.activatePackage("package-with-stylesheets-manifest")
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '1px'
runs ->
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '1px'
describe "when the metadata does not contain a 'stylesheets' manifest", ->
it "loads all stylesheets from the stylesheets directory", ->
one = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/1.css")
two = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/2.less")
three = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/3.css")
three = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/3.test-context.css")
four = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/4.css")
one = atom.themes.stringToId(one)
two = atom.themes.stringToId(two)
three = atom.themes.stringToId(three)
four = atom.themes.stringToId(four)
expect(atom.themes.stylesheetElementForId(one)).toBeNull()
expect(atom.themes.stylesheetElementForId(two)).toBeNull()
expect(atom.themes.stylesheetElementForId(three)).toBeNull()
expect(atom.themes.stylesheetElementForId(four)).toBeNull()
waitsForPromise ->
atom.packages.activatePackage("package-with-stylesheets")
runs ->
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(four)).not.toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '3px'
it "assigns the stylesheet's context based on the filename", ->
waitsForPromise ->
atom.packages.activatePackage("package-with-stylesheets")
expect(atom.themes.stylesheetElementForId(one)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(two)).not.toBeNull()
expect(atom.themes.stylesheetElementForId(three)).not.toBeNull()
expect($('#jasmine-content').css('font-size')).toBe '3px'
runs ->
count = 0
for styleElement in atom.styles.getStyleElements()
if styleElement.sourcePath.match /1.css/
expect(styleElement.context).toBe undefined
count++
if styleElement.sourcePath.match /2.less/
expect(styleElement.context).toBe undefined
count++
if styleElement.sourcePath.match /3.test-context.css/
expect(styleElement.context).toBe 'test-context'
count++
if styleElement.sourcePath.match /4.css/
expect(styleElement.context).toBe undefined
count++
expect(count).toBe 4
describe "grammar loading", ->
it "loads the package's grammars", ->
@@ -304,8 +350,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", ->
@@ -317,13 +363,13 @@ describe "PackageManager", ->
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()
@@ -409,8 +455,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 ->
@@ -445,15 +491,15 @@ describe "PackageManager", ->
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 ->
@@ -481,8 +527,8 @@ 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()
it "activates all the packages, and none of the themes", ->
atom.packages.activate()
+1 -1
Ver Arquivo
@@ -92,7 +92,7 @@ describe "Package", ->
it "reloads without readding to the stylesheets list", ->
expect(theme.getStylesheetPaths().length).toBe 3
theme.reloadStylesheet(theme.getStylesheetPaths()[0])
theme.reloadStylesheets()
expect(theme.getStylesheetPaths().length).toBe 3
describe "events", ->
+7
Ver Arquivo
@@ -33,6 +33,13 @@ describe "PaneContainer", ->
[pane1B, pane2B, pane3B] = containerB.getPanes()
expect(containerB.getActivePane()).toBe pane3B
it "makes the first pane active if no pane exists for the activePaneId", ->
pane3A.activate()
state = containerA.serialize()
state.activePaneId = -22
containerB = atom.deserializers.deserialize(state)
expect(containerB.getActivePane()).toBe containerB.getPanes()[0]
it "does not allow the root pane to be destroyed", ->
container = new PaneContainer
container.getRoot().destroy()
+6 -6
Ver Arquivo
@@ -19,7 +19,7 @@ describe "PaneContainerView", ->
save: -> @saved = true
isEqual: (other) -> @name is other?.name
container = atom.workspace.getView(atom.workspace.paneContainer).__spacePenView
container = atom.views.getView(atom.workspace.paneContainer).__spacePenView
pane1 = container.getRoot()
pane1.activateItem(new TestView('1'))
pane2 = pane1.splitRight(new TestView('2'))
@@ -73,7 +73,7 @@ describe "PaneContainerView", ->
describe "serialization", ->
it "can be serialized and deserialized, and correctly adjusts dimensions of deserialized panes after attach", ->
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
newContainer = atom.views.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(2)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > :contains(3)')).toExist()
@@ -89,14 +89,14 @@ describe "PaneContainerView", ->
describe "if the 'core.destroyEmptyPanes' config option is false (the default)", ->
it "leaves the empty panes intact", ->
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
newContainer = atom.views.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('atom-pane-axis.horizontal > :contains(1)')).toExist()
expect(newContainer.find('atom-pane-axis.horizontal > atom-pane-axis.vertical > atom-pane').length).toBe 2
describe "if the 'core.destroyEmptyPanes' config option is true", ->
it "removes empty panes on deserialization", ->
atom.config.set('core.destroyEmptyPanes', true)
newContainer = atom.workspace.getView(container.model.testSerialization()).__spacePenView
newContainer = atom.views.getView(container.model.testSerialization()).__spacePenView
expect(newContainer.find('atom-pane-axis.horizontal, atom-pane-axis.vertical')).not.toExist()
expect(newContainer.find('> :contains(1)')).toExist()
@@ -109,7 +109,7 @@ describe "PaneContainerView", ->
item2b = new TestView('2b')
item3a = new TestView('3a')
container = atom.workspace.getView(new PaneContainer).__spacePenView
container = atom.views.getView(new PaneContainer).__spacePenView
pane1 = container.getRoot()
pane1.activateItem(item1a)
container.attachToDom()
@@ -259,7 +259,7 @@ describe "PaneContainerView", ->
# |7|8|9|
# -------
container = atom.workspace.getView(new PaneContainer).__spacePenView
container = atom.views.getView(new PaneContainer).__spacePenView
pane1 = container.getRoot()
pane1.activateItem(new TestView('1'))
pane4 = pane1.splitDown(new TestView('4'))
+49
Ver Arquivo
@@ -146,6 +146,24 @@ describe "Pane", ->
pane.activateNextItem()
expect(pane.getActiveItem()).toBe item1
describe "::moveItemRight() and ::moveItemLeft()", ->
it "moves the active item to the right and left, without looping around at either end", ->
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
[item1, item2, item3] = pane.getItems()
pane.activateItemAtIndex(0)
expect(pane.getActiveItem()).toBe item1
pane.moveItemLeft()
expect(pane.getItems()).toEqual [item1, item2, item3]
pane.moveItemRight()
expect(pane.getItems()).toEqual [item2, item1, item3]
pane.moveItemLeft()
expect(pane.getItems()).toEqual [item1, item2, item3]
pane.activateItemAtIndex(2)
expect(pane.getActiveItem()).toBe item3
pane.moveItemRight()
expect(pane.getItems()).toEqual [item1, item2, item3]
describe "::activateItemAtIndex(index)", ->
it "activates the item at the given index", ->
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
@@ -565,6 +583,37 @@ describe "Pane", ->
expect(pane1.isActive()).toBe false
expect(pane2.isActive()).toBe true
describe "::close()", ->
it "prompts to save unsaved items before destroying the pane", ->
pane = new Pane(items: [new Item("A"), new Item("B")])
[item1, item2] = pane.getItems()
item1.shouldPromptToSave = -> true
item1.getUri = -> "/test/path"
item1.save = jasmine.createSpy("save")
spyOn(atom, 'confirm').andReturn(0)
pane.close()
expect(atom.confirm).toHaveBeenCalled()
expect(item1.save).toHaveBeenCalled()
expect(pane.isDestroyed()).toBe true
it "does not destroy the pane if cancel is called", ->
pane = new Pane(items: [new Item("A"), new Item("B")])
[item1, item2] = pane.getItems()
item1.shouldPromptToSave = -> true
item1.getUri = -> "/test/path"
item1.save = jasmine.createSpy("save")
spyOn(atom, 'confirm').andReturn(1)
pane.close()
expect(atom.confirm).toHaveBeenCalled()
expect(item1.save).not.toHaveBeenCalled()
expect(pane.isDestroyed()).toBe false
describe "::destroy()", ->
[container, pane1, pane2] = []
+6 -3
Ver Arquivo
@@ -24,7 +24,7 @@ describe "PaneView", ->
beforeEach ->
deserializerDisposable = atom.deserializers.add(TestView)
container = atom.workspace.getView(new PaneContainer).__spacePenView
container = atom.views.getView(new PaneContainer).__spacePenView
containerModel = container.model
view1 = new TestView(id: 'view-1', text: 'View 1')
view2 = new TestView(id: 'view-2', text: 'View 2')
@@ -144,12 +144,15 @@ describe "PaneView", ->
describe "when an item is moved to another pane", ->
it "detaches the item's view rather than removing it", ->
container.attachToDom()
expect(view1.is(':visible')).toBe true
paneModel2 = paneModel.splitRight()
view1.data('preservative', 1234)
paneModel.moveItemToPane(view1, paneModel2, 1)
expect(view1.data('preservative')).toBe 1234
paneModel2.activateItemAtIndex(1)
expect(view1.data('preservative')).toBe 1234
expect(view1.is(':visible')).toBe true
describe "when the title of the active item changes", ->
describe 'when there is no onDidChangeTitle method', ->
@@ -311,13 +314,13 @@ describe "PaneView", ->
container.attachToDom()
pane.focus()
container2 = atom.workspace.getView(container.model.testSerialization()).__spacePenView
container2 = atom.views.getView(container.model.testSerialization()).__spacePenView
pane2 = container2.getRoot()
container2.attachToDom()
expect(pane2).toMatchSelector(':has(:focus)')
$(document.activeElement).blur()
container3 = atom.workspace.getView(container.model.testSerialization()).__spacePenView
container3 = atom.views.getView(container.model.testSerialization()).__spacePenView
pane3 = container3.getRoot()
container3.attachToDom()
expect(pane3).not.toMatchSelector(':has(:focus)')
+68 -13
Ver Arquivo
@@ -34,8 +34,8 @@ describe "PanelContainerElement", ->
element = container.getView()
jasmineContent.appendChild(element)
it 'has a location attribute with value from the model', ->
expect(element.getAttribute('location')).toBe 'left'
it 'has a location class with value from the model', ->
expect(element).toHaveClass 'left'
it 'removes the element when the container is destroyed', ->
expect(element.parentNode).toBe jasmineContent
@@ -43,21 +43,76 @@ describe "PanelContainerElement", ->
expect(element.parentNode).not.toBe jasmineContent
describe "adding and removing panels", ->
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
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(), location: 'left'})
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0]).toHaveClass 'left'
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
panel2 = new Panel({viewRegistry, 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'
panel1.destroy()
expect(element.childNodes.length).toBe 1
panel2.destroy()
expect(element.childNodes.length).toBe 0
describe "when the container is at the bottom location", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'bottom'})
element = container.getView()
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'})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0]).toHaveClass 'bottom'
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
expect(panel1.getView()).toHaveClass 'one'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), className: 'two'})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
expect(panel2.getView()).toHaveClass 'two'
panel1.destroy()
expect(element.childNodes.length).toBe 1
panel2.destroy()
expect(element.childNodes.length).toBe 0
describe "when the container is modal", ->
beforeEach ->
container = new PanelContainer({viewRegistry, location: 'modal'})
element = container.getView()
jasmineContent.appendChild(element)
it "allows only one panel to be visible at a time", ->
panel1 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0].tagName).toBe 'ATOM-PANEL'
expect(panel1.getView().style.display).not.toBe 'none'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem(), location: 'left'})
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(element.childNodes.length).toBe 2
panel1.destroy()
expect(element.childNodes.length).toBe 1
expect(panel1.getView().style.display).toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
panel2.destroy()
expect(element.childNodes.length).toBe 0
panel1.show()
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).toBe 'none'
+9
Ver Arquivo
@@ -54,3 +54,12 @@ describe "PanelElement", ->
panel.show()
expect(element.style.display).not.toBe 'none'
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()
jasmineContent.appendChild(element)
expect(element).toHaveClass 'some'
expect(element).toHaveClass 'classes'
+1 -1
Ver Arquivo
@@ -184,7 +184,7 @@ describe "SelectListView", ->
describe "when the mini editor loses focus", ->
it "triggers the cancelled hook and detaches the select list", ->
spyOn(selectList, 'detach')
filterEditorView.hiddenInput.trigger 'focusout'
filterEditorView.trigger 'blur'
expect(selectList.cancelled).toHaveBeenCalled()
expect(selectList.detach).toHaveBeenCalled()
+13 -11
Ver Arquivo
@@ -82,7 +82,7 @@ beforeEach ->
serializedWindowState = null
spyOn(atom, 'saveSync')
atom.syntax.clearGrammarOverrides()
atom.grammars.clearGrammarOverrides()
spy = spyOn(atom.packages, 'resolvePackagePath').andCallFake (packageName) ->
if specPackageName and packageName is specPackageName
@@ -106,6 +106,7 @@ beforeEach ->
config.set "editor.autoIndent", false
config.set "core.disabledPackages", ["package-that-throws-an-exception",
"package-with-broken-package-json", "package-with-broken-keymap"]
config.set "editor.useShadowDOM", true
config.load.reset()
config.save.reset()
@@ -134,8 +135,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()
@@ -149,7 +151,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 = ->
@@ -190,6 +192,10 @@ 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)
addCustomMatchers = (spec) ->
spec.addMatchers
toBeInstanceOf: (expected) ->
@@ -219,7 +225,7 @@ addCustomMatchers = (spec) ->
@message = -> return "Expected element '" + @actual + "' or its descendants" + notText + " to have focus."
element = @actual
element = element.get(0) if element.jquery
element.webkitMatchesSelector(":focus") or element.querySelector(":focus")
element is document.activeElement or element.contains(document.activeElement)
toShow: ->
notText = if @isNot then " not" else ""
@@ -338,12 +344,8 @@ window.setEditorWidthInChars = (editorView, widthInChars, charWidth=editorView.c
$(window).trigger 'resize' # update width of editor view's on-screen lines
window.setEditorHeightInLines = (editorView, heightInLines, lineHeight=editorView.lineHeight) ->
if editorView.hasClass('react')
editorView.height(editorView.getEditor().getLineHeightInPixels() * heightInLines)
editorView.component?.measureHeightAndWidth()
else
editorView.height(lineHeight * heightInLines + editorView.renderedLines.position().top)
$(window).trigger 'resize' # update editor view's on-screen lines
editorView.height(editorView.getEditor().getLineHeightInPixels() * heightInLines)
editorView.component?.measureHeightAndWidth()
$.fn.resultOfTrigger = (type) ->
event = $.Event(type)
+53
Ver Arquivo
@@ -52,3 +52,56 @@ describe "StylesElement", ->
expect(element.children.length).toBe initialChildCount + 1
expect(element.children[initialChildCount].textContent).toBe "a {color: blue;}"
expect(updatedStyleElements).toEqual [element.children[initialChildCount]]
it "only includes style elements matching the 'context' attribute", ->
initialChildCount = element.children.length
atom.styles.addStyleSheet("a {color: red;}", context: 'test-context')
atom.styles.addStyleSheet("a {color: green;}")
expect(element.children.length).toBe initialChildCount + 2
expect(element.children[initialChildCount].textContent).toBe "a {color: red;}"
expect(element.children[initialChildCount + 1].textContent).toBe "a {color: green;}"
element.setAttribute('context', 'test-context')
expect(element.children.length).toBe 1
expect(element.children[0].textContent).toBe "a {color: red;}"
atom.styles.addStyleSheet("a {color: blue;}", context: 'test-context')
atom.styles.addStyleSheet("a {color: yellow;}")
expect(element.children.length).toBe 2
expect(element.children[0].textContent).toBe "a {color: red;}"
expect(element.children[1].textContent).toBe "a {color: blue;}"
describe "atom-text-editor shadow DOM selector upgrades", ->
beforeEach ->
element.setAttribute('context', 'atom-text-editor')
spyOn(console, 'warn')
it "upgrades selectors containing .editor-colors", ->
atom.styles.addStyleSheet(".editor-colors {background: black;}", context: 'atom-text-editor')
expect(element.firstChild.sheet.cssRules[0].selectorText).toBe ':host'
it "upgrades selectors containing .editor", ->
atom.styles.addStyleSheet """
.editor {background: black;}
.editor.mini {background: black;}
.editor:focus {background: black;}
""", context: 'atom-text-editor'
expect(element.firstChild.sheet.cssRules[0].selectorText).toBe ':host'
expect(element.firstChild.sheet.cssRules[1].selectorText).toBe ':host(.mini)'
expect(element.firstChild.sheet.cssRules[2].selectorText).toBe ':host(:focus)'
it "defers selector upgrade until the element is attached", ->
element = new StylesElement
element.setAttribute('context', 'atom-text-editor')
element.initialize()
atom.styles.addStyleSheet ".editor {background: black;}", context: 'atom-text-editor'
expect(element.firstChild.sheet).toBeNull()
document.querySelector('#jasmine-content').appendChild(element)
expect(element.firstChild.sheet.cssRules[0].selectorText).toBe ':host'
+45 -45
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,44 @@ 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
grammar = atom.grammars.selectGrammar('foo.js')
atom.grammars.removeGrammar(grammar)
expect(atom.grammars.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)
atom.grammars.addProperties(".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
atom.grammars.addProperties(".source .string.quoted.double", foo: bar: baz: 22)
atom.grammars.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()
expect(atom.grammars.getProperty([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
expect(atom.grammars.getProperty([".source.js", ".string.quoted.double.js"], "foo.bar.baz")).toBe 22
expect(atom.grammars.getProperty([".source.js", ".variable.assignment.js"], "foo.bar.baz")).toBe 11
expect(atom.grammars.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)
atom.grammars.addProperties(".source.coffee .string.quoted.single", foo: bar: baz: 42)
atom.grammars.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
expect(atom.grammars.getProperty([".source.coffee", ".string.quoted.single"], "foo.bar.baz")).toBe 42
expect(atom.grammars.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.grammars.addProperties("a", ".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
atom.grammars.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
atom.grammars.removeProperties("b")
expect(atom.grammars.getProperty([".source.js", ".string.quoted.double.js"], "foo.bar.baz")).toBeUndefined()
expect(atom.grammars.getProperty([".source.coffee", ".string.quoted.double.coffee"], "foo.bar.baz")).toBe 42
+284 -7
Ver Arquivo
@@ -721,11 +721,11 @@ describe "TextEditorComponent", ->
editor.setCursorScreenPosition([0, 16])
nextAnimationFrame()
atom.themes.applyStylesheet 'test', """
atom.styles.addStyleSheet """
.function.js {
font-weight: bold;
}
"""
""", context: 'atom-text-editor'
nextAnimationFrame() # update based on new measurements
cursor = componentNode.querySelector('.cursor')
@@ -1131,6 +1131,13 @@ describe "TextEditorComponent", ->
regions = componentNode.querySelectorAll('.test-highlight .region')
expect(regions.length).toBe 2
it "renders classes on the regions directly if 'deprecatedRegionClass' option is defined", ->
decoration = editor.decorateMarker(marker, type: 'highlight', class: 'test-highlight', deprecatedRegionClass: 'test-highlight-region')
nextAnimationFrame()
regions = componentNode.querySelectorAll('.test-highlight .region.test-highlight-region')
expect(regions.length).toBe 2
describe "when flashing a decoration via Decoration::flash()", ->
highlightNode = null
beforeEach ->
@@ -1196,6 +1203,221 @@ describe "TextEditorComponent", ->
expect(componentNode.querySelector('.test-highlight')).toBeFalsy()
expect(componentNode.querySelector('.new-test-highlight')).toBeTruthy()
describe "overlay decoration rendering", ->
[item] = []
beforeEach ->
item = document.createElement('div')
item.classList.add 'overlay-test'
describe "when the marker is empty", ->
it "renders an overlay decoration when added and removes the overlay when the decoration is destroyed", ->
marker = editor.displayBuffer.markBufferRange([[2, 13], [2, 13]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
overlay = component.getTopmostDOMNode().querySelector('atom-overlay .overlay-test')
expect(overlay).toBe item
decoration.destroy()
nextAnimationFrame()
overlay = component.getTopmostDOMNode().querySelector('atom-overlay .overlay-test')
expect(overlay).toBe null
it "renders in the correct position on initial display and when the marker moves", ->
editor.setCursorBufferPosition([2, 5])
marker = editor.getLastCursor().getMarker()
decoration = editor.decorateMarker(marker, {type: 'overlay', 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'
editor.moveRight()
editor.moveRight()
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([2, 7])
expect(overlay.style.left).toBe position.left + 'px'
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", ->
marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([2, 10])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
it "renders at the head of the marker when the marker is reversed", ->
marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never', reversed: true)
decoration = editor.decorateMarker(marker, {type: 'overlay', 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 ->
itemWidth = 4 * editor.getDefaultCharWidth()
itemHeight = 4 * editor.getLineHeightInPixels()
gutterWidth = componentNode.querySelector('.gutter').offsetWidth
windowWidth = gutterWidth + 30 * editor.getDefaultCharWidth()
windowHeight = 9 * editor.getLineHeightInPixels()
item.style.width = itemWidth + 'px'
item.style.height = itemHeight + 'px'
wrapperNode.style.width = windowWidth + 'px'
wrapperNode.style.height = windowHeight + 'px'
component.measureHeightAndWidth()
nextAnimationFrame()
it "flips horizontally when near the right edge", ->
marker = editor.displayBuffer.markBufferRange([[0, 26], [0, 26]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([0, 26])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
editor.insertText('a')
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([0, 27])
expect(overlay.style.left).toBe position.left - itemWidth + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
it "flips vertically when near the bottom edge", ->
marker = editor.displayBuffer.markBufferRange([[4, 0], [4, 0]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([4, 0])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
editor.insertNewline()
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([5, 0])
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top - itemHeight + 'px'
describe "when the editor is very small", ->
beforeEach ->
gutterWidth = componentNode.querySelector('.gutter').offsetWidth
windowWidth = gutterWidth + 6 * editor.getDefaultCharWidth()
windowHeight = 6 * editor.getLineHeightInPixels()
wrapperNode.style.width = windowWidth + 'px'
wrapperNode.style.height = windowHeight + 'px'
component.measureHeightAndWidth()
nextAnimationFrame()
it "does not flip horizontally and force the overlay to have a negative left", ->
marker = editor.displayBuffer.markBufferRange([[0, 2], [0, 2]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([0, 2])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
editor.insertText('a')
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([0, 3])
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
it "does not flip vertically and force the overlay to have a negative top", ->
marker = editor.displayBuffer.markBufferRange([[1, 0], [1, 0]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([1, 0])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
editor.insertNewline()
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([2, 0])
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
describe "when editor scroll position is not 0", ->
it "flips horizontally when near the right edge", ->
editor.setScrollLeft(2 * editor.getDefaultCharWidth())
marker = editor.displayBuffer.markBufferRange([[0, 28], [0, 28]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([0, 28])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
editor.insertText('a')
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([0, 29])
expect(overlay.style.left).toBe position.left - itemWidth + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
it "flips vertically when near the bottom edge", ->
editor.setScrollTop(2 * editor.getLineHeightInPixels())
marker = editor.displayBuffer.markBufferRange([[6, 0], [6, 0]], invalidate: 'never')
decoration = editor.decorateMarker(marker, {type: 'overlay', item})
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([6, 0])
overlay = component.getTopmostDOMNode().querySelector('atom-overlay')
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px'
editor.insertNewline()
nextAnimationFrame()
position = editor.pixelPositionForBufferPosition([7, 0])
expect(overlay.style.left).toBe position.left + 'px'
expect(overlay.style.top).toBe position.top - itemHeight + 'px'
describe "hidden input field", ->
it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", ->
editor.setVerticalScrollMargin(0)
@@ -1537,8 +1759,9 @@ describe "TextEditorComponent", ->
it "transfers focus to the hidden input", ->
expect(document.activeElement).toBe document.body
componentNode.focus()
expect(document.activeElement).toBe inputNode
wrapperNode.focus()
expect(document.activeElement).toBe wrapperNode
expect(wrapperNode.shadowRoot.activeElement).toBe inputNode
it "adds the 'is-focused' class to the editor when the hidden input is focused", ->
expect(document.activeElement).toBe document.body
@@ -1667,12 +1890,13 @@ describe "TextEditorComponent", ->
component.measureHeightAndWidth()
nextAnimationFrame()
atom.themes.applyStylesheet "test", """
atom.styles.addStyleSheet """
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
"""
""", context: 'atom-text-editor'
nextAnimationFrame()
scrollbarCornerNode = componentNode.querySelector('.scrollbar-corner')
@@ -1922,6 +2146,31 @@ describe "TextEditorComponent", ->
expect(nextAnimationFrame).toBe noAnimationFrame
expect(editor.lineTextForBufferRow(0)).toBe 'var quicksort = function () {'
it "groups events that occur close together in time into single undo entries", ->
currentTime = 0
spyOn(Date, 'now').andCallFake -> currentTime
atom.config.set('editor.undoGroupingInterval', 100)
editor.setText("")
componentNode.dispatchEvent(buildTextInputEvent(data: 'x', target: inputNode))
currentTime += 99
componentNode.dispatchEvent(buildTextInputEvent(data: 'y', target: inputNode))
currentTime += 99
componentNode.dispatchEvent(new CustomEvent('editor:duplicate-lines', bubbles: true, cancelable: true))
currentTime += 100
componentNode.dispatchEvent(new CustomEvent('editor:duplicate-lines', bubbles: true, cancelable: true))
expect(editor.getText()).toBe "xy\nxy\nxy"
componentNode.dispatchEvent(new CustomEvent('core:undo', bubbles: true, cancelable: true))
expect(editor.getText()).toBe "xy\nxy"
componentNode.dispatchEvent(new CustomEvent('core:undo', bubbles: true, cancelable: true))
expect(editor.getText()).toBe ""
describe "when IME composition is used to insert international characters", ->
inputNode = null
@@ -2283,9 +2532,15 @@ 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", ->
it "adds and updates the encoding data attribute based on the current encoding", ->
expect(wrapperNode.dataset.encoding).toBe 'utf8'
editor.setEncoding('utf16le')
expect(wrapperNode.dataset.encoding).toBe 'utf16le'
describe "detaching and reattaching the editor (regression)", ->
it "does not throw an exception", ->
wrapperView.detach()
@@ -2429,6 +2684,28 @@ describe "TextEditorComponent", ->
expect(line1LeafNodes[0].classList.contains('indent-guide')).toBe false
expect(line1LeafNodes[1].classList.contains('indent-guide')).toBe false
describe "middle mouse paste on Linux", ->
it "pastes the previously selected text", ->
spyOn(require('ipc'), 'send').andCallFake (eventName, selectedText) ->
if eventName is 'write-text-to-selection-clipboard'
require('clipboard').writeText(selectedText, 'selection')
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 ''
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'
buildMouseEvent = (type, properties...) ->
properties = extend({bubbles: true, cancelable: true}, properties...)
properties.detail ?= 1
+75 -11
Ver Arquivo
@@ -1,4 +1,5 @@
TextEditorElement = require '../src/text-editor-element'
TextEditor = require '../src/text-editor'
# The rest of text-editor-component-spec will be moved to this file when React
# is eliminated. This covers only concerns related to the wrapper element for now
@@ -19,18 +20,81 @@ describe "TextEditorElement", ->
element = jasmineContent.firstChild
expect(element.getModel().getPlaceholderText()).toBe 'testing'
describe "::focus()", ->
it "transfers focus to the hidden text area and does not emit 'focusout' or 'blur' events", ->
describe "when the model is assigned", ->
it "adds the 'mini' attribute if .isMini() returns true on the model", ->
element = new TextEditorElement
model = new TextEditor(mini: true)
element.setModel(model)
expect(element.hasAttribute('mini')).toBe true
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", ->
atom.config.set('editor.useShadowDOM', true)
element = new TextEditorElement
jasmineContent.appendChild(element)
blurCalled = false
element.addEventListener 'blur', -> blurCalled = true
element.focus()
expect(blurCalled).toBe false
expect(element.hasFocus()).toBe true
expect(document.activeElement).toBe element
expect(element.shadowRoot.activeElement).toBe element.shadowRoot.querySelector('input')
document.body.focus()
expect(blurCalled).toBe true
describe "when the editor.useShadowDOM config option is false", ->
it "proxies focus/blur events to/from the hidden input", ->
atom.config.set('editor.useShadowDOM', false)
element = new TextEditorElement
jasmineContent.appendChild(element)
blurCalled = false
element.addEventListener 'blur', -> blurCalled = true
element.focus()
expect(blurCalled).toBe false
expect(element.hasFocus()).toBe true
expect(document.activeElement).toBe element.querySelector('input')
document.body.focus()
expect(blurCalled).toBe true
describe "when the themes finish loading", ->
[themeReloadCallback, initialThemeLoadComplete, element] = []
beforeEach ->
themeReloadCallback = null
initialThemeLoadComplete = false
spyOn(atom.themes, 'isInitialLoadComplete').andCallFake ->
initialThemeLoadComplete
spyOn(atom.themes, 'onDidReloadAll').andCallFake (fn) ->
themeReloadCallback = fn
atom.config.set("editor.useShadowDOM", false)
element = new TextEditorElement()
element.style.height = '200px'
element.getModel().setText [0..20].join("\n")
it "re-renders the scrollbar", ->
jasmineContent.appendChild(element)
focusoutCalled = false
element.addEventListener 'focusout', -> focusoutCalled = true
blurCalled = false
element.addEventListener 'blur', -> blurCalled = true
atom.styles.addStyleSheet """
::-webkit-scrollbar {
width: 8px;
}
"""
element.focus()
expect(focusoutCalled).toBe false
expect(blurCalled).toBe false
expect(element.hasFocus()).toBe true
expect(element.querySelector('input')).toBe document.activeElement
initialThemeLoadComplete = true
themeReloadCallback()
verticalScrollbarNode = element.querySelector(".vertical-scrollbar")
scrollbarWidth = verticalScrollbarNode.offsetWidth - verticalScrollbarNode.clientWidth
expect(scrollbarWidth).toEqual(8)
+371 -247
Ver Arquivo
@@ -98,12 +98,13 @@ describe "TextEditor", ->
expect(editor2.isFoldedAtBufferRow(4)).not.toBe editor.isFoldedAtBufferRow(4)
describe "config defaults", ->
it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs` config values", ->
it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs`, and `core.fileEncoding` config values", ->
editor1 = null
editor2 = null
atom.config.set('editor.tabLength', 4)
atom.config.set('editor.softWrap', true)
atom.config.set('editor.softTabs', false)
atom.config.set('core.fileEncoding', 'utf16le')
waitsForPromise ->
atom.workspace.open('a').then (o) -> editor1 = o
@@ -112,10 +113,12 @@ describe "TextEditor", ->
expect(editor1.getTabLength()).toBe 4
expect(editor1.isSoftWrapped()).toBe true
expect(editor1.getSoftTabs()).toBe false
expect(editor1.getEncoding()).toBe 'utf16le'
atom.config.set('editor.tabLength', 8)
atom.config.set('editor.softWrap', false)
atom.config.set('editor.softTabs', true)
atom.config.set('core.fileEncoding', 'macroman')
waitsForPromise ->
atom.workspace.open('b').then (o) -> editor2 = o
@@ -124,6 +127,7 @@ describe "TextEditor", ->
expect(editor2.getTabLength()).toBe 8
expect(editor2.isSoftWrapped()).toBe false
expect(editor2.getSoftTabs()).toBe true
expect(editor2.getEncoding()).toBe 'macroman'
describe "title", ->
describe ".getTitle()", ->
@@ -157,6 +161,19 @@ describe "TextEditor", ->
expect(observed).toEqual [__filename, undefined]
describe "encoding", ->
it "notifies ::onDidChangeEncoding observers when the editor encoding changes", ->
observed = []
editor.onDidChangeEncoding (encoding) -> observed.push(encoding)
editor.setEncoding('utf16le')
editor.setEncoding('utf16le')
editor.setEncoding('utf16be')
editor.setEncoding()
editor.setEncoding()
expect(observed).toEqual ['utf16le', 'utf16be', 'utf8']
describe "cursor", ->
describe ".getLastCursor()", ->
it "returns the most recently created cursor", ->
@@ -1145,6 +1162,21 @@ describe "TextEditor", ->
editor.selectLinesContainingCursors()
expect(editor.getSelectedBufferRange()).toEqual [[0,0], [2,0]]
it "autoscrolls to the selection", ->
editor.manageScrollPosition = true
editor.setLineHeightInPixels(10)
editor.setDefaultCharWidth(10)
editor.setHeight(50)
editor.setWidth(50)
editor.setHorizontalScrollbarHeight(0)
editor.setCursorScreenPosition([5, 6])
editor.scrollToTop()
expect(editor.getScrollTop()).toBe 0
editor.selectLinesContainingCursors()
expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10
describe ".selectToBeginningOfWord()", ->
it "selects text from cusor position to beginning of word", ->
editor.setCursorScreenPosition [0,13]
@@ -1792,6 +1824,16 @@ describe "TextEditor", ->
expect(willInsertSpy).toHaveBeenCalled()
expect(didInsertSpy).not.toHaveBeenCalled()
describe "when the undo option is set to 'skip'", ->
beforeEach ->
editor.setSelectedBufferRange([[1, 2], [1, 2]])
it "does not undo the skipped operation", ->
range = editor.insertText('x')
range = editor.insertText('y', undo: 'skip')
editor.undo()
expect(buffer.lineForRow(1)).toBe ' yvar sort = function(items) {'
describe ".insertNewline()", ->
describe "when there is a single cursor", ->
describe "when the cursor is at the beginning of a line", ->
@@ -2435,17 +2477,33 @@ describe "TextEditor", ->
expect(editor.getCursorScreenPosition()).toEqual [0, editor.getTabLength() * 2]
describe "clipboard operations", ->
beforeEach ->
editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
describe ".cutSelectedText()", ->
it "removes the selected text from the buffer and places it on the clipboard", ->
editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
editor.cutSelectedText()
expect(buffer.lineForRow(0)).toBe "var = function () {"
expect(buffer.lineForRow(1)).toBe " var = function(items) {"
expect(clipboard.readText()).toBe 'quicksort\nsort'
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([
[[0, 0], [0, 0]],
[[5, 0], [5, 0]],
])
it "cuts the lines on which there are cursors", ->
editor.cutSelectedText()
expect(buffer.getLineCount()).toBe(11)
expect(buffer.lineForRow(1)).toBe(" if (items.length <= 1) return items;")
expect(buffer.lineForRow(4)).toBe(" current < pivot ? left.push(current) : right.push(current);")
expect(atom.clipboard.read()).toEqual """
var quicksort = function () {
current = items.shift();
"""
describe ".cutToEndOfLine()", ->
describe "when soft wrap is on", ->
it "cuts up to the end of the line", ->
@@ -2484,37 +2542,165 @@ describe "TextEditor", ->
expect(buffer.lineForRow(1)).toBe " var sort = function(items) {"
expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;"
expect(clipboard.readText()).toBe 'quicksort\nsort\nitems'
expect(atom.clipboard.readWithMetadata().metadata.selections).toEqual([
'quicksort'
'sort'
'items'
])
expect(atom.clipboard.read()).toEqual """
quicksort
sort
items
"""
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([
[[1, 5], [1, 5]],
[[5, 8], [5, 8]]
])
it "copies the lines on which there are cursors", ->
editor.copySelectedText()
expect(atom.clipboard.read()).toEqual([
" var sort = function(items) {\n"
" current = items.shift();\n"
].join("\n"))
expect(editor.getSelectedBufferRanges()).toEqual([
[[1, 5], [1, 5]],
[[5, 8], [5, 8]]
])
describe ".pasteText()", ->
copyText = (text, {startColumn, textEditor}={}) ->
startColumn ?= 0
textEditor ?= editor
textEditor.setCursorBufferPosition([0, 0])
textEditor.insertText(text)
numberOfNewlines = text.match(/\n/g)?.length
endColumn = text.match(/[^\n]*$/)[0]?.length
textEditor.getLastSelection().setBufferRange([[0,startColumn], [numberOfNewlines,endColumn]])
textEditor.cutSelectedText()
it "pastes text into the buffer", ->
editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
atom.clipboard.write('first')
editor.pasteText()
expect(editor.lineTextForBufferRow(0)).toBe "var first = function () {"
expect(editor.lineTextForBufferRow(1)).toBe " var first = function(items) {"
describe "when `autoIndentOnPaste` is true", ->
beforeEach ->
atom.config.set("editor.autoIndentOnPaste", true)
describe "when only whitespace precedes the cursor", ->
it "auto-indents the lines spanned by the pasted text", ->
atom.clipboard.write("console.log(x);\nconsole.log(y);\n")
editor.setCursorBufferPosition([5, 2])
editor.pasteText()
expect(editor.lineTextForBufferRow(5)).toBe(" console.log(x);")
expect(editor.lineTextForBufferRow(6)).toBe(" console.log(y);")
describe "when non-whitespace characters precede the cursor", ->
it "does not auto-indent the first line being pasted", ->
editor.setText """
if (x) {
y();
}
"""
atom.clipboard.write(" z();")
editor.setCursorBufferPosition([1, Infinity])
editor.pasteText()
expect(editor.lineTextForBufferRow(1)).toBe(" y(); z();")
describe "when `autoIndentOnPaste` is false", ->
beforeEach ->
atom.config.set('editor.autoIndentOnPaste', false)
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()
editor.setCursorBufferPosition([5, 6])
editor.pasteText()
expect(editor.lineTextForBufferRow(5)).toBe " var sort = function(items) {"
expect(editor.lineTextForBufferRow(6)).toBe " 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()
editor.setCursorBufferPosition([1, 2])
editor.pasteText()
expect(editor.lineTextForBufferRow(1)).toBe " current < pivot ? left.push(current) : right.push(current);"
expect(editor.lineTextForBufferRow(2)).toBe "}"
describe "when the first copied line has leading whitespace", ->
it "preserves the line's leading whitespace", ->
editor.setSelectedBufferRange([[4, 0], [6, 0]])
editor.copySelectedText()
editor.setCursorBufferPosition([0, 0])
editor.pasteText()
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 ->
atom.config.set("editor.autoIndentOnPaste", false)
editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
editor.copySelectedText()
it "pastes each selection separately into the buffer", ->
atom.clipboard.write('first\nsecond', {selections: ['first', 'second'] })
editor.copySelectedText()
editor.moveRight()
editor.insertText("_")
editor.pasteText()
expect(editor.lineTextForBufferRow(0)).toBe "var first = function () {"
expect(editor.lineTextForBufferRow(1)).toBe " var second = function(items) {"
expect(editor.lineTextForBufferRow(0)).toBe "var quicksort_quicksort = function () {"
expect(editor.lineTextForBufferRow(1)).toBe " var sort_sort = function(items) {"
describe 'and the selections count does not match', ->
it "pastes the whole text into the buffer", ->
atom.clipboard.write('first\nsecond\nthird', {selections: ['first', 'second', 'third'] })
editor.pasteText()
expect(editor.lineTextForBufferRow(0)).toBe "var first"
expect(editor.lineTextForBufferRow(1)).toBe "second"
expect(editor.lineTextForBufferRow(2)).toBe "third = function () {"
beforeEach ->
editor.setSelectedBufferRanges([[[0, 4], [0, 13]]])
expect(editor.lineTextForBufferRow(3)).toBe " var first"
expect(editor.lineTextForBufferRow(4)).toBe "second"
expect(editor.lineTextForBufferRow(5)).toBe "third = function(items) {"
it "pastes the whole text into the buffer", ->
editor.pasteText()
expect(editor.lineTextForBufferRow(0)).toBe "var quicksort"
expect(editor.lineTextForBufferRow(1)).toBe "sort = function () {"
describe "when a full line was cut", ->
beforeEach ->
editor.setCursorBufferPosition([2, 13])
editor.cutSelectedText()
editor.setCursorBufferPosition([2, 13])
it "pastes the line above the cursor and retains the cursor's column", ->
editor.pasteText()
expect(editor.lineTextForBufferRow(2)).toBe(" if (items.length <= 1) return items;")
expect(editor.lineTextForBufferRow(3)).toBe(" var pivot = items.shift(), current, left = [], right = [];")
expect(editor.getCursorBufferPosition()).toEqual([3, 13])
describe "when a full line was copied", ->
beforeEach ->
editor.setCursorBufferPosition([2, 13])
editor.copySelectedText()
describe "when there is a selection", ->
it "overwrites the selection as with any copied text", ->
editor.setSelectedBufferRange([[1, 2], [1, Infinity]])
editor.pasteText()
expect(editor.lineTextForBufferRow(1)).toBe(" if (items.length <= 1) return items;")
expect(editor.lineTextForBufferRow(2)).toBe(" ")
expect(editor.lineTextForBufferRow(3)).toBe(" if (items.length <= 1) return items;")
expect(editor.getCursorBufferPosition()).toEqual([2, 2])
describe "when there is no selection", ->
it "pastes the line above the cursor and retains the cursor's column", ->
editor.pasteText()
expect(editor.lineTextForBufferRow(2)).toBe(" if (items.length <= 1) return items;")
expect(editor.lineTextForBufferRow(3)).toBe(" if (items.length <= 1) return items;")
expect(editor.getCursorBufferPosition()).toEqual([3, 13])
describe ".indentSelectedRows()", ->
describe "when nothing is selected", ->
@@ -2645,6 +2831,18 @@ describe "TextEditor", ->
expect(editor.getSelectedBufferRange()).toEqual [[0, 1], [3, 0]]
describe ".autoIndentSelectedRows", ->
it "auto-indents the selection", ->
editor.setCursorBufferPosition([2, 0])
editor.insertText("function() {\ninside=true\n}\n i=1\n")
editor.getLastSelection().setBufferRange([[2,0], [6,0]])
editor.autoIndentSelectedRows()
expect(editor.lineTextForBufferRow(2)).toBe " function() {"
expect(editor.lineTextForBufferRow(3)).toBe " inside=true"
expect(editor.lineTextForBufferRow(4)).toBe " }"
expect(editor.lineTextForBufferRow(5)).toBe " i=1"
describe ".toggleLineCommentsInSelection()", ->
it "toggles comments on the selected lines", ->
editor.setSelectedBufferRange([[4, 5], [7, 5]])
@@ -3087,6 +3285,11 @@ describe "TextEditor", ->
expect(editor.getTabLength()).toBe 6
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 6
changeHandler = jasmine.createSpy('changeHandler')
editor.onDidChange(changeHandler)
editor.setTabLength(6)
expect(changeHandler).not.toHaveBeenCalled()
it 'retokenizes when the editor.tabLength setting is updated', ->
expect(editor.getTabLength()).toBe 2
expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2
@@ -3129,251 +3332,159 @@ 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
describe "auto-indent", ->
copyText = (text, {startColumn, textEditor}={}) ->
startColumn ?= 0
textEditor ?= editor
textEditor.setCursorBufferPosition([0, 0])
textEditor.insertText(text)
numberOfNewlines = text.match(/\n/g)?.length
endColumn = text.match(/[^\n]*$/)[0]?.length
textEditor.getLastSelection().setBufferRange([[0,startColumn], [numberOfNewlines,endColumn]])
textEditor.cutSelectedText()
describe "editor.autoIndent", ->
describe "when editor.autoIndent is false (default)", ->
describe "when `indent` is triggered", ->
it "does not auto-indent the line", ->
editor.setCursorBufferPosition([1, 30])
editor.insertText("\n ")
expect(editor.lineTextForBufferRow(2)).toBe " "
atom.config.set("editor.autoIndent", false)
editor.indent()
expect(editor.lineTextForBufferRow(2)).toBe " "
describe "when editor.autoIndent is true", ->
beforeEach ->
atom.config.set("editor.autoIndent", true)
describe "when `indent` is triggered", ->
it "auto-indents the line", ->
editor.setCursorBufferPosition([1, 30])
editor.insertText("\n ")
expect(editor.lineTextForBufferRow(2)).toBe " "
atom.config.set("editor.autoIndent", true)
editor.indent()
expect(editor.lineTextForBufferRow(2)).toBe " "
describe "when a newline is added", ->
describe "when the line preceding the newline adds a new level of indentation", ->
it "indents the newline to one additional level of indentation beyond the preceding line", ->
editor.setCursorBufferPosition([1, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
describe "when the line preceding the newline does't add a level of indentation", ->
it "indents the new line to the same level a as the preceding line", ->
editor.setCursorBufferPosition([5, 14])
editor.insertText('\n')
expect(editor.indentationForBufferRow(6)).toBe editor.indentationForBufferRow(5)
describe "when the line preceding the newline is a comment", ->
it "maintains the indent of the commented line", ->
editor.setCursorBufferPosition([0, 0])
editor.insertText(' //')
editor.setCursorBufferPosition([0, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(1)).toBe 2
it "does not indent the line preceding the newline", ->
editor.setCursorBufferPosition([2, 0])
editor.insertText(' var this-line-should-be-indented-more\n')
expect(editor.indentationForBufferRow(1)).toBe 1
atom.config.set("editor.autoIndent", true)
editor.setCursorBufferPosition([2, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(1)).toBe 1
expect(editor.indentationForBufferRow(2)).toBe 1
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.insertNewline()
expect(buffer.lineForRow(0)).toBe ' var sort = function()'
expect(buffer.lineForRow(1)).toBe ' {}'
expect(editor.getCursorScreenPosition()).toEqual [1, 2]
describe "when inserted text matches a decrease indent pattern", ->
describe "when the preceding line matches an increase indent pattern", ->
it "decreases the indentation to match that of the preceding line", ->
editor.setCursorBufferPosition([1, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
editor.insertText('}')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1)
describe "when the preceding line doesn't match an increase indent pattern", ->
it "decreases the indentation to be one level below that of the preceding line", ->
editor.setCursorBufferPosition([3, Infinity])
editor.insertText('\n ')
expect(editor.indentationForBufferRow(4)).toBe editor.indentationForBufferRow(3)
editor.insertText('}')
expect(editor.indentationForBufferRow(4)).toBe editor.indentationForBufferRow(3) - 1
it "doesn't break when decreasing the indentation on a row that has no indentation", ->
editor.setCursorBufferPosition([12, Infinity])
editor.insertText("\n}; # too many closing brackets!")
expect(editor.lineTextForBufferRow(13)).toBe "}; # too many closing brackets!"
describe "when inserted text does not match a decrease indent pattern", ->
it "does not decrease the indentation", ->
editor.setCursorBufferPosition([12, 0])
editor.insertText(' ')
expect(editor.lineTextForBufferRow(12)).toBe ' };'
editor.insertText('\t\t')
expect(editor.lineTextForBufferRow(12)).toBe ' \t\t};'
describe "when the current line does not match a decrease indent pattern", ->
it "leaves the line unchanged", ->
editor.setCursorBufferPosition([2, 4])
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
editor.insertText('foo')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
describe 'when scoped settings are used', ->
coffeeEditor = null
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage('language-coffee-script')
waitsForPromise ->
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)
afterEach: ->
atom.packages.deactivatePackages()
atom.packages.unloadPackages()
it "does not auto-indent the line for javascript files", ->
describe "editor.autoIndent", ->
describe "when editor.autoIndent is false (default)", ->
describe "when `indent` is triggered", ->
it "does not auto-indent the line", ->
editor.setCursorBufferPosition([1, 30])
editor.insertText("\n")
editor.insertText("\n ")
expect(editor.lineTextForBufferRow(2)).toBe " "
atom.config.set("editor.autoIndent", false)
editor.indent()
expect(editor.lineTextForBufferRow(2)).toBe " "
describe "when editor.autoIndent is true", ->
beforeEach ->
atom.config.set("editor.autoIndent", true)
describe "when `indent` is triggered", ->
it "auto-indents the line", ->
editor.setCursorBufferPosition([1, 30])
editor.insertText("\n ")
expect(editor.lineTextForBufferRow(2)).toBe " "
atom.config.set("editor.autoIndent", true)
editor.indent()
expect(editor.lineTextForBufferRow(2)).toBe " "
coffeeEditor.setCursorBufferPosition([1, 18])
coffeeEditor.insertText("\n")
expect(coffeeEditor.lineTextForBufferRow(2)).toBe ""
describe "editor.normalizeIndentOnPaste", ->
beforeEach ->
atom.config.set('editor.normalizeIndentOnPaste', true)
it "does not normalize the indentation level of the text when editor.normalizeIndentOnPaste is false", ->
copyText(" function() {\nvar cool = 1;\n }\n")
atom.config.set('editor.normalizeIndentOnPaste', false)
editor.setCursorBufferPosition([5, 2])
editor.pasteText()
expect(editor.lineTextForBufferRow(5)).toBe " function() {"
expect(editor.lineTextForBufferRow(6)).toBe "var cool = 1;"
expect(editor.lineTextForBufferRow(7)).toBe " }"
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();"
it "does not adjust the whitespace if there are preceding characters", ->
copyText(" foo")
editor.setCursorBufferPosition([5, 30])
editor.pasteText()
expect(editor.lineTextForBufferRow(5)).toBe " current = items.shift(); foo"
describe "when the inserted text contains newlines", ->
describe "when the cursor is preceded only by whitespace characters", ->
it "normalizes indented lines to the cursor's current indentation level", ->
copyText(" while (true) {\n foo();\n }\n", {startColumn: 2})
editor.setCursorBufferPosition([3, 4])
editor.pasteText()
expect(editor.lineTextForBufferRow(3)).toBe " while (true) {"
expect(editor.lineTextForBufferRow(4)).toBe " foo();"
expect(editor.lineTextForBufferRow(5)).toBe " }"
expect(editor.lineTextForBufferRow(6)).toBe "var pivot = items.shift(), current, left = [], right = [];"
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})
describe "when a newline is added", ->
describe "when the line preceding the newline adds a new level of indentation", ->
it "indents the newline to one additional level of indentation beyond the preceding line", ->
editor.setCursorBufferPosition([1, Infinity])
editor.pasteText()
editor.insertText('\n')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
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 ""
describe "when the line preceding the newline does't add a level of indentation", ->
it "indents the new line to the same level a as the preceding line", ->
editor.setCursorBufferPosition([5, 14])
editor.insertText('\n')
expect(editor.indentationForBufferRow(6)).toBe editor.indentationForBufferRow(5)
describe 'when scoped settings are used', ->
coffeeEditor = null
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage('language-coffee-script')
waitsForPromise ->
atom.project.open('coffee.coffee', autoIndent: false).then (o) -> coffeeEditor = o
describe "when the line preceding the newline is a comment", ->
it "maintains the indent of the commented line", ->
editor.setCursorBufferPosition([0, 0])
editor.insertText(' //')
editor.setCursorBufferPosition([0, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(1)).toBe 2
runs ->
atom.config.set('.source.js', 'editor.normalizeIndentOnPaste', true)
atom.config.set('.source.coffee', 'editor.normalizeIndentOnPaste', false)
describe "when the line preceding the newline contains only whitespace", ->
it "bases the new line's indentation on only the preceding line", ->
editor.setCursorBufferPosition([6, Infinity])
editor.insertText("\n ")
expect(editor.getCursorBufferPosition()).toEqual([7, 2])
afterEach: ->
atom.packages.deactivatePackages()
atom.packages.unloadPackages()
editor.insertNewline()
editor.logScreenLines()
expect(editor.lineTextForBufferRow(8)).toBe(" ")
it "normalizes the indentation level based on scoped settings", ->
copyText(" while (true) {\n foo();\n }\n", {startColumn: 2, textEditor: coffeeEditor})
coffeeEditor.setCursorBufferPosition([4, 4])
coffeeEditor.pasteText()
expect(coffeeEditor.lineTextForBufferRow(4)).toBe " while (true) {"
expect(coffeeEditor.lineTextForBufferRow(5)).toBe " foo();"
expect(coffeeEditor.lineTextForBufferRow(6)).toBe " }"
it "does not indent the line preceding the newline", ->
editor.setCursorBufferPosition([2, 0])
editor.insertText(' var this-line-should-be-indented-more\n')
expect(editor.indentationForBufferRow(1)).toBe 1
copyText(" while (true) {\n foo();\n }\n", {startColumn: 2})
editor.setCursorBufferPosition([3, 4])
editor.pasteText()
expect(editor.lineTextForBufferRow(3)).toBe " while (true) {"
expect(editor.lineTextForBufferRow(4)).toBe " foo();"
expect(editor.lineTextForBufferRow(5)).toBe " }"
atom.config.set("editor.autoIndent", true)
editor.setCursorBufferPosition([2, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(1)).toBe 1
expect(editor.indentationForBufferRow(2)).toBe 1
it "autoIndentSelectedRows auto-indents the selection", ->
editor.setCursorBufferPosition([2, 0])
editor.insertText("function() {\ninside=true\n}\n i=1\n")
editor.getLastSelection().setBufferRange([[2,0], [6,0]])
editor.autoIndentSelectedRows()
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.insertNewline()
expect(editor.lineTextForBufferRow(2)).toBe " function() {"
expect(editor.lineTextForBufferRow(3)).toBe " inside=true"
expect(editor.lineTextForBufferRow(4)).toBe " }"
expect(editor.lineTextForBufferRow(5)).toBe " i=1"
expect(buffer.lineForRow(0)).toBe ' var sort = function()'
expect(buffer.lineForRow(1)).toBe ' {}'
expect(editor.getCursorScreenPosition()).toEqual [1, 2]
describe "when inserted text matches a decrease indent pattern", ->
describe "when the preceding line matches an increase indent pattern", ->
it "decreases the indentation to match that of the preceding line", ->
editor.setCursorBufferPosition([1, Infinity])
editor.insertText('\n')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
editor.insertText('}')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1)
describe "when the preceding line doesn't match an increase indent pattern", ->
it "decreases the indentation to be one level below that of the preceding line", ->
editor.setCursorBufferPosition([3, Infinity])
editor.insertText('\n ')
expect(editor.indentationForBufferRow(4)).toBe editor.indentationForBufferRow(3)
editor.insertText('}')
expect(editor.indentationForBufferRow(4)).toBe editor.indentationForBufferRow(3) - 1
it "doesn't break when decreasing the indentation on a row that has no indentation", ->
editor.setCursorBufferPosition([12, Infinity])
editor.insertText("\n}; # too many closing brackets!")
expect(editor.lineTextForBufferRow(13)).toBe "}; # too many closing brackets!"
describe "when inserted text does not match a decrease indent pattern", ->
it "does not decrease the indentation", ->
editor.setCursorBufferPosition([12, 0])
editor.insertText(' ')
expect(editor.lineTextForBufferRow(12)).toBe ' };'
editor.insertText('\t\t')
expect(editor.lineTextForBufferRow(12)).toBe ' \t\t};'
describe "when the current line does not match a decrease indent pattern", ->
it "leaves the line unchanged", ->
editor.setCursorBufferPosition([2, 4])
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
editor.insertText('foo')
expect(editor.indentationForBufferRow(2)).toBe editor.indentationForBufferRow(1) + 1
describe 'when scoped settings are used', ->
coffeeEditor = null
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage('language-coffee-script')
waitsForPromise ->
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)
afterEach: ->
atom.packages.deactivatePackages()
atom.packages.unloadPackages()
it "does not auto-indent the line for javascript files", ->
editor.setCursorBufferPosition([1, 30])
editor.insertText("\n")
expect(editor.lineTextForBufferRow(2)).toBe " "
coffeeEditor.setCursorBufferPosition([1, 18])
coffeeEditor.insertText("\n")
expect(coffeeEditor.lineTextForBufferRow(2)).toBe ""
describe "soft and hard tabs", ->
afterEach ->
@@ -3395,6 +3506,19 @@ describe "TextEditor", ->
runs ->
expect(editor.softTabs).toBe false
it "uses hard tabs in Makefile files", ->
# FIXME remove once this is handled by a scoped setting in the
# language-make package
waitsForPromise ->
atom.packages.activatePackage('language-make')
waitsForPromise ->
atom.project.open('Makefile').then (o) -> editor = o
runs ->
expect(editor.softTabs).toBe false
describe ".destroy()", ->
it "destroys all markers associated with the edit session", ->
expect(buffer.getMarkerCount()).toBeGreaterThan 0
@@ -3638,7 +3762,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'
@@ -3656,7 +3780,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"
+38 -40
Ver Arquivo
@@ -70,7 +70,7 @@ describe "ThemeManager", ->
describe "when the core.themes config value changes", ->
it "add/removes stylesheets to reflect the new config value", ->
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
spyOn(themeManager, 'getUserStylesheetPath').andCallFake -> null
spyOn(atom.styles, 'getUserStyleSheetPath').andCallFake -> null
waitsForPromise ->
themeManager.activateThemes()
@@ -85,16 +85,7 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style.theme')).toHaveLength 0
atom.config.set('core.themes', ['atom-dark-syntax'])
waitsFor ->
reloadHandler.callCount == 1
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 1
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-syntax/
atom.config.set('core.themes', ['atom-light-syntax', 'atom-dark-syntax'])
atom.config.set('core.themes', ['atom-dark-ui'])
waitsFor ->
reloadHandler.callCount == 1
@@ -102,8 +93,17 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 2
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-syntax/
expect($('style[group=theme]:eq(1)').attr('source-path')).toMatch /atom-light-syntax/
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-ui/
atom.config.set('core.themes', ['atom-light-ui', 'atom-dark-ui'])
waitsFor ->
reloadHandler.callCount == 1
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 2
expect($('style[group=theme]:eq(0)').attr('source-path')).toMatch /atom-dark-ui/
expect($('style[group=theme]:eq(1)').attr('source-path')).toMatch /atom-light-ui/
atom.config.set('core.themes', [])
waitsFor ->
@@ -111,7 +111,7 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style[group=theme]')).toHaveLength 0
expect($('style[group=theme]')).toHaveLength 2
# atom-dark-ui has an directory path, the syntax one doesn't
atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui'])
@@ -207,24 +207,25 @@ describe "ThemeManager", ->
expect(stylesheetsChangedHandler).toHaveBeenCalled()
describe "base stylesheet loading", ->
workspaceElement = null
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView.append $('<atom-text-editor>')
atom.workspaceView.attachToDom()
workspaceElement = atom.views.getView(atom.workspace)
jasmine.attachToDOM(workspaceElement)
workspaceElement.appendChild document.createElement('atom-text-editor')
waitsForPromise ->
themeManager.activateThemes()
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'])
atom.config.set('core.themes', ['theme-with-ui-variables', 'theme-with-syntax-variables'])
waitsFor ->
reloadHandler.callCount > 0
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"
@@ -234,39 +235,41 @@ describe "ThemeManager", ->
describe "when there is a theme with incomplete variables", ->
it "loads the correct values from the fallback ui-variables", ->
themeManager.onDidReloadAll reloadHandler = jasmine.createSpy()
atom.config.set('core.themes', ['theme-with-incomplete-ui-variables'])
atom.config.set('core.themes', ['theme-with-incomplete-ui-variables', 'theme-with-syntax-variables'])
waitsFor ->
reloadHandler.callCount > 0
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'])
atom.config.set('core.themes', ['theme-with-ui-variables', 'theme-with-syntax-variables'])
waitsFor ->
reloadHandler.callCount > 0
runs ->
# `theme-` twice as it prefixes the name with `theme-`
expect(atom.workspaceView).toHaveClass 'theme-theme-with-ui-variables'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-ui'
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", ->
it "reloads it", ->
[stylesheetRemovedHandler, stylesheetAddedHandler, stylesheetsChangedHandler] = []
userStylesheetPath = path.join(temp.mkdirSync("atom"), 'styles.less')
fs.writeFileSync(userStylesheetPath, 'body {border-style: dotted !important;}')
spyOn(themeManager, 'getUserStylesheetPath').andReturn userStylesheetPath
spyOn(atom.styles, 'getUserStyleSheetPath').andReturn userStylesheetPath
waitsForPromise ->
themeManager.activateThemes()
@@ -308,24 +311,19 @@ describe "ThemeManager", ->
expect(stylesheetsChangedHandler).toHaveBeenCalled()
describe "when a non-existent theme is present in the config", ->
it "logs a warning but does not throw an exception (regression)", ->
reloaded = false
beforeEach ->
spyOn(console, 'warn')
atom.config.set('core.themes', ['non-existent-dark-ui', 'non-existent-dark-syntax'])
waitsForPromise ->
themeManager.activateThemes()
runs ->
disposable = themeManager.onDidReloadAll ->
disposable.dispose()
reloaded = true
spyOn(console, 'warn')
expect(-> atom.config.set('core.themes', ['atom-light-ui', 'theme-really-does-not-exist'])).not.toThrow()
waitsFor -> reloaded
runs ->
expect(console.warn.callCount).toBe 1
expect(console.warn.argsForCall[0][0].length).toBeGreaterThan 0
it 'uses the default dark UI and syntax themes and logs a warning', ->
activeThemeNames = themeManager.getActiveNames()
expect(console.warn.callCount).toBe 2
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-dark-ui')
expect(activeThemeNames).toContain('atom-dark-syntax')
describe "when in safe mode", ->
beforeEach ->
+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)
+72
Ver Arquivo
@@ -0,0 +1,72 @@
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"
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()
+5 -5
Ver Arquivo
@@ -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()
+9
Ver Arquivo
@@ -492,3 +492,12 @@ describe "Workspace", ->
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
describe '::addModalPanel(model)', ->
it 'adds a panel to the correct panel container', ->
atom.workspace.panelContainers.modal.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addModalPanel(item: new TestPanel())
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
expect(panel.getClassName()).toBe 'overlay from-top' # the default
+10 -7
Ver Arquivo
@@ -13,7 +13,7 @@ describe "WorkspaceView", ->
atom.project.setPaths([atom.project.resolve('dir')])
pathToOpen = atom.project.resolve('a')
atom.workspace = new Workspace
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.enableKeymap()
atom.workspaceView.focus()
@@ -29,7 +29,7 @@ describe "WorkspaceView", ->
atom.workspaceView.remove()
atom.project = atom.deserializers.deserialize(projectState)
atom.workspace = Workspace.deserialize(workspaceState)
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.attachToDom()
describe "when the serialized WorkspaceView has an unsaved buffer", ->
@@ -274,15 +274,18 @@ describe "WorkspaceView", ->
describe 'panel containers', ->
workspaceElement = null
beforeEach ->
workspaceElement = atom.workspace.getView(atom.workspace)
workspaceElement = atom.views.getView(atom.workspace)
it 'inserts panel container elements in the correct places in the DOM', ->
leftContainer = workspaceElement.querySelector('atom-panel-container[location="left"]')
rightContainer = workspaceElement.querySelector('atom-panel-container[location="right"]')
leftContainer = workspaceElement.querySelector('atom-panel-container.left')
rightContainer = workspaceElement.querySelector('atom-panel-container.right')
expect(leftContainer.nextSibling).toBe workspaceElement.verticalAxis
expect(rightContainer.previousSibling).toBe workspaceElement.verticalAxis
topContainer = workspaceElement.querySelector('atom-panel-container[location="top"]')
bottomContainer = workspaceElement.querySelector('atom-panel-container[location="bottom"]')
topContainer = workspaceElement.querySelector('atom-panel-container.top')
bottomContainer = workspaceElement.querySelector('atom-panel-container.bottom')
expect(topContainer.nextSibling).toBe workspaceElement.paneContainer
expect(bottomContainer.previousSibling).toBe workspaceElement.paneContainer
modalContainer = workspaceElement.querySelector('atom-panel-container.modal')
expect(modalContainer.parentNode).toBe workspaceElement
+101 -18
Ver Arquivo
@@ -5,6 +5,7 @@ path = require 'path'
remote = require 'remote'
screen = require 'screen'
shell = require 'shell'
{deprecate} = require 'grim'
_ = require 'underscore-plus'
{deprecate} = require 'grim'
@@ -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
@@ -125,11 +143,14 @@ class Atom extends Model
# Public: A {KeymapManager} instance
keymaps: null
# Public: A {TooltipManager} instance
tooltips: 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
@@ -137,15 +158,18 @@ class Atom extends Model
# Public: A {ThemeManager} instance
themes: null
# Public: A {StyleManager} instance
styles: null
# Public: A {DeserializerManager} instance
deserializers: null
# Public: A {ViewRegistry} instance
views: null
# Public: A {Workspace} instance
workspace: null
# Public: A {WorkspaceView} instance
workspaceView: null
###
Section: Construction and Destruction
###
@@ -170,10 +194,21 @@ class Atom extends Model
require('grim').deprecate = ->
window.onerror = =>
@openDevTools()
@executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()')
@lastUncaughtError = Array::slice.call(arguments)
[message, url, line, column, originalError] = @lastUncaughtError
eventObject = {message, url, line, column, originalError}
openDevTools = true
eventObject.preventDefault = -> openDevTools = false
@emitter.emit 'will-throw-error', eventObject
if openDevTools
@openDevTools()
@executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()')
@emit 'uncaught-error', arguments...
@emitter.emit 'did-throw-error', {message, url, line, column, originalError}
@unsubscribe()
@setBodyPlatformClass()
@@ -182,10 +217,12 @@ class Atom extends Model
Config = require './config'
KeymapManager = require './keymap-extensions'
ViewRegistry = require './view-registry'
CommandRegistry = require './command-registry'
TooltipManager = require './tooltip-manager'
PackageManager = require './package-manager'
Clipboard = require './clipboard'
Syntax = require './syntax'
GrammarRegistry = require './grammar-registry'
ThemeManager = require './theme-manager'
StyleManager = require './style-manager'
ContextMenuManager = require './context-menu-manager'
@@ -208,7 +245,9 @@ class Atom extends Model
@config = new Config({configDirPath, resourcePath})
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@tooltips = new TooltipManager
@commands = new CommandRegistry
@views = new ViewRegistry
@packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode})
@styles = new StyleManager
document.head.appendChild(new StylesElement)
@@ -217,7 +256,11 @@ class Atom extends Model
@menu = new MenuManager({resourcePath})
@clipboard = new Clipboard()
@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()
@@ -242,6 +285,36 @@ class Atom extends Model
onDidBeep: (callback) ->
@emitter.on 'did-beep', callback
# Extended: Invoke the given callback when there is an unhandled error, but
# before the devtools pop open
#
# * `callback` {Function} to be called whenever there is an unhandled error
# * `event` {Object}
# * `originalError` {Object} the original error object
# * `message` {String} the original error object
# * `url` {String} Url to the file where the error originated.
# * `line` {Number}
# * `column` {Number}
# * `preventDefault` {Function} call this to avoid popping up the dev tools.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onWillThrowError: (callback) ->
@emitter.on 'will-throw-error', callback
# Extended: Invoke the given callback whenever there is an unhandled error.
#
# * `callback` {Function} to be called whenever there is an unhandled error
# * `event` {Object}
# * `originalError` {Object} the original error object
# * `message` {String} the original error object
# * `url` {String} Url to the file where the error originated.
# * `line` {Number}
# * `column` {Number}
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidThrowError: (callback) ->
@emitter.on 'did-throw-error', callback
###
Section: Atom Details
###
@@ -488,15 +561,19 @@ class Atom extends Model
@packages.activate()
@keymaps.loadUserKeymap()
@requireUserInitScript() unless safeMode
@menu.update()
@subscribe @config.onDidChange 'core.autoHideMenuBar', ({newValue}) =>
@setAutoHideMenuBar(newValue)
@setAutoHideMenuBar(true) if @config.get('core.autoHideMenuBar')
maximize = dimensions?.maximized and process.platform isnt 'darwin'
@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()
@@ -505,10 +582,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
@@ -521,7 +598,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.
@@ -597,11 +674,13 @@ class Atom extends Model
startTime = Date.now()
@workspace = Workspace.deserialize(@state.workspace) ? new Workspace
@workspaceView = @workspace.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 ? {}
@@ -708,3 +787,7 @@ class Atom extends Model
setBodyPlatformClass: ->
document.body.classList.add("platform-#{process.platform}")
setAutoHideMenuBar: (autoHide) ->
ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide)
ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide)
+3 -5
Ver Arquivo
@@ -22,14 +22,10 @@ class ApplicationMenu
# keystrokesByCommand - An Object where the keys are commands and the values
# are Arrays containing the keystroke.
update: (window, template, keystrokesByCommand) ->
return unless window is @lastFocusedWindow
@translateTemplate(template, keystrokesByCommand)
@substituteVersion(template)
@windowTemplates.set(window, template)
@setActiveTemplate(template)
@showUpdateMenuItem(global.atomApplication.autoUpdateManager.getState())
@setActiveTemplate(template) if window is @lastFocusedWindow
setActiveTemplate: (template) ->
unless _.isEqual(template, @activeTemplate)
@@ -37,6 +33,8 @@ class ApplicationMenu
@menu = Menu.buildFromTemplate(_.deepClone(template))
Menu.setApplicationMenu(@menu)
@showUpdateMenuItem(global.atomApplication.autoUpdateManager.getState())
# Register a BrowserWindow with this application menu.
addWindow: (window) ->
@lastFocusedWindow ?= window
+12 -1
Ver Arquivo
@@ -70,7 +70,7 @@ class AtomApplication
@autoUpdateManager = new AutoUpdateManager(@version)
@applicationMenu = new ApplicationMenu(@version)
@atomProtocolHandler = new AtomProtocolHandler(@resourcePath)
@atomProtocolHandler = new AtomProtocolHandler(@resourcePath, @safeMode)
@listenForArgumentsFromNewProcess()
@setupJavaScriptArguments()
@@ -155,7 +155,13 @@ class AtomApplication
atomWindow?.browserWindow.inspectElement(x, y)
@on 'application:open-documentation', -> require('shell').openExternal('https://atom.io/docs/latest/?app')
@on 'application:open-discussions', -> require('shell').openExternal('https://discuss.atom.io')
@on 'application:open-roadmap', -> require('shell').openExternal('https://atom.io/roadmap?app')
@on 'application:open-faq', -> require('shell').openExternal('https://atom.io/faq')
@on 'application:open-terms-of-use', -> require('shell').openExternal('https://atom.io/terms')
@on 'application:report-issue', -> require('shell').openExternal('https://github.com/atom/atom/issues/new')
@on 'application:search-issues', -> require('shell').openExternal('https://github.com/issues?q=+is%3Aissue+user%3Aatom')
@on 'application:install-update', -> @autoUpdateManager.install()
@on 'application:check-for-update', => @autoUpdateManager.check()
@@ -232,6 +238,11 @@ class AtomApplication
win = BrowserWindow.fromWebContents(event.sender)
win[method](args...)
clipboard = null
ipc.on 'write-text-to-selection-clipboard', (event, selectedText) ->
clipboard ?= require 'clipboard'
clipboard.writeText(selectedText, 'selection')
# Public: Executes the given command.
#
# If it isn't handled globally, delegate to the currently focused window.
+29 -12
Ver Arquivo
@@ -5,16 +5,26 @@ protocol = require 'protocol'
# Handles requests with 'atom' protocol.
#
# It's created by {AtomApplication} upon instantiation, and is used to create a
# custom resource loader by adding the 'atom' custom protocol.
# It's created by {AtomApplication} upon instantiation and is used to create a
# custom resource loader for 'atom://' URLs.
#
# The following directories are searched in order:
# * ~/.atom/assets
# * ~/.atom/dev/packages (unless in safe mode)
# * ~/.atom/packages
# * RESOURCE_PATH/node_modules
#
module.exports =
class AtomProtocolHandler
constructor: (@resourcePath) ->
@loadPaths = [
path.join(app.getHomeDir(), '.atom', 'dev', 'packages')
path.join(app.getHomeDir(), '.atom', 'packages')
path.join(@resourcePath, 'node_modules')
]
constructor: (resourcePath, safeMode) ->
@loadPaths = []
@dotAtomDirectory = path.join(app.getHomeDir(), '.atom')
unless safeMode
@loadPaths.push(path.join(@dotAtomDirectory, 'dev', 'packages'))
@loadPaths.push(path.join(@dotAtomDirectory, 'packages'))
@loadPaths.push(path.join(resourcePath, 'node_modules'))
@registerAtomProtocol()
@@ -22,7 +32,14 @@ class AtomProtocolHandler
registerAtomProtocol: ->
protocol.registerProtocol 'atom', (request) =>
relativePath = path.normalize(request.url.substr(7))
for loadPath in @loadPaths
filePath = path.join(loadPath, relativePath)
break if fs.statSyncNoException(filePath).isFile?()
return new protocol.RequestFileJob(filePath)
if relativePath.indexOf('assets/') is 0
assetsPath = path.join(@dotAtomDirectory, relativePath)
filePath = assetsPath if fs.statSyncNoException(assetsPath).isFile?()
unless filePath
for loadPath in @loadPaths
filePath = path.join(loadPath, relativePath)
break if fs.statSyncNoException(filePath).isFile?()
new protocol.RequestFileJob(filePath)
+9 -22
Ver Arquivo
@@ -15,15 +15,20 @@ class AutoUpdateManager
constructor: (@version) ->
@state = IdleState
@feedUrl = "https://atom.io/api/updates?version=#{@version}"
if process.platform is 'win32'
# Squirrel for Windows can't handle query params
# https://github.com/Squirrel/Squirrel.Windows/issues/132
@feedUrl = 'https://atom.io/api/updates'
else
@feedUrl = "https://atom.io/api/updates?version=#{@version}"
process.nextTick => @setupAutoUpdater()
setupAutoUpdater: ->
autoUpdater = require 'auto-updater'
if process.platform is 'win32'
autoUpdater.checkForUpdates = => @checkForUpdatesShim()
autoUpdater = require './auto-updater-win32'
else
autoUpdater = require 'auto-updater'
autoUpdater.setFeedUrl @feedUrl
@@ -48,24 +53,6 @@ class AutoUpdateManager
unless /\w{7}/.test(@version)
@check(hidePopups: true)
# Windows doesn't have an auto-updater, so use this method to shim the events.
checkForUpdatesShim: ->
autoUpdater.emit 'checking-for-update'
https = require 'https'
request = https.get @feedUrl, (response) ->
if response.statusCode == 200
body = ""
response.on 'data', (chunk) -> body += chunk
response.on 'end', ->
{notes, name} = JSON.parse(body)
autoUpdater.emit 'update-downloaded', null, notes, name
else
autoUpdater.emit 'update-not-available'
request.on 'error', (error) ->
autoUpdater.emit 'error', null, error.message
emitUpdateAvailableEvent: (windows...) ->
return unless @releaseVersion? and @releaseNotes
for atomWindow in windows
+69
Ver Arquivo
@@ -0,0 +1,69 @@
{EventEmitter} = require 'events'
_ = require 'underscore-plus'
shellAutoUpdater = require 'auto-updater'
SquirrelUpdate = require './squirrel-update'
class AutoUpdater
_.extend @prototype, EventEmitter.prototype
setFeedUrl: (@updateUrl) ->
quitAndInstall: ->
unless SquirrelUpdate.existsSync()
shellAutoUpdater.quitAndInstall()
return
@installUpdate (error) ->
return if error?
SquirrelUpdate.spawn ['--processStart', 'atom.exe'], ->
shellAutoUpdater.quitAndInstall()
downloadUpdate: (callback) ->
SquirrelUpdate.spawn ['--download', @updateUrl], (error, stdout) ->
return callback(error) if error?
try
# Last line of output is the JSON details about the releases
json = stdout.trim().split('\n').pop()
update = JSON.parse(json)?.releasesToApply?.pop?()
catch error
error.stdout = stdout
return callback(error)
callback(null, update)
installUpdate: (callback) ->
SquirrelUpdate.spawn(['--update', @updateUrl], callback)
checkForUpdates: ->
throw new Error('Update URL is not set') unless @updateUrl
@emit 'checking-for-update'
unless SquirrelUpdate.existsSync()
@emit 'update-not-available'
return
@downloadUpdate (error, update) =>
if error?
console.log "Failed to download: #{error.message} - #{error.code} - #{error.stdout}"
@emit 'update-not-available'
return
unless update?
@emit 'update-not-available'
return
@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()
module.exports = new AutoUpdater()
+18
Ver Arquivo
@@ -13,7 +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()
args = parseCommandLine()
addPathToOpen = (event, pathToOpen) ->
@@ -134,6 +148,10 @@ parseCommandLine = ->
unless fs.statSyncNoException(resourcePath)
resourcePath = path.dirname(path.dirname(__dirname))
# On Yosemite the $PATH is not inherited by the "open" command, so we have to
# explicitly pass it by command line, see http://git.io/YC8_Ew.
process.env.PATH = args['path-environment'] if args['path-environment']
{resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile}
start()
+198
Ver Arquivo
@@ -0,0 +1,198 @@
app = require 'app'
ChildProcess = require 'child_process'
fs = require 'fs-plus'
path = require 'path'
rootAtomFolder = path.resolve(process.execPath, '..', '..')
binFolder = path.join(rootAtomFolder, 'bin')
updateDotExe = path.join(rootAtomFolder, 'Update.exe')
exeName = path.basename(process.execPath)
if process.env.SystemRoot
system32Path = path.join(process.env.SystemRoot, 'System32')
regPath = path.join(system32Path, 'reg.exe')
setxPath = path.join(system32Path, 'setx.exe')
else
regPath = 'reg.exe'
setxPath = 'setx.exe'
# Registry keys used for context menu
fileKeyPath = 'HKCU\\Software\\Classes\\*\\shell\\Atom'
directoryKeyPath = 'HKCU\\Software\\Classes\\directory\\shell\\Atom'
backgroundKeyPath = 'HKCU\\Software\\Classes\\directory\\background\\shell\\Atom'
environmentKeyPath = 'HKCU\\Environment'
# Spawn a command and invoke the callback when it completes with an error
# and the output from standard out.
spawn = (command, args, callback) ->
spawnedProcess = ChildProcess.spawn(command, args)
stdout = ''
spawnedProcess.stdout.on 'data', (data) -> stdout += data
error = null
spawnedProcess.on 'error', (processError) -> error ?= processError
spawnedProcess.on 'close', (code, signal) ->
error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
error?.code ?= code
error?.stdout ?= stdout
callback(error, stdout)
# Spawn reg.exe and callback when it completes
spawnReg = (args, callback) ->
spawn(regPath, args, callback)
# Spawn setx.exe and callback when it completes
spawnSetx = (args, callback) ->
spawn(setxPath, args, callback)
# Spawn the Update.exe with the given arguments and invoke the callback when
# the command completes.
spawnUpdate = (args, callback) ->
spawn(updateDotExe, args, callback)
# Install the Open with Atom explorer context menu items via the registry.
installContextMenu = (callback) ->
addToRegistry = (args, callback) ->
args.unshift('add')
args.push('/f')
spawnReg(args, callback)
installMenu = (keyPath, arg, callback) ->
args = [keyPath, '/ve', '/d', 'Open with Atom']
addToRegistry args, ->
args = [keyPath, '/v', 'Icon', '/d', process.execPath]
addToRegistry args, ->
args = ["#{keyPath}\\command", '/ve', '/d', "#{process.execPath} \"#{arg}\""]
addToRegistry(args, callback)
installMenu fileKeyPath, '%1', ->
installMenu directoryKeyPath, '%1', ->
installMenu(backgroundKeyPath, '%V', callback)
# Get the user's PATH environment variable registry value.
getPath = (callback) ->
spawnReg ['query', environmentKeyPath, '/v', 'Path'], (error, stdout) ->
if error?
if error.code is 1
# The query failed so the Path does not exist yet in the registry
return callback(null, '')
else
return callback(error)
# Registry query output is in the form:
#
# HKEY_CURRENT_USER\Environment
# Path REG_SZ C:\a\folder\on\the\path;C\another\folder
#
lines = stdout.split(/[\r\n]+/).filter (line) -> line
segments = lines[lines.length - 1]?.split(' ')
if segments[1] is 'Path' and segments.length >= 3
pathEnv = segments?[3..].join(' ')
callback(null, pathEnv)
else
callback(new Error('Registry query for PATH failed'))
# Uninstall the Open with Atom explorer context menu items via the registry.
uninstallContextMenu = (callback) ->
deleteFromRegistry = (keyPath, callback) ->
spawnReg(['delete', keyPath, '/f'], callback)
deleteFromRegistry fileKeyPath, ->
deleteFromRegistry directoryKeyPath, ->
deleteFromRegistry(backgroundKeyPath, callback)
# Add atom and apm to the PATH
#
# This is done by adding .cmd shims to the root bin folder in the Atom
# install directory that point to the newly installed versions inside
# the versioned app directories.
addCommandsToPath = (callback) ->
installCommands = (callback) ->
atomCommandPath = path.join(binFolder, 'atom.cmd')
relativeExePath = path.relative(binFolder, process.execPath)
atomCommand = """
@echo off
"%~dp0\\#{relativeExePath}" %*
"""
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}" %*
"""
fs.writeFile atomCommandPath, atomCommand, ->
fs.writeFile apmCommandPath, apmCommand, ->
callback()
addBinToPath = (pathSegments, callback) ->
pathSegments.push(binFolder)
newPathEnv = pathSegments.join(';')
spawnSetx(['Path', newPathEnv], callback)
installCommands (error) ->
return callback(error) if error?
getPath (error, pathEnv) ->
return callback(error) if error?
pathSegments = pathEnv.split(/;+/).filter (pathSegment) -> pathSegment
if pathSegments.indexOf(binFolder) is -1
addBinToPath(pathSegments, callback)
else
callback()
# Remove atom and apm from the PATH
removeCommandsFromPath = (callback) ->
getPath (error, pathEnv) ->
return callback(error) if error?
pathSegments = pathEnv.split(/;+/).filter (pathSegment) ->
pathSegment and pathSegment isnt binFolder
newPathEnv = pathSegments.join(';')
if pathEnv isnt newPathEnv
spawnSetx(['Path', newPathEnv], callback)
else
callback()
# Create a desktop and start menu shortcut by using the command line API
# provided by Squirrel's Update.exe
createShortcut = (callback) ->
spawnUpdate(['--createShortcut', exeName], callback)
# Remove the desktop and start menu shortcuts by using the command line API
# provided by Squirrel's Update.exe
removeShortcut = (callback) ->
spawnUpdate(['--removeShortcut', exeName], callback)
exports.spawn = spawnUpdate
# Is the Update.exe installed with Atom?
exports.existsSync = ->
fs.existsSync(updateDotExe)
# Handle squirrel events denoted by --squirrel-* command line arguments.
exports.handleStartupEvent = ->
switch process.argv[1]
when '--squirrel-install', '--squirrel-updated'
createShortcut ->
installContextMenu ->
addCommandsToPath ->
app.quit()
true
when '--squirrel-uninstall'
removeShortcut ->
uninstallContextMenu ->
removeCommandsFromPath ->
app.quit()
true
when '--squirrel-obsolete'
app.quit()
true
else
false
+14 -15
Ver Arquivo
@@ -35,9 +35,7 @@ SpecificityCache = {}
# ```coffee
# atom.commands.add 'atom-text-editor',
# 'user:insert-date': (event) ->
# editor = $(this).view().getModel()
# # soon the above above line will be:
# # editor = @getModel()
# editor = @getModel()
# editor.insertText(new Date().toLocaleString())
# ```
module.exports =
@@ -130,25 +128,26 @@ class CommandRegistry
# * `jQuery` Present if the command was registered with the legacy
# `$::command` method.
findCommands: ({target}) ->
commandNames = new Set
commands = []
currentTarget = target
loop
for name, listeners of @inlineListenersByCommandName
if listeners.has(currentTarget) and not commandNames.has(name)
commandNames.add(name)
commands.push({name, displayName: _.humanizeEventName(name)})
for commandName, listeners of @selectorBasedListenersByCommandName
for listener in listeners
if currentTarget.webkitMatchesSelector?(listener.selector)
commands.push
name: commandName
displayName: _.humanizeEventName(commandName)
unless commandNames.has(commandName)
commandNames.add(commandName)
commands.push
name: commandName
displayName: _.humanizeEventName(commandName)
break if currentTarget is @rootNode
currentTarget = currentTarget.parentNode
break unless currentTarget?
for name, displayName of $(target).events() when displayName
commands.push({name, displayName, jQuery: true})
for name, displayName of $(window).events() when displayName
commands.push({name, displayName, jQuery: true})
break if currentTarget is window
currentTarget = currentTarget.parentNode ? window
commands
+59 -1
Ver Arquivo
@@ -35,6 +35,47 @@ module.exports =
destroyEmptyPanes:
type: 'boolean'
default: true
fileEncoding:
description: 'Default character set encoding to use when reading and writing files.'
type: 'string'
default: 'utf8'
enum: [
'cp437',
'eucjp',
'euckr',
'gbk',
'iso88591',
'iso885910',
'iso885913',
'iso885914',
'iso885915',
'iso885916',
'iso88592',
'iso88593',
'iso88594',
'iso88595',
'iso88596',
'iso88597',
'iso88597',
'iso88598',
'koi8r',
'koi8u',
'macroman',
'shiftjis',
'utf16be',
'utf16le',
'utf8',
'windows1250',
'windows1251',
'windows1252',
'windows1253',
'windows1254',
'windows1255',
'windows1256',
'windows1257',
'windows1258',
'windows866'
]
editor:
type: 'object'
@@ -74,7 +115,8 @@ module.exports =
autoIndent:
type: 'boolean'
default: true
normalizeIndentOnPaste:
description: 'Automatically indent the cursor when inserting a newline'
autoIndentOnPaste:
type: 'boolean'
default: true
nonWordCharacters:
@@ -105,10 +147,20 @@ module.exports =
scrollPastEnd:
type: 'boolean'
default: false
undoGroupingInterval:
type: 'integer'
default: 500
minimum: 0
description: 'Time interval in milliseconds within which operations will be grouped together in the undo history'
useHardwareAcceleration:
type: 'boolean'
default: true
description: 'Disabling will improve editor font rendering but reduce scrolling performance.'
useShadowDOM:
type: 'boolean'
default: false
title: 'Use Shadow DOM'
description: 'Enable to test out themes and packages with the new shadow DOM before it ships by default.'
confirmCheckoutHeadRevision:
type: 'boolean'
default: true
@@ -132,3 +184,9 @@ module.exports =
type: 'boolean'
default: process.platform isnt 'darwin'
description: 'Increase/decrease the editor font size when pressing the Ctrl key and scrolling the mouse up/down.'
if process.platform in ['win32', 'linux']
module.exports.core.properties.autoHideMenuBar =
type: 'boolean'
default: false
description: 'Automatically hide the menu bar and toggle it by pressing Alt. This is only supported on Windows & Linux.'
+19 -5
Ver Arquivo
@@ -536,11 +536,13 @@ class Config
if scopeSelector?
settings = @scopedSettingsStore.propertiesForSourceAndSelector('user-config', scopeSelector)
@scopedSettingsStore.removePropertiesForSourceAndSelector('user-config', scopeSelector)
_.setValueForKeyPath(settings, keyPath, undefined)
@addScopedSettings('user-config', scopeSelector, settings, @usersScopedSettingPriority)
@save() unless @configFileHasErrors
@getDefault(scopeSelector, keyPath)
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)
@@ -1046,3 +1048,15 @@ splitKeyPath = (keyPath) ->
startIndex = i + 1
keyPathArray.push keyPath.substr(startIndex, keyPath.length)
keyPathArray
withoutEmptyObjects = (object) ->
resultObject = undefined
if isPlainObject(object)
for key, value of object
newValue = withoutEmptyObjects(value)
if newValue?
resultObject ?= {}
resultObject[key] = newValue
else
resultObject = object
resultObject
+2 -2
Ver Arquivo
@@ -76,8 +76,8 @@ class ContextMenuManager
# * `event` The click event that deployed the context menu.
add: (itemsBySelector) ->
# Detect deprecated file path as first argument
unless typeof itemsBySelector is 'object'
Grim.deprecate("ContextMenuManage::add has changed to take a single object as its argument. Please consult the documentation.")
if itemsBySelector? and typeof itemsBySelector isnt 'object'
Grim.deprecate("ContextMenuManager::add has changed to take a single object as its argument. Please consult the documentation.")
itemsBySelector = arguments[1]
devMode = arguments[2]?.devMode
+61 -45
Ver Arquivo
@@ -17,7 +17,7 @@ class Cursor extends Model
visible: true
needsAutoscroll: null
# Instantiated by an {TextEditor}
# Instantiated by a {TextEditor}
constructor: ({@editor, @marker, id}) ->
@emitter = new Emitter
@@ -171,6 +171,10 @@ class Cursor extends Model
Section: Cursor Position Details
###
# Public: Returns the underlying {Marker} for the cursor.
# Useful with overlay {Decoration}s.
getMarker: -> @marker
# Public: Identifies if the cursor is surrounded by whitespace.
#
# "Surrounded" here means that the character directly before and after the
@@ -392,7 +396,7 @@ class Cursor extends Model
# Public: Moves the cursor to the next word boundary.
moveToNextWordBoundary: ->
if position = @getMoveNextWordBoundaryBufferPosition()
if position = @getNextWordBoundaryBufferPosition()
@setBufferPosition(position)
# Public: Moves the cursor to the beginning of the buffer line, skipping all
@@ -420,6 +424,61 @@ class Cursor extends Model
Section: Local Positions and Ranges
###
# Public: Returns buffer position of previous word boundary. It might be on
# the current word, or the previous word.
#
# * `options` (optional) {Object} with the following keys:
# * `wordRegex` A {RegExp} indicating what constitutes a "word"
# (default: {::wordRegExp})
getPreviousWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
previousNonBlankRow = @editor.buffer.previousNonBlankRow(currentBufferPosition.row)
scanRange = [[previousNonBlankRow, 0], currentBufferPosition]
beginningOfWordPosition = null
@editor.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row < currentBufferPosition.row and currentBufferPosition.column > 0
# force it to stop at the beginning of each line
beginningOfWordPosition = new Point(currentBufferPosition.row, 0)
else if range.end.isLessThan(currentBufferPosition)
beginningOfWordPosition = range.end
else
beginningOfWordPosition = range.start
if not beginningOfWordPosition?.isEqual(currentBufferPosition)
stop()
beginningOfWordPosition or currentBufferPosition
# Public: Returns buffer position of the next word boundary. It might be on
# the current word, or the previous word.
#
# * `options` (optional) {Object} with the following keys:
# * `wordRegex` A {RegExp} indicating what constitutes a "word"
# (default: {::wordRegExp})
getNextWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
scanRange = [currentBufferPosition, @editor.getEofBufferPosition()]
endOfWordPosition = null
@editor.scanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row > currentBufferPosition.row
# force it to stop at the beginning of each line
endOfWordPosition = new Point(range.start.row, 0)
else if range.start.isGreaterThan(currentBufferPosition)
endOfWordPosition = range.start
else
endOfWordPosition = range.end
if not endOfWordPosition?.isEqual(currentBufferPosition)
stop()
endOfWordPosition or currentBufferPosition
getMoveNextWordBoundaryBufferPosition: (options) ->
deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead'
@getNextWordBoundaryBufferPosition(options)
# Public: Retrieves the buffer position of where the current word starts.
#
# * `options` (optional) An {Object} with the following keys:
@@ -452,49 +511,6 @@ class Cursor extends Model
else
currentBufferPosition
# Public: Retrieves buffer position of previous word boundary. It might be on
# the current word, or the previous word.
getPreviousWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
previousNonBlankRow = @editor.buffer.previousNonBlankRow(currentBufferPosition.row)
scanRange = [[previousNonBlankRow, 0], currentBufferPosition]
beginningOfWordPosition = null
@editor.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row < currentBufferPosition.row and currentBufferPosition.column > 0
# force it to stop at the beginning of each line
beginningOfWordPosition = new Point(currentBufferPosition.row, 0)
else if range.end.isLessThan(currentBufferPosition)
beginningOfWordPosition = range.end
else
beginningOfWordPosition = range.start
if not beginningOfWordPosition?.isEqual(currentBufferPosition)
stop()
beginningOfWordPosition or currentBufferPosition
# Public: Retrieves buffer position of the next word boundary. It might be on
# the current word, or the previous word.
getMoveNextWordBoundaryBufferPosition: (options = {}) ->
currentBufferPosition = @getBufferPosition()
scanRange = [currentBufferPosition, @editor.getEofBufferPosition()]
endOfWordPosition = null
@editor.scanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) ->
if range.start.row > currentBufferPosition.row
# force it to stop at the beginning of each line
endOfWordPosition = new Point(range.start.row, 0)
else if range.start.isGreaterThan(currentBufferPosition)
endOfWordPosition = range.start
else
endOfWordPosition = range.end
if not endOfWordPosition?.isEqual(currentBufferPosition)
stop()
endOfWordPosition or currentBufferPosition
# Public: Retrieves the buffer position of where the current word ends.
#
# * `options` (optional) {Object} with the following keys:
+3 -4
Ver Arquivo
@@ -735,9 +735,7 @@ class DisplayBuffer extends Model
#
# Returns a {Point}.
screenPositionForBufferPosition: (bufferPosition, options) ->
# TODO: Expand this exception to cover all versions once we burn it in on non-release builds
if @isDestroyed() and not atom.isReleasedVersion()
throw new Error("This TextEditor has been destroyed")
throw new Error("This TextEditor has been destroyed") if @isDestroyed()
{ row, column } = @buffer.clipPosition(bufferPosition)
[startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row)
@@ -1077,8 +1075,9 @@ class DisplayBuffer extends Model
destroyed: ->
marker.unsubscribe() for id, marker of @markers
@tokenizedBuffer.destroy()
@scopedConfigSubscriptions.dispose()
@unsubscribe()
@tokenizedBuffer.destroy()
logLines: (start=0, end=@getLastRow()) ->
for row in [start..end]
+16 -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,13 @@ 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)
# 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")
+6 -2
Ver Arquivo
@@ -16,12 +16,12 @@ GutterComponent = React.createClass
measuredWidth: null
render: ->
{scrollHeight, scrollViewHeight, onMouseDown, backgroundColor, gutterBackgroundColor} = @props
{scrollHeight, scrollViewHeight, backgroundColor, gutterBackgroundColor} = @props
if gutterBackgroundColor isnt 'rbga(0, 0, 0, 0)'
backgroundColor = gutterBackgroundColor
div className: 'gutter', onClick: @onClick, onMouseDown: @onMouseDown,
div className: 'gutter',
div className: 'line-numbers', ref: 'lineNumbers', style:
height: Math.max(scrollHeight, scrollViewHeight)
WebkitTransform: @getTransform()
@@ -45,6 +45,10 @@ GutterComponent = React.createClass
@appendDummyLineNumber()
@updateLineNumbers() if @props.performedInitialMeasurement
node = @getDOMNode()
node.addEventListener 'click', @onClick
node.addEventListener 'mousedown', @onMouseDown
# Only update the gutter if the visible row range has changed or if a
# non-zero-delta change to the screen lines has occurred within the current
# visible row range.

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