Comparar commits

...

698 Commits

Autor SHA1 Mensagem Data
Nathan Sobo f06c3402c3 WIP: Transfer foreground/background color into shadow DOM
Refs #4086
2014-11-11 16:59:36 -07:00
Nathan Sobo e3d70ebad0 💄 2014-11-11 16:58:38 -07: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 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
Kevin Sawicki 1eaba0cb52 ⬆️ fuzzy-finder@0.60 2014-10-29 10:36:09 -07:00
Kevin Sawicki 0c590d6170 Load CoffeeScript when using a custom resource path
Load CoffeeScript early whenever the resource path a subdirectory
from process.resourcesPath

Close #3993
2014-10-29 10:21:23 -07:00
Kevin Sawicki 3df72ec173 ⬆️ apm@0.109 2014-10-29 09:51:59 -07:00
Kevin Sawicki 1456bf0d91 📝 runnung -> running 2014-10-29 09:01:18 -07:00
Kevin Sawicki edec6b9b0a 🐎 Use cached pair character information
Tokenized lines break out atomic tokens so trust the hasPairCharacter
value on the token instead of rechecking it.
2014-10-28 18:15:13 -07:00
Kevin Sawicki 9abc4580f4 Don't recompute pair boolean when building token
Pass in hasPairedCharacter to the Token constructor when it is
being broken out from the parent token instead of recomputing it.
2014-10-28 18:15:13 -07:00
Nathan Sobo 54260230c6 ⬆️ git-diff to prevent updating diffs on destroyed editors 2014-10-28 19:08:30 -06:00
Kevin Sawicki 9bd11fc2f7 Merge pull request #3989 from Bengt/patch-1
Add initial instructions to build rpm from sources, ...
2014-10-28 17:10:22 -07:00
Bengt Lüers 81586d22f4 Add initial instructions to build rpm from sources, add packaging dependency for Fedora 2014-10-29 01:09:21 +01:00
Kevin Sawicki dc824485aa Pass character codes around in TextUtils
Previously the character codes were looked up for each type of character pair.
2014-10-28 16:55:36 -07:00
Kevin Sawicki d1fcfabf0b Move comment above module.exports
Make it parseable by donna

Refs atom/donna#2
2014-10-28 16:20:11 -07:00
Nathan Sobo ea8a3a78da Don’t hide pane items that are already hidden 2014-10-28 11:23:35 -06:00
Kevin Sawicki 62f5d0f7f3 ⬆️ go-to-line@0.26 2014-10-27 16:18:21 -07:00
Kevin Sawicki b3f4d03a82 Add Red Hat install instructions
0.140 include an .rpm file on the releases page and this adds back
the install text added by @ardeshirj in #3797
2014-10-27 16:08:21 -07:00
Kevin Sawicki c2d51858b1 ⬆️ markdown-preview@0.107 2014-10-27 15:25:14 -07:00
Kevin Sawicki a5bca03a46 Prepare 0.141 2014-10-27 15:12:44 -07:00
Nathan Sobo 02d20e3155 Call legacy SpacePen remove hooks before unmounting TextEditorComponent 2014-10-27 15:29:59 -06:00
Nathan Sobo 2910e017bb Unmount TextEditorComponent when TextEditor is destroyed
We don’t want to do it when the element is detached because it might
be caused by moving the editor rather than destroying it. Unmounting
the component entirely and then remounting it causes the hidden input
to not be recycled, interfering with focus restoration. Watching for
destruction of the model is a good way to ensure we always tear down
the view at the right time without doing it prematurely.
2014-10-27 15:12:30 -06:00
Kevin Sawicki 248e164de2 ⬆️ language-ruby@0.41 2014-10-27 13:31:16 -07:00
Nathan Sobo 4d796f614c Update Tokenized/DisplayBuffer prior to TextBuffer::onDidChange handlers
Fixes #3789
2014-10-27 13:56:23 -06:00
Kevin Sawicki a8be05bb3b Clear focused window property on window closed
Closes #3806
2014-10-27 11:30:41 -07:00
Kevin Sawicki 101904e261 Upgrade to bracket-matcher@0.62 2014-10-27 11:15:53 -07:00
Nathan Sobo c0622e8bb5 ⬆️ language-coffee-script to fix jasmine snippet quotes 2014-10-27 11:55:24 -06:00
Kevin Sawicki ce5b755438 📝 Mention profile picture 2014-10-27 10:45:15 -07:00
Nathan Sobo 86781e6f9a Assign pane container before emitting onDidAddPane events
Fixes #3972
2014-10-27 11:39:42 -06:00
Kevin Sawicki a7f4a5b08e ⬆️ markdown-preview@0.106 2014-10-27 10:38:43 -07:00
Nathan Sobo 2b8167da53 Merge pull request #3974 from atom/ns-throw-on-destroyed-editors
Throw on non-release builds if translating positions on destroyed editor
2014-10-27 11:32:48 -06:00
Kevin Sawicki bb0ee8a78b ⬆️ atom-dark-syntax@0.20 2014-10-27 09:42:54 -07:00
Kevin Sawicki d1115d4c7c ⬆️ atom-light-syntax@0.21 2014-10-27 09:40:31 -07:00
Kevin Sawicki a71d7115bf ⬆️ language-sass@0.24 2014-10-27 09:37:27 -07:00
Kevin Sawicki af14a26625 Merge pull request #3965 from brunetton/master
📝 fix TextEditor::delete() doc
2014-10-27 09:13:04 -07:00
Kevin Sawicki dadd56f7a0 ⬆️ language-php@0.17 2014-10-27 09:12:30 -07:00
Kevin Sawicki 0e99b70650 🐧 Add troubleshooting for system gyp error
Closes #2824
2014-10-27 08:45:15 -07:00
Nathan Sobo 2965398062 Throw on non-release builds if translating positions on destroyed editor
It’s possible that bundled packages stray into this corner case, so I’d
like us to catch and fix misbehaving packages before exposing users to 
any exceptions. Once we go one release with this turned on, we can
enable the exception for all builds.
2014-10-27 07:38:18 -06:00
Bruno Duyé 55ace0fe99 📝 fix TextEditor::delete() doc 2014-10-25 19:35:19 +02:00
Nathan Sobo 03f7511229 ⬆️ find and replace for focus transfer fix 2014-10-24 16:14:52 -06:00
Kevin Sawicki 5f7976cada ⬆️ apm 0.108 2014-10-24 14:14:10 -07:00
Kevin Sawicki fa074431f9 Merge pull request #3953 from atom/ks-support-combining-characters
Support unicode combining characters
2014-10-24 14:13:40 -07:00
Kevin Sawicki b9239ffc57 Add spec for cursor position after pair char 2014-10-24 13:31:43 -07:00
Kevin Sawicki 06698c880f Access value on token 2014-10-24 13:31:43 -07:00
Kevin Sawicki 05dc9aad89 💄 2014-10-24 13:31:43 -07:00
Kevin Sawicki e5660e5e83 🐎 Only use String::substr for pair chars 2014-10-24 13:31:43 -07:00
Kevin Sawicki e928447eab Stored paired characters in width cache
Previously characters were treated individually even when multiple
characters would render as a single character on screen.
2014-10-24 13:31:43 -07:00
Kevin Sawicki 9b0f622ffb 📝 Mention combined characters in spec description 2014-10-24 13:31:42 -07:00
Kevin Sawicki b6cc7273a1 Add combined characters to spec 2014-10-24 13:31:42 -07:00
Kevin Sawicki 232be1f876 📝 Mention combined characters 2014-10-24 13:31:42 -07:00
Kevin Sawicki ddeec5d4d5 Treat combined characters as paired characters 2014-10-24 13:31:42 -07:00
Ben Ogle dc83f8bac7 Merge pull request #3944 from atom/bo-defer-config-load
Give scoped user settings a priority
2014-10-24 13:10:49 -07:00
Ben Ogle ae2a7769ed Upgrade scoped-property-store for priority option 2014-10-24 13:08:00 -07:00
Ben Ogle d0d6af7e55 Specs for priority 2014-10-24 13:07:14 -07:00
Ben Ogle 137df72a60 Give the user settings a priority
Base index 1000
2014-10-24 13:07:14 -07:00
Ben Ogle 2e187d3ec1 Upgrade scandal@1.0.3 for isBinary Fix 2014-10-24 11:48:03 -07:00
Ben Ogle 9f74250333 Upgrade whitespace to use scoped properties 2014-10-24 11:18:09 -07:00
Nathan Sobo de70a181c5 Upgrade text-buffer to avoid many position translation errors
Refs #3192
2014-10-24 10:55:51 -06:00
Kevin Sawicki 0272b2f281 ⬆️ spell-check@0.43 2014-10-24 09:15:09 -07:00
Kevin Sawicki 365b7bfaf9 Merge pull request #3950 from avdv/patch-1
Update linux.md
2014-10-24 09:11:35 -07:00
Claudio Bley 937ef321bd Update linux.md
You need to have python2 installed on Arch.

Otherwise you get build ENOENT errors using npm-gyp.
2014-10-24 14:08:10 +02:00
Kevin Sawicki 80a302df9e ⬆️ apm 0.107 2014-10-23 17:55:21 -07:00
Kevin Sawicki 381ee353a3 Upgrade to git-diff@0.41 2014-10-23 16:06:14 -07:00
Kevin Sawicki de3703d1ea 📝 Mark CommandRegistry and atom.commands public 2014-10-23 14:08:09 -07:00
Kevin Sawicki 0b8c4a0c7f ⬆️ image-view@0.38 2014-10-23 12:20:13 -07:00
Kevin Sawicki d299692237 Use correct 64-bith arch 2014-10-23 12:02:52 -07:00
Kevin Sawicki eaf435bd9a Merge pull request #3942 from atom/ks-fedora-dockerfile
Add Dockerfile to build an RPM on CI
2014-10-23 11:36:31 -07:00
Kevin Sawicki 8d71cbd510 📝 Mention fedora/debian checks 2014-10-23 11:10:18 -07:00
Kevin Sawicki 534ace6250 Use x64_64 as arch in rpm name 2014-10-23 11:09:48 -07:00
Kevin Sawicki 89157cdf29 Restore master only uploads 2014-10-23 10:49:05 -07:00
Kevin Sawicki ef2795ea0d Use bash 2014-10-23 10:35:18 -07:00
Kevin Sawicki 11b5bcff74 Use BUILD_ATOM_RPM_ACCESS_TOKEN 2014-10-23 10:10:05 -07:00
Kevin Sawicki d7019509e3 Return early when no token set 2014-10-23 10:01:26 -07:00
Kevin Sawicki 0417458fbb Log when token is missing 2014-10-23 09:56:44 -07:00
Kevin Sawicki ff32fff483 Add missing mkdir assignment 2014-10-23 09:28:47 -07:00
Kevin Sawicki f776678b83 Recreate rpm dir after deleting 2014-10-23 09:20:28 -07:00
Kevin Sawicki edacf02222 📝 Tweak image description 2014-10-23 09:11:13 -07:00
Kevin Sawicki 4b3d3701d5 Add rpm segment in mkrpm script 2014-10-23 09:10:16 -07:00
Kevin Sawicki dcbd1723b7 ⬆️ language-less@0.18 2014-10-23 08:58:35 -07:00
Kevin Sawicki 6c00dbd5ec ⬆️ language-less@0.17 2014-10-23 08:45:49 -07:00
Cheng Zhao 14fd4a9f7d 'enabled' is also a valid item attribute, fixes #3880 2014-10-23 10:34:15 +08:00
Kevin Sawicki b65c6da948 Add rm assignment to right task 2014-10-22 18:09:47 -07:00
Kevin Sawicki 1c1adf5beb Add missing rm assignment 2014-10-22 17:57:15 -07:00
Kevin Sawicki c1197d6390 Map BUILD_ATOM_LINUX_ACCESS_TOKEN to ATOM_ACCESS_TOKEN 2014-10-22 17:50:23 -07:00
Kevin Sawicki 7713720ba7 Drop x flag 2014-10-22 17:47:29 -07:00
Kevin Sawicki 4f1ec786f0 Add missing _ in env var 2014-10-22 17:47:13 -07:00
Kevin Sawicki 27ff02ad0e script/dockerbuild -> script/rpmbuild 2014-10-22 17:41:25 -07:00
Kevin Sawicki 738cdb6e66 Add missing _ in env var 2014-10-22 17:38:06 -07:00
Kevin Sawicki 0818e6d736 Log stack for now 2014-10-22 17:35:39 -07:00
Kevin Sawicki 6b57030bda Test uploads on this branch 2014-10-22 17:33:26 -07:00
Kevin Sawicki b64a5c93e3 Pass through needed env vars 2014-10-22 17:32:52 -07:00
Kevin Sawicki 317001b435 Do everything from dockerbuild script 2014-10-22 17:27:13 -07:00
Kevin Sawicki 4e3d15592e Upload .rpm file when available 2014-10-22 17:26:58 -07:00
Kevin Sawicki f4c40c2932 Publish build from dockerbuild 2014-10-22 17:26:35 -07:00
Kevin Sawicki 9cfc451a79 Remove RPM directory before rebuilding 2014-10-22 17:26:23 -07:00
Kevin Sawicki 198d3e90c7 Add initial rpm cibuild script 2014-10-22 17:04:59 -07:00
Kevin Sawicki 00da8a9df6 Build into rpm directory 2014-10-22 17:03:30 -07:00
Kevin Sawicki 293bd3ad3d Add initial script/dockerbuild 2014-10-22 17:03:19 -07:00
Kevin Sawicki bd0564e30d Move rpm Dockerfile to root 2014-10-22 17:03:05 -07:00
Kevin Sawicki 953940c757 Move debian Dockerfile to build folder 2014-10-22 16:53:22 -07:00
Kevin Sawicki 4ff6366d2b Add initial script/cibuild-atom-rpm 2014-10-22 16:18:05 -07:00
Kevin Sawicki 4db441f4df Add initial Fedora Dockerfile 2014-10-22 16:12:29 -07:00
Kevin Sawicki 71ef21bb70 📝 Link to roadmap issue 2014-10-22 12:59:57 -07:00
Kevin Sawicki de5e443329 Merge pull request #3925 from jfrazelle/dockerfile
Add Dockerfile.
2014-10-22 11:12:52 -07:00
Kevin Sawicki 6e15d68163 Prepare 0.140 2014-10-22 10:38:01 -07:00
Jessica Frazelle 6a3c7bcd50 Add Dockerfile.
I'm just going to leave this here.

You see I was trying to containerize a node webkit app, so I
thought why not atom. Except halfway through I realized it
actually isn't a node webkit app. I finished it anyways
because I had already started. It mounts the X11 socket
so it's a containerized desktop app.
You can do what you want with it.

But since this is OSS, I am going to give you my opinion
anyway. So here it is:
You should take this and use it as a build script, because
it seems like building this is a real PITA.

Ok that's all, enjoy.
Also this file was written in vim.
No, I'm not sorry.

Signed-off-by: Jessica Frazelle <jess@docker.com>
2014-10-22 10:27:25 -07:00
Kevin Sawicki dfc0df42b2 ⬆️ underscore-plus@1.6.1 2014-10-22 10:21:08 -07:00
Kevin Sawicki 452c78b735 Use local variable over calling method again 2014-10-22 09:31:45 -07:00
Kevin Sawicki 42f67033cc Merge pull request #3916 from suda/master
Setting ATOM_HOME
2014-10-22 09:31:11 -07:00
Kevin Sawicki 5c417cf9cc ⬆️ language-sass@0.23 2014-10-21 17:31:40 -07:00
Kevin Sawicki 81143af4b4 Upgrade to markdown-preview@0.105 2014-10-21 16:41:39 -07:00
Kevin Sawicki 5c048a4f13 ⬆️ less-cache@0.17 2014-10-21 15:57:00 -07:00
Kevin Sawicki 2ac9cc9ed1 ⬆️ less-cache@0.16 2014-10-21 15:51:16 -07:00
Kevin Sawicki e8f8ead53f ⬆️ donna@1.0.6 2014-10-21 15:19:18 -07:00
Kevin Sawicki f3d8c5d7ec ⬆️ language-javascript@0.42 2014-10-21 15:14:18 -07:00
Ben Ogle 7d179ef40f Revert "back to 1.0.1"
This reverts commit 375b8efc22.
2014-10-21 14:41:12 -07:00
Ben Ogle 375b8efc22 back to 1.0.1 2014-10-21 14:34:00 -07:00
Kevin Sawicki 086a011a63 Upgrade to settings-view@0.153 2014-10-21 14:30:16 -07:00
Ben Ogle 46ff52b13a UPgrade donna again 2014-10-21 14:16:30 -07:00
Ben Ogle 0ed4d07c33 Upgrade to donna@1.0.4 2014-10-21 14:13:48 -07:00
Kevin Sawicki efe3d65291 Only upload on master 2014-10-21 14:11:06 -07:00
Kevin Sawicki 8576486d06 Prepare docs when building all branches 2014-10-21 14:10:44 -07:00
Kevin Sawicki e5abca138d ⬆️ language-gfm@0.53 2014-10-21 13:50:40 -07:00
Kevin Sawicki fa24154e24 ⬆️ grunt-download-atom-shell@0.10 2014-10-21 13:50:16 -07:00
Kevin Sawicki 45c05d3b7d Merge pull request #3917 from atom/ks-packages-slug
Inline package metadata in main package.json file
2014-10-21 13:49:39 -07:00
Kevin Sawicki bf4ac1d3eb 💄 2014-10-21 13:28:09 -07:00
Kevin Sawicki 892cdae622 Return false when resource path does not match resources path 2014-10-21 13:28:09 -07:00
Kevin Sawicki f33d7ba27f 📝 store -> stored 2014-10-21 13:28:09 -07:00
Kevin Sawicki 06436ef530 📝 Remove extra to 2014-10-21 13:28:09 -07:00
Kevin Sawicki 815244bba0 Delete from local cache reference 2014-10-21 13:28:08 -07:00
Kevin Sawicki 0303ebb5e5 Add resolved main path to package cache 2014-10-21 13:28:08 -07:00
Kevin Sawicki eab791d47e Cache paths are relative to resource path 2014-10-21 13:28:08 -07:00
Kevin Sawicki 6ad96d98b8 Bypass cache when in dev mode 2014-10-21 13:28:08 -07:00
Kevin Sawicki ed4ebefdc1 Use resourcePath on PackageManager 2014-10-21 13:28:08 -07:00
Kevin Sawicki a1828fa3a6 Remove package's package.json from cache
This file is inlined in the main package.json
2014-10-21 13:28:08 -07:00
Kevin Sawicki 345c0f670c Ignore extensions from bundled packages
These are generated in their own cache
2014-10-21 13:28:08 -07:00
Kevin Sawicki d78e6fa711 Build path manually 2014-10-21 13:28:08 -07:00
Kevin Sawicki c3a6475308 Remove unused properties from metadata
Saves another ~50k
2014-10-21 13:28:08 -07:00
Kevin Sawicki 2cc9f6bee8 Use absolute keymap/menu paths 2014-10-21 13:28:08 -07:00
Kevin Sawicki 0c6fba2ce2 Remove inlined files from app directory 2014-10-21 13:28:08 -07:00
Kevin Sawicki fa72db87a2 Update task description 2014-10-21 13:28:07 -07:00
Kevin Sawicki a0d7bbdb92 Don't pretty print package.json
It is now ~400k pretty printed and ~300k without
2014-10-21 13:28:07 -07:00
Kevin Sawicki 4c3e1ef82b 💄 2014-10-21 13:28:07 -07:00
Kevin Sawicki 1056418f97 Only use cache for bundled packages 2014-10-21 13:28:07 -07:00
Kevin Sawicki 37040ad485 Use _atomPackage key from main metadata 2014-10-21 13:28:07 -07:00
Kevin Sawicki dee9cccae7 Use proper relative paths in cache 2014-10-21 13:28:07 -07:00
Kevin Sawicki 50e27854cc Cache package metadata in main package.json file 2014-10-21 13:28:07 -07:00
Ben Ogle c931071c91 Merge pull request #3910 from atom/bo-descriptor-object
Add a ScopeDescriptor object
2014-10-21 13:27:17 -07:00
Ben Ogle 498c8d21b2 Fix comments n junk 2014-10-21 13:27:01 -07:00
Ben Ogle 263b792eee Merge pull request #3907 from atom/bo-scoped-schema
Add support for scoped defaults in config schemas
2014-10-21 13:12:18 -07:00
Ben Ogle ffd3990a6b Split with the new method 2014-10-21 11:57:01 -07:00
Ben Ogle 31490ca31e Last of scopeDescriptor -> scopes from tokens 2014-10-21 11:49:49 -07:00
Ben Ogle 37159bb478 Oops, don’t call the method twice 2014-10-21 11:44:58 -07:00
Ben Ogle 16ad957609 scopeDescriptor -> scopes
Now that we have a real ScopeDescriptor object, 
these should change back!
2014-10-21 11:38:43 -07:00
Ben Ogle 137eeab4cf Return scopes arrays from deprecated methods
backward compatibility
2014-10-21 11:19:58 -07:00
Kevin Sawicki ce2076f30a Merge pull request #3909 from atom/ks-extension-cache-for-packages
Add extension cache for installed packages
2014-10-21 11:12:31 -07:00
Kevin Sawicki 8479d564f5 Enable extensions for installed packages 2014-10-21 11:02:24 -07:00
Kevin Sawicki ec6004615a Load extensions in ModuleCache.create 2014-10-21 10:59:29 -07:00
Kevin Sawicki 7e7441dc23 Merge pull request #3906 from atom/ks-change-menu-on-focus
Swap out application menus on focus
2014-10-21 10:36:14 -07:00
Kevin Sawicki 2a09d25eb1 📝 Add template 2014-10-21 10:22:50 -07:00
Kevin Sawicki d5508b338b Compare templates before swapping them out 2014-10-21 10:22:50 -07:00
Kevin Sawicki 86bd43bf73 Store each window's menu template
Restore it when the window gains focus
2014-10-21 10:22:50 -07:00
Kevin Sawicki 3075b74b64 Close the template
Menu.buildFromTemplate modifies it so copy before hand
so it can be reused
2014-10-21 10:22:50 -07:00
Kevin Sawicki 11d7437ecc Add setActiveTemplate helper 2014-10-21 10:22:49 -07:00
Cheng Zhao df439f5ada Merge pull request #3915 from atom/atom-shell-v0.18.2
Upgrade to atom-shell@0.18.2
2014-10-21 23:02:18 +08:00
Wojtek Siudzinski dc28ddbdc8 Setting ATOM_HOME 2014-10-21 16:55:10 +02:00
Nathan Sobo 49e98d368a Log a warning if a package has an incompatible main module
I’ve been tripped up by this twice now, so it would be good to provide
some feedback when it happens.
2014-10-21 08:54:16 -06:00
Cheng Zhao 02e91aa4cd ⬆️ atom-shell@0.18.2 2014-10-21 22:46:40 +08:00
Ben Ogle 14c8e9cedc Fix specs 2014-10-20 18:40:32 -07:00
Kevin Sawicki 4867e3ef14 Upgrade to tabs@0.55 2014-10-20 18:03:11 -07:00
Ben Ogle 3a70b98ae1 ScopeDescriptor::create -> fromObject 2014-10-20 17:59:28 -07:00
Ben Ogle 08f35531ba Update descriptor docs 2014-10-20 17:49:14 -07:00
Ben Ogle ce2959c0b9 Return ScopeDescriptor objects 2014-10-20 17:49:02 -07:00
Ben Ogle 4c4b82fe6c Add new ScopeDescriptor object 2014-10-20 17:29:46 -07:00
Kevin Sawicki f4c3050050 Upgrade to snippets@0.56 2014-10-20 17:14:42 -07:00
Ben Ogle 2b148b7720 Accept escaped dots in config settings keys
Fixes #3898
2014-10-20 16:58:57 -07:00
Ben Ogle c40dd16466 Upgrade to underscore-plus 1.6 2014-10-20 16:57:46 -07:00
Ben Ogle 7ffe5d1385 Add support for scoped defaults in config schemas 2014-10-20 14:52:12 -07:00
Kevin Sawicki c2ef68a435 Go back to using a concurrency of 2 2014-10-20 14:21:20 -07:00
Kevin Sawicki aa117774b3 Experiment with longer timeout on Mac CI 2014-10-20 13:52:39 -07:00
Kevin Sawicki 6b44369458 Log time taken to upload 2014-10-20 13:37:19 -07:00
Kevin Sawicki 177b3a6d14 Use all the available cores on CI 2014-10-20 13:35:09 -07:00
Ben Ogle 4d1e488ef4 Add contributing to packages to the index 2014-10-20 13:34:15 -07:00
Ben Ogle 0a39c28a79 update contributing to packages to not mention amp develop 2014-10-20 13:34:15 -07:00
Kevin Sawicki e019347ca4 Output total spec time 2014-10-20 13:28:30 -07:00
Ben Ogle b425df1d58 Merge pull request #3837 from atom/bo-panel-api
Add panel API
2014-10-20 13:25:48 -07:00
Ben Ogle 055c632ee9 Call save() in restoreDefault() for scopedSettings 2014-10-20 12:29:46 -07:00
Ben Ogle 2ac1862e5f Remove toHide matcher. 2014-10-20 12:12:21 -07:00
Ben Ogle 5a82afd333 💄 2014-10-20 12:03:48 -07:00
Kevin Sawicki 13f81a452d Upgrade to language-less@0.16 2014-10-20 10:16:22 -07:00
Kevin Sawicki c8144b7e1b Upgrade to language-yaml@0.19 2014-10-20 09:40:36 -07:00
Nathan Sobo b3b78fa926 Merge pull request #3883 from atom/ns-core-specs-from-anywhere
Allow core specs from command line in atom repository regardless of its location
2014-10-20 10:29:13 -06:00
Nathan Sobo 824c00dab3 Add environment variable to the usage string instead of at end 2014-10-20 10:12:32 -06:00
Nathan Sobo 8d331e94d2 Preserve alphabetical sort order for options 2014-10-20 10:07:40 -06:00
Nathan Sobo bc2dd9f52c Drop unnecessary encoding argument 2014-10-20 10:06:19 -06:00
Nathan Sobo 5dd9f9c5ad Fix typo in comment 2014-10-20 10:05:53 -06:00
Kevin Sawicki 3f1afec15b 📝 Link to CSON description 2014-10-20 09:01:17 -07:00
Kevin Sawicki e4705d45c4 Merge pull request #3769 from Maxhodges/keymap-advice
Warn new users we are using a little known format (cson), not the more popular json doc notation.
2014-10-20 08:58:12 -07:00
Kevin Sawicki c0846ab8a6 Upgrade to deprecation-cop@0.11 2014-10-20 08:55:36 -07:00
Kevin Sawicki bfbb262844 Merge pull request #3886 from fenuks/patch-1
Add GenericName to .desktop file
2014-10-20 08:32:13 -07:00
fenuks 5669aa39ce 🐧 Add GenericName to .desktop file, fixes #3885 2014-10-18 20:07:54 +02:00
Nathan Sobo d1f9133ef4 Merge pull request #3830 from atom/ns-extract-style-manager
Extract style manager from theme manager
2014-10-17 18:11:16 -06:00
Nathan Sobo 362c9c8588 Document ATOM_DEV_RESOURCE_PATH environment variable in atom —help 2014-10-17 18:00:45 -06:00
Nathan Sobo c63cde1cd3 Set resource path based on spec directory when running atom core specs
Fixes #3872
2014-10-17 18:00:21 -06:00
Nathan Sobo 6d937831b9 Clarify spec-directory documentation in atom executable 2014-10-17 17:18:43 -06:00
Nathan Sobo 0eacbed162 Document the resource-path option to atom executable 2014-10-17 17:18:30 -06:00
Ben Ogle 6e034c6319 Call the attach hooks after adding a view to a panel. 2014-10-17 16:04:11 -07:00
Kevin Sawicki a4f6c674ef Upgrade to timecop@0.23 2014-10-17 15:51:57 -07:00
Kevin Sawicki 405af7fb16 Track time taken to read window state
Refs atom/timecop#6
2014-10-17 15:44:59 -07:00
Ben Ogle 995e89b5f6 📝 Move panels API for the sake of the docs 2014-10-17 15:42:16 -07:00
Kevin Sawicki 6b90b83867 ⬆️ apm@0.106 2014-10-17 15:34:03 -07:00
Ben Ogle 66d469ee10 Deprecate workspace pane methods 2014-10-17 15:31:56 -07:00
Ben Ogle 657cbc9c17 📝 Doc the new panel methods 2014-10-17 15:24:20 -07:00
Ben Ogle 29ea506f93 Doc Panel class 2014-10-17 15:23:20 -07:00
Ben Ogle 155d144788 Fix spec 2014-10-17 15:23:06 -07:00
Kevin Sawicki 892f341feb ⬆️ apm@0.105 2014-10-17 14:45:52 -07:00
Kevin Sawicki d5808b5c85 Merge pull request #3867 from atom/ks-select-past-last-line
Fix selecting past the last line
2014-10-17 14:38:18 -07:00
Kevin Sawicki d6feb686c1 Mention single click 2014-10-17 14:00:26 -07:00
Kevin Sawicki 5069a5b48b Add spec for clicking past last line 2014-10-17 14:00:25 -07:00
Kevin Sawicki 8c136b18c2 Set targetLeft to Infinity when past last row 2014-10-17 14:00:25 -07:00
Kevin Sawicki f81bc4b870 Never break when past the last row 2014-10-17 14:00:25 -07:00
Adam Boesch 111b956f93 Fix cursor not being able to move within the last line of text. 2014-10-17 14:00:25 -07:00
Adam Boesch 88a95ad06b Fix cursor so clicking the below the last line of text puts the cursor at
the end of the last line.
2014-10-17 14:00:25 -07:00
Kevin Sawicki 04bd602c23 Upgrade to language-c@0.29 2014-10-17 13:59:05 -07:00
Ben Ogle de78e53b35 Add priority system to the panels 2014-10-17 13:44:40 -07:00
Kevin Sawicki fb1a866447 Prepare 0.139 2014-10-17 13:18:59 -07:00
Kevin Sawicki 8925d309b0 Only build debian package for now 2014-10-17 12:59:42 -07:00
Ben Ogle b94485eafd Set the heights of atom panels for location left and right. 2014-10-17 12:08:24 -07:00
Cheng Zhao a83acd0e8a Merge pull request #3874 from atom/atom-shell-v0.18.1
⬆️ atom-shell@0.18.1
2014-10-17 19:43:04 +08:00
Cheng Zhao 4e2c500b64 ⬆️ atom-shell@0.18.1 2014-10-17 19:14:07 +08:00
Kevin Sawicki 03f863d558 ⬆️ language-toml@0.14 2014-10-16 18:48:04 -07:00
Kevin Sawicki b8ad484db0 ⬆️ language-ruby@0.40 2014-10-16 17:32:29 -07:00
Ben Ogle f0fd7c2682 Add hide/show ability for panels 2014-10-16 17:32:24 -07:00
Ben Ogle 3f170a8b5e Add matcher toHide() 2014-10-16 17:31:30 -07:00
Ben Ogle 37a7cfaf9a Remove location junk from panel creation 2014-10-16 17:31:13 -07:00
Ben Ogle 5683491029 Rename custom element so as not to clash 2014-10-16 17:30:54 -07:00
Ben Ogle 4ca630a7da orientation -> location 2014-10-16 16:54:08 -07:00
Ben Ogle 99aedbab89 Panel container probably not public 2014-10-16 16:49:18 -07:00
Ben Ogle 52c05eade7 Render proper atom-panels as children of containers 2014-10-16 16:48:56 -07:00
Kevin Sawicki 1ddb956a94 Cache versions that do not match the range 2014-10-16 16:32:52 -07:00
Kevin Sawicki 2570c20da0 Merge pull request #3860 from atom/ks-join-line-single-space
Join lines with a single space
2014-10-16 16:31:59 -07:00
Ben Ogle 299710f08a Integrate the pane containers into the workspace 2014-10-16 16:17:44 -07:00
Ben Ogle 83e5873f3b Panel containers have the orientation 2014-10-16 16:16:49 -07:00
Kevin Sawicki 4889e03cf2 Always move to end of current line 2014-10-16 16:13:38 -07:00
Kevin Sawicki 7f6cc8a100 📝 Correct typos 2014-10-16 16:13:38 -07:00
Kevin Sawicki e8e0ee1e34 📝 form -> from 2014-10-16 16:13:37 -07:00
Kevin Sawicki 8e3d8eda31 Removed added newline 2014-10-16 16:13:37 -07:00
Kevin Sawicki afd1fa995f 💄 2014-10-16 16:13:37 -07:00
Kevin Sawicki a03c9b6d68 Add trailing whitespace to line 2014-10-16 16:13:37 -07:00
Kevin Sawicki cdd31d69a8 Add spec for joining from empty line 2014-10-16 16:13:37 -07:00
Kevin Sawicki f94983d4d9 Scan buffer to remove trailing whitespace 2014-10-16 16:13:37 -07:00
Adam Boesch ffa528001c Fix join lines so that only a single space will exist between two lines that are joined. 2014-10-16 16:13:37 -07:00
Kevin Sawicki 305b9bc030 Add missing require 2014-10-16 16:13:23 -07:00
Kevin Sawicki 6ed3ef3f60 Only require coffee file when available
Closes #3864
2014-10-16 15:41:23 -07:00
Ben Ogle 5c2e55861c Add panel containers 2014-10-16 15:33:28 -07:00
Nathan Sobo c0843d467d Opt out of command registration for textInput events
There seems to be issues capturing them when they are programmatically
dispatched via dispatchEvent. This was causing problems for the vim-mode
specs. This event belongs among the native events that aren’t treated
as commands anyway.
2014-10-16 15:58:14 -06:00
Ben Ogle 734a79b7ec Add initial panel API.
It can only add things to the left right now.
2014-10-16 13:44:03 -07:00
Ben Ogle 55a5e66701 Merge pull request #3831 from atom/bo-scoped-docs
Add docs for scope selectors and scope descriptors.
2014-10-16 13:26:53 -07:00
Ben Ogle da86c86577 Integrate feedback 2014-10-16 13:26:07 -07:00
Ben Ogle 072c537b6b Upgrade language-gfm 2014-10-16 13:23:35 -07:00
Ben Ogle 1577a28ad4 Add links to the new doc in the API docs 2014-10-16 13:23:34 -07:00
Ben Ogle ee23131688 Rename scopes -> Scope selectors in config::set docs 2014-10-16 13:23:34 -07:00
Ben Ogle 7d8b5bc1fc Add scopes and scope descriptors docs 2014-10-16 13:23:34 -07:00
Ben Ogle 0243597ee8 ⬆️ Upgrade python language to use 4 space tabs 2014-10-16 13:21:41 -07:00
Ben Ogle 50a5609c6b Merge pull request #3847 from atom/bo-scoped-defaults
Add scoped defaults
2014-10-16 11:04:15 -07:00
Kevin Sawicki e76ea838e1 ⬆️ apm 0.104 2014-10-16 09:10:58 -07:00
Kevin Sawicki ed5c011963 :up_arrow: link@0.26 2014-10-15 18:19:44 -07:00
Ben Ogle 0bc1407e7d 📝 Add doc strings 2014-10-15 18:16:44 -07:00
Ben Ogle 7aa00f3417 ⬆️ scoped-property-store 2014-10-15 18:13:15 -07:00
Nathan Sobo 06e9dbf48a 💄 Remove confusing parentheses usage 2014-10-15 19:11:13 -06:00
Kevin Sawicki ff5acb6a34 Upgrade to language-coffee-script@0.36 2014-10-15 18:07:47 -07:00
Nathan Sobo 231295cb2c Add dummy commands prior to package activation so they appear in palette
Fixes #3846
2014-10-15 18:55:38 -06:00
Kevin Sawicki c8a18dfaf8 ⬆️ git-diff@0.40 2014-10-15 17:25:45 -07:00
Kevin Sawicki b339baa923 ⬆️ language-go@0.19 2014-10-15 17:07:20 -07:00
Kevin Sawicki 92d08b47ad Add config for font zooming when Ctrl+Scrolling 2014-10-15 16:59:43 -07:00
Kevin Sawicki 5c3a7a99fc Merge pull request #3737 from russlescai/rl-mousewheel-ctrl-zoom-with-fixes
Adjust font size using Control key with Mouse Scroll Wheel.
2014-10-15 16:52:46 -07:00
Kevin Sawicki ea932a01f9 Build in ~/rpmbuild 2014-10-15 16:42:42 -07:00
Kevin Sawicki d261df0906 Add missing buildDir variable 2014-10-15 16:38:21 -07:00
Kevin Sawicki fac167379f Copy rpm file to build directory 2014-10-15 16:37:16 -07:00
Kevin Sawicki f6d9af8d1a Build rpm in temp folder 2014-10-15 16:34:18 -07:00
Kevin Sawicki a128cf5eb3 Remove rpm install instructions
Will add back once the first rpm release is made
2014-10-15 16:31:25 -07:00
Kevin Sawicki e9c2ee9675 Report errors from mkrpm 2014-10-15 16:31:13 -07:00
Kevin Sawicki e85d33b2a6 Merge pull request #3797 from ardeshirj/mkrpm
mkrpm grunt task
2014-10-15 16:30:16 -07:00
Ben Ogle a42b3ff171 Support a scopeSelector in getSettings() 2014-10-15 16:26:03 -07:00
Ardeshir Javaherchi 86fdbfbb15 🐧 Update to atom.desktop in mkrpm and remove extra variables 2014-10-15 15:53:32 -07:00
Ben Ogle 757abfe3db Config::restoreDefaults handles scopes 2014-10-15 15:33:38 -07:00
Ardeshir Javaherchi cde7940e40 Merge branch 'master' into mkrpm 2014-10-15 15:21:01 -07:00
Ben Ogle d7d6e506da ScopeChainForScopeDescriptor 2014-10-15 15:11:41 -07:00
Ben Ogle 593fc1e77a name -> source 2014-10-15 15:11:27 -07:00
Ben Ogle ae857203fd Support scoped settings in getDefault 2014-10-15 15:11:19 -07:00
Kevin Sawicki a1c418e995 ⬆️ Upgrade to apm 0.103 2014-10-15 15:09:11 -07:00
Kevin Sawicki f07f096f56 Use Range class that memoizes 2014-10-15 14:47:24 -07:00
Ben Ogle 62c1972c95 isDefault supports scoped settings 2014-10-15 14:44:16 -07:00
Nathan Sobo 314c525d2d Assign properties in addition to attributes for convenience 2014-10-15 15:14:13 -06:00
Nathan Sobo 04b3eef768 Fix theme-manager-specs 2014-10-15 15:14:13 -06:00
Nathan Sobo 506753a535 Subscribe to <atom-styles> element to shim events in ThemeManager
This is better than subscribing to atom.styles because the events it
emits contain the *actual* style elements we insert into the DOM.
2014-10-15 15:14:13 -06:00
Nathan Sobo a8b9e1b790 Handle style element updates in StylesElement 2014-10-15 15:14:13 -06:00
Nathan Sobo be51ccf786 Add StylesElement::onDidAdd/RemoveStyleElement 2014-10-15 15:14:13 -06:00
Nathan Sobo 65e077abd1 Use StyleManager and StylesElement to manage all stylesheet elements
For now, loading remains in the theme manager, but all application of
stylesheets is routed through atom.styles.
2014-10-15 15:14:13 -06:00
Nathan Sobo 79598aaae9 Add StyleElement
This will be used to handle stylesheet rendering when we move management
of loading stylesheets to the StyleManager instead of the theme manager.
This sets us up for being able to render specific stylesheets in shadow
roots in addition to just having global stylesheets.
2014-10-15 15:14:13 -06:00
Nathan Sobo 62a43c6fb9 Revise StyleManager API 2014-10-15 15:14:12 -06:00
Nathan Sobo 1fe1147901 Add group parameter to StyleManager::addStyleSheet
This can be used to sequence style elements at the correct location in
the cascade even if they are loaded later than elements in a subsequent
group.
2014-10-15 15:14:12 -06:00
Nathan Sobo 1c97dcd195 Add sourcePath parameter to StyleManager::addStyleSheet 2014-10-15 15:14:12 -06:00
Nathan Sobo d3371dbcd2 Start on StyleManager
This will take over raw stylesheet management from the theme manager
now that it’s becoming more complex with the need to target specific
host elements. Instead of actually adding nodes to the head of the
document, it will instead simply manage a set of stylesheets we want to
apply and leave actual DOM manipulation to <atom-styles> custom elements
that can render the set of active stylesheets in the appropriate
locations.
2014-10-15 15:14:12 -06:00
Kevin Sawicki b2b4860983 Merge pull request #3761 from atom/ks-require-cache
Cache requires across installed packages
2014-10-15 14:00:10 -07:00
Kevin Sawicki 57fc3deaed Assert that resolved atom shell module paths exist 2014-10-15 13:12:42 -07:00
Kevin Sawicki 677949d61c Check that all builtins resolve without hitting fs 2014-10-15 13:09:47 -07:00
Kevin Sawicki e09d7159bc Add spec for no compatible module version available 2014-10-15 13:09:47 -07:00
Kevin Sawicki e02af51a04 🐎 Extend range to memoize matched versions 2014-10-15 13:09:47 -07:00
Kevin Sawicki d2c7a2caca Return early when cache to add is missing 2014-10-15 13:09:47 -07:00
Kevin Sawicki 739a629552 💄 2014-10-15 13:09:47 -07:00
Kevin Sawicki 88f0183352 Remove unneeded quotes 2014-10-15 13:09:47 -07:00
Kevin Sawicki 7f01a163e5 💄 2014-10-15 13:09:47 -07:00
Kevin Sawicki fc44662ba3 Add spec for resolving compatible module paths 2014-10-15 13:09:47 -07:00
Kevin Sawicki 5052aaca95 Don't leave empty paths with a trailing slash 2014-10-15 13:09:46 -07:00
Kevin Sawicki 826681b6c2 Add relative path cache spec 2014-10-15 13:09:46 -07:00
Kevin Sawicki 8334bba484 Add initial ModuleCache spec 2014-10-15 13:09:46 -07:00
Kevin Sawicki a0ae526017 Check candidates after ranges
This way builtins are checked for correctly when the
range isn’t found
2014-10-15 13:09:46 -07:00
Kevin Sawicki 6a6c7b1852 Calculate load time in index.js
Do it previously in window-bootstrap caused several things to not be
included such as requiring coffee script and atom shell modules.

Now it is a much more accurate representation of on load time.
2014-10-15 13:09:46 -07:00
Kevin Sawicki 42040f8a9d Return early when no candidates exist 2014-10-15 13:09:46 -07:00
Kevin Sawicki 9d1db0f3de Remove unneeded trailing slash check
Package names don’t have these anyway and file paths
won’t be ending with them.
2014-10-15 13:09:46 -07:00
Kevin Sawicki f0b922f643 Use String::startsWith 2014-10-15 13:09:46 -07:00
Kevin Sawicki bb92b8697d Add isCorePath helper 2014-10-15 13:09:46 -07:00
Kevin Sawicki 4c17c9eae6 fs-plust -> fs-plus 2014-10-15 13:09:46 -07:00
Kevin Sawicki 289f17b119 Require coffee before module cache in dev mode 2014-10-15 13:09:46 -07:00
Kevin Sawicki dfd7bcae7f Use process.resourcesPath to find Atom shell root 2014-10-15 13:09:46 -07:00
Kevin Sawicki 0cfd37acd0 Special case reactionary in cache 2014-10-15 13:09:45 -07:00
Kevin Sawicki 105fc302ea Upgrade to text-buffer@3.2.9 2014-10-15 13:09:45 -07:00
Kevin Sawicki f4ddc05b9c Remove call to removed function 2014-10-15 13:09:45 -07:00
Kevin Sawicki 948f96dd6f Only load fs-plus when creating a cache 2014-10-15 13:09:45 -07:00
Kevin Sawicki db627f5cde 🐎 Join paths manually
path.join calls path.normalize and with the number of paths
being pushed through the cache it is faster to require them
manually since they are already normalized
2014-10-15 13:09:45 -07:00
Kevin Sawicki a6866656b7 Inline isAbsolute method
This allows fs-plus to be required through the cache
2014-10-15 13:09:45 -07:00
Kevin Sawicki 40c5289e2b Defer requires until the cache is populated 2014-10-15 13:09:45 -07:00
Kevin Sawicki 7dffc58c5b Use Module's filename instead of id 2014-10-15 13:09:45 -07:00
Kevin Sawicki 67d430d100 Add crash-reporter to cache 2014-10-15 13:09:45 -07:00
Kevin Sawicki d745b9ef5f Register module cache as early as possible 2014-10-15 13:09:45 -07:00
Kevin Sawicki b9d89cbf5d Inline valid extensions to check for 2014-10-15 13:09:45 -07:00
Kevin Sawicki 934c0720d8 Require ipc when needed 2014-10-15 13:09:44 -07:00
Kevin Sawicki 06ac206707 Add clipboard to cache 2014-10-15 13:09:44 -07:00
Kevin Sawicki 6e1bdbbed7 Verify that file path is absolute or relative 2014-10-15 13:09:44 -07:00
Kevin Sawicki 3e3de50eb3 💄 2014-10-15 13:09:44 -07:00
Kevin Sawicki d7a8dfb209 Add Atom Shell builtins to cache 2014-10-15 13:09:44 -07:00
Kevin Sawicki b0aea54544 Check cache before atom require short-circuit 2014-10-15 13:09:44 -07:00
Kevin Sawicki 41598af2b2 Add pre-resolved path to require('atom') 2014-10-15 13:09:44 -07:00
Kevin Sawicki f495db41e7 getCachedModulePath -> resolveModulePath 2014-10-15 13:09:44 -07:00
Kevin Sawicki 76187f176c Add core cache of pre-resolved paths
This reduces the number of calls to Module._findPath for
relative paths since they can be resolved without stating
2014-10-15 13:09:44 -07:00
Kevin Sawicki d7cb1550bf Remove semicolon 2014-10-15 13:09:44 -07:00
Kevin Sawicki 086be13ac4 Add Module._findPath debug timing and count 2014-10-15 13:09:44 -07:00
Kevin Sawicki f0cffcbd84 Add addPathToCache helper for apm to warm using 2014-10-15 13:09:44 -07:00
Kevin Sawicki d1f3d7d51e Mention plain return 2014-10-15 13:09:43 -07:00
Kevin Sawicki bdc0341eb3 undefined -> return 2014-10-15 13:09:43 -07:00
Kevin Sawicki 171411823f 🐎 Resolve uncached core dependencies
Trust modules under the resource path to be there without stat-ing and
verifying.
2014-10-15 13:09:43 -07:00
Kevin Sawicki 7926531330 Whitelist folders path from core
There are several folders bundled in the app that aren't needed in the
require cache list so it is simpler to opt-in the folders that should
be part of the cache.
2014-10-15 13:09:43 -07:00
Kevin Sawicki 440866d79e Remove invalid range logging 2014-10-15 13:09:43 -07:00
Kevin Sawicki d9c758b940 Remove no main module logging 2014-10-15 13:09:43 -07:00
Kevin Sawicki 827a8ba107 First dependency version added wins 2014-10-15 13:09:43 -07:00
Kevin Sawicki 65a1fafaf7 Ensure CoffeeScript is registered when caching
This ensures folders with .coffee files are includes in the
folders array
2014-10-15 13:09:43 -07:00
Kevin Sawicki 9bd6891ac2 Use realpath so path.relative works right 2014-10-15 13:09:43 -07:00
Kevin Sawicki 8a0755340f Remove extra ) 2014-10-15 13:09:43 -07:00
Kevin Sawicki bdebe575b7 💄 Use regular require paths 2014-10-15 13:09:43 -07:00
Kevin Sawicki 472a48092d Export cache for debugging purposes 2014-10-15 13:09:42 -07:00
Kevin Sawicki d877872c71 Use right require path 2014-10-15 13:09:42 -07:00
Kevin Sawicki 0a297d7642 Load module cache in index.js 2014-10-15 13:09:42 -07:00
Kevin Sawicki 87d2026e63 Generate module cache during build 2014-10-15 13:09:42 -07:00
Kevin Sawicki 20f6489232 Disable debug mode 2014-10-15 13:09:42 -07:00
Kevin Sawicki 2c737b8927 Move debug property into cache object 2014-10-15 13:09:42 -07:00
Kevin Sawicki 0df5045edb Move registered property into cache object 2014-10-15 13:09:42 -07:00
Kevin Sawicki b91c25186f Use hasOwnProperty 2014-10-15 13:09:42 -07:00
Kevin Sawicki 7b8a293f30 Inline path to listSync call 2014-10-15 13:09:42 -07:00
Kevin Sawicki 26df31aa1f 💄 Group exported methods 2014-10-15 13:09:42 -07:00
Kevin Sawicki 36ff22e30a generateDependencies -> create 2014-10-15 13:09:42 -07:00
Kevin Sawicki 93c5b4be7b Generate cache for bundled packages 2014-10-15 13:09:42 -07:00
Kevin Sawicki 495fa43753 Allow passing in metadata to ModuleCache.add 2014-10-15 13:09:41 -07:00
Kevin Sawicki 2954aacb1c Ignore invalid ranges
They cannot be cache since multiple commits/branches may
map to the same version number which would lead to
unpredictable results.
2014-10-15 13:09:41 -07:00
Kevin Sawicki 1bf8f516c3 Cache parsed ranges 2014-10-15 13:09:41 -07:00
Kevin Sawicki e0a84232c3 💄 2014-10-15 13:09:41 -07:00
Kevin Sawicki 8c204bb60e Restore cache 2014-10-15 13:09:41 -07:00
Kevin Sawicki 245c77869f Add require time and load count tracking 2014-10-15 13:09:41 -07:00
Kevin Sawicki 508a30efb1 Return when package.json can't be required 2014-10-15 13:09:41 -07:00
Kevin Sawicki 5ad54bbe92 Wire up cache to Module._resolveFilename 2014-10-15 13:09:41 -07:00
Kevin Sawicki 4da6513fb5 Add initial cache of resource path module 2014-10-15 13:09:41 -07:00
Kevin Sawicki 1154490a97 Store main path of module
This is the key in Module._cache
2014-10-15 13:09:41 -07:00
Kevin Sawicki 0e7e24ca6b relative -> relativePath 2014-10-15 13:09:40 -07:00
Kevin Sawicki 944ac14be7 Make dependencies an array of objects 2014-10-15 13:09:40 -07:00
Kevin Sawicki 7aa28920cf Use fs.listSync 2014-10-15 13:09:40 -07:00
Kevin Sawicki 6ce6553456 Add initial task to generate dependencies 2014-10-15 13:09:40 -07:00
Kevin Sawicki b4470a14cb Explicitly register cache 2014-10-15 13:09:40 -07:00
Kevin Sawicki 5b629e6b29 💄 2014-10-15 13:09:40 -07:00
Kevin Sawicki 7304b97547 Parse resource path for relativizing cache paths 2014-10-15 13:09:40 -07:00
Kevin Sawicki f523c5eb73 Do hasOwnProperty check first 2014-10-15 13:09:40 -07:00
Kevin Sawicki 5981cfb8c9 Ignore native modules since they are already cached 2014-10-15 13:09:40 -07:00
Kevin Sawicki d1e966349f Add initial cache lookup method 2014-10-15 13:09:40 -07:00
Kevin Sawicki dc19fa4baa 📝 Add a couple notes 2014-10-15 13:09:40 -07:00
Kevin Sawicki 84e90d140f Wire initial module cache 2014-10-15 13:09:40 -07:00
Kevin Sawicki ea557ab109 Prepare 0.138 2014-10-15 13:07:58 -07:00
Kevin Sawicki bfbc0b1c46 Upgrade to settings-view@0.152 2014-10-15 11:28:37 -07:00
Paul Betts d3b9a14f98 Merge pull request #3836 from atom/dont-fail-if-no-deltas
Don't fail create-installer if ATOM_ACCESS_TOKEN isn't set
2014-10-15 11:08:00 -07:00
Kevin Sawicki ad6fc94a5c ⬆️ Upgrade to grammar-selector@0.35 2014-10-15 09:18:54 -07:00
Kevin Sawicki 07a1b28e67 Upgrade to incompatible-packages@0.10 2014-10-15 09:12:10 -07:00
Kevin Sawicki 966adbdf20 Upgrade to tree-view@0.131 2014-10-15 09:01:45 -07:00
Kevin Sawicki bbfac9430e Use -> instead of => 2014-10-14 18:06:40 -07:00
Kevin Sawicki 7bc3fffa1a Merge pull request #3822 from suda/master
Replaced xcopy with robocopy
2014-10-14 17:32:42 -07:00
Kevin Sawicki 7b9aa23129 📝 deps -> dependencies 2014-10-14 17:28:19 -07:00
Kevin Sawicki 9ef4b84afb 📝 Add missing : 2014-10-14 17:27:57 -07:00
Kevin Sawicki 01625bc892 Merge pull request #3828 from zigal/patch-1
📝 adding an emoji for upgrading deps
2014-10-14 17:27:16 -07:00
zigal a2781b2a84 📝 adding an emoji for upgrading deps 2014-10-14 20:14:59 +02:00
Wojtek Siudzinski f382edd431 Replaced xcopy with robocopy 2014-10-14 08:51:55 +02:00
Ardeshir Javaherchi 503393122f 📝 Add Red Hat Linux to README file 2014-10-11 17:07:05 -07:00
Ardeshir Javaherchi b5c6d76999 Add grunt mkrpm task to create rpm package 2014-10-11 17:04:14 -07:00
Max Hodges 6c56f2f985 Update keymap.cson 2014-10-09 16:01:41 +09:00
Max Hodges a4b959f2b8 Update keymap.cson 2014-10-09 13:26:14 +09:00
Max Hodges c59b7f6ead new users should be warned about cson
improper trailing and leading spaces can cause your bindings to fail.Since cson has very little adoption relative to json, I think it's important to warn new users that they need to understand CoffeeScript notation or else a single space could break their file. I spent one full hour today trying to get an auto-indent mapping to work. The solution involved adding one leading space!
2014-10-09 13:15:55 +09:00
Russell Lescai 38a6f52ef7 Rearranged onMouseWheel function for tidier merge. 2014-10-07 11:16:25 +10:30
Russell Lescai 33e2829697 Adjust font size using Control key with Mouse Scroll Wheel. 2014-10-07 10:18:12 +10:30
136 arquivos alterados com 4435 adições e 1351 exclusões
+13 -15
Ver Arquivo
@@ -12,19 +12,21 @@ propose changes to this document in a pull request.
## Submitting Issues
* Check the [debugging guide](https://atom.io/docs/latest/debugging) for tips
on debugging. You might be able to find the cause of the problem and fix
on debugging. You might be able to find the cause of the problem and fix
things yourself.
* Include the version of Atom you are using and the OS.
* Include screenshots and animated GIFs whenever possible; they are immensely
helpful.
* Include the behavior you expected and other places you've seen that behavior
such as Emacs, vi, Xcode, etc.
* Check the dev tools (`alt-cmd-i`) for errors to include. If the dev tools
* Check the dev tools (`alt-cmd-i`) for errors to include. If the dev tools
are open _before_ the error is triggered, a full stack trace for the error
will be logged. If you can reproduce the error, use this approach to get the
full stack trace and include it in the issue.
* On Mac, check Console.app for stack traces to include if reporting a crash.
* Perform a cursory search to see if a similar issue has already been submitted.
* Please setup a [profile picture](https://help.github.com/articles/how-do-i-set-up-my-profile-picture)
to make yourself recognizable and so we can all get to know each other better.
### Package Repositories
@@ -62,6 +64,8 @@ For more information on how to work with Atom's official packages, see
* Use `path.join()` to concatenate filenames.
* Use `os.tmpdir()` rather than `/tmp` when you need to reference the
temporary directory.
* Using a plain `return` when returning explicitly at the end of a function.
* Not `return null`, `return undefined`, `null`, or `undefined`
## Git Commit Messages
@@ -82,6 +86,7 @@ For more information on how to work with Atom's official packages, see
* :green_heart: `:green_heart:` when fixing the CI build
* :white_check_mark: `:white_check_mark:` when adding tests
* :lock: `:lock:` when dealing with security
* :arrow_up: `:arrow_up:` when upgrading dependencies
## CoffeeScript Styleguide
@@ -96,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) ->
+22
Ver Arquivo
@@ -0,0 +1,22 @@
# VERSION: 0.1
# DESCRIPTION: Image to build Atom and create a .rpm file
# Base docker image
FROM fedora:20
# Install dependencies
RUN yum install -y \
make \
gcc \
gcc-c++ \
glibc-devel \
git-core \
libgnome-keyring-devel \
rpmdevtools
# Install node
RUN curl -sL https://rpm.nodesource.com/setup | bash -
RUN yum install -y nodejs
ADD . /atom
WORKDIR /atom
+14
Ver Arquivo
@@ -4,6 +4,9 @@ Atom is a hackable text editor for the 21st century, built on [atom-shell](http:
Visit [atom.io](https://atom.io) to learn more.
Visit [issue #3684](https://github.com/atom/atom/issues/3684) to learn more
about the Atom 1.0 roadmap.
## Installing
### Mac OS X
@@ -36,6 +39,17 @@ Currently only a 64-bit version is available.
The Linux version does not currently automatically update so you will need to
repeat these steps to upgrade to future releases.
### Red Hat Linux (Fedora, CentOS, Red Hat)
Currently only a 64-bit version is available.
1. Download `atom.x86_64.rpm` from the [Atom releases page](https://github.com/atom/atom/releases/latest).
2. Run `sudo yum localinstall atom.x86_64.rpm` on the downloaded package.
3. Launch Atom using the installed `atom` command.
The Linux version does not currently automatically update so you will need to
repeat these steps to upgrade to future releases.
## Building
* [Linux](docs/build-instructions/linux.md)
+1 -1
Ver Arquivo
@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.102.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)
+50
Ver Arquivo
@@ -0,0 +1,50 @@
# VERSION: 0.1
# DESCRIPTION: Create the atom editor in a container
# AUTHOR: Jessica Frazelle <jessie@docker.com>
# COMMENTS:
# This file describes how to build the atom editor
# in a container with all dependencies installed.
# Tested on Debian Jessie.
# USAGE:
# # Download atom Dockerfile
# wget http://raw.githubusercontent.com/atom/atom/master/Dockerfile
#
# # Build atom image
# docker build -t atom .
#
# docker run -v /tmp/.X11-unix:/tmp/.X11-unix \
# -e DISPLAY=unix$DISPLAY atom
#
DOCKER-VERSION 1.3
# Base docker image
FROM debian:jessie
MAINTAINER Jessica Frazelle <jessie@docker.com>
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
ca-certificates \
curl \
git \
libasound2 \
libgconf-2-4 \
libgnome-keyring-dev \
libgtk2.0-0 \
libnss3 \
libxtst6 \
--no-install-recommends
# install node
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
# clone atom
RUN git clone https://github.com/atom/atom /src
WORKDIR /src
RUN git fetch && git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
RUN script/build && script/grunt install
# Autorun atom
CMD /usr/local/bin/atom --foreground --log-file /var/log/atom.log && tail -f /var/log/atom.log
+2 -2
Ver Arquivo
@@ -7,7 +7,7 @@
},
"dependencies": {
"async": "~0.2.9",
"donna": "1.0.1",
"donna": "1.0.6",
"formidable": "~1.0.14",
"fs-plus": "2.x",
"github-releases": "~0.2.0",
@@ -18,7 +18,7 @@
"grunt-contrib-csslint": "~0.1.2",
"grunt-contrib-less": "~0.8.0",
"grunt-cson": "0.10.0",
"grunt-download-atom-shell": "~0.8.0",
"grunt-download-atom-shell": "~0.10.0",
"grunt-lesslint": "0.13.0",
"grunt-markdown": "~0.4.0",
"grunt-peg": "~1.1.0",
+1 -1
Ver Arquivo
@@ -153,7 +153,7 @@ module.exports = (grunt) ->
fs.writeFileSync path.join(appDir, 'node_modules', 'symbols-view', 'vendor', 'ctags-win32.exe.ignore'), ''
fs.writeFileSync path.join(shellAppDir, 'atom.exe.gui'), ''
dependencies = ['compile', "generate-license:save"]
dependencies = ['compile', 'generate-license:save', 'generate-module-cache', 'compile-packages-slug']
dependencies.push('copy-info-plist') if process.platform is 'darwin'
dependencies.push('set-exe-icon') if process.platform is 'win32'
grunt.task.run(dependencies...)
@@ -0,0 +1,54 @@
path = require 'path'
CSON = require 'season'
fs = require 'fs-plus'
_ = require 'underscore-plus'
module.exports = (grunt) ->
{spawn, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', ->
appDir = fs.realpathSync(grunt.config.get('atom.appDir'))
modulesDirectory = path.join(appDir, 'node_modules')
packages = {}
for moduleDirectory in fs.listSync(modulesDirectory)
continue if path.basename(moduleDirectory) is '.bin'
metadataPath = path.join(moduleDirectory, 'package.json')
metadata = grunt.file.readJSON(metadataPath)
continue unless metadata?.engines?.atom?
moduleCache = metadata._atomModuleCache ? {}
rm metadataPath
_.remove(moduleCache.extensions?['.json'] ? [], 'package.json')
for property in ['_from', '_id', 'dist', 'readme', 'readmeFilename']
delete metadata[property]
pack = {metadata, keymaps: {}, menus: {}}
if metadata.main
mainPath = require.resolve(path.resolve(moduleDirectory, metadata.main))
pack.main = path.relative(appDir, mainPath)
for keymapPath in fs.listSync(path.join(moduleDirectory, 'keymaps'), ['.cson', '.json'])
relativePath = path.relative(appDir, keymapPath)
pack.keymaps[relativePath] = CSON.readFileSync(keymapPath)
rm keymapPath
for menuPath in fs.listSync(path.join(moduleDirectory, 'menus'), ['.cson', '.json'])
relativePath = path.relative(appDir, menuPath)
pack.menus[relativePath] = CSON.readFileSync(menuPath)
rm menuPath
packages[metadata.name] = pack
for extension, paths of moduleCache.extensions
delete moduleCache.extensions[extension] if paths.length is 0
metadata = grunt.file.readJSON(path.join(appDir, 'package.json'))
metadata._atomPackages = packages
grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata))
@@ -0,0 +1,39 @@
path = require 'path'
fs = require 'fs-plus'
ModuleCache = require '../../src/module-cache'
module.exports = (grunt) ->
grunt.registerTask 'generate-module-cache', 'Generate a module cache for all core modules and packages', ->
appDir = grunt.config.get('atom.appDir')
{packageDependencies} = grunt.file.readJSON('package.json')
for packageName, version of packageDependencies
ModuleCache.create(path.join(appDir, 'node_modules', packageName))
ModuleCache.create(appDir)
metadata = grunt.file.readJSON(path.join(appDir, 'package.json'))
metadata._atomModuleCache.folders.forEach (folder) ->
if '' in folder.paths
folder.paths = [
''
'exports'
'spec'
'src'
'src/browser'
'static'
'vendor'
]
# Reactionary does not have an explicit react dependency
metadata._atomModuleCache.folders.push
paths: [
'node_modules/reactionary-atom-fork/lib'
]
dependencies: {
'react-atom-fork': metadata.dependencies['react-atom-fork']
}
grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata))
+1 -1
Ver Arquivo
@@ -32,7 +32,7 @@ module.exports = (grunt) ->
binDir = path.join(installDir, 'bin')
shareDir = path.join(installDir, 'share', 'atom')
iconName = path.join(shareDir,'resources','app','resources','atom.png')
iconName = path.join(shareDir,'resources', 'app', 'resources', 'atom.png')
mkdir binDir
cp 'atom.sh', path.join(binDir, 'atom')
+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
"""
+48
Ver Arquivo
@@ -0,0 +1,48 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
module.exports = (grunt) ->
{spawn, rm, mkdir} = require('./task-helpers')(grunt)
fillTemplate = (filePath, data) ->
template = _.template(String(fs.readFileSync("#{filePath}.in")))
filled = template(data)
outputPath = path.join(grunt.config.get('atom.buildDir'), path.basename(filePath))
grunt.file.write(outputPath, filled)
outputPath
grunt.registerTask 'mkrpm', 'Create rpm package', ->
done = @async()
if process.arch is 'ia32'
arch = 'i386'
else if process.arch is 'x64'
arch = 'amd64'
else
return done("Unsupported arch #{process.arch}")
{name, version, description} = grunt.file.readJSON('package.json')
buildDir = grunt.config.get('atom.buildDir')
rpmDir = path.join(buildDir, 'rpm')
rm rpmDir
mkdir rpmDir
installDir = grunt.config.get('atom.installDir')
shareDir = path.join(installDir, 'share', 'atom')
iconName = path.join(shareDir, 'resources', 'app', 'resources', 'atom.png')
data = {name, version, description, installDir, iconName}
specFilePath = fillTemplate(path.join('resources', 'linux', 'redhat', 'atom.spec'), data)
desktopFilePath = fillTemplate(path.join('resources', 'linux', 'atom.desktop'), data)
cmd = path.join('script', 'mkrpm')
args = [specFilePath, desktopFilePath, buildDir]
spawn {cmd, args}, (error) ->
if error?
done(error)
else
grunt.log.ok "Created rpm package in #{rpmDir}"
done()
+41 -8
Ver Arquivo
@@ -20,9 +20,9 @@ module.exports = (gruntObject) ->
{cp} = require('./task-helpers')(grunt)
grunt.registerTask 'publish-build', 'Publish the built app', ->
return if process.env.JANKY_SHA1 and process.env.JANKY_BRANCH isnt 'master'
tasks = ['upload-assets']
tasks.unshift('build-docs', 'prepare-docs') if process.platform is 'darwin'
tasks = []
tasks.push('build-docs', 'prepare-docs') if process.platform is 'darwin'
tasks.push('upload-assets') if process.env.JANKY_SHA1 and process.env.JANKY_BRANCH is 'master'
grunt.task.run(tasks)
grunt.registerTask 'prepare-docs', 'Move api.json to atom-api.json', ->
@@ -31,7 +31,16 @@ module.exports = (gruntObject) ->
cp path.join(docsOutputDir, 'api.json'), path.join(buildDir, 'atom-api.json')
grunt.registerTask 'upload-assets', 'Upload the assets to a GitHub release', ->
done = @async()
doneCallback = @async()
startTime = Date.now()
done = (args...) ->
elapsedTime = Math.round((Date.now() - startTime) / 100) / 10
grunt.log.ok("Upload time: #{elapsedTime}s")
doneCallback(args...)
unless token
return done(new Error('ATOM_ACCESS_TOKEN environment variable not set'))
buildDir = grunt.config.get('atom.buildDir')
assets = getAssets()
@@ -63,9 +72,21 @@ getAssets = ->
else
arch = 'amd64'
{version} = grunt.file.readJSON('package.json')
# Check for a Debian build
sourcePath = "#{buildDir}/atom-#{version}-#{arch}.deb"
assetName = "atom-#{arch}.deb"
# Check for a Fedora build
unless fs.isFileSync(sourcePath)
rpmName = fs.readdirSync("#{buildDir}/rpm")[0]
sourcePath = "#{buildDir}/rpm/#{rpmName}"
if process.arch is 'ia32'
arch = 'i386'
else
arch = 'x86_64'
assetName = "atom.#{arch}.rpm"
{cp} = require('./task-helpers')(grunt)
cp sourcePath, path.join(buildDir, assetName)
@@ -102,10 +123,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 =
+1 -1
Ver Arquivo
@@ -32,7 +32,7 @@ module.exports = (grunt) ->
packageJsonPath = path.join(appDir, 'package.json')
packageJson = require(packageJsonPath)
packageJson.version = version
packageJsonString = JSON.stringify(packageJson, null, 2)
packageJsonString = JSON.stringify(packageJson)
fs.writeFileSync(packageJsonPath, packageJsonString)
if process.platform is 'darwin'
+5 -3
Ver Arquivo
@@ -4,6 +4,8 @@ path = require 'path'
_ = require 'underscore-plus'
async = require 'async'
concurrency = 2
module.exports = (grunt) ->
{isAtomPackage, spawn} = require('./task-helpers')(grunt)
@@ -61,7 +63,7 @@ module.exports = (grunt) ->
continue unless isAtomPackage(packagePath)
packageSpecQueue.push(packagePath)
packageSpecQueue.concurrency = 1
packageSpecQueue.concurrency = concurrency - 1
packageSpecQueue.drain = -> callback(null, failedPackages)
runCoreSpecs = (callback) ->
@@ -84,7 +86,7 @@ module.exports = (grunt) ->
fs.unlinkSync('ci.log')
else
# TODO: Restore concurrency on Windows
packageSpecQueue.concurrency = 2
packageSpecQueue.concurrency = concurrency
callback(null, error)
@@ -102,7 +104,7 @@ module.exports = (grunt) ->
method [runCoreSpecs, runPackageSpecs], (error, results) ->
[coreSpecFailed, failedPackages] = results
elapsedTime = Math.round((Date.now() - startTime) / 100) / 10
grunt.verbose.writeln("Total spec time: #{elapsedTime}s")
grunt.log.ok("Total spec time: #{elapsedTime}s using #{concurrency} cores")
failures = failedPackages
failures.push "atom core" if coreSpecFailed
@@ -0,0 +1,87 @@
# Scoped Settings, Scopes and Scope Descriptors
Atom supports language-specific settings. You can soft wrap only Markdown files, or set the tab length to 4 in Python files.
Language-specific settings are a subset of something more general we call "scoped settings". Scoped settings allow targeting down to a specific syntax token type. For example, you could conceivably set a setting to target only Ruby comments, only code inside Markdown files, or even only JavaScript function names.
## Scope names in syntax tokens
Each token in the editor has a collection of scope names. For example, the aformentioned JavaScript function name might have the scope names `function` and `name`. An open paren might have the scope names `punctuation`, `parameters`, `begin`.
Scope names work just like CSS classes. In fact, in the editor, scope names are attached to a token's DOM node as CSS classes.
Take this piece of JavaScript:
```js
function functionName() {
console.log('Log it out');
}
```
In the dev tools, the first line's markup looks like this.
![screen shot 2014-10-14 at 11 21 35 am](https://cloud.githubusercontent.com/assets/69169/4634321/2b1b923c-53cf-11e4-9268-6e57bcb14ec8.png)
All the class names on the spans are scope names. Any scope name can be used to target a setting's value.
## Scope Selectors
Scope selectors allow you to target specific tokens just like a CSS selector targets specific nodes in the DOM. Some examples:
```coffee
'.source.js' # selects all javascript tokens
'.source.js .function.name' # selects all javascript function names
'.function.name' # selects all function names in any language
```
[Config::set][config-set] accepts a `scopeSelector`. If you'd like to set a setting for JavaScript function names, you can give it the js function name `scopeSelector`:
```coffee
atom.config.set('.source.js .function.name', 'my-package.my-setting', 'special value')
```
## Scope Descriptors
A scope descriptor is an [Object][scope-descriptor] that wraps an `Array` of
`String`s. The Array describes a path from the root of the syntax tree to a
token including _all_ scope names for the entire path.
In our JavaScript example above, a scope descriptor for the function name token would be:
```coffee
['source.js', 'meta.function.js', 'entity.name.function.js']
```
[Config::get][config-get] accepts a `scopeDescriptor`. You can get the value for your setting scoped to JavaScript function names via:
```coffee
scopeDescriptor = ['source.js', 'meta.function.js', 'entity.name.function.js']
value = atom.config.get(scopeDescriptor, 'my-package.my-setting')
```
But, you do not need to generate scope descriptors by hand. There are a couple methods available to get the scope descriptor from the editor:
* [Editor::getRootScopeDescriptor][editor-getRootScopeDescriptor] to get the language's descriptor. eg. `[".source.js"]`
* [Editor::scopeDescriptorForBufferPosition][editor-scopeDescriptorForBufferPosition] to get the descriptor at a specific position in the buffer.
* [Cursor::getScopeDescriptor][cursor-getScopeDescriptor] to get a cursor's descriptor based on position. eg. if the cursor were in the name of the method in our example it would return `["source.js", "meta.function.js", "entity.name.function.js"]`
Let's revisit our example using these methods:
```coffee
editor = atom.workspace.getActiveTextEditor()
cursor = editor.getLastCursor()
valueAtCursor = atom.config.get(cursor.getScopeDescriptor(), 'my-package.my-setting')
valueForLanguage = atom.config.get(editor.getRootScopeDescriptor(), 'my-package.my-setting')
```
[config]:https://atom.io/docs/api/latest/Config
[config-get]:https://atom.io/docs/api/latest/Config#instance-get
[config-set]:https://atom.io/docs/api/latest/Config#instance-set
[config-observe]:https://atom.io/docs/api/latest/Config#instance-observe
[editor-getRootScopeDescriptor]:https://atom.io/docs/api/latest/TextEditor#instance-getRootScopeDescriptor
[editor-scopeDescriptorForBufferPosition]:https://atom.io/docs/api/latest/TextEditor#instance-scopeDescriptorForBufferPosition
[cursor-getScopeDescriptor]:https://atom.io/docs/api/latest/Cursor#instance-getScopeDescriptor
[scope-descriptor]:https://atom.io/docs/api/latest/ScopeDescriptor
+28 -6
Ver Arquivo
@@ -19,14 +19,14 @@ Ubuntu LTS 12.04 64-bit is the recommended platform.
* `sudo apt-get install build-essential git libgnome-keyring-dev fakeroot`
* Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#ubuntu-mint-elementary-os).
### Fedora
### Fedora / CentOS / RHEL
* `sudo yum --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel`
* `sudo yum --assumeyes install make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel rpmdevtools`
* Instructions for [Node.js](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#fedora).
### Arch
* `sudo pacman -S base-devel git nodejs libgnome-keyring`
* `sudo pacman -S base-devel git nodejs libgnome-keyring python2`
* `export PYTHON=/usr/bin/python2` before building Atom.
## Instructions
@@ -61,13 +61,19 @@ If you have problems with permissions don't forget to prefix with `sudo`
sudo script/grunt install
```
5. *Optionally*, you may generate a `.deb` package at `$TMPDIR/atom-build`:
To use the newly installed Atom, quit and restart all running Atom instances.
5. *Optionally*, you may generate distributable packages of Atom at `$TMPDIR/atom-build`. Currenty, `.deb` and `.rpm` package types are supported. To create a `.deb` package run:
```sh
script/grunt mkdeb
```
Use the newly installed Atom by fully quitting Atom and then reopening.
To create an `.rpm` package run
```sh
script/grunt mkrpm
```
## Advanced Options
@@ -85,7 +91,7 @@ script/build --build-dir /build/atom/here
## Troubleshooting
### Exception: "TypeError: Unable to watch path"
### TypeError: Unable to watch path
If you get following error with a big traceback right after Atom starts:
@@ -115,6 +121,22 @@ have Node.js installed, or node isn't identified as Node.js on your machine.
If it's the latter, entering `sudo ln -s /usr/bin/nodejs /usr/bin/node` into
your terminal may fix the issue.
### AttributeError: 'module' object has no attribute 'script_main'
If you get following error with a big traceback while building Atom:
```
sys.exit(gyp.script_main()) AttributeError: 'module' object has no attribute 'script_main' gyp ERR!
```
you need to uninstall the system version of gyp.
On Fedora you would do the following:
```sh
sudo yum remove gyp
```
#### You can also use Alternatives
On some variants (mostly Debian based distros) it's preferable for you to use
+3 -3
Ver Arquivo
@@ -36,7 +36,7 @@
## Why do I have to use GitHub for Windows?
You don't. You can use your existing Git! GitHub for Windows's Git Shell is just
easier to set up.
easier to set up.
If you _prefer_ using your existing Git installation, make sure git's cmd directory is in your PATH env variable (e.g. `C:\Program Files (x86)\Git\cmd`) before you open your powershell or command window.
Note that you may have to open your command window as administrator. For powershell that doesn't seem to always be the case, though.
@@ -67,11 +67,11 @@ If none of this works, do install Github for Windows and use its Git shell. Make
* https://code.google.com/p/gyp/issues/detail?id=393
* `script/build` stops at installing runas with 'Failed at the runas@0.5.4 install script.'
See the next item.
* `error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.`
* If you're building atom with Visual Studio 2013 try executing the following
command in your Git shell and then re-run `script/build`:
+16 -14
Ver Arquivo
@@ -9,22 +9,27 @@ in the proper package's repository.
### Cloning
The first step is creating your own clone. You can of course do this manually
with git, or you can use the `apm develop` command to create a clone based on
the package's `repository` field in the `package.json`.
The first step is creating your own clone.
For example, if you want to make changes to the `tree-view` package, run the
following command:
For example, if you want to make changes to the `tree-view` package, fork the repo on your github account, then clone it:
```
> apm develop tree-view
Cloning https://github.com/atom/tree-view ✓
> git clone git@github.com:your-username/tree-view.git
```
Next install all the dependencies:
```
> cd tree-view
> apm install
Installing modules ✓
~/.atom/dev/packages/tree-view -> ~/github/tree-view
```
This clones the `tree-view` repository to `~/github`. If you prefer a different
path, specify it via the `ATOM_REPOS_HOME` environment variable.
Now you can link it to development mode so when you run an Atom window with `atom --dev`, you will use your fork instead of the built in package:
```
> apm link -d
```
### Running in Development Mode
@@ -46,7 +51,4 @@ from the package directory to create and remove dev-mode symlinks.
### Installing Dependencies
Finally, you need to install the cloned package's dependencies by running
`apm install` within the package directory. This step is also performed
automatically the first time you run `apm develop`, but you'll want to keep
dependencies up to date by running `apm update` after pulling upstream changes.
You'll want to keep dependencies up to date by running `apm update` after pulling any upstream changes.
+2
Ver Arquivo
@@ -9,6 +9,7 @@
* [Converting a TextMate Bundle](converting-a-text-mate-bundle.md)
* [Converting a TextMate Theme](converting-a-text-mate-theme.md)
* [Contributing](contributing.md)
* [Contributing to Core Packages](contributing-to-packages.md)
* [Debugging](debugging.md)
### Advanced Topics
@@ -18,3 +19,4 @@
* [Keymaps](advanced/keymaps.md)
* [Serialization](advanced/serialization.md)
* [View System](advanced/view-system.md)
* [Scopes and Scope Descriptors](advanced/scopes-and-scope-descriptors.md)
+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()}"
+5 -1
Ver Arquivo
@@ -12,10 +12,14 @@
# 'atom-text-editor':
# 'enter': 'editor:newline'
#
# '.workspace':
# 'atom-workspace':
# 'ctrl-shift-p': 'core:move-up'
# 'ctrl-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * https://atom.io/docs/latest/customizing-atom#customizing-key-bindings
# * https://atom.io/docs/latest/advanced/keymaps
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
+3
Ver Arquivo
@@ -13,3 +13,6 @@
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
+3
Ver Arquivo
@@ -15,6 +15,9 @@
'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'
+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'
+2
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
+4
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
+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' }
]
}
+6
Ver Arquivo
@@ -147,6 +147,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' }
]
}
+7 -1
Ver Arquivo
@@ -109,7 +109,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' }
]
}
{
@@ -165,6 +165,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' }
]
}
+52 -52
Ver Arquivo
@@ -1,7 +1,7 @@
{
"name": "atom",
"productName": "Atom",
"version": "0.137.0",
"version": "0.146.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.0",
"atomShellVersion": "0.19.1",
"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",
@@ -37,110 +37,110 @@
"guid": "0.0.10",
"jasmine-json": "~0.0",
"jasmine-tagged": "^1.1.2",
"less-cache": "0.15.0",
"less-cache": "0.17.0",
"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",
"react-atom-fork": "^0.11.1",
"reactionary-atom-fork": "^1.0.0",
"runas": "1.0.1",
"scandal": "1.0.2",
"scoped-property-store": "^0.13.2",
"scandal": "1.0.3",
"scoped-property-store": "^0.15.0",
"scrollbar-style": "^1.0.2",
"season": "^1.0.2",
"semver": "1.1.4",
"semver": "2.2.1",
"serializable": "^1",
"space-pen": "3.8.0",
"space-pen": "3.8.1",
"temp": "0.7.0",
"text-buffer": "^3.2.8",
"text-buffer": "^3.6.0",
"theorist": "^1.0.2",
"underscore-plus": "^1.5.1",
"underscore-plus": "^1.6.1",
"vm-compatibility-layer": "0.1.0"
},
"packageDependencies": {
"atom-dark-syntax": "0.19.0",
"atom-dark-syntax": "0.21.0",
"atom-dark-ui": "0.35.0",
"atom-light-syntax": "0.20.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",
"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",
"bracket-matcher": "0.61.0",
"bookmarks": "0.30.0",
"bracket-matcher": "0.62.0",
"command-palette": "0.27.0",
"deprecation-cop": "0.10.0",
"dev-live-reload": "0.34.0",
"deprecation-cop": "0.11.0",
"dev-live-reload": "0.35.0",
"encoding-selector": "0.7.0",
"exception-reporting": "0.20.0",
"feedback": "0.33.0",
"find-and-replace": "0.140.0",
"fuzzy-finder": "0.58.0",
"git-diff": "0.39.0",
"go-to-line": "0.25.0",
"grammar-selector": "0.34.0",
"image-view": "0.37.0",
"incompatible-packages": "0.9.0",
"find-and-replace": "0.146.0",
"fuzzy-finder": "0.60.0",
"git-diff": "0.43.0",
"go-to-line": "0.26.0",
"grammar-selector": "0.37.0",
"image-view": "0.40.0",
"incompatible-packages": "0.10.0",
"keybinding-resolver": "0.20.0",
"link": "0.25.0",
"markdown-preview": "0.104.0",
"metrics": "0.36.0",
"link": "0.26.0",
"markdown-preview": "0.110.0",
"metrics": "0.38.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.151.0",
"snippets": "0.55.0",
"spell-check": "0.42.0",
"settings-view": "0.159.0",
"snippets": "0.56.0",
"spell-check": "0.43.0",
"status-bar": "0.46.0",
"styleguide": "0.30.0",
"symbols-view": "0.66.0",
"tabs": "0.54.0",
"timecop": "0.22.0",
"tree-view": "0.130.0",
"symbols-view": "0.68.0",
"tabs": "0.55.0",
"timecop": "0.23.0",
"tree-view": "0.132.0",
"update-package-dependencies": "0.6.0",
"welcome": "0.19.0",
"whitespace": "0.25.0",
"whitespace": "0.26.0",
"wrap-guide": "0.23.0",
"language-c": "0.28.0",
"language-coffee-script": "0.35.0",
"language-css": "0.21.0",
"language-gfm": "0.51.0",
"language-c": "0.30.0",
"language-coffee-script": "0.37.0",
"language-css": "0.23.0",
"language-gfm": "0.53.0",
"language-git": "0.9.0",
"language-go": "0.18.0",
"language-go": "0.19.0",
"language-html": "0.26.0",
"language-hyperlink": "0.12.0",
"language-java": "0.11.0",
"language-javascript": "0.40.0",
"language-javascript": "0.43.0",
"language-json": "0.8.0",
"language-less": "0.15.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.16.0",
"language-php": "0.18.0",
"language-property-list": "0.7.0",
"language-python": "0.20.0",
"language-ruby": "0.39.0",
"language-python": "0.23.0",
"language-ruby": "0.41.0",
"language-ruby-on-rails": "0.18.0",
"language-sass": "0.22.0",
"language-shellscript": "0.8.0",
"language-sass": "0.25.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.12.0",
"language-toml": "0.14.0",
"language-xml": "0.24.0",
"language-yaml": "0.18.0"
"language-yaml": "0.19.0"
},
"private": true,
"scripts": {
+1
Ver Arquivo
@@ -1,6 +1,7 @@
[Desktop Entry]
Name=Atom
Comment=<%= description %>
GenericName=Text Editor
Exec=<%= installDir %>/share/atom/atom %U
Icon=<%= iconName %>
Type=Application
+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 %>
+26
Ver Arquivo
@@ -0,0 +1,26 @@
Name: <%= name %>
Version: <%= version %>
Release: 0.1%{?dist}
Summary: Atom is a hackable text editor for the 21st century
License: MIT
URL: https://atom.io/
AutoReqProv: no # Avoid libchromiumcontent.so missing dependency
%description
<%= description %>
%install
mkdir -p %{buildroot}/usr/local/share/atom
cp -r /tmp/atom-build/Atom/* %{buildroot}/usr/local/share/atom
mkdir -p %{buildroot}/usr/local/bin/
ln -sf /usr/local/share/atom/resources/app/apm/node_modules/.bin/apm %{buildroot}/usr/local/bin/apm
cp atom.sh %{buildroot}/usr/local/bin/atom
chmod 755 atom.sh
mkdir -p %{buildroot}/usr/local/share/applications/
mv atom.desktop %{buildroot}/usr/local/share/applications/
%files
/usr/local/bin/atom
/usr/local/bin/apm
/usr/local/share/atom/
/usr/local/share/applications/atom.desktop
Arquivo executável
+10
Ver Arquivo
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
docker build -t atom-rpm .
docker run \
--env JANKY_SHA1="$JANKY_SHA1" \
--env JANKY_BRANCH="$JANKY_BRANCH" \
--env ATOM_ACCESS_TOKEN="$BUILD_ATOM_RPM_ACCESS_TOKEN" \
atom-rpm /atom/script/rpmbuild
+1 -1
Ver Arquivo
@@ -15,4 +15,4 @@ if [%2] == [] (
if exist %2 rmdir %2 /s /q
:: cp -rf %1 %2
xcopy %1 %2 /e /h /c /i /y /r
(robocopy %1 %2 /e) ^& IF %ERRORLEVEL% LEQ 1 exit 0
Arquivo executável
+22
Ver Arquivo
@@ -0,0 +1,22 @@
#!/bin/bash
set -e
SPEC_FILE="$1"
DESKTOP_FILE="$2"
BUILD_DIRECTORY="$3"
RPM_BUILD_ROOT=~/rpmbuild
ARCH=`uname -m`
rpmdev-setuptree
cp -r $BUILD_DIRECTORY/Atom/* $RPM_BUILD_ROOT/BUILD
cp $SPEC_FILE $RPM_BUILD_ROOT/SPECS
cp ./atom.sh $RPM_BUILD_ROOT/BUILD
cp $DESKTOP_FILE $RPM_BUILD_ROOT/BUILD
rpmbuild -ba $SPEC_FILE
cp $RPM_BUILD_ROOT/RPMS/$ARCH/atom-*.rpm $BUILD_DIRECTORY/rpm
rm -rf $RPM_BUILD_ROOT
Arquivo executável
+6
Ver Arquivo
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
script/build
script/grunt mkrpm publish-build --stack
+1 -1
Ver Arquivo
@@ -6,7 +6,7 @@ ThemeManager = require '../src/theme-manager'
describe "the `atom` global", ->
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
describe 'window sizing methods', ->
describe '::getPosition and ::setPosition', ->
+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'}
]
+110
Ver Arquivo
@@ -88,6 +88,19 @@ describe "Config", ->
expect(atom.config.getDefault('foo.bar')).toEqual initialDefaultValue
expect(atom.config.getDefault('foo.bar')).not.toBe initialDefaultValue
describe "when scoped settings are used", ->
it "returns the global default when no scoped default set", ->
atom.config.setDefaults("foo", bar: baz: 10)
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 10
it "returns the scoped default when a scoped default is set", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 42
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
expect(atom.config.getDefault('.source.coffee', 'foo.bar.baz')).toBe 42
describe ".isDefault(keyPath)", ->
it "returns true when the value of the key path is its default value", ->
atom.config.setDefaults("foo", same: 1, changes: 1)
@@ -99,6 +112,21 @@ describe "Config", ->
expect(atom.config.isDefault('foo.same')).toBe false
expect(atom.config.isDefault('foo.changes')).toBe false
describe "when scoped settings are used", ->
it "returns false when a scoped setting was set by the user", ->
expect(atom.config.isDefault('.source.coffee', 'foo.bar.baz')).toBe true
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
expect(atom.config.isDefault('.source.coffee', 'foo.bar.baz')).toBe true
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
expect(atom.config.isDefault('.source.coffee', 'foo.bar.baz')).toBe false
describe ".setDefaults(keyPath)", ->
it "sets a default when the setting's key contains an escaped dot", ->
atom.config.setDefaults("foo", 'a\\.b': 1, b: 2)
expect(atom.config.get("foo")).toEqual 'a\\.b': 1, b: 2
describe ".toggle(keyPath)", ->
it "negates the boolean value of the current key path value", ->
atom.config.set('foo.a', 1)
@@ -130,6 +158,66 @@ describe "Config", ->
atom.config.restoreDefault('a.c')
expect(atom.config.get('a.c')).toBeUndefined()
it "calls ::save()", ->
atom.config.setDefaults('a', b: 3)
atom.config.set('a.b', 4)
atom.config.save.reset()
atom.config.restoreDefault('a.c')
expect(atom.config.save.callCount).toBe 1
describe "when scoped settings are used", ->
it "restores the global default when no scoped default set", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 10
it "restores the scoped default when a scoped default is set", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.set('.source.coffee', 'foo.bar.ok', 100)
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 55
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.get(['.source.coffee'], 'foo.bar.baz')).toBe 42
expect(atom.config.get(['.source.coffee'], 'foo.bar.ok')).toBe 100
it "calls ::save()", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
atom.config.set('.source.coffee', 'foo.bar.baz', 55)
atom.config.save.reset()
atom.config.restoreDefault('.source.coffee', 'foo.bar.baz')
expect(atom.config.save.callCount).toBe 1
describe ".getSettings()", ->
it "returns all settings including defaults", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set("foo.ok", 12)
expect(atom.config.getSettings().foo).toEqual
ok: 12
bar:
baz: 10
describe "when scoped settings are used", ->
it "returns all the scoped settings including all the defaults", ->
atom.config.setDefaults("foo", bar: baz: 10)
atom.config.set("foo.ok", 12)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: baz: 42)
atom.config.addScopedSettings("default", ".source.coffee", foo: bar: omg: 'omg')
expect(atom.config.getSettings(".source.coffee").foo).toEqual
ok: 12
bar:
baz: 42
omg: 'omg'
describe ".pushAtKeyPath(keyPath, value)", ->
it "pushes the given value to the array at the key path and updates observers", ->
atom.config.set("foo.bar.baz", ["a"])
@@ -948,6 +1036,21 @@ describe "Config", ->
expect(atom.config.set('foo.bar.arr', ['two', 'three'])).toBe true
expect(atom.config.get('foo.bar.arr')).toEqual ['two', 'three']
describe "when scoped settings are used", ->
beforeEach ->
schema =
type: 'string'
default: 'ok'
scopes:
'.source.js':
default: 'omg'
atom.config.setSchema('foo.bar.str', schema)
it 'it respects the scoped defaults', ->
expect(atom.config.get('foo.bar.str')).toBe 'ok'
expect(atom.config.get(['.source.js'], 'foo.bar.str')).toBe 'omg'
expect(atom.config.get(['.source.coffee'], 'foo.bar.str')).toBe 'ok'
describe "scoped settings", ->
describe ".get(scopeDescriptor, keyPath)", ->
it "returns the property with the most specific scope selector", ->
@@ -972,6 +1075,13 @@ describe "Config", ->
atom.config.setDefaults("foo", hasDefault: 'ok')
expect(atom.config.get([".source.coffee", ".string.quoted.single"], "foo.hasDefault")).toBe 'ok'
describe 'setting priority', ->
describe 'when package settings are added after user settings', ->
it "returns the user's setting because the user's setting has higher priority", ->
atom.config.set(".source.coffee", "foo.bar.baz", 100)
atom.config.addScopedSettings("some-package", ".source.coffee", foo: bar: baz: 1)
expect(atom.config.get([".source.coffee"], "foo.bar.baz")).toBe 100
describe ".set(scope, keyPath, value)", ->
it "sets the value and overrides the others", ->
atom.config.addScopedSettings("config", ".source.coffee .string.quoted.double.coffee", foo: bar: baz: 42)
+5
Ver Arquivo
@@ -56,6 +56,11 @@ describe "DisplayBuffer", ->
buffer.delete([[8, 0], [10, 0]])
expect(displayBuffer.getScrollTop()).toBe 60
it "updates the display buffer prior to invoking change handlers registered on the buffer", ->
buffer.onDidChange -> expect(displayBuffer2.tokenizedLineForScreenRow(0).text).toBe "testing"
displayBuffer2 = new DisplayBuffer({buffer, tabLength})
buffer.setText("testing")
describe "soft wrapping", ->
beforeEach ->
displayBuffer.setSoftWrapped(true)
+3
Ver Arquivo
@@ -0,0 +1,3 @@
{
"foo": "bar"
}
@@ -0,0 +1 @@
a { color: red }
@@ -0,0 +1,4 @@
{
"theme": "syntax",
"stylesheets": ["editor.less"]
}
+92
Ver Arquivo
@@ -0,0 +1,92 @@
path = require 'path'
Module = require 'module'
fs = require 'fs-plus'
temp = require 'temp'
ModuleCache = require '../src/module-cache'
describe 'ModuleCache', ->
beforeEach ->
spyOn(Module, '_findPath').andCallThrough()
it 'resolves atom shell module paths without hitting the filesystem', ->
builtins = ModuleCache.cache.builtins
expect(Object.keys(builtins).length).toBeGreaterThan 0
for builtinName, builtinPath of builtins
expect(require.resolve(builtinName)).toBe builtinPath
expect(fs.isFileSync(require.resolve(builtinName)))
expect(Module._findPath.callCount).toBe 0
it 'resolves relative core paths without hitting the filesystem', ->
ModuleCache.add atom.getLoadSettings().resourcePath, {
_atomModuleCache:
extensions:
'.json': [
path.join('spec', 'fixtures', 'module-cache', 'file.json')
]
}
expect(require('./fixtures/module-cache/file.json').foo).toBe 'bar'
expect(Module._findPath.callCount).toBe 0
it 'resolves module paths when a compatible version is provided by core', ->
packagePath = fs.realpathSync(temp.mkdirSync('atom-package'))
ModuleCache.add packagePath, {
_atomModuleCache:
folders: [{
paths: [
''
]
dependencies:
'underscore-plus': '*'
}]
}
ModuleCache.add atom.getLoadSettings().resourcePath, {
_atomModuleCache:
dependencies: [{
name: 'underscore-plus'
version: require('underscore-plus/package.json').version
path: path.join('node_modules', 'underscore-plus', 'lib', 'underscore-plus.js')
}]
}
indexPath = path.join(packagePath, 'index.js')
fs.writeFileSync indexPath, """
exports.load = function() { require('underscore-plus'); };
"""
packageMain = require(indexPath)
Module._findPath.reset()
packageMain.load()
expect(Module._findPath.callCount).toBe 0
it 'does not resolve module paths when no compatible version is provided by core', ->
packagePath = fs.realpathSync(temp.mkdirSync('atom-package'))
ModuleCache.add packagePath, {
_atomModuleCache:
folders: [{
paths: [
''
]
dependencies:
'underscore-plus': '0.0.1'
}]
}
ModuleCache.add atom.getLoadSettings().resourcePath, {
_atomModuleCache:
dependencies: [{
name: 'underscore-plus'
version: require('underscore-plus/package.json').version
path: path.join('node_modules', 'underscore-plus', 'lib', 'underscore-plus.js')
}]
}
indexPath = path.join(packagePath, 'index.js')
fs.writeFileSync indexPath, """
exports.load = function() { require('underscore-plus'); };
"""
packageMain = require(indexPath)
Module._findPath.reset()
expect(-> packageMain.load()).toThrow()
expect(Module._findPath.callCount).toBe 1
+83 -38
Ver Arquivo
@@ -3,7 +3,7 @@ Package = require '../src/package'
describe "PackageManager", ->
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
describe "::loadPackage(name)", ->
it "continues if the package has an invalid package.json", ->
@@ -48,9 +48,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')
@@ -182,8 +183,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 +205,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 +220,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 +239,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 +256,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 +281,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", ->
+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)')
+118
Ver Arquivo
@@ -0,0 +1,118 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelElement = require '../src/panel-element'
PanelContainer = require '../src/panel-container'
PanelContainerElement = require '../src/panel-container-element'
describe "PanelContainerElement", ->
[jasmineContent, element, container, viewRegistry] = []
class TestPanelContainerItem
constructior: ->
class TestPanelContainerItemElement extends HTMLElement
createdCallback: ->
@classList.add('test-root')
setModel: (@model) ->
TestPanelContainerItemElement = document.registerElement 'atom-test-container-item-element', prototype: TestPanelContainerItemElement.prototype
beforeEach ->
jasmineContent = document.body.querySelector('#jasmine-content')
viewRegistry = new ViewRegistry
viewRegistry.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
viewRegistry.addViewProvider
modelConstructor: PanelContainer
viewConstructor: PanelContainerElement
viewRegistry.addViewProvider
modelConstructor: TestPanelContainerItem
viewConstructor: TestPanelContainerItemElement
container = new PanelContainer({viewRegistry, location: 'left'})
element = container.getView()
jasmineContent.appendChild(element)
it 'has a location attribute with value from the model', ->
expect(element.getAttribute('location')).toBe 'left'
it 'removes the element when the container is destroyed', ->
expect(element.parentNode).toBe jasmineContent
container.destroy()
expect(element.parentNode).not.toBe jasmineContent
describe "adding and removing panels", ->
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()})
container.addPanel(panel1)
expect(element.childNodes.length).toBe 1
expect(element.childNodes[0].getAttribute('location')).toBe '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].getAttribute('location')).toBe '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(panel1.getView().style.display).not.toBe 'none'
panel2 = new Panel({viewRegistry, item: new TestPanelContainerItem()})
container.addPanel(panel2)
expect(panel1.getView().style.display).toBe 'none'
expect(panel2.getView().style.display).not.toBe 'none'
panel1.show()
expect(panel1.getView().style.display).not.toBe 'none'
expect(panel2.getView().style.display).toBe 'none'
+98
Ver Arquivo
@@ -0,0 +1,98 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelContainer = require '../src/panel-container'
describe "PanelContainer", ->
[container, viewRegistry] = []
class TestPanelItem
constructior: ->
beforeEach ->
viewRegistry = new ViewRegistry
container = new PanelContainer({viewRegistry})
describe "::addPanel(panel)", ->
it 'emits an onDidAddPanel event with the index the panel was inserted at', ->
container.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel1 = new Panel(item: new TestPanelItem())
container.addPanel(panel1)
expect(addPanelSpy).toHaveBeenCalledWith({panel: panel1, index: 0})
panel2 = new Panel(item: new TestPanelItem())
container.addPanel(panel2)
expect(addPanelSpy).toHaveBeenCalledWith({panel: panel2, index: 1})
describe "when a panel is destroyed", ->
it 'emits an onDidRemovePanel event with the index of the removed item', ->
container.onDidRemovePanel removePanelSpy = jasmine.createSpy()
panel1 = new Panel(item: new TestPanelItem())
container.addPanel(panel1)
panel2 = new Panel(item: new TestPanelItem())
container.addPanel(panel2)
expect(removePanelSpy).not.toHaveBeenCalled()
panel2.destroy()
expect(removePanelSpy).toHaveBeenCalledWith({panel: panel2, index: 1})
panel1.destroy()
expect(removePanelSpy).toHaveBeenCalledWith({panel: panel1, index: 0})
describe "panel priority", ->
describe 'left / top panel container', ->
[initialPanel] = []
beforeEach ->
# 'left' logic is the same as 'top'
container = new PanelContainer({viewRegistry, location: 'left'})
initialPanel = new Panel(item: new TestPanelItem())
container.addPanel(initialPanel)
describe 'when a panel with low priority is added', ->
it 'is inserted at the beginning of the list', ->
container.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = new Panel(item: new TestPanelItem(), priority: 0)
container.addPanel(panel)
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
expect(container.getPanels()[0]).toBe panel
describe 'when a panel with priority between two other panels is added', ->
it 'is inserted at the between the two panels', ->
panel = new Panel(item: new TestPanelItem(), priority: 1000)
container.addPanel(panel)
container.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = new Panel(item: new TestPanelItem(), priority: 101)
container.addPanel(panel)
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 1})
expect(container.getPanels()[1]).toBe panel
describe 'right / bottom panel container', ->
[initialPanel] = []
beforeEach ->
# 'bottom' logic is the same as 'right'
container = new PanelContainer({viewRegistry, location: 'right'})
initialPanel = new Panel(item: new TestPanelItem())
container.addPanel(initialPanel)
describe 'when a panel with high priority is added', ->
it 'is inserted at the beginning of the list', ->
container.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = new Panel(item: new TestPanelItem(), priority: 1000)
container.addPanel(panel)
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
expect(container.getPanels()[0]).toBe panel
describe 'when a panel with low priority is added', ->
it 'is inserted at the end of the list', ->
container.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = new Panel(item: new TestPanelItem(), priority: 0)
container.addPanel(panel)
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 1})
expect(container.getPanels()[1]).toBe panel
+65
Ver Arquivo
@@ -0,0 +1,65 @@
ViewRegistry = require '../src/view-registry'
Panel = require '../src/panel'
PanelElement = require '../src/panel-element'
describe "PanelElement", ->
[jasmineContent, element, panel, viewRegistry] = []
class TestPanelItem
constructior: ->
class TestPanelItemElement extends HTMLElement
createdCallback: ->
@classList.add('test-root')
setModel: (@model) ->
TestPanelItemElement = document.registerElement 'atom-test-item-element', prototype: TestPanelItemElement.prototype
beforeEach ->
jasmineContent = document.body.querySelector('#jasmine-content')
viewRegistry = new ViewRegistry
viewRegistry.addViewProvider
modelConstructor: Panel
viewConstructor: PanelElement
viewRegistry.addViewProvider
modelConstructor: TestPanelItem
viewConstructor: TestPanelItemElement
it 'removes the element when the panel is destroyed', ->
panel = new Panel({viewRegistry, item: new TestPanelItem})
element = panel.getView()
jasmineContent.appendChild(element)
expect(element.parentNode).toBe jasmineContent
panel.destroy()
expect(element.parentNode).not.toBe jasmineContent
describe "changing panel visibility", ->
it 'initially renders panel created with visibile: false', ->
panel = new Panel({viewRegistry, visible: false, item: new TestPanelItem})
element = panel.getView()
jasmineContent.appendChild(element)
expect(element.style.display).toBe 'none'
it 'hides and shows the panel element when Panel::hide() and Panel::show() are called', ->
panel = new Panel({viewRegistry, item: new TestPanelItem})
element = panel.getView()
jasmineContent.appendChild(element)
expect(element.style.display).not.toBe 'none'
panel.hide()
expect(element.style.display).toBe 'none'
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'
+23
Ver Arquivo
@@ -0,0 +1,23 @@
Panel = require '../src/panel'
describe "Panel", ->
[panel] = []
class TestPanelItem
constructior: ->
beforeEach ->
panel = new Panel(item: new TestPanelItem())
describe "changing panel visibility", ->
it 'emits an event when visibility changes', ->
panel.onDidChangeVisible spy = jasmine.createSpy()
panel.hide()
expect(panel.isVisible()).toBe false
expect(spy).toHaveBeenCalledWith(false)
spy.reset()
panel.show()
expect(panel.isVisible()).toBe true
expect(spy).toHaveBeenCalledWith(true)
+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()
+8 -10
Ver Arquivo
@@ -29,6 +29,7 @@ atom.packages.packageDirPaths.unshift(fixturePackagesPath)
atom.keymaps.loadBundledKeymaps()
keyBindingsToRestore = atom.keymaps.getKeyBindings()
commandsToRestore = atom.commands.getSnapshot()
styleElementsToRestore = atom.styles.getSnapshot()
window.addEventListener 'core:close', -> window.close()
window.addEventListener 'beforeunload', ->
@@ -44,8 +45,7 @@ Object.defineProperty document, 'title',
jasmine.getEnv().addEqualityTester(_.isEqual) # Use underscore's definition of equality for toEqual assertions
if process.platform is 'win32' and process.env.JANKY_SHA1
# Use longer timeout on Windows CI
if process.env.JANKY_SHA1 and process.platform is 'win32'
jasmine.getEnv().defaultTimeoutInterval = 60000
else
jasmine.getEnv().defaultTimeoutInterval = 5000
@@ -74,6 +74,7 @@ beforeEach ->
atom.workspace = new Workspace()
atom.keymaps.keyBindings = _.clone(keyBindingsToRestore)
atom.commands.restoreSnapshot(commandsToRestore)
atom.styles.restoreSnapshot(styleElementsToRestore)
window.resetTimeouts()
atom.packages.packageStates = {}
@@ -105,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()
@@ -218,13 +220,13 @@ 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 ""
element = @actual
element = element.get(0) if element.jquery
@message = -> return "Expected element '#{element}' or its descendants #{notText} to show."
@message = -> return "Expected element '#{element}' or its descendants#{notText} to show."
element.style.display in ['block', 'inline-block', 'static', 'fixed']
window.keyIdentifierForKey = (key) ->
@@ -337,12 +339,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)
+66
Ver Arquivo
@@ -0,0 +1,66 @@
StyleManager = require '../src/style-manager'
describe "StyleManager", ->
[manager, addEvents, removeEvents, updateEvents] = []
beforeEach ->
manager = new StyleManager
addEvents = []
removeEvents = []
updateEvents = []
manager.onDidAddStyleElement (event) -> addEvents.push(event)
manager.onDidRemoveStyleElement (event) -> removeEvents.push(event)
manager.onDidUpdateStyleElement (event) -> updateEvents.push(event)
describe "::addStyleSheet(source, params)", ->
it "adds a stylesheet based on the given source and returns a disposable allowing it to be removed", ->
disposable = manager.addStyleSheet("a {color: red;}")
expect(addEvents.length).toBe 1
expect(addEvents[0].textContent).toBe "a {color: red;}"
styleElements = manager.getStyleElements()
expect(styleElements.length).toBe 1
expect(styleElements[0].textContent).toBe "a {color: red;}"
disposable.dispose()
expect(removeEvents.length).toBe 1
expect(removeEvents[0].textContent).toBe "a {color: red;}"
expect(manager.getStyleElements().length).toBe 0
describe "when a sourcePath parameter is specified", ->
it "ensures a maximum of one style element for the given source path, updating a previous if it exists", ->
disposable1 = manager.addStyleSheet("a {color: red;}", sourcePath: '/foo/bar')
expect(addEvents.length).toBe 1
expect(addEvents[0].getAttribute('source-path')).toBe '/foo/bar'
disposable2 = manager.addStyleSheet("a {color: blue;}", sourcePath: '/foo/bar')
expect(addEvents.length).toBe 1
expect(updateEvents.length).toBe 1
expect(updateEvents[0].getAttribute('source-path')).toBe '/foo/bar'
expect(updateEvents[0].textContent).toBe "a {color: blue;}"
disposable2.dispose()
addEvents = []
manager.addStyleSheet("a {color: yellow;}", sourcePath: '/foo/bar')
expect(addEvents.length).toBe 1
expect(addEvents[0].getAttribute('source-path')).toBe '/foo/bar'
expect(addEvents[0].textContent).toBe "a {color: yellow;}"
describe "when a group parameter is specified", ->
it "inserts the stylesheet at the end of any existing stylesheets for the same group", ->
manager.addStyleSheet("a {color: red}", group: 'a')
manager.addStyleSheet("a {color: blue}", group: 'b')
manager.addStyleSheet("a {color: green}", group: 'a')
expect(manager.getStyleElements().map (elt) -> elt.textContent).toEqual [
"a {color: red}"
"a {color: green}"
"a {color: blue}"
]
+76
Ver Arquivo
@@ -0,0 +1,76 @@
StylesElement = require '../src/styles-element'
StyleManager = require '../src/style-manager'
describe "StylesElement", ->
[element, addedStyleElements, removedStyleElements, updatedStyleElements] = []
beforeEach ->
element = new StylesElement
document.querySelector('#jasmine-content').appendChild(element)
addedStyleElements = []
removedStyleElements = []
updatedStyleElements = []
element.onDidAddStyleElement (element) -> addedStyleElements.push(element)
element.onDidRemoveStyleElement (element) -> removedStyleElements.push(element)
element.onDidUpdateStyleElement (element) -> updatedStyleElements.push(element)
it "renders a style tag for all currently active stylesheets in the style manager", ->
initialChildCount = element.children.length
disposable1 = atom.styles.addStyleSheet("a {color: red;}")
expect(element.children.length).toBe initialChildCount + 1
expect(element.children[initialChildCount].textContent).toBe "a {color: red;}"
expect(addedStyleElements).toEqual [element.children[initialChildCount]]
disposable2 = atom.styles.addStyleSheet("a {color: blue;}")
expect(element.children.length).toBe initialChildCount + 2
expect(element.children[initialChildCount + 1].textContent).toBe "a {color: blue;}"
expect(addedStyleElements).toEqual [element.children[initialChildCount], element.children[initialChildCount + 1]]
disposable1.dispose()
expect(element.children.length).toBe initialChildCount + 1
expect(element.children[initialChildCount].textContent).toBe "a {color: blue;}"
expect(removedStyleElements).toEqual [addedStyleElements[0]]
it "orders style elements by group", ->
initialChildCount = element.children.length
atom.styles.addStyleSheet("a {color: red}", group: 'a')
atom.styles.addStyleSheet("a {color: blue}", group: 'b')
atom.styles.addStyleSheet("a {color: green}", group: 'a')
expect(element.children[initialChildCount].textContent).toBe "a {color: red}"
expect(element.children[initialChildCount + 1].textContent).toBe "a {color: green}"
expect(element.children[initialChildCount + 2].textContent).toBe "a {color: blue}"
it "updates existing style nodes when style elements are updated", ->
initialChildCount = element.children.length
atom.styles.addStyleSheet("a {color: red;}", sourcePath: '/foo/bar')
atom.styles.addStyleSheet("a {color: blue;}", sourcePath: '/foo/bar')
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;}"
+80 -6
Ver Arquivo
@@ -698,16 +698,34 @@ describe "TextEditorComponent", ->
expect(cursorRect.left).toBe rangeRect.left
expect(cursorRect.width).toBe rangeRect.width
it "accounts for the width of paired characters when positioning cursors", ->
atom.config.set('editor.fontFamily', 'sans-serif')
editor.setText('he\u0301y') # e with an accent mark
editor.setCursorBufferPosition([0, 3])
nextAnimationFrame()
cursor = componentNode.querySelector('.cursor')
cursorRect = cursor.getBoundingClientRect()
cursorLocationTextNode = component.lineNodeForScreenRow(0).querySelector('.source.js').firstChild
range = document.createRange()
range.setStart(cursorLocationTextNode, 3)
range.setEnd(cursorLocationTextNode, 4)
rangeRect = range.getBoundingClientRect()
expect(cursorRect.left).toBe rangeRect.left
expect(cursorRect.width).toBe rangeRect.width
it "positions cursors correctly after character widths are changed via a stylesheet change", ->
atom.config.set('editor.fontFamily', 'sans-serif')
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')
@@ -1113,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 ->
@@ -1230,6 +1255,22 @@ describe "TextEditorComponent", ->
beforeEach ->
linesNode = componentNode.querySelector('.lines')
describe "when the mouse is single-clicked below the last line", ->
it "moves the cursor to the end of file buffer position", ->
editor.setText('foo')
editor.setCursorBufferPosition([0, 0])
height = 4.5 * lineHeightInPixels
wrapperNode.style.height = height + 'px'
wrapperNode.style.width = 10 * charWidth + 'px'
component.measureHeightAndWidth()
nextAnimationFrame()
coordinates = clientCoordinatesForScreenPosition([0, 2])
coordinates.clientY = height * 2
linesNode.dispatchEvent(buildMouseEvent('mousedown', coordinates))
nextAnimationFrame()
expect(editor.getCursorScreenPosition()).toEqual [0, 3]
describe "when a non-folded line is single-clicked", ->
describe "when no modifier keys are held down", ->
it "moves the cursor to the nearest screen position", ->
@@ -1503,8 +1544,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
@@ -1633,12 +1675,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')
@@ -1888,6 +1931,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
@@ -2252,6 +2320,12 @@ describe "TextEditorComponent", ->
editor.setGrammar(atom.syntax.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()
+88 -12
Ver Arquivo
@@ -19,18 +19,94 @@ 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", ->
element = new TextEditorElement
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 "style transfer", ->
beforeEach ->
waitsForPromise -> atom.themes.activateThemes()
afterEach ->
atom.themes.deactivateThemes()
ffit "transfers the foreground and background colors into the shadow DOM", ->
runs ->
element = new TextEditorElement()
jasmineContent.appendChild(element)
initialBackgroundColor = getComputedStyle(element.shadowRoot.querySelector('.editor')).backgroundColor
atom.styles.addStyleSheet """
atom-text-editor { background: red; }
"""
newBackgroundColor = getComputedStyle(element.shadowRoot.querySelector('.editor')).backgroundColor
expect(newBackgroundColor).not.toBe initialBackgroundColor
describe "when the themes finish loading with the shadow DOM disabled (regressios)", ->
[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)
+94 -9
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", ->
@@ -2446,6 +2488,22 @@ describe "TextEditor", ->
expect(clipboard.readText()).toBe 'quicksort\nsort'
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([[1, 0], [1, 0]])
editor.addCursorAtBufferPosition([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.readWithMetadata().metadata.selections).toEqual([
"var quicksort = function () {\n"
" current = items.shift();\n"
])
describe ".cutToEndOfLine()", ->
describe "when soft wrap is on", ->
it "cuts up to the end of the line", ->
@@ -2490,6 +2548,18 @@ describe "TextEditor", ->
'items'
])
describe "when no text is selected", ->
beforeEach ->
editor.setSelectedBufferRanges([[1, 0], [1, 0]])
editor.addCursorAtBufferPosition([5, 0])
it "copies the lines on which there are cursors", ->
editor.copySelectedText()
expect(atom.clipboard.readWithMetadata().metadata.selections).toEqual([
"var quicksort = function () {\n"
" current = items.shift();\n"
])
describe ".pasteText()", ->
it "pastes text into the buffer", ->
atom.clipboard.write('first')
@@ -3087,6 +3157,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
@@ -3412,9 +3487,12 @@ describe "TextEditor", ->
describe "when no text is selected", ->
describe "when the line below isn't empty", ->
it "joins the line below with the current line separated by a space and moves the cursor to the start of line that was moved up", ->
editor.setCursorBufferPosition([0, Infinity])
editor.insertText(' ')
editor.setCursorBufferPosition([0])
editor.joinLines()
expect(editor.lineTextForBufferRow(0)).toBe 'var quicksort = function () { var sort = function(items) {'
expect(editor.getCursorBufferPosition()).toEqual [0, 30]
expect(editor.getCursorBufferPosition()).toEqual [0, 29]
describe "when the line below is empty", ->
it "deletes the line below and moves the cursor to the end of the line", ->
@@ -3430,6 +3508,13 @@ describe "TextEditor", ->
editor.joinLines()
expect(editor.lineTextForBufferRow(12)).toBe '};'
describe "when the line is empty", ->
it "joins the line below with the current line with no added space", ->
editor.setCursorBufferPosition([10])
editor.joinLines()
expect(editor.lineTextForBufferRow(10)).toBe 'return sort(Array.apply(this, arguments));'
expect(editor.getCursorBufferPosition()).toEqual [10, 0]
describe "when text is selected", ->
describe "when the selection does not span multiple lines", ->
it "joins the line below with the current line separated by a space and retains the selected text", ->
@@ -3650,10 +3735,10 @@ describe "TextEditor", ->
{tokens} = grammar.tokenizeLine("var i; // http://github.com")
expect(tokens[0].value).toBe "var"
expect(tokens[0].scopeDescriptor).toEqual ["source.js", "storage.modifier.js"]
expect(tokens[0].scopes).toEqual ["source.js", "storage.modifier.js"]
expect(tokens[6].value).toBe "http://github.com"
expect(tokens[6].scopeDescriptor).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"]
expect(tokens[6].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"]
describe "when the grammar is added", ->
it "retokenizes existing buffers that contain tokens that match the injection selector", ->
@@ -3665,7 +3750,7 @@ describe "TextEditor", ->
{tokens} = editor.tokenizedLineForScreenRow(0)
expect(tokens[1].value).toBe " http://github.com"
expect(tokens[1].scopeDescriptor).toEqual ["source.js", "comment.line.double-slash.js"]
expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"]
waitsForPromise ->
atom.packages.activatePackage('language-hyperlink')
@@ -3673,7 +3758,7 @@ describe "TextEditor", ->
runs ->
{tokens} = editor.tokenizedLineForScreenRow(0)
expect(tokens[2].value).toBe "http://github.com"
expect(tokens[2].scopeDescriptor).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"]
expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"]
describe "when the grammar is updated", ->
it "retokenizes existing buffers that contain tokens that match the injection selector", ->
@@ -3685,7 +3770,7 @@ describe "TextEditor", ->
{tokens} = editor.tokenizedLineForScreenRow(0)
expect(tokens[1].value).toBe " SELECT * FROM OCTOCATS"
expect(tokens[1].scopeDescriptor).toEqual ["source.js", "comment.line.double-slash.js"]
expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"]
waitsForPromise ->
atom.packages.activatePackage('package-with-injection-selector')
@@ -3693,7 +3778,7 @@ describe "TextEditor", ->
runs ->
{tokens} = editor.tokenizedLineForScreenRow(0)
expect(tokens[1].value).toBe " SELECT * FROM OCTOCATS"
expect(tokens[1].scopeDescriptor).toEqual ["source.js", "comment.line.double-slash.js"]
expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"]
waitsForPromise ->
atom.packages.activatePackage('language-sql')
@@ -3701,7 +3786,7 @@ describe "TextEditor", ->
runs ->
{tokens} = editor.tokenizedLineForScreenRow(0)
expect(tokens[2].value).toBe "SELECT"
expect(tokens[2].scopeDescriptor).toEqual ["source.js", "comment.line.double-slash.js", "keyword.other.DML.sql"]
expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "keyword.other.DML.sql"]
describe ".normalizeTabsInBufferRange()", ->
it "normalizes tabs depending on the editor's soft tab/tab length settings", ->
+16 -2
Ver Arquivo
@@ -2,18 +2,23 @@ textUtils = require '../src/text-utils'
describe 'text utilities', ->
describe '.hasPairedCharacter(string)', ->
it 'returns true when the string contains a surrogate pair or variation sequence', ->
it 'returns true when the string contains a surrogate pair, variation sequence, or combined character', ->
expect(textUtils.hasPairedCharacter('abc')).toBe false
expect(textUtils.hasPairedCharacter('a\uD835\uDF97b\uD835\uDF97c')).toBe true
expect(textUtils.hasPairedCharacter('\uD835\uDF97')).toBe true
expect(textUtils.hasPairedCharacter('\u2714\uFE0E')).toBe true
expect(textUtils.hasPairedCharacter('e\u0301')).toBe true
expect(textUtils.hasPairedCharacter('\uD835')).toBe false
expect(textUtils.hasPairedCharacter('\uDF97')).toBe false
expect(textUtils.hasPairedCharacter('\uFE0E')).toBe false
expect(textUtils.hasPairedCharacter('\u0301')).toBe false
expect(textUtils.hasPairedCharacter('\uFE0E\uFE0E')).toBe false
expect(textUtils.hasPairedCharacter('\u0301\u0301')).toBe false
describe '.isPairedCharacter(string, index)', ->
it 'returns true when the index is the start of a high/low surrogate pair or variation sequence', ->
it 'returns true when the index is the start of a high/low surrogate pair, variation sequence, or combined character', ->
expect(textUtils.isPairedCharacter('a\uD835\uDF97b\uD835\uDF97c', 0)).toBe false
expect(textUtils.isPairedCharacter('a\uD835\uDF97b\uD835\uDF97c', 1)).toBe true
expect(textUtils.isPairedCharacter('a\uD835\uDF97b\uD835\uDF97c', 2)).toBe false
@@ -21,12 +26,21 @@ describe 'text utilities', ->
expect(textUtils.isPairedCharacter('a\uD835\uDF97b\uD835\uDF97c', 4)).toBe true
expect(textUtils.isPairedCharacter('a\uD835\uDF97b\uD835\uDF97c', 5)).toBe false
expect(textUtils.isPairedCharacter('a\uD835\uDF97b\uD835\uDF97c', 6)).toBe false
expect(textUtils.isPairedCharacter('a\u2714\uFE0E', 0)).toBe false
expect(textUtils.isPairedCharacter('a\u2714\uFE0E', 1)).toBe true
expect(textUtils.isPairedCharacter('a\u2714\uFE0E', 2)).toBe false
expect(textUtils.isPairedCharacter('a\u2714\uFE0E', 3)).toBe false
expect(textUtils.isPairedCharacter('\uD835')).toBe false
expect(textUtils.isPairedCharacter('\uDF97')).toBe false
expect(textUtils.isPairedCharacter('\uFE0E')).toBe false
expect(textUtils.isPairedCharacter('\uFE0E')).toBe false
expect(textUtils.isPairedCharacter('\uFE0E\uFE0E')).toBe false
expect(textUtils.isPairedCharacter('ae\u0301c', 0)).toBe false
expect(textUtils.isPairedCharacter('ae\u0301c', 1)).toBe true
expect(textUtils.isPairedCharacter('ae\u0301c', 2)).toBe false
expect(textUtils.isPairedCharacter('ae\u0301c', 3)).toBe false
expect(textUtils.isPairedCharacter('ae\u0301c', 4)).toBe false
+30 -33
Ver Arquivo
@@ -85,25 +85,25 @@ describe "ThemeManager", ->
runs ->
reloadHandler.reset()
expect($('style.theme')).toHaveLength 0
atom.config.set('core.themes', ['atom-dark-syntax'])
atom.config.set('core.themes', ['atom-dark-ui'])
waitsFor ->
reloadHandler.callCount == 1
runs ->
reloadHandler.reset()
expect($('style.theme')).toHaveLength 1
expect($('style.theme:eq(0)').attr('id')).toMatch /atom-dark-syntax/
atom.config.set('core.themes', ['atom-light-syntax', 'atom-dark-syntax'])
expect($('style[group=theme]')).toHaveLength 2
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.theme')).toHaveLength 2
expect($('style.theme:eq(0)').attr('id')).toMatch /atom-dark-syntax/
expect($('style.theme:eq(1)').attr('id')).toMatch /atom-light-syntax/
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.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'])
@@ -119,7 +119,7 @@ describe "ThemeManager", ->
reloadHandler.callCount == 1
runs ->
expect($('style.theme')).toHaveLength 2
expect($('style[group=theme]')).toHaveLength 2
importPaths = themeManager.getImportPaths()
expect(importPaths.length).toBe 1
expect(importPaths[0]).toContain 'atom-dark-ui'
@@ -142,8 +142,8 @@ describe "ThemeManager", ->
expect(stylesheetAddedHandler).toHaveBeenCalled()
expect(stylesheetsChangedHandler).toHaveBeenCalled()
element = $('head style[id*="css.css"]')
expect(element.attr('id')).toBe themeManager.stringToId(cssPath)
element = $('head style[source-path*="css.css"]')
expect(element.attr('source-path')).toBe themeManager.stringToId(cssPath)
expect(element.text()).toBe fs.readFileSync(cssPath, 'utf8')
expect(element[0].sheet).toBe stylesheetAddedHandler.argsForCall[0][0]
@@ -159,8 +159,8 @@ describe "ThemeManager", ->
themeManager.requireStylesheet(lessPath)
expect($('head style').length).toBe lengthBefore + 1
element = $('head style[id*="sample.less"]')
expect(element.attr('id')).toBe themeManager.stringToId(lessPath)
element = $('head style[source-path*="sample.less"]')
expect(element.attr('source-path')).toBe themeManager.stringToId(lessPath)
expect(element.text()).toBe """
#header {
color: #4d926f;
@@ -178,9 +178,9 @@ describe "ThemeManager", ->
it "supports requiring css and less stylesheets without an explicit extension", ->
themeManager.requireStylesheet path.join(__dirname, 'fixtures', 'css')
expect($('head style[id*="css.css"]').attr('id')).toBe themeManager.stringToId(atom.project.resolve('css.css'))
expect($('head style[source-path*="css.css"]').attr('source-path')).toBe themeManager.stringToId(atom.project.resolve('css.css'))
themeManager.requireStylesheet path.join(__dirname, 'fixtures', 'sample')
expect($('head style[id*="sample.less"]').attr('id')).toBe themeManager.stringToId(atom.project.resolve('sample.less'))
expect($('head style[source-path*="sample.less"]').attr('source-path')).toBe themeManager.stringToId(atom.project.resolve('sample.less'))
$('head style[id*="css.css"]').remove()
$('head style[id*="sample.less"]').remove()
@@ -208,7 +208,7 @@ describe "ThemeManager", ->
describe "base stylesheet loading", ->
beforeEach ->
atom.workspaceView = atom.workspace.getView(atom.workspace).__spacePenView
atom.workspaceView = atom.views.getView(atom.workspace).__spacePenView
atom.workspaceView.append $('<atom-text-editor>')
atom.workspaceView.attachToDom()
@@ -217,7 +217,7 @@ describe "ThemeManager", ->
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
@@ -234,7 +234,7 @@ 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
@@ -251,7 +251,7 @@ describe "ThemeManager", ->
expect(atom.workspaceView).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
@@ -259,7 +259,9 @@ describe "ThemeManager", ->
runs ->
# `theme-` twice as it prefixes the name with `theme-`
expect(atom.workspaceView).toHaveClass 'theme-theme-with-ui-variables'
expect(atom.workspaceView).toHaveClass 'theme-theme-with-syntax-variables'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-ui'
expect(atom.workspaceView).not.toHaveClass 'theme-atom-dark-syntax'
describe "when the user stylesheet changes", ->
it "reloads it", ->
@@ -308,24 +310,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 ->
+42 -42
Ver Arquivo
@@ -51,12 +51,12 @@ describe "TokenizedBuffer", ->
it "initially creates un-tokenized screen lines, then tokenizes lines chunk at a time in the background", ->
line0 = tokenizedBuffer.tokenizedLineForRow(0)
expect(line0.tokens.length).toBe 1
expect(line0.tokens[0]).toEqual(value: line0.text, scopeDescriptor: ['source.js'])
expect(line0.tokens[0]).toEqual(value: line0.text, scopes: ['source.js'])
line11 = tokenizedBuffer.tokenizedLineForRow(11)
expect(line11.tokens.length).toBe 2
expect(line11.tokens[0]).toEqual(value: " ", scopeDescriptor: ['source.js'], isAtomic: true)
expect(line11.tokens[1]).toEqual(value: "return sort(Array.apply(this, arguments));", scopeDescriptor: ['source.js'])
expect(line11.tokens[0]).toEqual(value: " ", scopes: ['source.js'], isAtomic: true)
expect(line11.tokens[1]).toEqual(value: "return sort(Array.apply(this, arguments));", scopes: ['source.js'])
# background tokenization has not begun
expect(tokenizedBuffer.tokenizedLineForRow(0).ruleStack).toBeUndefined()
@@ -149,10 +149,10 @@ describe "TokenizedBuffer", ->
it "updates tokens to reflect the change", ->
buffer.setTextInRange([[0, 0], [2, 0]], "foo()\n7\n")
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[1]).toEqual(value: '(', scopeDescriptor: ['source.js', 'meta.brace.round.js'])
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: '7', scopeDescriptor: ['source.js', 'constant.numeric.js'])
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[1]).toEqual(value: '(', scopes: ['source.js', 'meta.brace.round.js'])
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: '7', scopes: ['source.js', 'constant.numeric.js'])
# line 2 is unchanged
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[2]).toEqual(value: 'if', scopeDescriptor: ['source.js', 'keyword.control.js'])
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[2]).toEqual(value: 'if', scopes: ['source.js', 'keyword.control.js'])
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -164,7 +164,7 @@ describe "TokenizedBuffer", ->
buffer.insert([5, 30], '/* */')
changeHandler.reset()
buffer.insert([2, 0], '/*')
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopeDescriptor).toEqual ['source.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopes).toEqual ['source.js']
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
delete event.bufferChange
@@ -172,9 +172,9 @@ describe "TokenizedBuffer", ->
changeHandler.reset()
advanceClock()
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
delete event.bufferChange
@@ -185,23 +185,23 @@ describe "TokenizedBuffer", ->
buffer.insert([5, 0], '*/')
buffer.insert([1, 0], 'var ')
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
describe "when lines are both updated and removed", ->
it "updates tokens to reflect the change", ->
buffer.setTextInRange([[1, 0], [3, 0]], "foo()")
# previous line 0 remains
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual(value: 'var', scopeDescriptor: ['source.js', 'storage.modifier.js'])
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.modifier.js'])
# previous line 3 should be combined with input to form line 1
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: 'foo', scopeDescriptor: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[6]).toEqual(value: '=', scopeDescriptor: ['source.js', 'keyword.operator.js'])
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: 'foo', scopes: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[6]).toEqual(value: '=', scopes: ['source.js', 'keyword.operator.js'])
# lines below deleted regions should be shifted upward
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[2]).toEqual(value: 'while', scopeDescriptor: ['source.js', 'keyword.control.js'])
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[4]).toEqual(value: '=', scopeDescriptor: ['source.js', 'keyword.operator.js'])
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[4]).toEqual(value: '<', scopeDescriptor: ['source.js', 'keyword.operator.js'])
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[2]).toEqual(value: 'while', scopes: ['source.js', 'keyword.control.js'])
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[4]).toEqual(value: '=', scopes: ['source.js', 'keyword.operator.js'])
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[4]).toEqual(value: '<', scopes: ['source.js', 'keyword.operator.js'])
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -214,8 +214,8 @@ describe "TokenizedBuffer", ->
changeHandler.reset()
buffer.setTextInRange([[2, 0], [3, 0]], '/*')
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js', 'punctuation.definition.comment.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopeDescriptor).toEqual ['source.js']
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0].scopes).toEqual ['source.js', 'comment.block.js', 'punctuation.definition.comment.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopes).toEqual ['source.js']
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
delete event.bufferChange
@@ -223,8 +223,8 @@ describe "TokenizedBuffer", ->
changeHandler.reset()
advanceClock()
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
delete event.bufferChange
@@ -235,19 +235,19 @@ describe "TokenizedBuffer", ->
buffer.setTextInRange([[1, 0], [2, 0]], "foo()\nbar()\nbaz()\nquux()")
# previous line 0 remains
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual( value: 'var', scopeDescriptor: ['source.js', 'storage.modifier.js'])
expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual( value: 'var', scopes: ['source.js', 'storage.modifier.js'])
# 3 new lines inserted
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: 'foo', scopeDescriptor: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0]).toEqual(value: 'bar', scopeDescriptor: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0]).toEqual(value: 'baz', scopeDescriptor: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: 'foo', scopes: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0]).toEqual(value: 'bar', scopes: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0]).toEqual(value: 'baz', scopes: ['source.js'])
# previous line 2 is joined with quux() on line 4
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0]).toEqual(value: 'quux', scopeDescriptor: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[4]).toEqual(value: 'if', scopeDescriptor: ['source.js', 'keyword.control.js'])
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0]).toEqual(value: 'quux', scopes: ['source.js'])
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[4]).toEqual(value: 'if', scopes: ['source.js', 'keyword.control.js'])
# previous line 3 is pushed down to become line 5
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[4]).toEqual(value: '=', scopeDescriptor: ['source.js', 'keyword.operator.js'])
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[4]).toEqual(value: '=', scopes: ['source.js', 'keyword.operator.js'])
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -264,17 +264,17 @@ describe "TokenizedBuffer", ->
[event] = changeHandler.argsForCall[0]
delete event.bufferChange
expect(event).toEqual(start: 2, end: 2, delta: 2)
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js', 'punctuation.definition.comment.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[0].scopeDescriptor).toEqual ['source.js']
expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0].scopes).toEqual ['source.js', 'comment.block.js', 'punctuation.definition.comment.js']
expect(tokenizedBuffer.tokenizedLineForRow(3).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(4).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[0].scopes).toEqual ['source.js']
changeHandler.reset()
advanceClock() # tokenize invalidated lines in background
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(6).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(7).tokens[0].scopeDescriptor).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(8).tokens[0].scopeDescriptor).not.toBe ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(5).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(6).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(7).tokens[0].scopes).toEqual ['source.js', 'comment.block.js']
expect(tokenizedBuffer.tokenizedLineForRow(8).tokens[0].scopes).not.toBe ['source.js', 'comment.block.js']
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -343,7 +343,7 @@ describe "TokenizedBuffer", ->
expect(tokens[0].value).toBe "#"
expect(tokens[1].value).toBe " Econ 101"
expect(tokens[2].value).toBe tabAsSpaces
expect(tokens[2].scopeDescriptor).toEqual tokens[1].scopeDescriptor
expect(tokens[2].scopes).toEqual tokens[1].scopes
expect(tokens[2].isAtomic).toBeTruthy()
expect(tokens[3].value).toBe ""
@@ -526,7 +526,7 @@ describe "TokenizedBuffer", ->
fullyTokenize(tokenizedBuffer)
{tokens} = tokenizedBuffer.tokenizedLineForRow(0)
expect(tokens[0]).toEqual value: "<div class='name'>", scopeDescriptor: ["text.html.ruby"]
expect(tokens[0]).toEqual value: "<div class='name'>", scopes: ["text.html.ruby"]
waitsForPromise ->
atom.packages.activatePackage('language-html')
@@ -534,7 +534,7 @@ describe "TokenizedBuffer", ->
runs ->
fullyTokenize(tokenizedBuffer)
{tokens} = tokenizedBuffer.tokenizedLineForRow(0)
expect(tokens[0]).toEqual value: '<', scopeDescriptor: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"]
expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"]
describe ".tokenForPosition(position)", ->
afterEach ->
@@ -545,9 +545,9 @@ describe "TokenizedBuffer", ->
buffer = atom.project.bufferForPathSync('sample.js')
tokenizedBuffer = new TokenizedBuffer({buffer})
fullyTokenize(tokenizedBuffer)
expect(tokenizedBuffer.tokenForPosition([1,0]).scopeDescriptor).toEqual ["source.js"]
expect(tokenizedBuffer.tokenForPosition([1,1]).scopeDescriptor).toEqual ["source.js"]
expect(tokenizedBuffer.tokenForPosition([1,2]).scopeDescriptor).toEqual ["source.js", "storage.modifier.js"]
expect(tokenizedBuffer.tokenForPosition([1,0]).scopes).toEqual ["source.js"]
expect(tokenizedBuffer.tokenForPosition([1,1]).scopes).toEqual ["source.js"]
expect(tokenizedBuffer.tokenForPosition([1,2]).scopes).toEqual ["source.js", "storage.modifier.js"]
describe ".bufferRangeForScopeAtPosition(selector, position)", ->
beforeEach ->
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@ describe "TokenizedLine", ->
ensureValidScopeTree(child, scopeDescriptor.concat([scopeTree.scope]))
else
expect(scopeTree).toBe tokens[tokenIndex++]
expect(scopeDescriptor).toEqual scopeTree.scopeDescriptor
expect(scopeDescriptor).toEqual scopeTree.scopes
waitsForPromise ->
atom.project.open('coffee.coffee').then (o) -> editor = o
+45
Ver Arquivo
@@ -456,3 +456,48 @@ describe "Workspace", ->
expect(item2.isModified()).toBe false
expect(atom.setDocumentEdited).toHaveBeenCalledWith(false)
describe "adding panels", ->
class TestPanel
constructior: ->
describe '::addLeftPanel(model)', ->
it 'adds a panel to the correct panel container', ->
atom.workspace.panelContainers.left.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addLeftPanel(item: new TestPanel())
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
describe '::addRightPanel(model)', ->
it 'adds a panel to the correct panel container', ->
atom.workspace.panelContainers.right.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addRightPanel(item: new TestPanel())
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
describe '::addTopPanel(model)', ->
it 'adds a panel to the correct panel container', ->
atom.workspace.panelContainers.top.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addTopPanel(item: new TestPanel())
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
describe '::addBottomPanel(model)', ->
it 'adds a panel to the correct panel container', ->
atom.workspace.panelContainers.bottom.onDidAddPanel addPanelSpy = jasmine.createSpy()
panel = atom.workspace.addBottomPanel(item: new TestPanel())
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
+21 -2
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", ->
@@ -270,3 +270,22 @@ describe "WorkspaceView", ->
atom.config.set('editor.lineHeight', '30px')
expect(getComputedStyle(editorNode).lineHeight).toBe atom.config.get('editor.lineHeight')
expect(editor.getLineHeightInPixels()).not.toBe initialLineHeight
describe 'panel containers', ->
workspaceElement = null
beforeEach ->
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"]')
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"]')
expect(topContainer.nextSibling).toBe workspaceElement.paneContainer
expect(bottomContainer.previousSibling).toBe workspaceElement.paneContainer
modalContainer = workspaceElement.querySelector('atom-panel-container[location="modal"]')
expect(modalContainer.parentNode).toBe workspaceElement
+29 -4
Ver Arquivo
@@ -14,6 +14,7 @@ fs = require 'fs-plus'
{$} = require './space-pen-extensions'
WindowEventHandler = require './window-event-handler'
StylesElement = require './styles-element'
# Essential: Atom global for dealing with packages, themes, menus, and the window.
#
@@ -29,7 +30,10 @@ class Atom extends Model
#
# Returns an Atom instance, fully initialized
@loadOrCreate: (mode) ->
@deserialize(@loadState(mode)) ? new this({mode, @version})
startTime = Date.now()
atom = @deserialize(@loadState(mode)) ? new this({mode, @version})
atom.deserializeTimings.atom = Date.now() - startTime
atom
# Deserializes the Atom environment from a state object
@deserialize: (state) ->
@@ -103,7 +107,7 @@ class Atom extends Model
Section: Properties
###
# Experimental: A {CommandRegistry} instance
# Public: A {CommandRegistry} instance
commands: null
# Public: A {Config} instance
@@ -136,6 +140,9 @@ class Atom extends Model
# Public: A {DeserializerManager} instance
deserializers: null
# Public: A {ViewRegistry} instance
views: null
# Public: A {Workspace} instance
workspace: null
@@ -152,6 +159,7 @@ class Atom extends Model
{@mode} = @state
DeserializerManager = require './deserializer-manager'
@deserializers = new DeserializerManager()
@deserializeTimings = {}
# Sets up the basic services that should be available in all modes
# (both spec and application).
@@ -169,6 +177,7 @@ class Atom extends Model
@executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()')
@lastUncaughtError = Array::slice.call(arguments)
@emit 'uncaught-error', arguments...
@emitter.emit 'did-throw-error', arguments...
@unsubscribe()
@setBodyPlatformClass()
@@ -177,11 +186,13 @@ class Atom extends Model
Config = require './config'
KeymapManager = require './keymap-extensions'
ViewRegistry = require './view-registry'
CommandRegistry = require './command-registry'
PackageManager = require './package-manager'
Clipboard = require './clipboard'
Syntax = require './syntax'
ThemeManager = require './theme-manager'
StyleManager = require './style-manager'
ContextMenuManager = require './context-menu-manager'
MenuManager = require './menu-manager'
{devMode, safeMode, resourcePath} = @getLoadSettings()
@@ -196,11 +207,17 @@ class Atom extends Model
# Make react.js faster
process.env.NODE_ENV ?= 'production' unless devMode
# Set Atom's home so packages don't have to guess it
process.env.ATOM_HOME = configDirPath
@config = new Config({configDirPath, resourcePath})
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@commands = new CommandRegistry
@views = new ViewRegistry
@packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode})
@styles = new StyleManager
document.head.appendChild(new StylesElement)
@themes = new ThemeManager({packageManager: @packages, configDirPath, resourcePath, safeMode})
@contextMenu = new ContextMenuManager({resourcePath, devMode})
@menu = new MenuManager({resourcePath})
@@ -231,6 +248,15 @@ class Atom extends Model
onDidBeep: (callback) ->
@emitter.on 'did-beep', callback
# Extended: Invoke the given callback whenever there is an unhandled error.
#
# * `callback` {Function} to be called whenever there is an unhandled error
# * `errorMessage` {String}
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidThrowError: (callback) ->
@emitter.on 'did-throw-error', callback
###
Section: Atom Details
###
@@ -586,7 +612,7 @@ class Atom extends Model
startTime = Date.now()
@workspace = Workspace.deserialize(@state.workspace) ? new Workspace
@workspaceView = @workspace.getView(@workspace).__spacePenView
@workspaceView = @views.getView(@workspace).__spacePenView
@deserializeTimings.workspace = Date.now() - startTime
@keymaps.defaultTarget = @workspaceView[0]
@@ -597,7 +623,6 @@ class Atom extends Model
delete @state.packageStates
deserializeEditorWindow: ->
@deserializeTimings = {}
@deserializePackageStates()
@deserializeProject()
@deserializeWorkspaceView()
+29 -5
Ver Arquivo
@@ -10,24 +10,48 @@ _ = require 'underscore-plus'
module.exports =
class ApplicationMenu
constructor: (@version) ->
@menu = Menu.buildFromTemplate @getDefaultTemplate()
Menu.setApplicationMenu @menu
@windowTemplates = new WeakMap()
@setActiveTemplate(@getDefaultTemplate())
global.atomApplication.autoUpdateManager.on 'state-changed', (state) =>
@showUpdateMenuItem(state)
# Public: Updates the entire menu with the given keybindings.
#
# window - The BrowserWindow this menu template is associated with.
# template - The Object which describes the menu to display.
# keystrokesByCommand - An Object where the keys are commands and the values
# are Arrays containing the keystroke.
update: (template, keystrokesByCommand) ->
update: (window, template, keystrokesByCommand) ->
@translateTemplate(template, keystrokesByCommand)
@substituteVersion(template)
@menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(@menu)
@windowTemplates.set(window, template)
@setActiveTemplate(template) if window is @lastFocusedWindow
setActiveTemplate: (template) ->
unless _.isEqual(template, @activeTemplate)
@activeTemplate = template
@menu = Menu.buildFromTemplate(_.deepClone(template))
Menu.setApplicationMenu(@menu)
@showUpdateMenuItem(global.atomApplication.autoUpdateManager.getState())
# Register a BrowserWindow with this application menu.
addWindow: (window) ->
@lastFocusedWindow ?= window
focusHandler = =>
@lastFocusedWindow = window
if template = @windowTemplates.get(window)
@setActiveTemplate(template)
window.on 'focus', focusHandler
window.once 'closed', =>
@lastFocusedWindow = null if window is @lastFocusedWindow
@windowTemplates.delete(window)
window.removeListener 'focus', focusHandler
@enableWindowSpecificItems(true)
# Flattens the given menu and submenu items into an single Array.
#
# menu - A complete menu configuration object for atom-shell's menu API.
+10 -3
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()
@@ -97,7 +97,7 @@ class AtomApplication
# Public: Adds the {AtomWindow} to the global window list.
addWindow: (window) ->
@windows.push window
@applicationMenu?.enableWindowSpecificItems(true)
@applicationMenu?.addWindow(window.browserWindow)
window.once 'window:loaded', =>
@autoUpdateManager.emitUpdateAvailableEvent(window)
@@ -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()
@@ -215,7 +221,8 @@ class AtomApplication
@promptForPath({window})
ipc.on 'update-application-menu', (event, template, keystrokesByCommand) =>
@applicationMenu.update(template, keystrokesByCommand)
win = BrowserWindow.fromWebContents(event.sender)
@applicationMenu.update(win, template, keystrokesByCommand)
ipc.on 'run-package-specs', (event, specDirectory) =>
@runSpecs({resourcePath: global.devResourcePath, specDirectory: specDirectory, exitWhenDone: false})
+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)
+22 -3
Ver Arquivo
@@ -78,13 +78,18 @@ parseCommandLine = ->
Folder paths will open in an existing window if that folder has already been
opened or a new window if it hasn't.
Environment Variables:
ATOM_DEV_RESOURCE_PATH The path from which Atom loads source code in dev mode.
Defaults to `~/github/atom`.
"""
options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.')
options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.')
options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.')
options.alias('l', 'log-file').string('l').describe('l', 'Log all output to file.')
options.alias('n', 'new-window').boolean('n').describe('n', 'Open a new window.')
options.alias('s', 'spec-directory').string('s').describe('s', 'Set the spec directory (default: Atom\'s spec directory).')
options.alias('r', 'resource-path').string('r').describe('r', 'Set the path to the Atom source directory and enable dev-mode.')
options.alias('s', 'spec-directory').string('s').describe('s', 'Set the directory from which to run package specs (default: Atom\'s spec directory).')
options.boolean('safe').describe('safe', 'Do not load packages from ~/.atom/packages or ~/.atom/dev/packages.')
options.alias('t', 'test').boolean('t').describe('t', 'Run the specified specs and exit with error code on failures.')
options.alias('v', 'version').boolean('v').describe('v', 'Print the version.')
@@ -113,12 +118,26 @@ parseCommandLine = ->
if args['resource-path']
devMode = true
resourcePath = args['resource-path']
else if devMode
resourcePath = global.devResourcePath
else
# Set resourcePath based on the specDirectory if running specs on atom core
if specDirectory?
packageDirectoryPath = path.join(specDirectory, '..')
packageManifestPath = path.join(packageDirectoryPath, 'package.json')
if fs.statSyncNoException(packageManifestPath)
try
packageManifest = JSON.parse(fs.readFileSync(packageManifestPath))
resourcePath = packageDirectoryPath if packageManifest.name is 'atom'
if devMode
resourcePath ?= global.devResourcePath
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()
+8
Ver Arquivo
@@ -45,3 +45,11 @@ module.exports =
writable: false
value: requireCoffeeScript
})
addPathToCache: (filePath) ->
extension = path.extname(filePath)
if extension is '.coffee'
content = fs.readFileSync(filePath, 'utf8')
cachePath = getCachePath(coffee)
compileCoffeeScript(coffee, filePath, cachePath)
else if extension is '.cson'
CSON.readFileSync(filePath)
+17 -19
Ver Arquivo
@@ -6,9 +6,7 @@ _ = require 'underscore-plus'
SequenceCount = 0
SpecificityCache = {}
module.exports =
# Experimental: Associates listener functions with commands in a
# Public: Associates listener functions with commands in a
# context-sensitive way using CSS selectors. You can access a global instance of
# this class via `atom.commands`, and commands registered there will be
# presented in the command palette.
@@ -37,11 +35,10 @@ module.exports =
# ```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 =
class CommandRegistry
constructor: (@rootNode) ->
@registeredCommands = {}
@@ -115,7 +112,7 @@ class CommandRegistry
@commandRegistered(commandName)
new Disposable =>
new Disposable ->
listenersForElement.splice(listenersForElement.indexOf(listener), 1)
listenersForCommand.delete(element) if listenersForElement.length is 0
@@ -131,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
+55
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'
@@ -105,10 +146,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
@@ -128,3 +179,7 @@ module.exports =
cr:
type: ['boolean', 'string']
default: '\u00a4'
zoomFontWhenCtrlScrolling:
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.'
+121 -43
Ver Arquivo
@@ -9,6 +9,7 @@ pathWatcher = require 'pathwatcher'
{deprecate} = require 'grim'
ScopedPropertyStore = require 'scoped-property-store'
ScopeDescriptor = require './scope-descriptor'
# Essential: Used to access all of Atom's configuration details.
#
@@ -313,6 +314,7 @@ class Config
@settings = {}
@scopedSettingsStore = new ScopedPropertyStore
@usersScopedSettings = new CompositeDisposable
@usersScopedSettingPriority = {priority: 1000}
@configFileHasErrors = false
@configFilePath = fs.resolve(@configDirPath, 'config', ['json', 'cson'])
@configFilePath ?= path.join(@configDirPath, 'config.cson')
@@ -335,9 +337,11 @@ class Config
# # do stuff with value
# ```
#
# * `scopeDescriptor` (optional) {Array} of {String}s describing a path from
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples.
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` {String} name of the key to observe
# * `callback` {Function} to call when the value of the key changes.
# * `value` the new value of the key
@@ -349,7 +353,7 @@ class Config
if args.length is 2
# observe(keyPath, callback)
[keyPath, callback, scopeDescriptor, options] = args
else if args.length is 3 and Array.isArray(scopeDescriptor)
else if args.length is 3 and (Array.isArray(scopeDescriptor) or scopeDescriptor instanceof ScopeDescriptor)
# observe(scopeDescriptor, keyPath, callback)
[scopeDescriptor, keyPath, callback, options] = args
else if args.length is 3 and _.isString(scopeDescriptor) and _.isObject(keyPath)
@@ -371,9 +375,11 @@ class Config
# Essential: Add a listener for changes to a given key path. If `keyPath` is
# not specified, your callback will be called on changes to any key.
#
# * `scopeDescriptor` (optional) {Array} of {String}s describing a path from
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples.
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` (optional) {String} name of the key to observe. Must be
# specified if `scopeDescriptor` is specified.
# * `callback` {Function} to call when the value of the key changes.
@@ -440,9 +446,11 @@ class Config
# atom.config.get(scopeDescriptor, 'editor.tabLength') # => 2
# ```
#
# * `scopeDescriptor` (optional) {Array} of {String}s describing a path from
# * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from
# the root of the syntax tree to a token. Get one by calling
# {editor.getLastCursor().getScopeDescriptor()}
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` The {String} name of the key to retrieve.
#
# Returns the value from Atom's default settings, the user's configuration
@@ -486,7 +494,9 @@ class Config
# atom.config.get(['source.js'], 'editor.tabLength') # => 4
# ```
#
# * `scope` (optional) {String}. eg. '.source.ruby'
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
# See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors)
# for more information.
# * `keyPath` The {String} name of the key.
# * `value` The value of the setting. Passing `undefined` will revert the
# setting to the default value.
@@ -494,11 +504,11 @@ class Config
# Returns a {Boolean}
# * `true` if the value was set.
# * `false` if the value was not able to be coerced to the type specified in the setting's schema.
set: (scope, keyPath, value) ->
set: (scopeSelector, keyPath, value) ->
if arguments.length < 3
value = keyPath
keyPath = scope
scope = undefined
keyPath = scopeSelector
scopeSelector = undefined
unless value == undefined
try
@@ -506,8 +516,8 @@ class Config
catch e
return false
if scope?
@setRawScopedValue(scope, keyPath, value)
if scopeSelector?
@setRawScopedValue(scopeSelector, keyPath, value)
else
@setRawValue(keyPath, value)
@@ -519,29 +529,59 @@ class Config
# * `keyPath` The {String} name of the key.
#
# Returns the new value.
restoreDefault: (keyPath) ->
@set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath))
@get(keyPath)
restoreDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
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)
else
@set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath))
@get(keyPath)
# Extended: Get the global default value of the key path. _Please note_ that in most
# cases calling this is not necessary! {::get} returns the default value when
# a custom value is not specified.
#
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
# * `keyPath` The {String} name of the key.
#
# Returns the default value.
getDefault: (keyPath) ->
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
getDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
if scopeSelector?
defaultValue = @scopedSettingsStore.getPropertyValue(scopeSelector, keyPath, excludeSources: ['user-config'])
defaultValue ?= _.valueForKeyPath(@defaultSettings, keyPath)
else
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
_.deepClone(defaultValue)
# Extended: Is the value at `keyPath` its default value?
#
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
# * `keyPath` The {String} name of the key.
#
# Returns a {Boolean}, `true` if the current value is the default, `false`
# otherwise.
isDefault: (keyPath) ->
not _.valueForKeyPath(@settings, keyPath)?
isDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
if scopeSelector?
settings = @scopedSettingsStore.propertiesForSourceAndSelector('user-config', scopeSelector)
not _.valueForKeyPath(settings, keyPath)?
else
not _.valueForKeyPath(@settings, keyPath)?
# Extended: Retrieve the schema for a specific key path. The schema will tell
# you what type the keyPath expects, and other metadata about the config
@@ -552,7 +592,7 @@ class Config
# Returns an {Object} eg. `{type: 'integer', default: 23, minimum: 1}`.
# Returns `null` when the keyPath has no schema specified.
getSchema: (keyPath) ->
keys = keyPath.split('.')
keys = splitKeyPath(keyPath)
schema = @schema
for key in keys
break unless schema?
@@ -560,9 +600,17 @@ class Config
schema
# Extended: Returns a new {Object} containing all of the global settings and
# defaults. This does not include scoped settings.
getSettings: ->
_.deepExtend(@settings, @defaultSettings)
# defaults. Returns the scoped settings when a `scopeSelector` is specified.
#
# * `scopeSelector` (optional) {String}. eg. '.source.ruby'
getSettings: (scopeSelector) ->
settings = _.deepExtend(@settings, @defaultSettings)
if scopeSelector?
scopedSettings = @scopedSettingsStore.propertiesForSelector(scopeSelector)
settings = _.deepExtend(scopedSettings, settings)
settings
# Extended: Get the {String} path to the config file being used.
getUserConfigPath: ->
@@ -624,7 +672,7 @@ class Config
rootSchema = @schema
if keyPath
for key in keyPath.split('.')
for key in splitKeyPath(keyPath)
rootSchema.type = 'object'
rootSchema.properties ?= {}
properties = rootSchema.properties
@@ -633,6 +681,7 @@ class Config
_.extend rootSchema, schema
@setDefaults(keyPath, @extractDefaultsFromSchema(schema))
@setScopedDefaultsFromSchema(keyPath, schema)
load: ->
@initializeConfigDirectory()
@@ -708,7 +757,7 @@ class Config
unsetUnspecifiedValues = (keyPath, value) =>
if isPlainObject(value)
keys = if keyPath? then keyPath.split('.') else []
keys = splitKeyPath(keyPath)
for key, childValue of value
continue unless value.hasOwnProperty(key)
unsetUnspecifiedValues(keys.concat([key]).join('.'), childValue)
@@ -721,7 +770,7 @@ class Config
setRecursive: (keyPath, value) ->
if isPlainObject(value)
keys = if keyPath? then keyPath.split('.') else []
keys = splitKeyPath(keyPath)
for key, childValue of value
continue unless value.hasOwnProperty(key)
@setRecursive(keys.concat([key]).join('.'), childValue)
@@ -764,8 +813,8 @@ class Config
isSubKeyPath: (keyPath, subKeyPath) ->
return false unless keyPath? and subKeyPath?
pathSubTokens = subKeyPath.split('.')
pathTokens = keyPath.split('.').slice(0, pathSubTokens.length)
pathSubTokens = splitKeyPath(subKeyPath)
pathTokens = splitKeyPath(keyPath).slice(0, pathSubTokens.length)
_.isEqual(pathTokens, pathSubTokens)
setRawDefault: (keyPath, value) ->
@@ -776,7 +825,7 @@ class Config
setDefaults: (keyPath, defaults) ->
if defaults? and isPlainObject(defaults)
keys = if keyPath? then keyPath.split('.') else []
keys = splitKeyPath(keyPath)
for key, childValue of defaults
continue unless defaults.hasOwnProperty(key)
@setDefaults(keys.concat([key]).join('.'), childValue)
@@ -787,6 +836,32 @@ class Config
catch e
console.warn("'#{keyPath}' could not set the default. Attempted default: #{JSON.stringify(defaults)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")
# `schema` will look something like this
#
# ```coffee
# type: 'string'
# default: 'ok'
# scopes:
# '.source.js':
# default: 'omg'
# ```
setScopedDefaultsFromSchema: (keyPath, schema) ->
if schema.scopes? and isPlainObject(schema.scopes)
scopedDefaults = {}
for scope, scopeSchema of schema.scopes
continue unless scopeSchema.hasOwnProperty('default')
scopedDefaults[scope] = {}
_.setValueForKeyPath(scopedDefaults[scope], keyPath, scopeSchema.default)
@scopedSettingsStore.addProperties('schema-default', scopedDefaults)
if schema.type is 'object' and schema.properties? and isPlainObject(schema.properties)
keys = splitKeyPath(keyPath)
for key, childValue of schema.properties
continue unless schema.properties.hasOwnProperty(key)
@setScopedDefaultsFromSchema(keys.concat([key]).join('.'), childValue)
return
extractDefaultsFromSchema: (schema) ->
if schema.default?
schema.default
@@ -807,13 +882,13 @@ class Config
resetUserScopedSettings: (newScopedSettings) ->
@usersScopedSettings?.dispose()
@usersScopedSettings = new CompositeDisposable
@usersScopedSettings.add @scopedSettingsStore.addProperties('user-config', newScopedSettings)
@usersScopedSettings.add @scopedSettingsStore.addProperties('user-config', newScopedSettings, @usersScopedSettingPriority)
@emitter.emit 'did-change'
addScopedSettings: (name, selector, value) ->
addScopedSettings: (source, selector, value, options) ->
settingsBySelector = {}
settingsBySelector[selector] = value
disposable = @scopedSettingsStore.addProperties(name, settingsBySelector)
disposable = @scopedSettingsStore.addProperties(source, settingsBySelector, options)
@emitter.emit 'did-change'
new Disposable =>
disposable.dispose()
@@ -827,16 +902,12 @@ class Config
settingsBySelector = {}
settingsBySelector[selector] = value
@usersScopedSettings.add @scopedSettingsStore.addProperties('user-config', settingsBySelector)
@usersScopedSettings.add @scopedSettingsStore.addProperties('user-config', settingsBySelector, @usersScopedSettingPriority)
@emitter.emit 'did-change'
getRawScopedValue: (scopeDescriptor, keyPath) ->
scopeChain = scopeDescriptor
.map (scope) ->
scope = ".#{scope}" unless scope[0] is '.'
scope
.join(' ')
@scopedSettingsStore.getPropertyValue(scopeChain, keyPath)
scopeDescriptor = ScopeDescriptor.fromObject(scopeDescriptor)
@scopedSettingsStore.getPropertyValue(scopeDescriptor.getScopeChain(), keyPath)
observeScopedKeyPath: (scopeDescriptor, keyPath, callback) ->
oldValue = @get(scopeDescriptor, keyPath)
@@ -863,12 +934,8 @@ class Config
# * language mode uses it for one thing.
# * autocomplete uses it for editor.completions
settingsForScopeDescriptor: (scopeDescriptor, keyPath) ->
scopeChain = scopeDescriptor
.map (scope) ->
scope = ".#{scope}" unless scope[0] is '.'
scope
.join(' ')
@scopedSettingsStore.getProperties(scopeChain, keyPath)
scopeDescriptor = ScopeDescriptor.fromObject(scopeDescriptor)
@scopedSettingsStore.getProperties(scopeDescriptor.getScopeChain(), keyPath)
# Base schema enforcers. These will coerce raw input into the specified type,
# and will throw an error when the value cannot be coerced. Throwing the error
@@ -968,3 +1035,14 @@ Config.addSchemaEnforcers
isPlainObject = (value) ->
_.isObject(value) and not _.isArray(value) and not _.isFunction(value) and not _.isString(value)
splitKeyPath = (keyPath) ->
return [] unless keyPath?
startIndex = 0
keyPathArray = []
for char, i in keyPath
if char is '.' and (i is 0 or keyPath[i-1] != '\\')
keyPathArray.push keyPath.substring(startIndex, i)
startIndex = i + 1
keyPathArray.push keyPath.substr(startIndex, keyPath.length)
keyPathArray
+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
+58 -46
Ver Arquivo
@@ -216,12 +216,12 @@ class Cursor extends Model
# Public: Retrieves the scope descriptor for the cursor's current position.
#
# Returns an {Array} of {String}s.
# Returns a {ScopeDescriptor}
getScopeDescriptor: ->
@editor.scopeDescriptorForBufferPosition(@getBufferPosition())
getScopes: ->
Grim.deprecate 'Use Cursor::getScopeDescriptor() instead'
@getScopeDescriptor()
@getScopeDescriptor().getScopesArray()
# Public: Returns true if this cursor has no non-whitespace characters before
# its current position.
@@ -392,7 +392,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 +420,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 +507,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:
+33 -9
Ver Arquivo
@@ -650,11 +650,21 @@ class DisplayBuffer extends Model
left = 0
column = 0
for token in @tokenizedLineForScreenRow(targetRow).tokens
charWidths = @getScopedCharWidths(token.scopeDescriptor)
for char in token.value
charWidths = @getScopedCharWidths(token.scopes)
valueIndex = 0
while valueIndex < token.value.length
if token.hasPairedCharacter
char = token.value.substr(valueIndex, 2)
charLength = 2
valueIndex += 2
else
char = token.value[valueIndex]
charLength = 1
valueIndex++
return {top, left} if column is targetColumn
left += charWidths[char] ? defaultCharWidth unless char is '\0'
column++
column += charLength
{top, left}
screenPositionForPixelPosition: (pixelPosition) ->
@@ -662,18 +672,29 @@ class DisplayBuffer extends Model
targetLeft = pixelPosition.left
defaultCharWidth = @defaultCharWidth
row = Math.floor(targetTop / @getLineHeightInPixels())
targetLeft = Infinity if row > @getLastRow()
row = Math.min(row, @getLastRow())
row = Math.max(0, row)
left = 0
column = 0
for token in @tokenizedLineForScreenRow(row).tokens
charWidths = @getScopedCharWidths(token.scopeDescriptor)
for char in token.value
charWidths = @getScopedCharWidths(token.scopes)
valueIndex = 0
while valueIndex < token.value.length
if token.hasPairedCharacter
char = token.value.substr(valueIndex, 2)
charLength = 2
valueIndex += 2
else
char = token.value[valueIndex]
charLength = 1
valueIndex++
charWidth = charWidths[char] ? defaultCharWidth
break if targetLeft <= left + (charWidth / 2)
left += charWidth
column++
column += charLength
new Point(row, column)
@@ -714,6 +735,8 @@ class DisplayBuffer extends Model
#
# Returns a {Point}.
screenPositionForBufferPosition: (bufferPosition, options) ->
throw new Error("This TextEditor has been destroyed") if @isDestroyed()
{ row, column } = @buffer.clipPosition(bufferPosition)
[startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row)
for screenRow in [startScreenRow...endScreenRow]
@@ -756,7 +779,7 @@ class DisplayBuffer extends Model
#
# bufferPosition - A {Point} in the {TextBuffer}
#
# Returns an {Array} of {String}s.
# Returns a {ScopeDescriptor}.
scopeDescriptorForBufferPosition: (bufferPosition) ->
@tokenizedBuffer.scopeDescriptorForPosition(bufferPosition)
@@ -1051,9 +1074,10 @@ class DisplayBuffer extends Model
marker.notifyObservers(textChanged: false)
destroyed: ->
marker.unsubscribe() for marker in @getMarkers()
@tokenizedBuffer.destroy()
marker.unsubscribe() for id, marker of @markers
@scopedConfigSubscriptions.dispose()
@unsubscribe()
@tokenizedBuffer.destroy()
logLines: (start=0, end=@getLastRow()) ->
for row in [start..end]
+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.
+16 -9
Ver Arquivo
@@ -14,9 +14,9 @@ HighlightComponent = React.createClass
div {className},
if endPixelPosition.top is startPixelPosition.top
@renderSingleLineRegions()
@renderSingleLineRegions(decoration.deprecatedRegionClass)
else
@renderMultiLineRegions()
@renderMultiLineRegions(decoration.deprecatedRegionClass)
componentDidMount: ->
{editor, decoration} = @props
@@ -41,25 +41,32 @@ HighlightComponent = React.createClass
removeFlashClass = -> node.classList.remove(flash.class)
@flashTimeoutId = setTimeout(removeFlashClass, flash.duration)
renderSingleLineRegions: ->
renderSingleLineRegions: (regionClass) ->
{startPixelPosition, endPixelPosition, lineHeightInPixels} = @props
className = 'region'
className += " #{regionClass}" if regionClass?
[
div className: 'region', key: 0, style:
div className: className, key: 0, style:
top: startPixelPosition.top
height: lineHeightInPixels
left: startPixelPosition.left
width: endPixelPosition.left - startPixelPosition.left
]
renderMultiLineRegions: ->
renderMultiLineRegions: (regionClass) ->
{startPixelPosition, endPixelPosition, lineHeightInPixels} = @props
className = 'region'
className += " #{regionClass}" if regionClass?
regions = []
index = 0
# First row, extending from selection start to the right side of screen
regions.push(
div className: 'region', key: index++, style:
div className: className, key: index++, style:
top: startPixelPosition.top
left: startPixelPosition.left
height: lineHeightInPixels
@@ -69,7 +76,7 @@ HighlightComponent = React.createClass
# Middle rows, extending from left side to right side of screen
if endPixelPosition.top - startPixelPosition.top > lineHeightInPixels
regions.push(
div className: 'region', key: index++, style:
div className: className, key: index++, style:
top: startPixelPosition.top + lineHeightInPixels
height: endPixelPosition.top - startPixelPosition.top - lineHeightInPixels
left: 0
@@ -78,7 +85,7 @@ HighlightComponent = React.createClass
# Last row, extending from left side of screen to selection end
regions.push(
div className: 'region', key: index, style:
div className: className, key: index, style:
top: endPixelPosition.top
height: lineHeightInPixels
left: 0
@@ -88,4 +95,4 @@ HighlightComponent = React.createClass
regions
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'startPixelPosition', 'endPixelPosition', 'lineHeightInPixels')
not isEqualForProperties(newProps, @props, 'startPixelPosition', 'endPixelPosition', 'lineHeightInPixels', 'decoration')
+7 -1
Ver Arquivo
@@ -17,9 +17,15 @@ HighlightsComponent = React.createClass
highlightComponents = []
for markerId, {startPixelPosition, endPixelPosition, decorations} of highlightDecorations
for decoration in decorations
highlightComponents.push(HighlightComponent({editor, key: "#{markerId}-#{decoration.class}", startPixelPosition, endPixelPosition, decoration, lineHeightInPixels}))
highlightComponents.push(HighlightComponent({editor, key: "#{markerId}-#{decoration.id}", startPixelPosition, endPixelPosition, decoration, lineHeightInPixels}))
highlightComponents
componentDidMount: ->
if atom.config.get('editor.useShadowDOM')
insertionPoint = document.createElement('content')
insertionPoint.setAttribute('select', '.underlayer')
@getDOMNode().appendChild(insertionPoint)
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth', 'scopedCharacterWidthsChangeCount')
+5 -10
Ver Arquivo
@@ -7,16 +7,17 @@ InputComponent = React.createClass
displayName: 'InputComponent'
render: ->
{className, style, onFocus, onBlur} = @props
{className, style} = @props
input {className, style, onFocus, onBlur, 'data-react-skip-selection-restoration': true}
input {className, style, 'data-react-skip-selection-restoration': true}
getInitialState: ->
{lastChar: ''}
componentDidMount: ->
@getDOMNode().addEventListener 'paste', @onPaste
@getDOMNode().addEventListener 'compositionupdate', @onCompositionUpdate
node = @getDOMNode()
node.addEventListener 'paste', @onPaste
node.addEventListener 'compositionupdate', @onCompositionUpdate
# Don't let text accumulate in the input forever, but avoid excessive reflows
componentDidUpdate: ->
@@ -34,11 +35,5 @@ InputComponent = React.createClass
onPaste: (e) ->
e.preventDefault()
onFocus: ->
@props.onFocus?()
onBlur: ->
@props.onBlur?()
focus: ->
@getDOMNode().focus()
+23 -7
Ver Arquivo
@@ -57,6 +57,12 @@ LinesComponent = React.createClass
@lineIdsByScreenRow = {}
@renderedDecorationsByLineId = {}
componentDidMount: ->
if atom.config.get('editor.useShadowDOM')
insertionPoint = document.createElement('content')
insertionPoint.setAttribute('select', '.overlayer')
@getDOMNode().appendChild(insertionPoint)
shouldComponentUpdate: (newProps) ->
return true unless isEqualForProperties(newProps, @props,
'renderedRowRange', 'lineDecorations', 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth',
@@ -200,7 +206,7 @@ LinesComponent = React.createClass
firstTrailingWhitespacePosition = text.search(/\s*$/)
lineIsWhitespaceOnly = firstTrailingWhitespacePosition is 0
for token in tokens
innerHTML += @updateScopeStack(scopeStack, token.scopeDescriptor)
innerHTML += @updateScopeStack(scopeStack, token.scopes)
hasIndentGuide = not mini and showIndentGuide and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and lineIsWhitespaceOnly))
innerHTML += token.getValueAsHtml({hasIndentGuide})
@@ -308,10 +314,20 @@ LinesComponent = React.createClass
iterator = null
charIndex = 0
for {value, scopeDescriptor}, tokenIndex in tokenizedLine.tokens
charWidths = editor.getScopedCharWidths(scopeDescriptor)
for {value, scopes, hasPairedCharacter} in tokenizedLine.tokens
charWidths = editor.getScopedCharWidths(scopes)
valueIndex = 0
while valueIndex < value.length
if hasPairedCharacter
char = value.substr(valueIndex, 2)
charLength = 2
valueIndex += 2
else
char = value[valueIndex]
charLength = 1
valueIndex++
for char in value
continue if char is '\0'
unless charWidths[char]?
@@ -329,11 +345,11 @@ LinesComponent = React.createClass
i = charIndex - textNodeIndex
rangeForMeasurement.setStart(textNode, i)
rangeForMeasurement.setEnd(textNode, i + 1)
rangeForMeasurement.setEnd(textNode, i + charLength)
charWidth = rangeForMeasurement.getBoundingClientRect().width
editor.setScopedCharWidth(scopeDescriptor, char, charWidth)
editor.setScopedCharWidth(scopes, char, charWidth)
charIndex++
charIndex += charLength
@measuredLines.add(tokenizedLine)
+1 -1
Ver Arquivo
@@ -44,7 +44,7 @@ normalizeLabel = (label) ->
label.replace(/\&/g, '')
cloneMenuItem = (item) ->
item = _.pick(item, 'type', 'label', 'command', 'submenu', 'commandDetail')
item = _.pick(item, 'type', 'label', 'enabled', 'command', 'submenu', 'commandDetail')
if item.submenu?
item.submenu = item.submenu.map (submenuItem) -> cloneMenuItem(submenuItem)
item
+311
Ver Arquivo
@@ -0,0 +1,311 @@
Module = require 'module'
path = require 'path'
semver = require 'semver'
# Extend semver.Range to memoize matched versions for speed
class Range extends semver.Range
constructor: ->
super
@matchedVersions = new Set()
@unmatchedVersions = new Set()
test: (version) ->
return true if @matchedVersions.has(version)
return false if @unmatchedVersions.has(version)
matches = super
if matches
@matchedVersions.add(version)
else
@unmatchedVersions.add(version)
matches
nativeModules = process.binding('natives')
cache =
builtins: {}
debug: false
dependencies: {}
extensions: {}
folders: {}
ranges: {}
registered: false
resourcePath: null
resourcePathWithTrailingSlash: null
# isAbsolute is inlined from fs-plus so that fs-plus itself can be required
# from this cache.
if process.platform is 'win32'
isAbsolute = (pathToCheck) ->
pathToCheck and (pathToCheck[1] is ':' or (pathToCheck[0] is '\\' and pathToCheck[1] is '\\'))
else
isAbsolute = (pathToCheck) ->
pathToCheck and pathToCheck[0] is '/'
isCorePath = (pathToCheck) ->
pathToCheck.startsWith(cache.resourcePathWithTrailingSlash)
loadDependencies = (modulePath, rootPath, rootMetadata, moduleCache) ->
fs = require 'fs-plus'
for childPath in fs.listSync(path.join(modulePath, 'node_modules'))
continue if path.basename(childPath) is '.bin'
continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))
childMetadataPath = path.join(childPath, 'package.json')
continue unless fs.isFileSync(childMetadataPath)
childMetadata = JSON.parse(fs.readFileSync(childMetadataPath))
if childMetadata?.version
try
mainPath = require.resolve(childPath)
if mainPath
moduleCache.dependencies.push
name: childMetadata.name
version: childMetadata.version
path: path.relative(rootPath, mainPath)
loadDependencies(childPath, rootPath, rootMetadata, moduleCache)
return
loadFolderCompatibility = (modulePath, rootPath, rootMetadata, moduleCache) ->
fs = require 'fs-plus'
metadataPath = path.join(modulePath, 'package.json')
return unless fs.isFileSync(metadataPath)
dependencies = JSON.parse(fs.readFileSync(metadataPath))?.dependencies ? {}
for name, version of dependencies
try
new Range(version)
catch error
delete dependencies[name]
onDirectory = (childPath) ->
path.basename(childPath) isnt 'node_modules'
extensions = ['.js', '.coffee', '.json', '.node']
paths = {}
onFile = (childPath) ->
if path.extname(childPath) in extensions
relativePath = path.relative(rootPath, path.dirname(childPath))
paths[relativePath] = true
fs.traverseTreeSync(modulePath, onFile, onDirectory)
paths = Object.keys(paths)
if paths.length > 0 and Object.keys(dependencies).length > 0
moduleCache.folders.push({paths, dependencies})
for childPath in fs.listSync(path.join(modulePath, 'node_modules'))
continue if path.basename(childPath) is '.bin'
continue if rootPath is modulePath and rootMetadata.packageDependencies?.hasOwnProperty(path.basename(childPath))
loadFolderCompatibility(childPath, rootPath, rootMetadata, moduleCache)
return
loadExtensions = (modulePath, rootPath, rootMetadata, moduleCache) ->
fs = require 'fs-plus'
extensions = ['.js', '.coffee', '.json', '.node']
nodeModulesPath = path.join(rootPath, 'node_modules')
onFile = (filePath) ->
filePath = path.relative(rootPath, filePath)
segments = filePath.split(path.sep)
return if 'test' in segments
return if 'tests' in segments
return if 'spec' in segments
return if 'specs' in segments
return if segments.length > 1 and not (segments[0] in ['exports', 'lib', 'node_modules', 'src', 'static', 'vendor'])
extension = path.extname(filePath)
if extension in extensions
moduleCache.extensions[extension] ?= []
moduleCache.extensions[extension].push(filePath)
onDirectory = (childPath) ->
# Don't include extensions from bundled packages
# These are generated and stored in the package's own metadata cache
if rootMetadata.name is 'atom'
parentPath = path.dirname(childPath)
if parentPath is nodeModulesPath
packageName = path.basename(childPath)
return false if rootMetadata.packageDependencies?.hasOwnProperty(packageName)
true
fs.traverseTreeSync(rootPath, onFile, onDirectory)
return
satisfies = (version, rawRange) ->
unless parsedRange = cache.ranges[rawRange]
parsedRange = new Range(rawRange)
cache.ranges[rawRange] = parsedRange
parsedRange.test(version)
resolveFilePath = (relativePath, parentModule) ->
return unless relativePath
return unless parentModule?.filename
return unless relativePath[0] is '.' or isAbsolute(relativePath)
resolvedPath = path.resolve(path.dirname(parentModule.filename), relativePath)
return unless isCorePath(resolvedPath)
extension = path.extname(resolvedPath)
if extension
return resolvedPath if cache.extensions[extension]?.has(resolvedPath)
else
for extension, paths of cache.extensions
resolvedPathWithExtension = "#{resolvedPath}#{extension}"
return resolvedPathWithExtension if paths.has(resolvedPathWithExtension)
return
resolveModulePath = (relativePath, parentModule) ->
return unless relativePath
return unless parentModule?.filename
return if nativeModules.hasOwnProperty(relativePath)
return if relativePath[0] is '.'
return if isAbsolute(relativePath)
folderPath = path.dirname(parentModule.filename)
range = cache.folders[folderPath]?[relativePath]
unless range?
if builtinPath = cache.builtins[relativePath]
return builtinPath
else
return
candidates = cache.dependencies[relativePath]
return unless candidates?
for version, resolvedPath of candidates
if Module._cache.hasOwnProperty(resolvedPath) or isCorePath(resolvedPath)
return resolvedPath if satisfies(version, range)
return
registerBuiltins = (devMode) ->
if devMode or not cache.resourcePath.startsWith("#{process.resourcesPath}#{path.sep}")
fs = require 'fs-plus'
atomCoffeePath = path.join(cache.resourcePath, 'exports', 'atom.coffee')
cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath)
cache.builtins.atom ?= path.join(cache.resourcePath, 'exports', 'atom.js')
atomShellRoot = path.join(process.resourcesPath, 'atom')
commonRoot = path.join(atomShellRoot, 'common', 'api', 'lib')
commonBuiltins = ['callbacks-registry', 'clipboard', 'crash-reporter', 'screen', 'shell']
for builtin in commonBuiltins
cache.builtins[builtin] = path.join(commonRoot, "#{builtin}.js")
rendererRoot = path.join(atomShellRoot, 'renderer', 'api', 'lib')
rendererBuiltins = ['ipc', 'remote']
for builtin in rendererBuiltins
cache.builtins[builtin] = path.join(rendererRoot, "#{builtin}.js")
if cache.debug
cache.findPathCount = 0
cache.findPathTime = 0
cache.loadCount = 0
cache.requireTime = 0
global.moduleCache = cache
originalLoad = Module::load
Module::load = ->
cache.loadCount++
originalLoad.apply(this, arguments)
originalRequire = Module::require
Module::require = ->
startTime = Date.now()
exports = originalRequire.apply(this, arguments)
cache.requireTime += Date.now() - startTime
exports
originalFindPath = Module._findPath
Module._findPath = (request, paths) ->
cacheKey = JSON.stringify({request, paths})
cache.findPathCount++ unless Module._pathCache[cacheKey]
startTime = Date.now()
foundPath = originalFindPath.apply(global, arguments)
cache.findPathTime += Date.now() - startTime
foundPath
exports.create = (modulePath) ->
fs = require 'fs-plus'
modulePath = fs.realpathSync(modulePath)
metadataPath = path.join(modulePath, 'package.json')
metadata = JSON.parse(fs.readFileSync(metadataPath))
moduleCache =
version: 1
dependencies: []
extensions: {}
folders: []
loadDependencies(modulePath, modulePath, metadata, moduleCache)
loadFolderCompatibility(modulePath, modulePath, metadata, moduleCache)
loadExtensions(modulePath, modulePath, metadata, moduleCache)
metadata._atomModuleCache = moduleCache
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2))
return
exports.register = ({resourcePath, devMode}={}) ->
return if cache.registered
originalResolveFilename = Module._resolveFilename
Module._resolveFilename = (relativePath, parentModule) ->
resolvedPath = resolveModulePath(relativePath, parentModule)
resolvedPath ?= resolveFilePath(relativePath, parentModule)
resolvedPath ? originalResolveFilename(relativePath, parentModule)
cache.registered = true
cache.resourcePath = resourcePath
cache.resourcePathWithTrailingSlash = "#{resourcePath}#{path.sep}"
registerBuiltins(devMode)
return
exports.add = (directoryPath, metadata) ->
# path.join isn't used in this function for speed since path.join calls
# path.normalize and all the paths are already normalized here.
unless metadata?
try
metadata = require("#{directoryPath}#{path.sep}package.json")
catch error
return
cacheToAdd = metadata?._atomModuleCache
return unless cacheToAdd?
for dependency in cacheToAdd.dependencies ? []
cache.dependencies[dependency.name] ?= {}
cache.dependencies[dependency.name][dependency.version] ?= "#{directoryPath}#{path.sep}#{dependency.path}"
for entry in cacheToAdd.folders ? []
for folderPath in entry.paths
if folderPath
cache.folders["#{directoryPath}#{path.sep}#{folderPath}"] = entry.dependencies
else
cache.folders[directoryPath] = entry.dependencies
for extension, paths of cacheToAdd.extensions
cache.extensions[extension] ?= new Set()
for filePath in paths
cache.extensions[extension].add("#{directoryPath}#{path.sep}#{filePath}")
return
exports.cache = cache
+2 -2
Ver Arquivo
@@ -29,11 +29,11 @@ module.exports =
class PackageManager
EmitterMixin.includeInto(this)
constructor: ({configDirPath, devMode, safeMode, @resourcePath}) ->
constructor: ({configDirPath, @devMode, safeMode, @resourcePath}) ->
@emitter = new Emitter
@packageDirPaths = []
unless safeMode
if devMode
if @devMode
@packageDirPaths.push(path.join(configDirPath, "dev", "packages"))
@packageDirPaths.push(path.join(configDirPath, "packages"))
+74 -28
Ver Arquivo
@@ -10,8 +10,14 @@ Q = require 'q'
{deprecate} = require 'grim'
$ = null # Defer require in case this is in the window-less browser process
ModuleCache = require './module-cache'
ScopedProperties = require './scoped-properties'
try
packagesCache = require('../package.json')?._atomPackages ? {}
catch error
packagesCache = {}
# Loads and activates a package's main module and resources such as
# stylesheets, keymaps, grammar, editor properties, and menus.
module.exports =
@@ -20,19 +26,31 @@ class Package
@stylesheetsDir: 'stylesheets'
@isBundledPackagePath: (packagePath) ->
if atom.packages.devMode
return false unless atom.packages.resourcePath.startsWith("#{process.resourcesPath}#{path.sep}")
@resourcePathWithTrailingSlash ?= "#{atom.packages.resourcePath}#{path.sep}"
packagePath?.startsWith(@resourcePathWithTrailingSlash)
@loadMetadata: (packagePath, ignoreErrors=false) ->
if metadataPath = CSON.resolve(path.join(packagePath, 'package'))
try
metadata = CSON.readFileSync(metadataPath)
catch error
throw error unless ignoreErrors
packageName = path.basename(packagePath)
if @isBundledPackagePath(packagePath)
metadata = packagesCache[packageName]?.metadata
unless metadata?
if metadataPath = CSON.resolve(path.join(packagePath, 'package'))
try
metadata = CSON.readFileSync(metadataPath)
catch error
throw error unless ignoreErrors
metadata ?= {}
metadata.name = path.basename(packagePath)
metadata.name = packageName
metadata
keymaps: null
menus: null
stylesheets: null
stylesheetDisposables: null
grammars: null
scopedProperties: null
mainModulePath: null
@@ -46,7 +64,9 @@ class Package
constructor: (@path, @metadata) ->
@emitter = new Emitter
@metadata ?= Package.loadMetadata(@path)
@bundledPackage = Package.isBundledPackagePath(@path)
@name = @metadata?.name ? path.basename(@path)
ModuleCache.add(@path, @metadata)
@reset()
###
@@ -156,16 +176,24 @@ class Package
activateStylesheets: ->
return if @stylesheetsActivated
type = @getStylesheetType()
for [stylesheetPath, content] in @stylesheets
atom.themes.applyStylesheet(stylesheetPath, content, type)
group = @getStylesheetType()
@stylesheetDisposables = new CompositeDisposable
for [sourcePath, source] in @stylesheets
if match = path.basename(sourcePath).match(/[^.]*\.([^.]*)\./)
context = match[1]
else if @metadata.theme is 'syntax'
context = 'atom-text-editor'
else
context = undefined
@stylesheetDisposables.add(atom.styles.addStyleSheet(source, {sourcePath, group, context}))
@stylesheetsActivated = true
activateResources: ->
@activationDisposables = new CompositeDisposable
@activationDisposables.add(atom.keymaps.add(keymapPath, map)) for [keymapPath, map] in @keymaps
@activationDisposables.add(atom.contextMenu.add(map['context-menu'])) for [menuPath, map] in @menus
@activationDisposables.add(atom.menu.add(map.menu)) for [menuPath, map] in @menus when map.menu
@activationDisposables.add(atom.contextMenu.add(map['context-menu'])) for [menuPath, map] in @menus when map['context-menu']?
@activationDisposables.add(atom.menu.add(map['menu'])) for [menuPath, map] in @menus when map['menu']?
unless @grammarsActivated
grammar.activate() for grammar in @grammars
@@ -175,10 +203,16 @@ class Package
@scopedPropertiesActivated = true
loadKeymaps: ->
@keymaps = @getKeymapPaths().map (keymapPath) -> [keymapPath, CSON.readFileSync(keymapPath)]
if @bundledPackage and packagesCache[@name]?
@keymaps = (["#{atom.packages.resourcePath}#{path.sep}#{keymapPath}", keymapObject] for keymapPath, keymapObject of packagesCache[@name].keymaps)
else
@keymaps = @getKeymapPaths().map (keymapPath) -> [keymapPath, CSON.readFileSync(keymapPath)]
loadMenus: ->
@menus = @getMenuPaths().map (menuPath) -> [menuPath, CSON.readFileSync(menuPath)]
if @bundledPackage and packagesCache[@name]?
@menus = (["#{atom.packages.resourcePath}#{path.sep}#{menuPath}", menuObject] for menuPath, menuObject of packagesCache[@name].menus)
else
@menus = @getMenuPaths().map (menuPath) -> [menuPath, CSON.readFileSync(menuPath)]
getKeymapPaths: ->
keymapsDirPath = path.join(@path, 'keymaps')
@@ -295,7 +329,7 @@ class Package
deactivateResources: ->
grammar.deactivate() for grammar in @grammars
scopedProperties.deactivate() for scopedProperties in @scopedProperties
atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in @stylesheets
@stylesheetDisposables?.dispose()
@activationDisposables?.dispose()
@stylesheetsActivated = false
@grammarsActivated = false
@@ -304,27 +338,38 @@ class Package
reloadStylesheets: ->
oldSheets = _.clone(@stylesheets)
@loadStylesheets()
atom.themes.removeStylesheet(stylesheetPath) for [stylesheetPath] in oldSheets
@reloadStylesheet(stylesheetPath, content) for [stylesheetPath, content] in @stylesheets
reloadStylesheet: (stylesheetPath, content) ->
atom.themes.applyStylesheet(stylesheetPath, content, @getStylesheetType())
@stylesheetDisposables.dispose()
@stylesheetDisposables = new CompositeDisposable
@stylesheetsActivated = false
@activateStylesheets()
requireMainModule: ->
return @mainModule if @mainModule?
return unless @isCompatible()
unless @isCompatible()
console.warn """
Failed to require the main module of '#{@name}' because it requires an incompatible native module.
Run `apm rebuild` in the package directory to resolve.
"""
return
mainModulePath = @getMainModulePath()
@mainModule = require(mainModulePath) if fs.isFileSync(mainModulePath)
getMainModulePath: ->
return @mainModulePath if @resolvedMainModulePath
@resolvedMainModulePath = true
mainModulePath =
if @metadata.main
path.join(@path, @metadata.main)
if @bundledPackage and packagesCache[@name]?
if packagesCache[@name].main
@mainModulePath = "#{atom.packages.resourcePath}#{path.sep}#{packagesCache[@name].main}"
else
path.join(@path, 'index')
@mainModulePath = fs.resolveExtension(mainModulePath, ["", _.keys(require.extensions)...])
@mainModulePath = null
else
mainModulePath =
if @metadata.main
path.join(@path, @metadata.main)
else
path.join(@path, 'index')
@mainModulePath = fs.resolveExtension(mainModulePath, ["", _.keys(require.extensions)...])
hasActivationCommands: ->
for selector, commands of @getActivationCommands()
@@ -336,8 +381,10 @@ class Package
for selector, commands of @getActivationCommands()
for command in commands
do (selector, command) =>
atom.commands.commandRegistered(command)
@activationCommandSubscriptions.add(atom.commands.onWillDispatch (event) =>
# Add dummy command so it appears in menu.
# The real command will be registered on package activation
@activationCommandSubscriptions.add atom.commands.add selector, command, ->
@activationCommandSubscriptions.add atom.commands.onWillDispatch (event) =>
return unless event.type is command
currentTarget = event.target
while currentTarget
@@ -346,7 +393,6 @@ class Package
@activateNow()
break
currentTarget = currentTarget.parentElement
)
getActivationCommands: ->
return @activationCommands if @activationCommands?
+8
Ver Arquivo
@@ -40,6 +40,8 @@ class PaneContainer extends Model
@registerViewProviders()
@setRoot(params?.root ? new Pane)
@setActivePane(@getPanes()[0]) unless @getActivePane()
@destroyEmptyPanes() if params?.destroyEmptyPanes
@monitorActivePaneItem()
@@ -137,6 +139,9 @@ class PaneContainer extends Model
setActivePane: (activePane) ->
if activePane isnt @activePane
unless activePane in @getPanes()
throw new Error("Setting active pane that is not present in pane container")
@activePane = activePane
@emitter.emit 'did-change-active-pane', @activePane
@activePane
@@ -147,6 +152,9 @@ class PaneContainer extends Model
paneForUri: (uri) ->
find @getPanes(), (pane) -> pane.itemForUri(uri)?
paneForItem: (item) ->
@getPanes().find (pane) -> item in pane.getItems()
saveAll: ->
pane.saveItems() for pane in @getPanes()
+40 -35
Ver Arquivo
@@ -28,39 +28,21 @@ class PaneElement extends HTMLElement
@itemViews.setAttribute 'class', 'item-views'
subscribeToDOMEvents: ->
@addEventListener 'focusin', => @model.focus()
@addEventListener 'focusout', => @model.blur()
@addEventListener 'focus', => @getActiveView()?.focus()
handleFocus = (event) =>
@model.focus()
if event.target is this and view = @getActiveView()
view.focus()
event.stopPropagation()
handleBlur = (event) =>
@model.blur() unless @contains(event.relatedTarget)
@addEventListener 'focus', handleFocus, true
@addEventListener 'blur', handleBlur, true
createSpacePenShim: ->
@__spacePenView = new PaneView(this)
addCommands = (handlersByName) =>
for name, handler of handlersByName
do (handler) =>
@__spacePenView.command name, => handler.apply(this, arguments)
addCommands(
'pane:save-items': -> @getModel().saveItems()
'pane:show-next-item': -> @getModel().activateNextItem()
'pane:show-previous-item': -> @getModel().activatePreviousItem()
'pane:show-item-1': -> @getModel().activateItemAtIndex(0)
'pane:show-item-2': -> @getModel().activateItemAtIndex(1)
'pane:show-item-3': -> @getModel().activateItemAtIndex(2)
'pane:show-item-4': -> @getModel().activateItemAtIndex(3)
'pane:show-item-5': -> @getModel().activateItemAtIndex(4)
'pane:show-item-6': -> @getModel().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
'pane:split-down': -> @getModel().splitDown(copyActiveItem: true)
'pane:close': -> @getModel().destroy()
'pane:close-other-items': -> @getModel().destroyInactiveItems()
)
getModel: -> @model
setModel: (@model) ->
@@ -86,16 +68,16 @@ class PaneElement extends HTMLElement
hasFocus = @hasFocus()
itemView = @model.getView(item)
unless @itemViews.contains(itemView)
@itemViews.appendChild(itemView)
callAttachHooks(itemView)
for child in @itemViews.children
if child is itemView
@showItemView(child) if @attached
else
@hideItemView(child)
unless @itemViews.contains(itemView)
@itemViews.appendChild(itemView)
callAttachHooks(itemView)
itemView.focus() if hasFocus
showItemView: (itemView) ->
@@ -107,8 +89,9 @@ class PaneElement extends HTMLElement
hideItemView: (itemView) ->
inlineDisplayStyle = itemView.style.display
@inlineDisplayStyles.set(itemView, inlineDisplayStyle) if inlineDisplayStyle?
itemView.style.display = 'none'
unless inlineDisplayStyle is 'none'
@inlineDisplayStyles.set(itemView, inlineDisplayStyle) if inlineDisplayStyle?
itemView.style.display = 'none'
itemRemoved: ({item, index, destroyed}) ->
if viewToRemove = @model.getView(item)
@@ -123,4 +106,26 @@ class PaneElement extends HTMLElement
hasFocus: ->
this is document.activeElement or @contains(document.activeElement)
atom.commands.add 'atom-pane',
'pane:save-items': -> @getModel().saveItems()
'pane:show-next-item': -> @getModel().activateNextItem()
'pane:show-previous-item': -> @getModel().activatePreviousItem()
'pane:show-item-1': -> @getModel().activateItemAtIndex(0)
'pane:show-item-2': -> @getModel().activateItemAtIndex(1)
'pane:show-item-3': -> @getModel().activateItemAtIndex(2)
'pane:show-item-4': -> @getModel().activateItemAtIndex(3)
'pane:show-item-5': -> @getModel().activateItemAtIndex(4)
'pane:show-item-6': -> @getModel().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
'pane:move-item-right': -> @getModel().moveItemRight()
'pane:move-item-left': -> @getModel().moveItemLeft()
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
'pane:split-down': -> @getModel().splitDown(copyActiveItem: true)
'pane:close': -> @getModel().close()
'pane:close-other-items': -> @getModel().destroyInactiveItems()
module.exports = PaneElement = document.registerElement 'atom-pane', prototype: PaneElement.prototype
+2 -8
Ver Arquivo
@@ -119,7 +119,7 @@ class PaneView extends View
deprecate 'Please return a Disposable object from your ::onDidChangeTitle method!' unless disposable?.dispose?
@activeItemDisposables.add(disposable) if disposable?.dispose?
else if item.on?
deprecate '::on methods for items are no longer supported. If you would like your item to support title change behavior, please implement a ::onDidChangeTitle() method.'
deprecate 'If you would like your pane item to support title change behavior, please implement a ::onDidChangeTitle() method. ::on methods for items are no longer supported. If not, ignore this message.'
disposable = item.on('title-changed', @activeItemTitleChanged)
@activeItemDisposables.add(disposable) if disposable?.dispose?
@@ -128,16 +128,10 @@ class PaneView extends View
deprecate 'Please return a Disposable object from your ::onDidChangeModified method!' unless disposable?.dispose?
@activeItemDisposables.add(disposable) if disposable?.dispose?
else if item.on?
deprecate '::on methods for items are no longer supported. If you would like your item to support modified behavior, please implement a ::onDidChangeModified() method.'
deprecate 'If you would like your pane item to support modified behavior, please implement a ::onDidChangeModified() method. If not, ignore this message. ::on methods for items are no longer supported.'
item.on('modified-status-changed', @activeItemModifiedChanged)
@activeItemDisposables.add(disposable) if disposable?.dispose?
view = @model.getView(item).__spacePenView
otherView.hide() for otherView in @itemViews.children().not(view).views()
@itemViews.append(view) unless view.parent().is(@itemViews)
view.show() if @attached
view.focus() if @hasFocus()
@trigger 'pane:active-item-changed', [item]
onItemAdded: ({item, index}) =>
+25 -2
Ver Arquivo
@@ -63,8 +63,9 @@ class Pane extends Model
getContainer: -> @container
setContainer: (container) ->
container.didAddPane({pane: this}) unless container is @container
@container = container
unless container is @container
@container = container
container.didAddPane({pane: this})
###
Section: Event Subscription
@@ -288,6 +289,18 @@ class Pane extends Model
else
@activateItemAtIndex(@items.length - 1)
# Public: Move the active tab to the right.
moveItemRight: ->
index = @getActiveItemIndex()
rightItemIndex = index + 1
@moveItem(@getActiveItem(), rightItemIndex) unless rightItemIndex > @items.length - 1
# Public: Move the active tab to the left
moveItemLeft: ->
index = @getActiveItemIndex()
leftItemIndex = index - 1
@moveItem(@getActiveItem(), leftItemIndex) unless leftItemIndex < 0
# Public: Get the index of the active item.
#
# Returns a {Number}.
@@ -501,6 +514,8 @@ class Pane extends Model
# Public: Makes this pane the *active* pane, causing it to gain focus.
activate: ->
throw new Error("Pane has been destroyed") if @isDestroyed()
@container?.setActivePane(this)
@emit 'activated'
@emitter.emit 'did-activate'
@@ -605,3 +620,11 @@ class Pane extends Model
rightmostSibling
else
@splitRight()
close: ->
@destroy() if @confirmClose()
confirmClose: ->
for item in @getItems()
return false unless @promptToSaveItem(item)
true
+42
Ver Arquivo
@@ -0,0 +1,42 @@
{CompositeDisposable} = require 'event-kit'
class PanelContainerElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
getModel: -> @model
setModel: (@model) ->
@subscriptions.add @model.onDidAddPanel(@panelAdded.bind(this))
@subscriptions.add @model.onDidRemovePanel(@panelRemoved.bind(this))
@subscriptions.add @model.onDidDestroy(@destroyed.bind(this))
@setAttribute('location', @model.getLocation())
panelAdded: ({panel, index}) ->
panelElement = panel.getView()
panelElement.setAttribute('location', @model.getLocation())
if index >= @childNodes.length
@appendChild(panelElement)
else
referenceItem = @childNodes[index + 1]
@insertBefore(panelElement, referenceItem)
if @model.isModal()
@hideAllPanelsExcept(panel)
@subscriptions.add panel.onDidChangeVisible (visible) =>
@hideAllPanelsExcept(panel) if visible
panelRemoved: ({panel, index}) ->
@removeChild(panel.getView())
destroyed: ->
@subscriptions.dispose()
@parentNode?.removeChild(this)
hideAllPanelsExcept: (excludedPanel) ->
for panel in @model.getPanels()
panel.hide() unless panel is excludedPanel
return
module.exports = PanelContainerElement = document.registerElement 'atom-panel-container', prototype: PanelContainerElement.prototype
+68
Ver Arquivo
@@ -0,0 +1,68 @@
{Emitter, CompositeDisposable} = require 'event-kit'
module.exports =
class PanelContainer
constructor: ({@viewRegistry, @location}) ->
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@panels = []
destroy: ->
panel.destroy() for panel in @getPanels()
@subscriptions.dispose()
@emitter.emit 'did-destroy', this
@emitter.dispose()
###
Section: Event Subscription
###
onDidAddPanel: (callback) ->
@emitter.on 'did-add-panel', callback
onDidRemovePanel: (callback) ->
@emitter.on 'did-remove-panel', callback
onDidDestroy: (callback) ->
@emitter.on 'did-destroy', callback
###
Section: Panels
###
getView: -> @viewRegistry.getView(this)
getLocation: -> @location
isModal: -> @location is 'modal'
getPanels: -> @panels
addPanel: (panel) ->
@subscriptions.add panel.onDidDestroy(@panelDestroyed.bind(this))
index = @getPanelIndex(panel)
if index is @panels.length
@panels.push(panel)
else
@panels.splice(index, 0, panel)
@emitter.emit 'did-add-panel', {panel, index}
panel
panelDestroyed: (panel) ->
index = @panels.indexOf(panel)
if index > -1
@panels.splice(index, 1)
@emitter.emit 'did-remove-panel', {panel, index}
getPanelIndex: (panel) ->
priority = panel.getPriority()
if @location in ['bottom', 'right']
for p, i in @panels by -1
return i + 1 if priority < p.getPriority()
0
else
for p, i in @panels
return i if priority < p.getPriority()
@panels.length

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