Comparar commits

...

235 Commits

Autor SHA1 Mensagem Data
Kevin Sawicki 5ced583a7c Prepare 0.43.0 release 2013-12-09 14:40:54 -08:00
Ben Ogle 308bb95ea2 upgrade to feedback@0.16.0 2013-12-09 12:09:37 -08:00
Ben Ogle 3490022180 Upgrade to find-and-replace@0.57.0 2013-12-09 11:53:49 -08:00
Ben Ogle e61d482384 Ugrade to find-and-replace@o0.56.0 2013-12-09 10:43:41 -08:00
Kevin Sawicki b108b5030a Upgrade to language-ruby@0.6.0 2013-12-09 08:18:30 -08:00
Kevin Sawicki 943fe29ca3 Upgrade to metrics@0.14.0 for spec fixes 2013-12-09 08:17:39 -08:00
Kevin Sawicki 2bbf7fd0d7 Upgrade to metrics@0.13.0 2013-12-09 08:09:59 -08:00
Cheng Zhao 42e9c612b2 Merge pull request #1219 from atom/atom-shell-v0.7.5
Update to atom-shell v0.7.6.
2013-12-09 01:00:24 -08:00
Cheng Zhao 33778cefdd Merge branch 'master' into atom-shell-v0.7.5 2013-12-09 16:52:05 +08:00
Cheng Zhao 39fb5dc134 Update to atom-shell v0.7.6. 2013-12-09 16:46:27 +08:00
Kevin Sawicki ffedaa1bc1 Upgrade to git-diff@0.20.0 for new move commands 2013-12-08 20:02:12 -08:00
Nathan Sobo 3402504779 Merge branch 'ns-latest-telepath' 2013-12-07 14:09:39 -08:00
Nathan Sobo f25d8d83c5 Merge branch 'master' into ns-latest-telepath 2013-12-07 13:58:53 -08:00
Nathan Sobo b4270b1e9e Merge branch 'ns-mock-cson-in-config-specs' 2013-12-07 13:52:00 -08:00
Kevin Sawicki 98701283e8 Merge pull request #1247 from atom/ks-observe-tab-length
Observe editor.tabLength config in TokenizedBuffer
2013-12-07 11:52:18 -08:00
Kevin Sawicki 34f71a2623 Observe editor.tabLength config in TokenizedBuffer
Closes #1224
2013-12-07 11:43:48 -08:00
Kevin Sawicki af06bf8984 Merge pull request #1258 from atom/ks-refresh-less-cache
Refresh less cache before activating themes
2013-12-07 11:38:32 -08:00
Kevin Sawicki 796632c36c Refresh less cache before activating themes
This ensures the import paths for themes contain the stylesheet directories

Closes #1225
2013-12-07 11:31:06 -08:00
Kevin Sawicki 65fa5bf880 Upgrade to settings-view@0.50.0, closes #1264 2013-12-07 11:28:02 -08:00
Nathan Sobo 88eb803d91 Mock season.writeFileSyne instead of fs.writeFileSync in config specs
The spec suite has been overwriting my config directory in weird cases.
While investigating it I noticed that we mock writeFileSync directly in
these specs, but we actually use season to write the config cson. This
makes this spec a bit simpler because it doesn't have to parse the CSON
in the spec. Lower level assertions belong on the season package itself.
2013-12-06 22:10:26 -08:00
Nathan Sobo b61654b52f Upgrade to telepath 0.61.0
This version adds a bunch of reactive primitives and ensures we destroy
documents when they are no longer referenced.
2013-12-06 21:55:57 -08:00
Nathan Sobo db1768a9c7 Upgrade feedback to 0.15.0 for spec fix 2013-12-06 21:55:43 -08:00
Nathan Sobo 6156dac3de Update status-bar to 0.24.0 so specs pass with new telepath 2013-12-06 19:57:05 -08:00
Daniel Hengeveld d5a7f7396e Merge pull request #1259 from atom/fix-doc-url
fix doc url
2013-12-06 14:16:06 -08:00
Daniel Hengeveld ca65ff6c55 fix doc url 2013-12-06 14:15:19 -08:00
Ben Ogle 49782d3335 Upgrade to feedback!0.14.0 2013-12-06 13:55:15 -08:00
Kevin Sawicki e45aeecb0a Update specs now that syntax themes have stylesheets folders 2013-12-06 13:24:34 -08:00
Kevin Sawicki d3edf33dc4 Upgrade syntax themes with new syntax-variables.less 2013-12-06 13:08:20 -08:00
Kevin Sawicki c54c925793 Merge pull request #1246 from atom/ks-color-commit-messages
Add a splash of color to commit messages
2013-12-06 13:06:52 -08:00
Kevin Sawicki e3b89aca93 Use defaults similar to ui-variables colors 2013-12-06 12:56:15 -08:00
Kevin Sawicki 9183d4968f Only include used colors for now 2013-12-06 12:56:14 -08:00
Kevin Sawicki 1aa96fc37a Drop text segment from color 2013-12-06 12:56:14 -08:00
Kevin Sawicki d75d3b6d09 Import syntax-variables in atom.less 2013-12-06 12:56:14 -08:00
Kevin Sawicki f60856eca7 Add more syntax variables 2013-12-06 12:56:14 -08:00
Kevin Sawicki 3a7049a1d9 Import syntax in atom.less 2013-12-06 12:56:14 -08:00
Kevin Sawicki 29d1b42d04 Move git markup styles to syntax.less 2013-12-06 12:56:14 -08:00
Kevin Sawicki 80552675d0 Add initial syntax-variables.less 2013-12-06 12:56:14 -08:00
Kevin Sawicki ff696355ee Use color variables for commit message files 2013-12-06 12:56:14 -08:00
Kevin Sawicki 3a2c4ca74d Upgrade to github-sign-in@0.15.0 2013-12-06 12:53:53 -08:00
Kevin Sawicki 777cc4b561 Merge pull request #1236 from atom/package-install-docs
Add manual package install directions to Atom docs
2013-12-06 12:27:54 -08:00
Kevin Sawicki c0fe3c01de 📝 Remove extra space 2013-12-06 12:26:52 -08:00
Kevin Sawicki 97dbe0d3b2 📝 Wording tweaks and link to apm and emmet 2013-12-06 12:26:24 -08:00
Cameron McEfee 250938869e Use @gjtorikian's suggested copy 2013-12-06 12:26:24 -08:00
Cameron McEfee 6092de9af8 Add manual package install directions to Atom docs 2013-12-06 12:26:23 -08:00
Ben Ogle 01855901e7 Upgrade release-notes and github-sign-in 2013-12-06 12:07:16 -08:00
Ben Ogle 161542a4af Merge pull request #1240 from atom/bo-token-stuff
Add token dealings to atom core
2013-12-06 12:04:52 -08:00
Ben Ogle 6d2bd7756e Add the getGitHubAuthTokenName fn back in 2013-12-06 11:57:31 -08:00
Ben Ogle f0fece2cf0 Add getters and setters for the keychain 2013-12-06 11:45:18 -08:00
Ben Ogle c36ee1dbe6 Add getGitHubTokenName 2013-12-06 11:39:40 -08:00
Ben Ogle 76ec5a98c4 Upgrade to atom-dark-ui@0.13.0 2013-12-06 10:59:16 -08:00
Ben Ogle ec022b5c77 Upgrade to feedback@0.13.0 2013-12-06 10:44:40 -08:00
Kevin Sawicki 912636a599 Upgrade to autosave@0.10.0 refs #1183 2013-12-06 10:05:44 -08:00
Kevin Sawicki 011c3cc223 Merge pull request #1237 from atom/ks-hard-tab-cache
Fix caching of hard tabs
2013-12-06 08:55:08 -08:00
Kevin Sawicki 433b64d581 Update spec for new hard tab span text length 2013-12-06 08:27:00 -08:00
Kevin Sawicki 365d69a19c Add missing s to invisible 2013-12-06 08:26:59 -08:00
Kevin Sawicki 5d1e507988 Remove extra newline 2013-12-06 08:26:59 -08:00
Kevin Sawicki 776b267396 💄 Correct indent 2013-12-06 08:26:59 -08:00
Kevin Sawicki 77e4b7f90f Use value ivar when invisible.tab is falsy 2013-12-06 08:26:59 -08:00
Kevin Sawicki 2501b98e8f Fix typo constructor 2013-12-06 08:26:59 -08:00
Kevin Sawicki 32d301ef34 typo: invisibles not invisible 2013-12-06 08:26:59 -08:00
Kevin Sawicki & Nathan Sobo f4861b7919 💄 Use @constructor instead of EditorView 2013-12-06 08:26:59 -08:00
Kevin Sawicki & Nathan Sobo 94e4fef108 Use DisplayBuffer::lineForRow in EditorView::positionLeftForLineAndColumn
Previously the tokenized lines were obtained from the tokenized buffer
which skipped the translation to screen coordinates.

Closes #1231
2013-12-06 08:26:59 -08:00
Kevin Sawicki & Nathan Sobo 7ae432fad5 Place entire hard tab value inside span
Previously only the first character was included in the span.
2013-12-06 08:26:59 -08:00
Ben Ogle 18057e303b Remove getUserAgent. just use navigator.userAgent 2013-12-05 18:55:20 -08:00
Matt Colyer 71064adae2 Upgrade grunt-download-atom-shell@0.1.3 2013-12-05 16:44:55 -08:00
Matt Colyer 43d964c357 Upgrade grunt-download-atom-shell@0.1.2 2013-12-05 11:39:59 -08:00
Ben Ogle 5f4115cb81 Add more native keybindings 2013-12-05 11:08:14 -08:00
Kevin Sawicki 8cf2cdb2a9 Add script/install-cli to install atom and apm 2013-12-05 11:02:37 -08:00
Kevin Sawicki a460530770 Show warning message opening opening dev window without repo cloned 2013-12-05 10:43:45 -08:00
Kevin Sawicki 162bab506d Mention package repositories 2013-12-05 08:50:58 -08:00
Cheng Zhao 6c5669b53d Add "productName" in package.json.
Atom-Shell would use it as application's name.
2013-12-05 18:15:26 +08:00
Cheng Zhao a7db8229d5 Also change the version field of package.json in set-development-version task. 2013-12-05 18:13:42 +08:00
Cheng Zhao b7848d760f Update to atom-shell v0.7.5. 2013-12-05 17:48:55 +08:00
Ben Ogle e6d8f3b9bf Merge pull request #1218 from shama/doc-typos
A couple typo fixes in the docs.
2013-12-04 21:12:09 -08:00
Kyle Robinson Young 0e270f85ba A couple typo fixes in the docs. 2013-12-04 20:40:27 -08:00
Kevin Sawicki 9e3f4dc033 Prepare 0.42.0 release 2013-12-04 19:04:36 -08:00
Kevin Sawicki c1a744b29c Make ATOM_ACCESS_TOKEN available in all grunt commands 2013-12-04 19:02:39 -08:00
Kevin Sawicki a283161c1e Upgrade to tree-view@0.43.0 refs #1213 2013-12-04 18:24:28 -08:00
Ben Ogle 9ede9571bc Upgrade to release-notes@0.14.0 2013-12-04 16:32:52 -08:00
Ben Ogle dbc21befec Upgrade to welcome@0.3.0 2013-12-04 16:28:31 -08:00
Ben Ogle ca0f0357d7 Upgrade to feedback@0.12.0 2013-12-04 16:25:15 -08:00
probablycorey be1c1f8719 Use permanent image link for atom logo 2013-12-04 16:19:33 -08:00
Cheng Zhao e95c60b4ec 💄 Fix typo in dialog. 2013-12-05 08:17:33 +08:00
probablycorey 847dd6d93b Update welcome package 2013-12-04 16:03:29 -08:00
Kevin Sawicki 7f62720350 Merge pull request #1208 from atom/ks-erb-infinite-parse-loop
Prevent infinite loop in erb grammar
2013-12-04 15:34:10 -08:00
Kevin Sawicki 8af0a59c52 Pop stack when rule is pushed without position advancement
Previously only the scope name was checked which allowed cases
were rules without scope names to grow the stack infinitely without
advancing the position.

Closes atom/language-ruby-on-rails#1
2013-12-04 15:18:33 -08:00
Kevin Sawicki 31a909828d Don't override ATOM_ACCESS_TOKEN if already set 2013-12-04 14:40:37 -08:00
Ben Ogle 78562dcf15 Upgrade to github-sign-in@0.14.0 2013-12-04 14:31:23 -08:00
Ben Ogle 4869fad7f6 Add styling for headings in overlays. 2013-12-04 14:29:32 -08:00
probablycorey 77da136d17 Update cmd-shift-P references and getting started doc 2013-12-04 14:07:43 -08:00
probablycorey 67b1d0d22a Update atom shell to 0.7.4 2013-12-04 14:03:58 -08:00
Kevin Sawicki 23fcb59c5d Upgrade to language-ruby@0.5.0 2013-12-04 14:00:50 -08:00
probablycorey 16ef30dc82 Update feedback package 2013-12-04 12:09:11 -08:00
Ben Ogle e3a4f450ad Update themes to have better tree-view focusing 2013-12-04 12:06:04 -08:00
Kevin Sawicki 847578398d Prepare 0.41.0 release 2013-12-04 12:02:08 -08:00
Kevin Sawicki 63dc8863e3 Use atom-bot's token as ATOM_ACCESS_TOKEN 2013-12-04 11:38:25 -08:00
Kevin Sawicki 58d09ec5a0 Update to fs-plus@0.10.0 2013-12-04 11:36:38 -08:00
Ben Ogle bb5d70fa2e Merge pull request #1182 from atom/removing-core-treeview-settings
Removing core treeview settings
2013-12-04 11:26:06 -08:00
Kevin Sawicki 4a904673e5 Upgrade apm for keychain token name fix 2013-12-04 11:22:50 -08:00
Kevin Sawicki 4c1d47779b 💄 Sort themes better 2013-12-04 09:36:14 -08:00
Kevin Sawicki a0adc32e04 💄 Sort themes 2013-12-04 09:35:50 -08:00
Kevin Sawicki 2434db4dc2 Merge pull request #1174 from atom/cj-update-docs
Update docs
2013-12-04 09:17:16 -08:00
Kevin Sawicki e2ee99556d Merge branch 'master' into cj-update-docs 2013-12-04 09:01:27 -08:00
Kevin Sawicki cececc2297 Update to new logo url 2013-12-04 08:58:04 -08:00
Kevin Sawicki f0825ca526 Add simple explanation 2013-12-04 08:55:19 -08:00
Kevin Sawicki 57c0261f96 Add Git commit messages section 2013-12-04 08:53:24 -08:00
Kevin Sawicki 6891922e07 Use friendlier emoji 2013-12-04 08:50:43 -08:00
Kevin Sawicki e03a7c336d Add example to require ordering section 2013-12-04 08:50:07 -08:00
Kevin Sawicki 49a32dd2dc Remove cmake dependency 2013-12-04 08:48:45 -08:00
Kevin Sawicki 94d4ad618c Add require(atom) for home directory example 2013-12-04 08:48:22 -08:00
Cheng Zhao 9b0f8ccee0 Merge pull request #1192 from atom/grunt-download-atom-shell
Use grunt-download-atom-shell to download and update atom-shell.
2013-12-03 22:07:34 -08:00
Nathan Sobo fa963f0583 Upgrade telepath to 0.45.1 in hopes of addressing #1153
Basically, it just hacks ArrayMarker::getRawStart/EndIndex in
non-replicated mode to check that the index isn't out of range. I'd
rather get to the root cause but I'm hoping this can save us some pain
in the short term while a lot of balls are in the air.
2013-12-03 20:17:01 -06:00
Ben Ogle d36c4f0ec9 getUserAgent() 2013-12-03 17:45:40 -08:00
probablycorey e6e72d99f3 Add welcome package 2013-12-03 15:37:48 -08:00
Kevin Sawicki 9ce22fd6d3 Add back internally used isPathModified 2013-12-03 13:37:21 -08:00
Garen Torikian 5166ca274c 📝 Typo fix 2013-12-03 13:02:35 -08:00
Kevin Sawicki 6f1dd702b0 Add back internally used Project::findBufferForPath 2013-12-03 12:12:28 -08:00
Kevin Sawicki 1d4f447975 📝 Fill in SelectList docs 2013-12-03 12:02:41 -08:00
Kevin Sawicki 4998fdda85 Remove unused methods in Project 2013-12-03 11:40:28 -08:00
Ben Ogle aa52428c26 Merge pull request #1193 from atom/dev-icon
Adjusting padding for new tabs
2013-12-03 11:30:43 -08:00
Matt Graham 9c1127dd1b adjusting padding for new tabs 2013-12-03 11:30:19 -08:00
Kevin Sawicki 91d4ef2653 📝 Mark more EditorView methods private 2013-12-03 11:25:17 -08:00
Kevin Sawicki 80cc881912 📝 Remove FIXME in Editor::transpose 2013-12-03 11:21:12 -08:00
Kevin Sawicki 867aaa8f95 📝 Move transact to public section with delegates tag 2013-12-03 11:21:12 -08:00
Kevin Sawicki 28a1dc58e7 Merge pull request #1190 from atom/ks-soft-wrap-cache
Use buffer positions for char width cache
2013-12-03 11:06:31 -08:00
Kevin Sawicki ee7ef0f893 Add spec that previously failed 2013-12-03 10:54:27 -08:00
Kevin Sawicki eaf60a00b3 Use TokenizedLine::tokenAtBufferColumn to obtain scopes 2013-12-03 10:54:27 -08:00
Kevin Sawicki e01c19e6b7 Use buffer positions when calculating char widths
Previously the editor width cache was being accessed using
screen columns which could cause incorrect position left values
for wrapped lines.

Closes #1096
2013-12-03 10:54:27 -08:00
Kevin Sawicki 930e479cdb Upgrade apm for template updates 2013-12-03 10:50:47 -08:00
Matt Graham 46c6d63dcd removing focus from core 2013-12-03 10:37:31 -08:00
Kevin Sawicki 1b502c6349 Prepare 0.40.0 release 2013-12-03 10:04:54 -08:00
Kevin Sawicki 07eb01016d Upgrade to tree-view@0.42.0 for spec cleanup 2013-12-03 09:28:32 -08:00
Cheng Zhao 99d6955644 Ignore grunt-download-atom-shell when loading packages. 2013-12-03 22:04:21 +08:00
Cheng Zhao 3f05ff9b14 Download grunt-download-atom-shell from apm registry.
I published grunt-download-atom-shell to apm registry so we do not need
to specify a git URL here, and as I tested the CI cannot fetch private
node module repositories due to lack of credient.

When it could be public we should publish it to npm registry instead.
2013-12-03 21:10:16 +08:00
Cheng Zhao 9caf3ca349 💄 Fix atom-shell's download dir. 2013-12-03 20:13:17 +08:00
Cheng Zhao 25a1b77048 Use grunt-download-atom-shell to download and update atom-shell. 2013-12-03 19:54:42 +08:00
Cheng Zhao 866c0c0668 Merge pull request #1191 from atom/atom-shell-v0.7.3
Update atom-shell to v0.7.3.
2013-12-02 20:55:09 -08:00
Cheng Zhao 6094efde76 Update atom-shell to v0.7.3. 2013-12-03 12:45:55 +08:00
Cheng Zhao b4099ba66f Use the new breakpad crash reporter in both browser and renderer. 2013-12-03 12:45:44 +08:00
probablycorey 10b560b5a7 Update feedback package 2013-12-02 16:21:38 -08:00
probablycorey 305c331777 Update feedback package 2013-12-02 16:10:27 -08:00
probablycorey 0b5cad27d2 Add ' body' to make .native-binding selector more specific 2013-12-02 16:09:43 -08:00
Kevin Sawicki 7d967e71f4 Upgrade apm for new templates 2013-12-02 15:02:14 -08:00
Kevin Sawicki d36a0aa437 Update file.icns to match atom.icns 2013-12-02 11:52:05 -08:00
Kevin Sawicki 8316da3338 Use long opts strings for clarity 2013-12-02 11:26:51 -08:00
Kevin Sawicki a0b200565c Specify callback to dialog.showOpenDialog 2013-12-02 11:21:29 -08:00
Kevin Sawicki 8f4de0b568 Merge pull request #1184 from atom/ks-no-more-ids
Use classes instead of ids
2013-12-02 09:49:40 -08:00
Kevin Sawicki 45cd3e9335 Upgrade themes for id to class renames 2013-12-02 09:35:51 -08:00
Kevin Sawicki c58b30bba9 Use class instead of id for pane container 2013-12-02 08:41:34 -08:00
Kevin Sawicki 0093f39102 Add classes to workspace view elements 2013-12-02 08:32:23 -08:00
Kevin Sawicki b1f041fa6e Use a class instead of id for panes element 2013-12-02 08:27:32 -08:00
Kevin Sawicki ca11661f6d Use a class instead of id for vertical element 2013-12-02 08:26:07 -08:00
Kevin Sawicki bc4ceb189c Use a class instead of id for horizontal element 2013-12-02 08:25:48 -08:00
Kevin Sawicki 98694e5407 Use a class instead of id for workspace view 2013-12-02 08:23:29 -08:00
Kevin Sawicki 86ae743e9d Use correct workspace view id 2013-12-02 08:17:31 -08:00
Kevin Sawicki dddd515c35 Upgrade packages for EditSession/Editor renames 2013-11-28 09:27:01 -08:00
Kevin Sawicki 85d46004fd Merge pull request #1155 from atom/ks-license
Add license
2013-11-28 09:26:23 -08:00
Kevin Sawicki 5cb6aa0538 Add initial LICENSE.md 2013-11-28 09:20:05 -08:00
Ben Ogle d228cfe1ee Upgrade to find-and-replace@0.55.0 2013-11-27 16:13:19 -08:00
probablycorey a8f7c5201b Add more keystrokes to .native-key-bindings 2013-11-27 14:20:45 -08:00
probablycorey e15b96691e Sort node modules to the top of require list 2013-11-27 13:29:49 -08:00
Corey Johnson 3053c4a585 Merge pull request #1168 from atom/cj-feedback-package
Add feedback package
2013-11-27 11:32:59 -08:00
probablycorey 776d58bf21 Merge remote-tracking branch 'origin/master' into cj-feedback-package
Conflicts:
	package.json
	src/editor-view.coffee
2013-11-27 11:26:34 -08:00
probablycorey 1b5762274c Update contribution guidelines 2013-11-27 11:20:22 -08:00
probablycorey 1f20dbf16d Remove philosophy portion from contributions.
I feel like these suggestions are too subjective. I think we could
expand upon these ideas in a separate document, but they are a bit 
overwhelming for new contributors.
2013-11-27 11:19:37 -08:00
probablycorey 9fe507d675 Update readme and build instructions 2013-11-27 10:59:11 -08:00
Cheng Zhao a190a069c1 Ship the "resources" dir in Atom.app, and do not copy icon separately, fixes #1165. 2013-11-27 14:58:25 +08:00
Kevin Sawicki c697e58a71 Upgrade to styleguide@0.17.0 for EditorView rename fixes 2013-11-26 19:53:24 -08:00
Kevin Sawicki 1f36d0ca02 Upgrade to space-pen@2.0.1
Closes #1164
2013-11-26 19:44:27 -08:00
Kevin Sawicki 235a1e46ab Merge pull request #1169 from atom/ks-remove-editor-shims
Rename EditSession/Editor to Editor/EditorView
2013-11-26 19:43:53 -08:00
Kevin Sawicki 1197dc1979 Upgrade to find-and-replace@0.54.0 2013-11-26 19:36:01 -08:00
Kevin Sawicki 94e94506b5 Upgrade to tree-view@0.41.0 2013-11-26 19:36:01 -08:00
Kevin Sawicki 163c800d55 Upgrade to bracket-matcher@0.14.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki 3f5a6184b6 Upgrade to bookmarks@0.15.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki 77819616a8 Upgrade to autoflow@0.11.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki 3749726742 Upgrade to autocomplete@0.18.0 2013-11-26 19:35:44 -08:00
Ben Ogle d22d6e9af2 Upgrade to git-diff@0.19.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki 7ad6f0b18b Upgrade to fuzzy-finder@0.27.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki cdfd27be3e Delegate EditorView::save to Editor::save 2013-11-26 19:35:44 -08:00
Kevin Sawicki 4e554a4941 Upgrade to markdown-preview@0.21.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki 3db5cad927 Upgrade to github-sign-in@0.13.0 2013-11-26 19:35:44 -08:00
Kevin Sawicki 1a21600bde Upgrade to symbols-view@0.26.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki 3c3811c527 Upgrade to spell-check@0.17.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki 16c0ef935f Upgrade to snippets@0.17.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki 6cc897ac67 Upgrade to settings-view@0.49.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki 80782feb24 Upgrade to package-generator@0.23.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki 3cfe50585a Move eachBuffer spec to project-spec 2013-11-26 19:35:43 -08:00
Kevin Sawicki 4c336ed0ee Upgrade to grammar-selector@0.13.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki c1cf8936eb Don't through exception from setGrammar delegate 2013-11-26 19:35:43 -08:00
Kevin Sawicki d131b3e39c Upgrade to go-to-line@0.12.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki 043ce8f972 Upgrade to git-diff@0.18.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki e4cac4de70 Upgrade to wrap-guid@0.8.0 2013-11-26 19:35:43 -08:00
Kevin Sawicki c5cc0706e0 Upgrade to to-the-hubs@0.15.0 2013-11-26 19:35:42 -08:00
Kevin Sawicki 45ddece673 Update getEditors references to getEditorViews 2013-11-26 19:35:42 -08:00
Kevin Sawicki 2901a04843 Rename WorkspaceView::getEditors to getEditorViews 2013-11-26 19:35:42 -08:00
Kevin Sawicki 0259536c5d Rename WorkspaceView::eachEditor to eachEditorView 2013-11-26 19:35:42 -08:00
Kevin Sawicki 48692e5127 Update EditSession to Editor in method references 2013-11-26 19:35:16 -08:00
Kevin Sawicki 19dc6b3523 Remove each helpers that delegate to Project 2013-11-26 19:35:16 -08:00
Kevin Sawicki d1496a0634 Rename EditSession to Editor 2013-11-26 19:35:16 -08:00
Kevin Sawicki d8c4fa902d Remove editSession options support 2013-11-26 19:35:16 -08:00
Kevin Sawicki f1e768767e Rename EditorView::activeEditSession to editor 2013-11-26 19:35:16 -08:00
Kevin Sawicki c03e9ad815 Rename Editor export to EditorView 2013-11-26 19:35:16 -08:00
Ben Ogle ebe3d0d885 Upgrade visual-bell@0.6.0 2013-11-26 18:06:45 -08:00
Ben Ogle 46f73d037f Fix replace on open buffers. only replace paths specified.
Closes find-and-replace#85
2013-11-26 17:08:21 -08:00
probablycorey e7e0f081f4 Update feedback package 2013-11-26 17:00:45 -08:00
probablycorey dde46ca931 Merge remote-tracking branch 'origin/master' into cj-feedback-package
Conflicts:
	package.json
2013-11-26 16:59:57 -08:00
Ben Ogle 65746521a6 Increase timeout to show default tips 2013-11-26 15:53:54 -08:00
Ben Ogle 5352f7322c upgrade to tabs@0.14.1 2013-11-26 15:52:37 -08:00
Ben Ogle f395905d4e Add destroyTooltip() 2013-11-26 15:46:01 -08:00
Ben Ogle f84635766c Upgrade to fnr@0.53.0 2013-11-26 15:36:05 -08:00
Ben Ogle 413078a493 Add hideTooltip function to hide the tip right now. 2013-11-26 15:35:47 -08:00
Kevin Sawicki d3c9b6e547 Rename root-view-spec.coffee to workspace-view-spec.coffee 2013-11-26 13:26:38 -08:00
Kevin Sawicki 078fffa7c1 Merge pull request #1166 from atom/ks-rename-root-view
Rename RootView to WorkspaceView
2013-11-26 12:28:10 -08:00
probablycorey 8472ac4fc8 Bump feedback version 2013-11-26 11:29:36 -08:00
probablycorey 1bdfb004ef Add feedback package 2013-11-26 11:23:36 -08:00
probablycorey e42079c762 Update Atom Shell 2013-11-26 11:15:55 -08:00
probablycorey a0ceb78627 Move snapshot code to package 2013-11-26 11:15:55 -08:00
probablycorey eb985a9880 Remove report issue menu 2013-11-26 11:15:55 -08:00
Kevin Sawicki d0eb26c35f 📝 RootView -> WorkspaceView 2013-11-26 11:07:46 -08:00
Kevin Sawicki 1489488159 Update rootView references in benchmarks 2013-11-26 11:02:54 -08:00
Kevin Sawicki a0a90ca26a Upgrade themes for root-view id rename 2013-11-26 11:02:53 -08:00
Kevin Sawicki 21f6676094 📝 activate() is only passed state 2013-11-26 11:02:53 -08:00
Kevin Sawicki ad9721a893 Rename workspace-view element to workspace 2013-11-26 11:02:53 -08:00
Kevin Sawicki 12ae7abc38 📝 Rename rootView to workspaceView 2013-11-26 11:02:53 -08:00
Kevin Sawicki ee0814313f Rename root-view.less to workspace-view.less 2013-11-26 11:02:53 -08:00
Kevin Sawicki a3c9e01595 Rename root-view element id to workspace-view 2013-11-26 11:02:53 -08:00
Kevin Sawicki 2e801fbf87 Rename root-view to workspace-view 2013-11-26 11:02:53 -08:00
Kevin Sawicki 40d7fb3c45 Upgrade to find-and-replace@0.52.0 2013-11-26 11:02:53 -08:00
Kevin Sawicki 14ad277012 Remove atom.workspaceView shim 2013-11-26 11:02:53 -08:00
Kevin Sawicki 6a9f29024a Remove RootView export 2013-11-26 11:02:53 -08:00
Kevin Sawicki 3ce6176313 Rename rootView to workspaceView 2013-11-26 11:02:53 -08:00
Kevin Sawicki 7d7ed79fde Upgrade packages for rootView rename 2013-11-26 11:02:52 -08:00
Ben Ogle 8aa32fc8d1 Merge pull request #1161 from atom/bo-editor-placeholder-text
Add ability for placeholder text in mini editor
2013-11-26 11:01:42 -08:00
Kevin Sawicki f8ed6eadc8 Add WorkspaceView and atom.workspaceView shims 2013-11-26 09:13:06 -08:00
Ben Ogle 0c2c739741 Add ability for placeholder text in mini editor 2013-11-25 14:46:54 -08:00
78 arquivos alterados com 1267 adições e 1230 exclusões
+39 -49
Ver Arquivo
@@ -1,67 +1,57 @@
# :rotating_light: Contributing to Atom :rotating_light:
# :tada: Contributing to Atom :tada:
These are just guidelines, not rules, use your best judgement and feel free
to propose changes to this document in a pull request.
## Issues
* Include screenshots and animated GIFs whenever possible, they are immensely
helpful
helpful.
* Include the behavior you expected to happen and other places you've seen
that behavior such as Emacs, vi, Xcode, etc.
* Check the Console app for stack traces to include if reporting a crash
* Check the Dev tools (`alt-cmd-i`) for errors and stack traces to include
* Check the Console app for stack traces to include if reporting a crash.
* Check the Dev tools (`alt-cmd-i`) for errors and stack traces to include.
### Package Repositories
## Code
This is the repository for the core Atom editor only. Atom comes bundled with
many packages and themes that are stored in other repos under the
[atom org](https://github.com/atom) such as [tabs](https://github.com/atom/tabs),
[find-and-replace](https://github.com/atom/find-and-replace),
[language-javascript](https://github.com/atom/language-javascript),
and [atom-light-ui](http://github.com/atom/atom-light-ui).
If you think you know which package is causing the issue you are reporting, feel
free to open up the issue in that specific repository instead. When in doubt
just open the issue here but be aware that it may get closed here and reopened
in the proper package's repository.
## Pull Requests
* Include screenshots and animated GIFs whenever possible.
* Follow the [JavaScript](https://github.com/styleguide/javascript) and
[CSS](https://github.com/styleguide/css) styleguides
* Include thoughtfully worded [Jasmine](http://pivotal.github.com/jasmine/)
specs
* Add 3rd-party packages as a `package.json` dependency
* Commit messages are in the present tense
* Commit messages that improve the format of the code start with :lipstick:
* Commit messages that improve the performance start with :racehorse:
* Commit messages that remove memory leaks start with :non-potable_water:
* Commit messages that improve documentation start with :memo:
* Files end with a newline
* Avoid placing files in `vendor`. 3rd-party packages should be added as a
`package.json` dependency.
* Files end with a newline.
* Requires should be in the following order:
* Built in Node Modules (such as `path`)
* Built in Atom and Atom Shell Modules (such as `atom`, `shell`)
* Local Modules (using relative paths)
* Class variables and methods should be in the following order:
* Class variables (variables starting with a `@`)
* Class methods (methods starting with a `@`)
* Instance variables
* Instance methods
* Beware of platform differences
* The home directory is `process.env.USERPROFILE` on Windows, while on OS X
and Linux it's `process.env.HOME`
* Path separator is `\` on Windows, and is `/` on OS X and Linux, so use
`path.join` to concatenate filenames
* Use `require('atom').fs.getHomeDirectory()` to get the home directory.
* Use `path.join()` to concatenate filenames.
* Temporary directory is not `/tmp` on Windows, use `os.tmpdir()` when
possible
## Philosophy
### Write Beautiful Code
Once you get something working, take the time to consider whether you can achieve it in a more elegant way. We're planning on open-sourcing Atom, so let's put our best foot forward.
### When in doubt, pair-up
Pairing can be an effective and fun way to pass on culture, knowledge, and taste. If you can find the time, we encourage you to work synchronously with other community members of all experience levels to help the knowledge-mulching process. It doesn't have to be all the time; a little pairing goes a long way.
### Write tests, and write them first
The test suite keeps protects our codebase from the ravages of entropy, but it only works when we have thorough coverage. Before you write implementation code, write a failing test proving that it's needed.
### Leave the test suite better than you found it
Consider how the specs you are adding fit into the spec-file as a whole. Is this the right place for your spec? Does the spec need to be reorganized now that you're adding this extra dimension? Specs are only as useful as the next person's ability to understand them.
### Solve today's problem
Avoid adding flexibility that isn't needed *today*. Nothing is ever set in stone, and we can always go back and add flexibility later. Adding it early just means we have to pay for complexity that we might not end up using.
### Favor clarity over brevity or cleverness.
Three lines that someone else can read are better than one line that's tricky.
### Don't be defensive
Only catch exceptions that are truly exceptional. Assume that components we control will honor their contracts. If they don't, the solution is to find and fix the problem in code rather than cluttering the code with attempts to foresee all potential issues at runtime.
### Don't be afraid to add classes and methods
Code rarely suffers from too many methods and classes, and often suffers from too few. Err on the side of numerous short, well-named methods. Pull out classes with well-defined roles.
### Rip shit out
Don't be afraid to delete code. Don't be afraid to rewrite something that needs to be refreshed. If it's in version control, we can always resurrect it.
### Maintain a consistent level of abstraction
Every line in a method should read at the same basic level of abstraction. If there's a section of a method that goes into a lot more detail than the rest of the method, consider extracting a new method and giving it a clear name.
## Git Commit Messages
* Use the present tense
* Reference issues and pull requests liberally
* Consider starting the commit message with an applicable emoji:
* :lipstick: when improving the format/structure of the code
* :racehorse: when improving performance
* :non-potable_water: when plugging memory leaks
* :memo: when writing docs
+16 -3
Ver Arquivo
@@ -7,6 +7,10 @@ _ = require 'underscore-plus'
packageJson = require './package.json'
# OAuth token for atom-bot
# TODO Remove once all repositories are public
process.env.ATOM_ACCESS_TOKEN ?= '362295be4c5258d3f7b967bbabae662a455ca2a7'
module.exports = (grunt) ->
if not grunt.option('verbose')
grunt.log.writeln = (args...) -> grunt.log
@@ -20,6 +24,7 @@ module.exports = (grunt) ->
buildDir = grunt.option('build-dir') ? path.join(tmpDir, 'atom-build')
shellAppDir = path.join(buildDir, appName)
appDir = path.join(shellAppDir, 'resources', 'app')
atomShellDownloadDir = path.join(os.tmpdir(), 'atom-cached-atom-shells')
else
appName = 'Atom.app'
tmpDir = '/tmp'
@@ -28,6 +33,7 @@ module.exports = (grunt) ->
shellAppDir = path.join(buildDir, appName)
contentsDir = path.join(shellAppDir, 'Contents')
appDir = path.join(contentsDir, 'Resources', 'app')
atomShellDownloadDir = '/tmp/atom-cached-atom-shells'
installDir = path.join(installRoot, appName)
@@ -168,6 +174,12 @@ module.exports = (grunt) ->
_.extend(context, parsed.attributes)
parsed.body
'download-atom-shell':
version: packageJson.atomShellVersion
outputDir: 'atom-shell'
downloadDir: atomShellDownloadDir
rebuild: true # rebuild native modules after atom-shell is updated
shell:
'kill-atom':
command: 'pkill -9 Atom'
@@ -183,13 +195,14 @@ module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-less')
grunt.loadNpmTasks('grunt-markdown')
grunt.loadNpmTasks('grunt-download-atom-shell')
grunt.loadNpmTasks('grunt-shell')
grunt.loadTasks('tasks')
grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson'])
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint'])
grunt.registerTask('test', ['shell:kill-atom', 'run-specs'])
grunt.registerTask('ci', ['update-atom-shell', 'build', 'set-development-version', 'lint', 'test'])
grunt.registerTask('deploy', ['partial-clean', 'update-atom-shell', 'build', 'codesign'])
grunt.registerTask('ci', ['download-atom-shell', 'build', 'set-development-version', 'lint', 'test'])
grunt.registerTask('deploy', ['partial-clean', 'download-atom-shell', 'build', 'codesign'])
grunt.registerTask('docs', ['markdown:guides', 'build-docs'])
grunt.registerTask('default', ['update-atom-shell', 'build', 'set-development-version', 'install'])
grunt.registerTask('default', ['download-atom-shell', 'build', 'set-development-version', 'install'])
+13
Ver Arquivo
@@ -0,0 +1,13 @@
Copyright 2013 GitHub Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+6 -19
Ver Arquivo
@@ -1,30 +1,17 @@
# Atom — Futuristic Text Editing
# Atom — The hackable, ~~collaborative~~ editor of tomorrow!
![atom](https://s3.amazonaws.com/speakeasy/apps/icons/27/medium/7db16e44-ba57-11e2-8c6f-981faf658e00.png)
![Atom](http://i.imgur.com/OrTvUAD.png)
Check out our [guides](https://www.atom.io/docs/latest/) and [API documentation](https://www.atom.io/docs/api/v34.0.0/api/)
Check out our [guides and API documentation](https://www.atom.io/docs/latest/).
## Installing
Download the latest Atom release from [speakeasy](https://speakeasy.githubapp.com/apps/27).
Download the latest [Atom release](https://github.com/atom/atom/releases/latest).
It will automatically update when a new release is available.
Atom will automatically update when a new release is available.
## Building
### Requirements
* Mountain Lion
* Looking for Windows support? Read [here][building].
* Boxen (Obviously Atom won't release with this requirement)
### Installation
1. `gh-setup atom`
2. `cd ~/github/atom`
3. `script/build`
Follow the instructions in the [build docs][building].
[building]: https://github.com/atom/atom/blob/master/docs/building-atom.md
+11 -11
Ver Arquivo
@@ -1,19 +1,19 @@
require './benchmark-helper'
{$, _, RootView} = require 'atom'
{$, _, WorkspaceView} = require 'atom'
TokenizedBuffer = require '../src/tokenized-buffer'
describe "editorView.", ->
editorView = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
window.rootView = new RootView
window.rootView.attachToDom()
atom.workspaceViewParentSelector = '#jasmine-content'
atom.workspaceView = new WorkspaceView
atom.workspaceView.attachToDom()
rootView.width(1024)
rootView.height(768)
rootView.openSync()
editorView = rootView.getActiveView()
atom.workspaceView.width(1024)
atom.workspaceView.height(768)
atom.workspaceView.openSync()
editorView = atom.workspaceView.getActiveView()
afterEach ->
if editorView.pendingDisplayUpdate
@@ -40,7 +40,7 @@ describe "editorView.", ->
describe "300-line-file.", ->
beforeEach ->
rootView.openSync('medium.coffee')
atom.workspaceView.openSync('medium.coffee')
describe "at-begining.", ->
benchmark "insert-delete", ->
@@ -171,11 +171,11 @@ describe "editorView.", ->
describe "9000-line-file.", ->
benchmark "opening.", 5, ->
rootView.openSync('huge.js')
atom.workspaceView.openSync('huge.js')
describe "after-opening.", ->
beforeEach ->
rootView.openSync('huge.js')
atom.workspaceView.openSync('huge.js')
benchmark "moving-to-eof.", 1, ->
editorView.moveCursorToBottom()
+3 -3
Ver Arquivo
@@ -6,10 +6,10 @@ atom][download].
## OSX
* Use Mountain Lion
* Use OS X 10.8 or later
* Install the latest node 0.10.x release (32bit preferable)
* Clone [atom][atom-git] to `~/github/atom`
* Run `~/github/atom/script/bootstrap`
* Run `~/github/atom/script/build`
## Windows
@@ -26,7 +26,7 @@ atom][download].
* Use the Windows GitHub shell and cd into `C:\Users\<user>\github\atom`
* Run `script\bootstrap`
[download]: http://www.atom.io
[download]: https://github.com/atom/atom/releases/latest
[win-node]: http://nodejs.org/download/
[win-python]: http://www.python.org/download/
[win-github]: http://windows.github.com/
+9 -9
Ver Arquivo
@@ -67,11 +67,11 @@ object.
Your package's top-level module should implement the following methods:
- `activate(rootView, state)`: This **required** method is called when your
package is loaded. It is always passed the window's global `rootView`, and is
sometimes passed state data if the window has been reloaded and your module
implements the `serialize` method. Use this to do initialization work when your
package is started (like setting up DOM elements or binding events).
- `activate(state)`: This **required** method is called when your
package is activated. It is passed the state data from the last time the window
was serialized if your module implements the `serialize()` method. Use this to
do initialization work when your package is started (like setting up DOM
elements or binding events).
- `serialize()`: This **optional** method is called when the window is shutting
down, allowing you to return JSON to represent the state of your component. When
@@ -104,7 +104,7 @@ module.exports = require "./lib/my-package"
`my-package/my-package.coffee` might start:
```coffeescript
module.exports =
activate: (rootView, state) -> # ...
activate: (state) -> # ...
deactivate: -> # ...
serialize: -> # ...
```
@@ -126,7 +126,7 @@ is recommended).
Ideally, you won't need much in the way of styling. We've provided a standard
set of components which define both the colors and UI elements for any package
that fits into Atom seamlessly. You can view all of Atom's UI components by opening
the styleguide: open the command palette (`cmd-p`) and search for _styleguide_,
the styleguide: open the command palette (`cmd-shift-P`) and search for _styleguide_,
or just type `cmd-ctrl-G`.
If you _do_ need special styling, try to keep only structural styles in the package
@@ -206,7 +206,7 @@ specific parts of the interface, like adding a file in the tree-view:
'context-menu':
'.tree-view':
'Add file': 'tree-view:add-file'
'#root-view':
'.workspace':
'Inspect Element': 'core:inspect'
```
@@ -311,7 +311,7 @@ protocol URLs to load resources in the package.
The URLs should be in the format of
`atom://package-name/relative-path-to-package-of-resource`, for example, the
`atom://image-view/images/transparent-background.gif` would be equivablent to
`atom://image-view/images/transparent-background.gif` would be equivalent to
`~/.atom/packages/image-view/images/transparent-background.gif`.
You can also use the `atom` protocol URLs in themes.
+2 -2
Ver Arquivo
@@ -34,7 +34,7 @@ target elements which are outside of the editor.
Let's create your first theme.
To get started, hit `cmd-p`, and start typing "Generate Theme" to generate
To get started, hit `cmd-shift-P`, and start typing "Generate Theme" to generate
a package. Select "Generate Theme," and you'll be asked for a theme name. Let's
call ours _motif_.
@@ -114,7 +114,7 @@ If you are creating an interface theme, you'll want a way to see how your theme
changes affect all the components in the system. The [styleguide] is a page with
every component Atom supports rendered.
To open the styleguide, open the command palette (`cmd-p`) and search for
To open the styleguide, open the command palette (`cmd-shift-P`) and search for
_styleguide_, or use the shortcut `cmd-ctrl-shift-g`.
![styleguide-img]
+10
Ver Arquivo
@@ -19,6 +19,16 @@ Themes` section on the `Packages` tab within the Settings panel.
You can install non-bundled packages by going to the `Available Packages`
section on the `Packages` tab within the Settings panel (`cmd-,`).
You can also install packages from the command line using the
[apm](https://github.com/atom/apm) command:
`apm install <package_name>` to install the latest version.
`apm install <package_name>@<package_version>` to install a specific version.
For example `apm install emmet@0.1.5` installs the `0.1.5` release of the
[Emmet](https://github.com/atom/emmet) package into `~/.atom/packages`.
## Customizing Key Bindings
Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
+38 -39
Ver Arquivo
@@ -6,13 +6,12 @@ productive as quickly as possible. There are also guides which cover
## The Command Palette
If there's one key-command you must remember in Atom, it should be `cmd-p`. You
can always hit `cmd-p` to bring up a list of commands that are relevant to the
currently focused interface element. If there is a key binding for a given
command, it is also displayed. This is a great way to explore the system and get
to know the key commands interactively. If you'd like to learn about adding or
changing a binding for a command, refer to the [key bindings][key-bindings]
section below.
If there's one key-command you remember in Atom, it should be `cmd-shift-P`. You
can always press `cmd-shift-P` to bring up a list of commands (and key bindings)
that are relevant to the currently focused interface element. This is a great
way to explore the system and learn key bindings interactively. For information
about adding or changing a key binding refer to the [customizing key
bindings][key-bindings] section.
![Command Palette]
@@ -20,24 +19,24 @@ section below.
### Working With Files
Atom windows are scoped to the directory in which they're opened from. So if you
launch Atom from the command line, everything will be relative to the current
directory. This means that the tree view on the left will only show files
contained within that directory.
Atom windows are scoped to the directory they're opened from. If you launch Atom
from the command line everything will be relative to the current directory. This
means that the tree view on the left will only show files contained within that
directory.
This can be a useful way to organize multiple projects, as each project will be
contained within it's own window and it's state will be unique to that window.
contained within its own window.
#### Finding Files
The fastest way to find a file in your project is to use the fuzzy finder. Just
hit `cmd-t` and start typing the name of the file you're looking for. If you
already have the file open as a tab and want to jump to it, hit `cmd-b` to bring
up a searchable list of open buffers.
The fastest way to find a file is to use the fuzzy finder. Press `cmd-t` and
begin typing the name of the file you're looking for. If you are looking for a
file that is already open press `cmd-b` to bring up a searchable list of open
files.
You can also use the tree view to navigate to a file. To open or move focus to
the tree view, hit `cmd-\`. You can then navigate to a file and select it with
`return`.
the tree view, press `cmd-\`. You can then navigate to a file using the arrow
keys and select it with `return`.
#### Adding, Moving, Deleting Files
@@ -46,50 +45,50 @@ select a directory in the tree view and press `a`. Then type the name of the
file. Any intermediate directories you type will be created automatically if
needed.
To move or rename a file or directory, select it in the tree view and hit `m`.
To delete a file, select it in the tree view and hit `delete`.
To move or rename a file or directory, select it in the tree view and press `m`.
To delete a file, select it in the tree view and press `delete`.
### Searching
#### Find and Replace
To search within a buffer use `cmd-f`. To search the entire project use
`cmd-shift-f`. To find and replace within the current buffer use `cmd-alt-f`.
`cmd-shift-f`.
#### Navigating By Symbols
If you want to jump to a method, the `cmd-j` binding opens a list of all symbols
in the current file. `cmd-.` jumps to the tag for the word currently under the
cursor.
If you want to jump to a method press `cmd-r`. It opens a list of all symbols
in the current file.
To search for symbols across your project use `cmd-shift-j`, but you'll need to
make sure you have a tags file generated for the project Also, if you're editing
CoffeeScript, it's a good idea to update your `~/.ctags` file to understand the
language. Here is [a good example][ctags].
To search for symbols across your project use `cmd-shift-r`, but you'll need to
make sure you have a ctags installed and a tags file generated for your project.
Also, if you're editing CoffeeScript, it's a good idea to update your `~/.ctags`
file to understand the language. Here is [a good example][ctags].
### Split Panes
You can split any editor pane horizontally or vertically by using `ctrl-w s` or
`ctrl-w v`. Once you have a split pane, you can move focus between them with
`ctrl-tab` or `ctrl-w w`. To close a pane, close all tabs inside it.
You can split any editor pane horizontally or vertically by using `cmd-k right` or
`cmd-k down`. Once you have a split pane, you can move focus between them with
`cmd-k cmd-right` or `cmd-k cmd-down`. To close a pane, close all tabs inside it.
### Folding
You can fold everything with `ctrl-{` and unfold everything with
`ctrl-}`. Or, you can fold / unfold by a single level with `ctrl-[` and
`ctrl-]`.
You can fold everything with `alt-cmd-{` and unfold everything with
`alt-cmd-}`. Or, you can fold / unfold by a single level with `alt-cmd-[` and
`alt-cmd-]`.
### Soft-Wrap
If you want to toggle soft wrap, trigger the command from the command palette.
Hit `cmd-p` to open the palette, then type "wrap" to find the correct
Press `cmd-shift-P` to open the palette, then type "wrap" to find the correct
command.
## Configuration
If you press `cmd-,`, a configuration panel will appear in the currently focused
pane. This serves as the primary interface for adjusting settings, installing
packages and changing themes.
Press `cmd-,` to display the a settings pane. This serves as the primary
interface for adjusting config settings, installing packages and changing
themes.
For more advanced configuration see the [customization guide][customization].
@@ -97,6 +96,6 @@ For more advanced configuration see the [customization guide][customization].
[theming]: creating-a-theme.md
[extending]: creating-a-package.md
[customization]: customizing-atom.md
[key-bindings]: #customizing-key-bindings
[key-bindings]: customizing-atom.md#customizing-key-bindings
[command palette]: https://f.cloud.github.com/assets/1424/1091618/ee7c3554-166a-11e3-9955-aaa61bb5509c.png
[ctags]: https://github.com/kevinsawicki/dotfiles/blob/master/.ctags
+1 -1
Ver Arquivo
@@ -23,7 +23,7 @@ The `observeConfig` method will call the given callback immediately with the
current value for the specified key path, and it will also call it in the future
whenever the value of that key path changes.
Subscriptions made with `observeConfig` are automatically cancelled when the
Subscriptions made with `observeConfig` are automatically canceled when the
view is removed. You can cancel config subscriptions manually via the
`unobserveConfig` method.
+1 -1
Ver Arquivo
@@ -23,7 +23,7 @@ Note that the last example describes multiple keystrokes in succession:
A semantic event is the name of the custom event that will be triggered on the
target of the keydown event when a key binding matches. You can use the command
palette (bound to `cmd-p`), to get a list of relevant events and their bindings
palette (bound to `cmd-shift-P`), to get a list of relevant events and their bindings
in any focused context in Atom.
### Rules for Mapping A Keydown Event to A Semantic Event
+13 -13
Ver Arquivo
@@ -8,11 +8,11 @@ view objects inherit from the jQuery prototype, and wrap DOM nodes
View objects are actually jQuery wrappers around DOM fragments, supporting all
the typical jQuery traversal and manipulation methods. In addition, view objects
have methods that are view-specific. For example, you could call both general
and view-specific on the global `rootView` instance:
and view-specific on the global `atom.workspaceView` instance:
```coffeescript
rootView.find('.editor.active') # standard jQuery method
rootView.getActiveEditor() # view-specific method
atom.workspaceView.find('.editor.active') # standard jQuery method
atom.workspaceView.getActiveEditor() # view-specific method
```
If you retrieve a jQuery wrapper for an element associated with a view, use the
@@ -20,7 +20,7 @@ If you retrieve a jQuery wrapper for an element associated with a view, use the
```coffeescript
# this is a plain jQuery object; you can't call view-specific methods
editorElement = rootView.find('.editor.active')
editorElement = atom.workspaceView.find('.editor.active')
# get the view object by calling `.view()` to call view-specific methods
editorView = editorElement.view()
@@ -29,18 +29,18 @@ editorView.setCursorBufferPosition([1, 2])
Refer to the [SpacePen] documentation for more details.
### RootView
### WorkspaceView
The root of Atom's view hierarchy is a global called `rootView`, which is a
singleton instance of the `RootView` view class. The root view fills the entire
The root of Atom's view hierarchy is a global called `atom.workspaceView`, which is a
singleton instance of the `WorkspaceView` view class. The root view fills the entire
window, and contains every other view. If you open Atom's inspector with
`alt-cmd-i`, you can see the internal structure of `RootView`:
`alt-cmd-i`, you can see the internal structure of `WorkspaceView`:
![RootView in the inspector][rootview-inspector]
![WorkspaceView in the inspector][workspaceview-inspector]
#### Panes
The `RootView` contains a `#horizontal` and a `#vertical` axis surrounding
The `WorkspaceView` contains a `#horizontal` and a `#vertical` axis surrounding
`#panes`. Elements in the horizontal axis will tile across the window
horizontally, appearing to have a vertical orientation. Items in the vertical
axis will tile across the window vertically, appearing to have a horizontal
@@ -55,11 +55,11 @@ outlets as follows:
```coffeescript
# place a view to the left of the panes (or use .append() to place it to the right)
rootView.horizontal.prepend(new MyView)
atom.workspaceView.horizontal.prepend(new MyView)
# place a view below the panes (or use .prepend() to place it above)
rootView.vertical.append(new MyOtherView)
atom.workspaceView.vertical.append(new MyOtherView)
```
[spacepen]: http://github.com/nathansobo/space-pen
[rootview-inspector]: https://f.cloud.github.com/assets/1424/1091631/1932c2d6-166b-11e3-8adf-9690fe82d3b8.png
[workspaceView-inspector]: https://f.cloud.github.com/assets/1424/1091631/1932c2d6-166b-11e3-8adf-9690fe82d3b8.png
+15 -15
Ver Arquivo
@@ -2,12 +2,12 @@
Let's take a look at creating your first package.
To get started, hit `cmd-p`, and start typing "Generate Package" to generate
To get started, hit `cmd-shift-P`, and start typing "Generate Package" to generate
a package. Once you select the "Generate Package" command, it'll ask you for a
name for your new package. Let's call ours _changer_.
Atom will pop open a new window, showing the _changer_ package with a default set of
folders and files created for us. Hit `cmd-p` and start typing "Changer." You'll
folders and files created for us. Hit `cmd-shift-P` and start typing "Changer." You'll
see a new `Changer:Toggle` command which, if selected, pops up a greeting. So far,
so good!
@@ -44,12 +44,12 @@ you can map to `body` if you want to scope to anywhere in Atom, or just `.editor
for the editor portion.
To bind keybindings to a command, we'll need to do a bit of association in our
CoffeeScript code using the `rootView.command` method. This method takes a command
CoffeeScript code using the `atom.workspaceView.command` method. This method takes a command
name and executes a callback function. Open up _lib/changer-view.coffee_, and
change `rootView.command "changer:toggle"` to look like this:
change `atom.workspaceView.command "changer:toggle"` to look like this:
```coffeescript
rootView.command "changer:magic", => @magic()
atom.workspaceView.command "changer:magic", => @magic()
```
It's common practice to namespace your commands with your package name, separated
@@ -180,7 +180,7 @@ ul.modified-files-list {
We'll add one more line to the end of the `magic` method to make this pane appear:
```coffeescript
rootView.vertical.append(this)
atom.workspaceView.vertical.append(this)
```
If you refresh Atom and hit the key command, you'll see a box appear right underneath
@@ -188,21 +188,21 @@ the editor:
![Changer_Panel_Append]
As you might have guessed, `rootView.vertical.append` tells Atom to append `this`
As you might have guessed, `atom.workspaceView.vertical.append` tells Atom to append `this`
item (_i.e._, whatever is defined by`@content`) _vertically_ to the editor. If
we had called `rootView.horizontal.append`, the pane would be attached to the
we had called `atom.workspaceView.horizontal.append`, the pane would be attached to the
right-hand side of the editor.
Before we populate this panel for real, let's apply some logic to toggle the pane
off and on, just like we did with the tree view. Replace the `rootView.vertical.append`
off and on, just like we did with the tree view. Replace the `atom.workspaceView.vertical.append`
call with this code:
```coffeescript
# toggles the pane
if @hasParent()
rootView.vertical.children().last().remove()
atom.workspaceView.vertical.children().last().remove()
else
rootView.vertical.append(this)
atom.workspaceView.vertical.append(this)
```
There are about a hundred different ways to toggle a pane on and off, and this
@@ -261,13 +261,13 @@ appending it to `modifiedFilesList`:
```coffeescript
# toggles the pane
if @hasParent()
rootView.vertical.children().last().remove()
atom.workspaceView.vertical.children().last().remove()
else
for file in modifiedFiles
stat = fs.lstatSync(file)
mtime = stat.mtime
@modifiedFilesList.append("<li>#{file} - Modified at #{mtime}")
rootView.vertical.append(this)
atom.workspaceView.vertical.append(this)
```
When you toggle the modified files list, your pane is now populated with the
@@ -283,13 +283,13 @@ this demonstration, we'll just clear the `modifiedFilesList` each time it's clos
# toggles the pane
if @hasParent()
@modifiedFilesList.empty() # added this to clear the list on close
rootView.vertical.children().last().remove()
atom.workspaceView.vertical.children().last().remove()
else
for file in modifiedFiles
stat = fs.lstatSync(file)
mtime = stat.mtime
@modifiedFilesList.append("<li>#{file} - Modified at #{mtime}")
rootView.vertical.append(this)
atom.workspaceView.vertical.append(this)
```
## Coloring UI Elements
+2 -2
Ver Arquivo
@@ -20,8 +20,8 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
module.exports.$ = $
module.exports.$$ = $$
module.exports.$$$ = $$$
module.exports.Editor = require '../src/editor-view'
module.exports.RootView = require '../src/root-view'
module.exports.EditorView = require '../src/editor-view'
module.exports.WorkspaceView = require '../src/workspace-view'
module.exports.SelectList = require '../src/select-list'
module.exports.ScrollView = require '../src/scroll-view'
module.exports.Task = require '../src/task'
+33 -4
Ver Arquivo
@@ -34,16 +34,45 @@
'escape': 'editor:consolidate-selections'
# allow standard input fields to work correctly
'input:not(.hidden-input), .native-key-bindings':
'body .native-key-bindings':
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'
'enter': 'native!'
'backspace': 'native!'
'shift-backspace': 'native!'
'delete': 'native!'
'up': 'native!'
'down': 'native!'
'shift-up': 'native!'
'shift-down': 'native!'
'alt-up': 'native!'
'alt-down': 'native!'
'alt-shift-up': 'native!'
'alt-shift-down': 'native!'
'cmd-up': 'native!'
'cmd-down': 'native!'
'cmd-shift-up': 'native!'
'cmd-shift-down': 'native!'
'ctrl-up': 'native!'
'ctrl-down': 'native!'
'ctrl-shift-up': 'native!'
'ctrl-shift-down': 'native!'
'left': 'native!'
'right': 'native!'
'shift-left': 'native!'
'shift-right': 'native!'
'backspace': 'native!'
'shift-backspace': 'native!'
'delete': 'native!'
'alt-left': 'native!'
'alt-right': 'native!'
'alt-shift-left': 'native!'
'alt-shift-right': 'native!'
'cmd-left': 'native!'
'cmd-right': 'native!'
'cmd-shift-left': 'native!'
'cmd-shift-right': 'native!'
'ctrl-left': 'native!'
'ctrl-right': 'native!'
'ctrl-shift-left': 'native!'
'ctrl-shift-right': 'native!'
'ctrl-b': 'native!'
'ctrl-f': 'native!'
'ctrl-F': 'native!'
+1 -1
Ver Arquivo
@@ -146,7 +146,7 @@
'cmd-k cmd-9': 'editor:fold-at-indent-level-9'
# allow standard input fields to work correctly
'body.platform-darwin input:not(.hidden-input), body.platform-darwin .native-key-bindings':
'body.platform-darwin .native-key-bindings':
'cmd-z': 'native!'
'cmd-Z': 'native!'
'cmd-x': 'native!'
-1
Ver Arquivo
@@ -165,7 +165,6 @@
{ label: "Install &update", command: 'application:install-update', visible: false }
{ type: 'separator' }
{ label: '&Documentation', command: 'application:open-documentation' }
{ label: 'Report an &Issue', command: 'application:report-issue' }
{ type: 'separator' }
]
}
+60 -49
Ver Arquivo
@@ -1,6 +1,7 @@
{
"name": "atom",
"version": "39.0.0",
"productName": "Atom",
"version": "0.43.0",
"main": "./src/browser/main.js",
"repository": {
"type": "git",
@@ -9,7 +10,13 @@
"bugs": {
"url": "https://github.com/atom/atom/issues"
},
"atomShellVersion": "0.6.11",
"licenses": [
{
"type": "Apache",
"url": "http://github.com/atom/atom/raw/master/LICENSE.md"
}
],
"atomShellVersion": "0.7.6",
"dependencies": {
"async": "0.2.6",
"bootstrap": "git://github.com/benogle/bootstrap.git",
@@ -18,12 +25,13 @@
"coffeestack": "0.6.0",
"emissary": "0.19.0",
"first-mate": "0.5.0",
"fs-plus": "0.9.0",
"fs-plus": "0.10.0",
"fuzzaldrin": "0.1.0",
"git-utils": "0.29.0",
"guid": "0.0.10",
"jasmine-focused": "~0.15.0",
"mkdirp": "0.3.5",
"keytar": "0.13.0",
"less-cache": "0.10.0",
"nslog": "0.1.0",
"oniguruma": "0.24.0",
@@ -34,8 +42,8 @@
"scandal": "0.8.0",
"season": "0.14.0",
"semver": "1.1.4",
"space-pen": "2.0.0",
"telepath": "0.45.0",
"space-pen": "2.0.1",
"telepath": "0.61.0",
"temp": "0.5.0",
"underscore-plus": "0.3.0"
},
@@ -64,51 +72,53 @@
"rimraf": "~2.2.2"
},
"packageDependencies": {
"atom-light-ui": "0.8.0",
"atom-light-syntax": "0.6.0",
"atom-dark-ui": "0.8.0",
"atom-dark-syntax": "0.6.0",
"atom-dark-syntax": "0.8.0",
"atom-dark-ui": "0.13.0",
"atom-light-syntax": "0.9.0",
"atom-light-ui": "0.13.0",
"base16-tomorrow-dark-theme": "0.6.0",
"solarized-dark-syntax": "0.4.0",
"archive-view": "0.14.0",
"autocomplete": "0.15.0",
"autoflow": "0.9.0",
"autosave": "0.7.0",
"bookmarks": "0.13.0",
"bracket-matcher": "0.12.0",
"command-logger": "0.7.0",
"command-palette": "0.10.0",
"dev-live-reload": "0.17.0",
"editor-stats": "0.7.0",
"archive-view": "0.16.0",
"autocomplete": "0.18.0",
"autoflow": "0.11.0",
"autosave": "0.10.0",
"bookmarks": "0.15.0",
"bracket-matcher": "0.15.0",
"command-logger": "0.8.0",
"command-palette": "0.11.0",
"dev-live-reload": "0.18.0",
"editor-stats": "0.8.0",
"exception-reporting": "0.8.0",
"find-and-replace": "0.49.0",
"fuzzy-finder": "0.25.0",
"gists": "0.11.0",
"git-diff": "0.16.0",
"github-sign-in": "0.11.0",
"go-to-line": "0.10.0",
"grammar-selector": "0.11.0",
"image-view": "0.9.0",
"keybinding-resolver": "0.5.0",
"link": "0.9.0",
"markdown-preview": "0.19.0",
"metrics": "0.12.0",
"package-generator": "0.21.0",
"release-notes": "0.12.0",
"settings-view": "0.47.0",
"snippets": "0.15.0",
"spell-check": "0.15.0",
"status-bar": "0.22.0",
"styleguide": "0.15.0",
"symbols-view": "0.24.0",
"tabs": "0.12.0",
"terminal": "0.22.0",
"timecop": "0.10.0",
"to-the-hubs": "0.13.0",
"tree-view": "0.39.0",
"visual-bell": "0.4.0",
"whitespace": "0.9.0",
"wrap-guide": "0.6.0",
"feedback": "0.16.0",
"find-and-replace": "0.57.0",
"fuzzy-finder": "0.27.0",
"gists": "0.12.0",
"git-diff": "0.20.0",
"github-sign-in": "0.15.0",
"go-to-line": "0.12.0",
"grammar-selector": "0.13.0",
"image-view": "0.10.0",
"keybinding-resolver": "0.6.0",
"link": "0.11.0",
"markdown-preview": "0.22.0",
"metrics": "0.14.0",
"package-generator": "0.23.0",
"release-notes": "0.15.0",
"settings-view": "0.50.0",
"snippets": "0.17.0",
"spell-check": "0.17.0",
"status-bar": "0.24.0",
"styleguide": "0.17.0",
"symbols-view": "0.27.0",
"tabs": "0.15.0",
"terminal": "0.23.0",
"timecop": "0.11.0",
"to-the-hubs": "0.15.0",
"tree-view": "0.43.0",
"visual-bell": "0.6.0",
"welcome": "0.3.0",
"whitespace": "0.10.0",
"wrap-guide": "0.8.0",
"language-c": "0.2.0",
"language-clojure": "0.1.0",
"language-coffee-script": "0.3.0",
@@ -131,7 +141,7 @@
"language-property-list": "0.2.0",
"language-puppet": "0.2.0",
"language-python": "0.2.0",
"language-ruby": "0.4.0",
"language-ruby": "0.6.0",
"language-ruby-on-rails": "0.3.0",
"language-sass": "0.3.0",
"language-shellscript": "0.2.0",
@@ -141,7 +151,8 @@
"language-todo": "0.2.0",
"language-toml": "0.7.0",
"language-xml": "0.2.0",
"language-yaml": "0.1.0"
"language-yaml": "0.1.0",
"grunt-download-atom-shell": "0.1.3"
},
"private": true,
"scripts": {
Arquivo binário não exibido.
+5
Ver Arquivo
@@ -2,6 +2,11 @@
var safeExec = require('./utils/child-process-wrapper.js').safeExec;
var path = require('path');
// OAuth token for atom-bot
// TODO Remove once all repositories are public
if (!process.env.ATOM_ACCESS_TOKEN)
process.env.ATOM_ACCESS_TOKEN = '362295be4c5258d3f7b967bbabae662a455ca2a7';
// Executes an array of commands one by one.
function executeCommands(commands, done, index) {
index = (index == undefined ? 0 : index);
Arquivo executável
+11
Ver Arquivo
@@ -0,0 +1,11 @@
#!/usr/bin/env coffee
path = require 'path'
CommandInstaller = require '../src/command-installer'
callback = (error, sourcePath, destinationPath) ->
unless error?
console.log "#{sourcePath} intalled to #{destinationPath}"
CommandInstaller.installAtomCommand(path.resolve(__dirname, '..'), callback)
CommandInstaller.installApmCommand(path.resolve(__dirname, '..'), callback)
+1 -1
Ver Arquivo
@@ -3,11 +3,11 @@
set -e
BUILT_PRODUCTS_DIR=$1
VERSION=$2
PLIST_PATH="$BUILT_PRODUCTS_DIR/Atom.app/Contents/Info.plist"
HELPER_PLIST_PATH="$BUILT_PRODUCTS_DIR/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/Info.plist"
# Update version
VERSION=$(git rev-parse --short HEAD | tr -d "\n")
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$HELPER_PLIST_PATH"
+5 -5
Ver Arquivo
@@ -1,11 +1,11 @@
{$, $$, fs, RootView} = require 'atom'
{$, $$, fs, WorkspaceView} = require 'atom'
Exec = require('child_process').exec
path = require 'path'
ThemeManager = require '../src/theme-manager'
describe "the `atom` global", ->
beforeEach ->
atom.rootView = new RootView
atom.workspaceView = new WorkspaceView
describe "package lifecycle methods", ->
describe ".loadPackage(name)", ->
@@ -90,12 +90,12 @@ describe "the `atom` global", ->
it "defers requiring/activating the main module until an activation event bubbles to the root view", ->
expect(pack.requireMainModule).not.toHaveBeenCalled()
expect(mainModule.activate).not.toHaveBeenCalled()
atom.rootView.trigger 'activation-event'
atom.workspaceView.trigger 'activation-event'
expect(mainModule.activate).toHaveBeenCalled()
it "triggers the activation event on all handlers registered during activation", ->
atom.rootView.openSync()
editorView = atom.rootView.getActiveView()
atom.workspaceView.openSync()
editorView = atom.workspaceView.getActiveView()
eventHandler = jasmine.createSpy("activation-event")
editorView.command 'activation-event', eventHandler
editorView.trigger 'activation-event'
+9 -9
Ver Arquivo
@@ -108,10 +108,10 @@ describe "Config", ->
expect(atom.config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
describe ".save()", ->
nodeFs = require 'fs'
CSON = require 'season'
beforeEach ->
spyOn(nodeFs, 'writeFileSync')
spyOn(CSON, 'writeFileSync')
jasmine.unspy atom.config, 'save'
describe "when ~/.atom/config.json exists", ->
@@ -122,12 +122,12 @@ describe "Config", ->
atom.config.set("x.y.z", 3)
atom.config.setDefaults("a.b", e: 4, f: 5)
nodeFs.writeFileSync.reset()
CSON.writeFileSync.reset()
atom.config.save()
expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.json"))
writtenConfig = JSON.parse(nodeFs.writeFileSync.argsForCall[0][1])
expect(writtenConfig).toEqual atom.config.settings
expect(CSON.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.json"))
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
expect(writtenConfig).toBe atom.config.settings
describe "when ~/.atom/config.json doesn't exist", ->
it "writes any non-default properties to ~/.atom/config.cson", ->
@@ -137,12 +137,12 @@ describe "Config", ->
atom.config.set("x.y.z", 3)
atom.config.setDefaults("a.b", e: 4, f: 5)
nodeFs.writeFileSync.reset()
CSON.writeFileSync.reset()
atom.config.save()
expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.cson"))
expect(CSON.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.cson"))
CoffeeScript = require 'coffee-script'
writtenConfig = CoffeeScript.eval(nodeFs.writeFileSync.argsForCall[0][1], bare: true)
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
expect(writtenConfig).toEqual atom.config.settings
describe ".setDefaults(keyPath, defaults)", ->
+110 -67
Ver Arquivo
@@ -1,4 +1,4 @@
RootView = require '../src/root-view'
WorkspaceView = require '../src/workspace-view'
EditorView = require '../src/editor-view'
{$, $$} = require '../src/space-pen-extensions'
_ = require 'underscore-plus'
@@ -99,7 +99,7 @@ describe "EditorView", ->
editorView.hiddenInput.focusout()
expect(editorView.isFocused).toBeFalsy()
describe "when the activeEditSession's file is modified on disk", ->
describe "when the editor's file is modified on disk", ->
it "triggers an alert", ->
filePath = path.join(temp.dir, 'atom-changed-file.txt')
fs.writeFileSync(filePath, "")
@@ -123,14 +123,14 @@ describe "EditorView", ->
describe ".remove()", ->
it "destroys the edit session", ->
editorView.remove()
expect(editorView.activeEditSession.destroyed).toBeTruthy()
expect(editorView.editor.destroyed).toBeTruthy()
describe ".edit(editor)", ->
[newEditSession, newBuffer] = []
[newEditor, newBuffer] = []
beforeEach ->
newEditSession = atom.project.openSync('two-hundred.txt')
newBuffer = newEditSession.buffer
newEditor = atom.project.openSync('two-hundred.txt')
newBuffer = newEditor.buffer
it "updates the rendered lines, cursors, selections, scroll position, and event subscriptions to match the given edit session", ->
editorView.attachToDom(heightInLines: 5, widthInChars: 30)
@@ -141,10 +141,10 @@ describe "EditorView", ->
previousScrollTop = editorView.scrollTop()
previousScrollLeft = editorView.scrollLeft()
newEditSession.setScrollTop(900)
newEditSession.setSelectedBufferRange([[40, 0], [43, 1]])
newEditor.setScrollTop(900)
newEditor.setSelectedBufferRange([[40, 0], [43, 1]])
editorView.edit(newEditSession)
editorView.edit(newEditor)
{ firstRenderedScreenRow, lastRenderedScreenRow } = editorView
expect(editorView.lineElementForScreenRow(firstRenderedScreenRow).text()).toBe newBuffer.lineForRow(firstRenderedScreenRow)
expect(editorView.lineElementForScreenRow(lastRenderedScreenRow).text()).toBe newBuffer.lineForRow(editorView.lastRenderedScreenRow)
@@ -168,14 +168,14 @@ describe "EditorView", ->
it "triggers alert if edit session's buffer goes into conflict with changes on disk", ->
filePath = path.join(temp.dir, 'atom-changed-file.txt')
fs.writeFileSync(filePath, "")
tempEditSession = atom.project.openSync(filePath)
editorView.edit(tempEditSession)
tempEditSession.insertText("a buffer change")
tempEditor = atom.project.openSync(filePath)
editorView.edit(tempEditor)
tempEditor.insertText("a buffer change")
spyOn(atom, "confirm")
contentsConflictedHandler = jasmine.createSpy("contentsConflictedHandler")
tempEditSession.on 'contents-conflicted', contentsConflictedHandler
tempEditor.on 'contents-conflicted', contentsConflictedHandler
fs.writeFileSync(filePath, "a file change")
waitsFor ->
contentsConflictedHandler.callCount > 0
@@ -231,18 +231,18 @@ describe "EditorView", ->
expect(editorView.scrollTop()).toBe 50
it "sets the new scroll top position on the active edit session", ->
expect(editorView.activeEditSession.getScrollTop()).toBe 0
expect(editorView.editor.getScrollTop()).toBe 0
editorView.scrollTop(123)
expect(editorView.activeEditSession.getScrollTop()).toBe 123
expect(editorView.editor.getScrollTop()).toBe 123
describe ".scrollHorizontally(pixelPosition)", ->
it "sets the new scroll left position on the active edit session", ->
editorView.attachToDom(heightInLines: 5)
setEditorWidthInChars(editorView, 5)
expect(editorView.activeEditSession.getScrollLeft()).toBe 0
expect(editorView.editor.getScrollLeft()).toBe 0
editorView.scrollHorizontally(left: 50)
expect(editorView.activeEditSession.getScrollLeft()).toBeGreaterThan 0
expect(editorView.activeEditSession.getScrollLeft()).toBe editorView.scrollLeft()
expect(editorView.editor.getScrollLeft()).toBeGreaterThan 0
expect(editorView.editor.getScrollLeft()).toBe editorView.scrollLeft()
describe "editor:attached event", ->
it 'only triggers an editor:attached event when it is first added to the DOM', ->
@@ -329,7 +329,7 @@ describe "EditorView", ->
expect(editorView.charWidth).not.toBe charWidthBefore
expect(editorView.getCursorView().position()).toEqual { top: 5 * editorView.lineHeight, left: 6 * editorView.charWidth }
newEditor = new EditorView(editorView.activeEditSession.copy())
newEditor = new EditorView(editorView.editor.copy())
newEditor.attachToDom()
expect(newEditor.css('font-family')).toBe fontFamily
@@ -357,7 +357,7 @@ describe "EditorView", ->
expect(editorView.renderedLines.outerHeight()).toBe buffer.getLineCount() * editorView.lineHeight
expect(editorView.verticalScrollbarContent.height()).toBe buffer.getLineCount() * editorView.lineHeight
newEditor = new EditorView(editorView.activeEditSession.copy())
newEditor = new EditorView(editorView.editor.copy())
editorView.remove()
newEditor.attachToDom()
expect(newEditor.css('font-size')).toBe '30px'
@@ -738,7 +738,7 @@ describe "EditorView", ->
describe "when a selection is added", ->
it "adds a selection view for it with the proper regions", ->
editorView.activeEditSession.addSelectionForBufferRange([[2, 7], [2, 25]])
editorView.editor.addSelectionForBufferRange([[2, 7], [2, 25]])
selectionViews = editorView.getSelectionViews()
expect(selectionViews.length).toBe 2
expect(selectionViews[1].regions.length).toBe 1
@@ -821,7 +821,7 @@ describe "EditorView", ->
describe "when a selection merges with another selection", ->
it "removes the merged selection view", ->
editor = editorView.activeEditSession
editor = editorView.editor
editor.setCursorScreenPosition([4, 10])
editor.selectToScreenPosition([5, 27])
editor.addCursorAtScreenPosition([3, 10])
@@ -836,7 +836,7 @@ describe "EditorView", ->
jasmine.unspy(editorView, 'requestDisplayUpdate')
spyOn(editorView, 'requestDisplayUpdate')
editor = editorView.activeEditSession
editor = editorView.editor
selection = editor.addSelectionForBufferRange([[3, 0], [3, 4]])
selection.destroy()
editorView.updateDisplay()
@@ -1109,7 +1109,7 @@ describe "EditorView", ->
editorView.scrollLeft(editorView.charWidth * 30)
editorView.trigger "editor:toggle-soft-wrap"
expect(editorView.scrollLeft()).toBe 0
expect(editorView.activeEditSession.getSoftWrapColumn()).not.toBe 100
expect(editorView.editor.getSoftWrapColumn()).not.toBe 100
describe "text rendering", ->
describe "when all lines in the buffer are visible on screen", ->
@@ -1158,7 +1158,8 @@ describe "EditorView", ->
line0 = editorView.renderedLines.find('.line:first')
span0_0 = line0.children('span:eq(0)').children('span:eq(0)')
expect(span0_0).toMatchSelector '.hard-tab'
expect(span0_0.text()).toBe ' '
expect(span0_0.text()).toBe ' '
expect(span0_0.text().length).toBe editor.getTabLength()
it "wraps leading whitespace in a span", ->
line1 = editorView.renderedLines.find('.line:eq(1)')
@@ -1464,8 +1465,8 @@ describe "EditorView", ->
it "renders lines properly", ->
editorView.lineOverdraw = 1
editorView.attachToDom(heightInLines: 5)
editorView.activeEditSession.foldBufferRow(4)
editorView.activeEditSession.foldBufferRow(0)
editorView.editor.foldBufferRow(4)
editorView.editor.foldBufferRow(0)
expect(editorView.renderedLines.find('.line').length).toBe 1
expect(editorView.renderedLines.find('.line').text()).toBe buffer.lineForRow(0)
@@ -1475,7 +1476,7 @@ describe "EditorView", ->
editorView.lineOverdraw = 1
editorView.attachToDom(heightInLines: 5)
editorView.scrollToBottom()
editorView.activeEditSession.foldBufferRow(0)
editorView.editor.foldBufferRow(0)
expect(editorView.renderedLines.find('.line').length).toBe 1
expect(editorView.renderedLines.find('.line').text()).toBe buffer.lineForRow(0)
@@ -1703,7 +1704,7 @@ describe "EditorView", ->
editorView.attachToDom()
setEditorHeightInLines(editorView, 20)
setEditorWidthInChars(editorView, 50)
expect(editorView.activeEditSession.getSoftWrapColumn()).toBe 50
expect(editorView.editor.getSoftWrapColumn()).toBe 50
it "wraps lines that are too long to fit within the editor view's width, adjusting cursor positioning accordingly", ->
expect(editorView.renderedLines.find('.line').length).toBe 16
@@ -1736,9 +1737,9 @@ describe "EditorView", ->
expect(editorView.bufferPositionForScreenPosition(editorView.getCursorScreenPosition())).toEqual [3, 60]
it "does not wrap the lines of any newly assigned buffers", ->
otherEditSession = atom.project.openSync()
otherEditSession.buffer.setText([1..100].join(''))
editorView.edit(otherEditSession)
otherEditor = atom.project.openSync()
otherEditor.buffer.setText([1..100].join(''))
editorView.edit(otherEditor)
expect(editorView.renderedLines.find('.line').length).toBe(1)
it "unwraps lines when softwrap is disabled", ->
@@ -1771,7 +1772,7 @@ describe "EditorView", ->
otherEditor = new EditorView(editor: atom.project.openSync('sample.js'))
spyOn(otherEditor, 'setWidthInChars')
otherEditor.activeEditSession.setSoftWrap(true)
otherEditor.editor.setSoftWrap(true)
expect(otherEditor.setWidthInChars).not.toHaveBeenCalled()
otherEditor.simulateDomAttachment()
@@ -1823,7 +1824,7 @@ describe "EditorView", ->
expect(editorView.gutter.find('.line-number:last').intValue()).toBe 11
it "re-renders the correct line number range when there are folds", ->
editorView.activeEditSession.foldBufferRow(1)
editorView.editor.foldBufferRow(1)
expect(editorView.gutter.find('.line-number-1')).toHaveClass 'fold'
buffer.insert([0, 0], '\n')
@@ -1894,14 +1895,14 @@ describe "EditorView", ->
describe "when the switching from an edit session for a long buffer to an edit session for a short buffer", ->
it "updates the line numbers to reflect the shorter buffer", ->
emptyEditSession = atom.project.openSync(null)
editorView.edit(emptyEditSession)
emptyEditor = atom.project.openSync(null)
editorView.edit(emptyEditor)
expect(editorView.gutter.lineNumbers.find('.line-number').length).toBe 1
editorView.edit(editor)
expect(editorView.gutter.lineNumbers.find('.line-number').length).toBeGreaterThan 1
editorView.edit(emptyEditSession)
editorView.edit(emptyEditor)
expect(editorView.gutter.lineNumbers.find('.line-number').length).toBe 1
describe "when the editor view is mini", ->
@@ -1934,7 +1935,6 @@ describe "EditorView", ->
miniEditor.setText(" and indented line")
expect(miniEditor.renderedLines.find('.indent-guide').length).toBe 0
it "lets you set the grammar", ->
miniEditor = new EditorView(mini: true)
miniEditor.setText("var something")
@@ -1946,6 +1946,31 @@ describe "EditorView", ->
# doesn't allow regular editors to set grammars
expect(-> editorView.setGrammar()).toThrow()
describe "placeholderText", ->
it "is hidden and shown when appropriate", ->
miniEditor = new EditorView(mini: true, placeholderText: 'octokitten')
miniEditor.attachToDom()
expect(miniEditor.underlayer.find('.placeholder-text')).toExist()
miniEditor.setText("var something")
expect(miniEditor.underlayer.find('.placeholder-text')).not.toExist()
miniEditor.setText("")
expect(miniEditor.underlayer.find('.placeholder-text')).toExist()
it "can be set", ->
miniEditor = new EditorView(mini: true)
miniEditor.attachToDom()
expect(miniEditor.find('.placeholder-text').text()).toEqual ''
miniEditor.setPlaceholderText 'octokitten'
expect(miniEditor.find('.placeholder-text').text()).toEqual 'octokitten'
miniEditor.setPlaceholderText 'new one'
expect(miniEditor.find('.placeholder-text').text()).toEqual 'new one'
describe "when the editor.showLineNumbers config is false", ->
it "doesn't render any line numbers", ->
expect(editorView.gutter.lineNumbers).toBeVisible()
@@ -2375,7 +2400,7 @@ describe "EditorView", ->
editorView.reloadGrammar()
expect(editorView.getGrammar().name).toBe 'JavaScript'
tokenizedBuffer = editorView.activeEditSession.displayBuffer.tokenizedBuffer
tokenizedBuffer = editorView.editor.displayBuffer.tokenizedBuffer
line0 = tokenizedBuffer.lineForScreenRow(0)
expect(line0.tokens.length).toBe 3
expect(line0.tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.modifier.js'])
@@ -2706,32 +2731,17 @@ describe "EditorView", ->
expect(buffer.lineForRow(15)).toBeUndefined()
expect(editorView.getCursorBufferPosition()).toEqual [13, 0]
describe "editor:save-debug-snapshot", ->
it "saves the state of the rendered lines, the display buffer, and the buffer to a file of the user's choosing", ->
saveDialogCallback = null
spyOn(atom, 'showSaveDialog').andCallFake (callback) -> saveDialogCallback = callback
spyOn(fs, 'writeFileSync')
editorView.trigger 'editor:save-debug-snapshot'
statePath = path.join(temp.dir, 'state')
expect(atom.showSaveDialog).toHaveBeenCalled()
saveDialogCallback(statePath)
expect(fs.writeFileSync).toHaveBeenCalled()
expect(fs.writeFileSync.argsForCall[0][0]).toBe statePath
expect(typeof fs.writeFileSync.argsForCall[0][1]).toBe 'string'
describe "when the escape key is pressed on the editor view", ->
it "clears multiple selections if there are any, and otherwise allows other bindings to be handled", ->
atom.keymap.bindKeys 'name', '.editor', 'escape': 'test-event'
testEventHandler = jasmine.createSpy("testEventHandler")
editorView.on 'test-event', testEventHandler
editorView.activeEditSession.addSelectionForBufferRange([[3, 0], [3, 0]])
expect(editorView.activeEditSession.getSelections().length).toBe 2
editorView.editor.addSelectionForBufferRange([[3, 0], [3, 0]])
expect(editorView.editor.getSelections().length).toBe 2
editorView.trigger(keydownEvent('escape'))
expect(editorView.activeEditSession.getSelections().length).toBe 1
expect(editorView.editor.getSelections().length).toBe 1
expect(testEventHandler).not.toHaveBeenCalled()
editorView.trigger(keydownEvent('escape'))
@@ -2740,10 +2750,10 @@ describe "EditorView", ->
describe "when the editor view is attached but invisible", ->
describe "when the editor view's text is changed", ->
it "redraws the editor view when it is next shown", ->
atom.rootView = new RootView
atom.rootView.openSync('sample.js')
atom.rootView.attachToDom()
editorView = atom.rootView.getActiveView()
atom.workspaceView = new WorkspaceView
atom.workspaceView.openSync('sample.js')
atom.workspaceView.attachToDom()
editorView = atom.workspaceView.getActiveView()
view = $$ -> @div id: 'view', tabindex: -1, 'View'
editorView.getPane().showItem(view)
@@ -2794,10 +2804,10 @@ describe "EditorView", ->
describe "when the editor view is removed", ->
it "fires a editor:will-be-removed event", ->
atom.rootView = new RootView
atom.rootView.openSync('sample.js')
atom.rootView.attachToDom()
editorView = atom.rootView.getActiveView()
atom.workspaceView = new WorkspaceView
atom.workspaceView.openSync('sample.js')
atom.workspaceView.attachToDom()
editorView = atom.workspaceView.getActiveView()
willBeRemovedHandler = jasmine.createSpy('fileChange')
editorView.on 'editor:will-be-removed', willBeRemovedHandler
@@ -2819,7 +2829,40 @@ describe "EditorView", ->
it "updates the active edit session with the current soft wrap column", ->
editorView.attachToDom()
setEditorWidthInChars(editorView, 50)
expect(editorView.activeEditSession.getSoftWrapColumn()).toBe 50
expect(editorView.editor.getSoftWrapColumn()).toBe 50
setEditorWidthInChars(editorView, 100)
$(window).trigger 'resize'
expect(editorView.activeEditSession.getSoftWrapColumn()).toBe 100
expect(editorView.editor.getSoftWrapColumn()).toBe 100
describe "character width caching", ->
describe "when soft wrap is enabled", ->
it "correctly calculates the the position left for a column", ->
editor.setSoftWrap(true)
editorView.setText('lllll 00000')
editorView.setFontFamily('serif')
editorView.setFontSize(10)
editorView.attachToDom()
editorView.setWidthInChars(5)
expect(editorView.pixelPositionForScreenPosition([0, 5]).left).toEqual 15
expect(editorView.pixelPositionForScreenPosition([1, 5]).left).toEqual 25
# Check that widths are actually being cached
spyOn(editorView, 'measureToColumn').andCallThrough()
editorView.pixelPositionForScreenPosition([0, 5])
editorView.pixelPositionForScreenPosition([1, 5])
expect(editorView.measureToColumn.callCount).toBe 0
describe "when the editor contains hard tabs", ->
it "correctly calculates the the position left for a column", ->
editorView.setText('\ttest')
editorView.attachToDom()
expect(editorView.pixelPositionForScreenPosition([0, editor.getTabLength()]).left).toEqual 20
expect(editorView.pixelPositionForScreenPosition([0, editor.getTabLength() + 1]).left).toEqual 30
# Check that widths are actually being cached
spyOn(editorView, 'measureToColumn').andCallThrough()
editorView.pixelPositionForScreenPosition([0, editor.getTabLength()])
editorView.pixelPositionForScreenPosition([0, editor.getTabLength() + 1])
expect(editorView.measureToColumn.callCount).toBe 0
@@ -9,5 +9,5 @@ module.exports =
activate: ->
@activateCallCount++
atom.rootView.getActiveView()?.command 'activation-event', =>
atom.workspaceView.getActiveView()?.command 'activation-event', =>
@activationEventCallCount++
@@ -1,5 +1,5 @@
# This package loads async, otherwise it would log errors when it
# is automatically serialized when rootView is deactivatated
# is automatically serialized when workspaceView is deactivatated
'main': 'index.coffee'
'activationEvents': ['activation-event']
+5 -5
Ver Arquivo
@@ -1,7 +1,7 @@
path = require 'path'
Keymap = require '../src/keymap'
{$, $$, RootView} = require 'atom'
{$, $$, WorkspaceView} = require 'atom'
describe "Keymap", ->
fragment = null
@@ -158,12 +158,12 @@ describe "Keymap", ->
expect(bazHandler).toHaveBeenCalled()
describe "when the event's target is the document body", ->
it "triggers the mapped event on the rootView", ->
atom.rootView = new RootView
atom.rootView.attachToDom()
it "triggers the mapped event on the workspaceView", ->
atom.workspaceView = new WorkspaceView
atom.workspaceView.attachToDom()
keymap.bindKeys 'name', 'body', 'x': 'foo'
fooHandler = jasmine.createSpy("fooHandler")
atom.rootView.on 'foo', fooHandler
atom.workspaceView.on 'foo', fooHandler
result = keymap.handleKeyEvent(keydownEvent('x', target: document.body))
expect(result).toBe(false)
+6 -9
Ver Arquivo
@@ -92,7 +92,7 @@ describe "Pane", ->
pane.showItem(editor1)
editorView = pane.activeView
expect(editorView.css('display')).not.toBe 'none'
expect(editorView.activeEditSession).toBe editor1
expect(editorView.editor).toBe editor1
describe "when a valid view has already been appended for another item", ->
it "multiple views are created for multiple items", ->
@@ -101,7 +101,7 @@ describe "Pane", ->
expect(pane.itemViews.find('.editor').length).toBe 2
editorView = pane.activeView
expect(editorView.css('display')).not.toBe 'none'
expect(editorView.activeEditSession).toBe editor2
expect(editorView.editor).toBe editor2
it "creates a new view with the item", ->
initialViewCount = pane.itemViews.find('.test-view').length
@@ -475,20 +475,20 @@ describe "Pane", ->
describe "when it is the last pane", ->
beforeEach ->
expect(container.getPanes().length).toBe 1
atom.rootView = focus: jasmine.createSpy("rootView.focus")
atom.workspaceView = focus: jasmine.createSpy("workspaceView.focus")
describe "when the removed pane is focused", ->
it "calls focus on rootView so we don't lose focus", ->
it "calls focus on workspaceView so we don't lose focus", ->
container.attachToDom()
pane.focus()
pane.remove()
expect(atom.rootView.focus).toHaveBeenCalled()
expect(atom.workspaceView.focus).toHaveBeenCalled()
describe "when the removed pane is not focused", ->
it "does not call focus on root view", ->
expect(pane).not.toMatchSelector ':has(:focus)'
pane.remove()
expect(atom.rootView.focus).not.toHaveBeenCalled()
expect(atom.workspaceView.focus).not.toHaveBeenCalled()
describe ".getNextPane()", ->
it "returns the next pane if one exists, wrapping around from the last pane to the first", ->
@@ -699,11 +699,8 @@ describe "Pane", ->
it "focuses the pane after attach only if had focus when serialized", ->
reloadContainer = ->
projectReplica = atom.replicate().get('project')
containerState = container.serialize()
container.remove()
atom.project = projectReplica
atom.project.destroy()
container = atom.deserializers.deserialize(containerState)
pane = container.getRoot()
container.attachToDom()
+69 -27
Ver Arquivo
@@ -39,15 +39,15 @@ describe "Project", ->
describe "when an edit session is destroyed", ->
it "removes edit session and calls destroy on buffer (if buffer is not referenced by other edit sessions)", ->
editor = atom.project.openSync("a")
anotherEditSession = atom.project.openSync("a")
anotherEditor = atom.project.openSync("a")
expect(atom.project.editors.length).toBe 2
expect(editor.buffer).toBe anotherEditSession.buffer
expect(editor.buffer).toBe anotherEditor.buffer
editor.destroy()
expect(atom.project.editors.length).toBe 1
anotherEditSession.destroy()
anotherEditor.destroy()
expect(atom.project.editors.length).toBe 0
describe "when an edit session is saved and the project has no path", ->
@@ -66,14 +66,14 @@ describe "Project", ->
editor1 = atom.project.openSync("a")
expect(handler.callCount).toBe 1
expect(atom.project.getEditSessions().length).toBe 1
expect(atom.project.getEditSessions()[0]).toBe editor1
expect(atom.project.getEditors().length).toBe 1
expect(atom.project.getEditors()[0]).toBe editor1
editor2 = atom.deserializers.deserialize(editor1.serialize())
expect(handler.callCount).toBe 2
expect(atom.project.getEditSessions().length).toBe 2
expect(atom.project.getEditSessions()[0]).toBe editor1
expect(atom.project.getEditSessions()[1]).toBe editor2
expect(atom.project.getEditors().length).toBe 2
expect(atom.project.getEditors()[0]).toBe editor1
expect(atom.project.getEditors()[1]).toBe editor2
describe "when an edit session is copied", ->
it "emits an 'editor-created' event and stores the edit session", ->
@@ -82,23 +82,23 @@ describe "Project", ->
editor1 = atom.project.openSync("a")
expect(handler.callCount).toBe 1
expect(atom.project.getEditSessions().length).toBe 1
expect(atom.project.getEditSessions()[0]).toBe editor1
expect(atom.project.getEditors().length).toBe 1
expect(atom.project.getEditors()[0]).toBe editor1
editor2 = editor1.copy()
expect(handler.callCount).toBe 2
expect(atom.project.getEditSessions().length).toBe 2
expect(atom.project.getEditSessions()[0]).toBe editor1
expect(atom.project.getEditSessions()[1]).toBe editor2
expect(atom.project.getEditors().length).toBe 2
expect(atom.project.getEditors()[0]).toBe editor1
expect(atom.project.getEditors()[1]).toBe editor2
describe ".openSync(path)", ->
[fooOpener, barOpener, absolutePath, newBufferHandler, newEditSessionHandler] = []
[fooOpener, barOpener, absolutePath, newBufferHandler, newEditorHandler] = []
beforeEach ->
absolutePath = require.resolve('./fixtures/dir/a')
newBufferHandler = jasmine.createSpy('newBufferHandler')
atom.project.on 'buffer-created', newBufferHandler
newEditSessionHandler = jasmine.createSpy('newEditSessionHandler')
atom.project.on 'editor-created', newEditSessionHandler
newEditorHandler = jasmine.createSpy('newEditorHandler')
atom.project.on 'editor-created', newEditorHandler
fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/)
barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//)
@@ -115,14 +115,14 @@ describe "Project", ->
editor = atom.project.openSync(absolutePath)
expect(editor.buffer.getPath()).toBe absolutePath
expect(newBufferHandler).toHaveBeenCalledWith editor.buffer
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when given a relative path that hasn't been opened previously", ->
it "returns a new edit session for the given path (relative to the project root) and emits 'buffer-created' and 'editor-created' events", ->
editor = atom.project.openSync('a')
expect(editor.buffer.getPath()).toBe absolutePath
expect(newBufferHandler).toHaveBeenCalledWith editor.buffer
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when passed the path to a buffer that has already been opened", ->
it "returns a new edit session containing previously opened buffer and emits a 'editor-created' event", ->
@@ -131,14 +131,14 @@ describe "Project", ->
expect(atom.project.openSync(absolutePath).buffer).toBe editor.buffer
expect(atom.project.openSync('a').buffer).toBe editor.buffer
expect(newBufferHandler).not.toHaveBeenCalled()
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when not passed a path", ->
it "returns a new edit session and emits 'buffer-created' and 'editor-created' events", ->
editor = atom.project.openSync()
expect(editor.buffer.getPath()).toBeUndefined()
expect(newBufferHandler).toHaveBeenCalledWith(editor.buffer)
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when passed a path that matches a custom opener", ->
it "returns the resource returned by the custom opener", ->
@@ -147,14 +147,14 @@ describe "Project", ->
expect(atom.project.openSync("bar://baz")).toEqual { bar: "bar://baz" }
describe ".open(path)", ->
[fooOpener, barOpener, absolutePath, newBufferHandler, newEditSessionHandler] = []
[fooOpener, barOpener, absolutePath, newBufferHandler, newEditorHandler] = []
beforeEach ->
absolutePath = require.resolve('./fixtures/dir/a')
newBufferHandler = jasmine.createSpy('newBufferHandler')
atom.project.on 'buffer-created', newBufferHandler
newEditSessionHandler = jasmine.createSpy('newEditSessionHandler')
atom.project.on 'editor-created', newEditSessionHandler
newEditorHandler = jasmine.createSpy('newEditorHandler')
atom.project.on 'editor-created', newEditorHandler
fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/)
barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//)
@@ -175,7 +175,7 @@ describe "Project", ->
runs ->
expect(editor.buffer.getPath()).toBe absolutePath
expect(newBufferHandler).toHaveBeenCalledWith editor.buffer
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when given a relative path that isn't currently opened", ->
it "returns a new edit session for the given path (relative to the project root) and emits 'buffer-created' and 'editor-created' events", ->
@@ -186,7 +186,7 @@ describe "Project", ->
runs ->
expect(editor.buffer.getPath()).toBe absolutePath
expect(newBufferHandler).toHaveBeenCalledWith editor.buffer
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when passed the path to a buffer that is currently opened", ->
it "returns a new edit session containing currently opened buffer and emits a 'editor-created' event", ->
@@ -199,7 +199,7 @@ describe "Project", ->
expect(atom.project.openSync(absolutePath).buffer).toBe editor.buffer
expect(atom.project.openSync('a').buffer).toBe editor.buffer
expect(newBufferHandler).not.toHaveBeenCalled()
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when not passed a path", ->
it "returns a new edit session and emits 'buffer-created' and 'editor-created' events", ->
@@ -210,7 +210,7 @@ describe "Project", ->
runs ->
expect(editor.buffer.getPath()).toBeUndefined()
expect(newBufferHandler).toHaveBeenCalledWith(editor.buffer)
expect(newEditSessionHandler).toHaveBeenCalledWith editor
expect(newEditorHandler).toHaveBeenCalledWith editor
describe "when passed a path that matches a custom opener", ->
it "returns the resource returned by the custom opener", ->
@@ -353,6 +353,19 @@ describe "Project", ->
expect(editor.isModified()).toBeFalsy()
it "does not replace when the path is not specified", ->
editor = atom.project.openSync('sample.js')
editor = atom.project.openSync('sample-with-comments.js')
results = []
waitsForPromise ->
atom.project.replace /items/gi, 'items', [commentFilePath], (result) ->
results.push(result)
runs ->
expect(results).toHaveLength 1
expect(results[0].filePath).toBe commentFilePath
it "does NOT save when modified", ->
editor = atom.project.openSync('sample.js')
editor.buffer.change([[0,0],[0,0]], 'omg')
@@ -532,3 +545,32 @@ describe "Project", ->
resultForA = _.find results, ({filePath}) -> path.basename(filePath) == 'a'
expect(resultForA.matches).toHaveLength 1
expect(resultForA.matches[0].matchText).toBe 'Elephant'
describe ".eachBuffer(callback)", ->
beforeEach ->
atom.project.bufferForPathSync('a')
it "invokes the callback for existing buffer", ->
count = 0
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.project.eachBuffer(callback)
expect(count).toBe 1
expect(callbackBuffer).toBe atom.project.getBuffers()[0]
it "invokes the callback for new buffers", ->
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.project.eachBuffer(callback)
count = 0
callbackBuffer = null
atom.project.bufferForPathSync(require.resolve('./fixtures/sample.txt'))
expect(count).toBe 1
expect(callbackBuffer).toBe atom.project.getBuffers()[1]
+3
Ver Arquivo
@@ -1,3 +1,6 @@
# Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
try
require '../src/window'
Atom = require '../src/atom'
+9 -6
Ver Arquivo
@@ -4,7 +4,7 @@ atom.restoreDimensions()
require '../vendor/jasmine-jquery'
path = require 'path'
{_, $, File, RootView, fs} = require 'atom'
{_, $, File, WorkspaceView, fs} = require 'atom'
Keymap = require '../src/keymap'
Config = require '../src/config'
{Point} = require 'telepath'
@@ -55,7 +55,10 @@ beforeEach ->
window.resetTimeouts()
atom.packages.packageStates = {}
spyOn(atom, 'saveWindowState')
serializedWindowState = null
spyOn(atom, 'saveWindowState').andCallFake -> serializedWindowState = @getWindowState().serialize()
spyOn(atom, 'loadSerializedWindowState').andCallFake -> serializedWindowState
atom.syntax.clearGrammarOverrides()
atom.syntax.clearProperties()
@@ -73,7 +76,7 @@ beforeEach ->
config = new Config({resourcePath, configDirPath: atom.getConfigDirPath()})
spyOn(config, 'load')
spyOn(config, 'save')
config.setDefaults('core', RootView.configDefaults)
config.setDefaults('core', WorkspaceView.configDefaults)
config.setDefaults('editor', EditorView.configDefaults)
config.set "editor.fontFamily", "Courier"
config.set "editor.fontSize", 16
@@ -85,7 +88,7 @@ beforeEach ->
# make editor display updates synchronous
spyOn(EditorView.prototype, 'requestDisplayUpdate').andCallFake -> @updateDisplay()
spyOn(RootView.prototype, 'setTitle').andCallFake (@title) ->
spyOn(WorkspaceView.prototype, 'setTitle').andCallFake (@title) ->
spyOn(window, "setTimeout").andCallFake window.fakeSetTimeout
spyOn(window, "clearTimeout").andCallFake window.fakeClearTimeout
spyOn(File.prototype, "detectResurrectionAfterDelay").andCallFake -> @detectResurrection()
@@ -104,8 +107,8 @@ afterEach ->
atom.packages.deactivatePackages()
atom.menu.template = []
atom.rootView?.remove?()
atom.rootView = null
atom.workspaceView?.remove?()
atom.workspaceView = null
atom.project?.destroy?()
atom.project = null
+11 -3
Ver Arquivo
@@ -635,11 +635,9 @@ describe "TextMateGrammar", ->
expect(lastToken.value).toEqual ';'
describe "HTML (Ruby - ERB)", ->
beforeEach ->
it "correctly parses strings inside tags", ->
grammar = atom.syntax.selectGrammar('page.erb')
lines = grammar.tokenizeLines '<% page_title "My Page" %>'
it "correctly parses strings inside tags", ->
tokens = lines[0]
expect(tokens[2].value).toEqual '"'
@@ -649,6 +647,16 @@ describe "TextMateGrammar", ->
expect(tokens[4].value).toEqual '"'
expect(tokens[4].scopes).toEqual ["text.html.erb", "meta.embedded.line.erb", "string.quoted.double.ruby", "punctuation.definition.string.end.ruby"]
it "does not loop infinitely on <%>", ->
atom.packages.activatePackage('language-html', sync: true)
atom.packages.activatePackage('language-ruby-on-rails', sync: true)
grammar = atom.syntax.selectGrammar('foo.html.erb')
[tokens] = grammar.tokenizeLines '<%>'
expect(tokens.length).toBe 1
expect(tokens[0].value).toEqual '<%>'
expect(tokens[0].scopes).toEqual ["text.html.erb"]
describe "Unicode support", ->
describe "Surrogate pair characters", ->
beforeEach ->
+8 -8
Ver Arquivo
@@ -1,5 +1,5 @@
path = require 'path'
{$, $$, fs, RootView} = require 'atom'
{$, $$, fs, WorkspaceView} = require 'atom'
ThemeManager = require '../src/theme-manager'
AtomPackage = require '../src/atom-package'
@@ -32,7 +32,7 @@ describe "ThemeManager", ->
describe "getImportPaths()", ->
it "returns the theme directories before the themes are loaded", ->
atom.config.set('core.themes', ['atom-dark-syntax', 'atom-dark-ui', 'atom-light-ui'])
atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui', 'atom-light-ui'])
paths = themeManager.getImportPaths()
@@ -67,8 +67,8 @@ describe "ThemeManager", ->
atom.config.set('core.themes', [])
expect($('style.theme').length).toBe 0
# atom-dark-ui has an directory path, the syntax ones dont.
atom.config.set('core.themes', ['atom-light-syntax', 'atom-dark-ui', 'atom-dark-syntax'])
# atom-dark-ui has an directory path, the syntax one doesn't
atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui'])
importPaths = themeManager.getImportPaths()
expect(importPaths.length).toBe 1
expect(importPaths[0]).toContain 'atom-dark-ui'
@@ -140,16 +140,16 @@ describe "ThemeManager", ->
describe "base stylesheet loading", ->
beforeEach ->
atom.rootView = new RootView
atom.rootView.append $$ -> @div class: 'editor'
atom.rootView.attachToDom()
atom.workspaceView = new WorkspaceView
atom.workspaceView.append $$ -> @div class: 'editor'
atom.workspaceView.attachToDom()
themeManager.activateThemes()
it "loads the correct values from the theme's ui-variables file", ->
atom.config.set('core.themes', ['theme-with-ui-variables'])
# an override loaded in the base css
expect(atom.rootView.css("background-color")).toBe "rgb(0, 0, 255)"
expect(atom.workspaceView.css("background-color")).toBe "rgb(0, 0, 255)"
# from within the theme itself
expect($(".editor").css("padding-top")).toBe "150px"
+10
Ver Arquivo
@@ -434,3 +434,13 @@ describe "TokenizedBuffer", ->
describe "when the selector matches a run of multiple tokens at the position", ->
it "returns the range covered by all contigous tokens (within a single line)", ->
expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.function', [1, 18])).toEqual [[1, 6], [1, 28]]
describe "when the editor.tabLength config value changes", ->
it "updates the tab length of the tokenized lines", ->
buffer = atom.project.bufferForPathSync('sample.js')
buffer.setText('\ttest')
tokenizedBuffer = new TokenizedBuffer({buffer})
fullyTokenize(tokenizedBuffer)
expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' '
atom.config.set('editor.tabLength', 6)
expect(tokenizedBuffer.tokenForPosition([0,0]).value).toBe ' '
+12 -12
Ver Arquivo
@@ -58,46 +58,46 @@ describe "Window", ->
beforeUnloadEvent = $.Event(new Event('beforeunload'))
describe "when pane items are are modified", ->
it "prompts user to save and and calls rootView.confirmClose", ->
spyOn(atom.rootView, 'confirmClose').andCallThrough()
it "prompts user to save and and calls workspaceView.confirmClose", ->
spyOn(atom.workspaceView, 'confirmClose').andCallThrough()
spyOn(atom, "confirm").andReturn(2)
editor = atom.rootView.openSync("sample.js")
editor = atom.workspaceView.openSync("sample.js")
editor.insertText("I look different, I feel different.")
$(window).trigger(beforeUnloadEvent)
expect(atom.rootView.confirmClose).toHaveBeenCalled()
expect(atom.workspaceView.confirmClose).toHaveBeenCalled()
expect(atom.confirm).toHaveBeenCalled()
it "prompts user to save and handler returns true if don't save", ->
spyOn(atom, "confirm").andReturn(2)
editor = atom.rootView.openSync("sample.js")
editor = atom.workspaceView.openSync("sample.js")
editor.insertText("I look different, I feel different.")
$(window).trigger(beforeUnloadEvent)
expect(atom.confirm).toHaveBeenCalled()
it "prompts user to save and handler returns false if dialog is canceled", ->
spyOn(atom, "confirm").andReturn(1)
editor = atom.rootView.openSync("sample.js")
editor = atom.workspaceView.openSync("sample.js")
editor.insertText("I look different, I feel different.")
$(window).trigger(beforeUnloadEvent)
expect(atom.confirm).toHaveBeenCalled()
describe ".unloadEditorWindow()", ->
it "saves the serialized state of the window so it can be deserialized after reload", ->
rootViewState = atom.rootView.serialize()
workspaceViewState = atom.workspaceView.serialize()
syntaxState = atom.syntax.serialize()
atom.unloadEditorWindow()
expect(atom.getWindowState().getObject('rootView')).toEqual rootViewState.toObject()
expect(atom.getWindowState().getObject('workspaceView')).toEqual workspaceViewState.toObject()
expect(atom.getWindowState().getObject('syntax')).toEqual syntaxState
expect(atom.saveWindowState).toHaveBeenCalled()
it "unsubscribes from all buffers", ->
atom.rootView.openSync('sample.js')
buffer = atom.rootView.getActivePaneItem().buffer
pane = atom.rootView.getActivePane()
atom.workspaceView.openSync('sample.js')
buffer = atom.workspaceView.getActivePaneItem().buffer
pane = atom.workspaceView.getActivePane()
pane.splitRight(pane.copyActiveItem())
expect(atom.rootView.find('.editor').length).toBe 2
expect(atom.workspaceView.find('.editor').length).toBe 2
atom.unloadEditorWindow()
@@ -1,52 +1,46 @@
{$, $$, fs, RootView, View} = require 'atom'
{$, $$, fs, WorkspaceView, View} = require 'atom'
Q = require 'q'
path = require 'path'
temp = require 'temp'
Pane = require '../src/pane'
describe "RootView", ->
describe "WorkspaceView", ->
pathToOpen = null
beforeEach ->
atom.project.setPath(atom.project.resolve('dir'))
pathToOpen = atom.project.resolve('a')
atom.rootView = new RootView
atom.rootView.enableKeymap()
atom.rootView.openSync(pathToOpen)
atom.rootView.focus()
atom.workspaceView = new WorkspaceView
atom.workspaceView.enableKeymap()
atom.workspaceView.openSync(pathToOpen)
atom.workspaceView.focus()
describe "@deserialize()", ->
viewState = null
refreshRootViewAndProject = ->
rootViewState = atom.rootView.serialize()
atom.project.getState().serializeForPersistence()
project2 = atom.replicate().get('project')
atom.rootView.remove()
atom.project.destroy()
atom.project = project2
atom.rootView = atom.deserializers.deserialize(rootViewState)
atom.rootView.attachToDom()
simulateReload = ->
atom.unloadEditorWindow()
atom.deserializeEditorWindow()
describe "when the serialized RootView has an unsaved buffer", ->
describe "when the serialized WorkspaceView has an unsaved buffer", ->
it "constructs the view with the same panes", ->
atom.rootView.attachToDom()
atom.rootView.openSync()
editor1 = atom.rootView.getActiveView()
atom.workspaceView.attachToDom()
atom.workspaceView.openSync()
editor1 = atom.workspaceView.getActiveView()
buffer = editor1.getBuffer()
editor1.splitRight()
expect(atom.rootView.getActiveView()).toBe atom.rootView.getEditors()[2]
expect(atom.workspaceView.getActiveView()).toBe atom.workspaceView.getEditorViews()[2]
refreshRootViewAndProject()
simulateReload()
expect(atom.rootView.getEditors().length).toBe 2
expect(atom.rootView.getActiveView()).toBe atom.rootView.getEditors()[1]
expect(atom.rootView.title).toBe "untitled - #{atom.project.getPath()}"
expect(atom.workspaceView.getEditorViews().length).toBe 2
expect(atom.workspaceView.getActiveView()).toBe atom.workspaceView.getEditorViews()[1]
expect(atom.workspaceView.title).toBe "untitled - #{atom.project.getPath()}"
describe "when there are open editors", ->
it "constructs the view with the same panes", ->
atom.rootView.attachToDom()
pane1 = atom.rootView.getActivePane()
atom.workspaceView.attachToDom()
pane1 = atom.workspaceView.getActivePane()
pane2 = pane1.splitRight()
pane3 = pane2.splitRight()
pane4 = pane2.splitDown()
@@ -57,13 +51,13 @@ describe "RootView", ->
pane4.activeItem.setCursorScreenPosition([0, 2])
pane2.focus()
refreshRootViewAndProject()
simulateReload()
expect(atom.rootView.getEditors().length).toBe 4
editor1 = atom.rootView.panes.find('.row > .pane .editor:eq(0)').view()
editor3 = atom.rootView.panes.find('.row > .pane .editor:eq(1)').view()
editor2 = atom.rootView.panes.find('.row > .column > .pane .editor:eq(0)').view()
editor4 = atom.rootView.panes.find('.row > .column > .pane .editor:eq(1)').view()
expect(atom.workspaceView.getEditorViews().length).toBe 4
editor1 = atom.workspaceView.panes.find('.row > .pane .editor:eq(0)').view()
editor3 = atom.workspaceView.panes.find('.row > .pane .editor:eq(1)').view()
editor2 = atom.workspaceView.panes.find('.row > .column > .pane .editor:eq(0)').view()
editor4 = atom.workspaceView.panes.find('.row > .column > .pane .editor:eq(1)').view()
expect(editor1.getPath()).toBe atom.project.resolve('a')
expect(editor2.getPath()).toBe atom.project.resolve('b')
@@ -84,181 +78,181 @@ describe "RootView", ->
expect(editor3.isFocused).toBeFalsy()
expect(editor4.isFocused).toBeFalsy()
expect(atom.rootView.title).toBe "#{path.basename(editor2.getPath())} - #{atom.project.getPath()}"
expect(atom.workspaceView.title).toBe "#{path.basename(editor2.getPath())} - #{atom.project.getPath()}"
describe "where there are no open editors", ->
it "constructs the view with no open editors", ->
atom.rootView.getActivePane().remove()
expect(atom.rootView.getEditors().length).toBe 0
refreshRootViewAndProject()
expect(atom.rootView.getEditors().length).toBe 0
atom.workspaceView.getActivePane().remove()
expect(atom.workspaceView.getEditorViews().length).toBe 0
simulateReload()
expect(atom.workspaceView.getEditorViews().length).toBe 0
describe "focus", ->
beforeEach ->
atom.rootView.attachToDom()
atom.workspaceView.attachToDom()
describe "when there is an active view", ->
it "hands off focus to the active view", ->
editorView = atom.rootView.getActiveView()
editorView = atom.workspaceView.getActiveView()
editorView.isFocused = false
atom.rootView.focus()
atom.workspaceView.focus()
expect(editorView.isFocused).toBeTruthy()
describe "when there is no active view", ->
beforeEach ->
atom.rootView.getActivePane().remove()
expect(atom.rootView.getActiveView()).toBeUndefined()
atom.rootView.attachToDom()
atom.workspaceView.getActivePane().remove()
expect(atom.workspaceView.getActiveView()).toBeUndefined()
atom.workspaceView.attachToDom()
expect(document.activeElement).toBe document.body
describe "when are visible focusable elements (with a -1 tabindex)", ->
it "passes focus to the first focusable element", ->
focusable1 = $$ -> @div "One", id: 'one', tabindex: -1
focusable2 = $$ -> @div "Two", id: 'two', tabindex: -1
atom.rootView.horizontal.append(focusable1, focusable2)
atom.workspaceView.horizontal.append(focusable1, focusable2)
expect(document.activeElement).toBe document.body
atom.rootView.focus()
atom.workspaceView.focus()
expect(document.activeElement).toBe focusable1[0]
describe "when there are no visible focusable elements", ->
it "surrenders focus to the body", ->
focusable = $$ -> @div "One", id: 'one', tabindex: -1
atom.rootView.horizontal.append(focusable)
atom.workspaceView.horizontal.append(focusable)
focusable.hide()
expect(document.activeElement).toBe document.body
atom.rootView.focus()
atom.workspaceView.focus()
expect(document.activeElement).toBe document.body
describe "keymap wiring", ->
commandHandler = null
beforeEach ->
commandHandler = jasmine.createSpy('commandHandler')
atom.rootView.on('foo-command', commandHandler)
atom.workspaceView.on('foo-command', commandHandler)
atom.keymap.bindKeys('name', '*', 'x': 'foo-command')
describe "when a keydown event is triggered in the RootView", ->
describe "when a keydown event is triggered in the WorkspaceView", ->
it "triggers matching keybindings for that event", ->
event = keydownEvent 'x', target: atom.rootView[0]
event = keydownEvent 'x', target: atom.workspaceView[0]
atom.rootView.trigger(event)
atom.workspaceView.trigger(event)
expect(commandHandler).toHaveBeenCalled()
describe "window title", ->
describe "when the project has no path", ->
it "sets the title to 'untitled'", ->
atom.project.setPath(undefined)
expect(atom.rootView.title).toBe 'untitled'
expect(atom.workspaceView.title).toBe 'untitled'
describe "when the project has a path", ->
beforeEach ->
atom.rootView.openSync('b')
atom.workspaceView.openSync('b')
describe "when there is an active pane item", ->
it "sets the title to the pane item's title plus the project path", ->
item = atom.rootView.getActivePaneItem()
expect(atom.rootView.title).toBe "#{item.getTitle()} - #{atom.project.getPath()}"
item = atom.workspaceView.getActivePaneItem()
expect(atom.workspaceView.title).toBe "#{item.getTitle()} - #{atom.project.getPath()}"
describe "when the title of the active pane item changes", ->
it "updates the window title based on the item's new title", ->
editor = atom.rootView.getActivePaneItem()
editor = atom.workspaceView.getActivePaneItem()
editor.buffer.setPath(path.join(temp.dir, 'hi'))
expect(atom.rootView.title).toBe "#{editor.getTitle()} - #{atom.project.getPath()}"
expect(atom.workspaceView.title).toBe "#{editor.getTitle()} - #{atom.project.getPath()}"
describe "when the active pane's item changes", ->
it "updates the title to the new item's title plus the project path", ->
atom.rootView.getActivePane().showNextItem()
item = atom.rootView.getActivePaneItem()
expect(atom.rootView.title).toBe "#{item.getTitle()} - #{atom.project.getPath()}"
atom.workspaceView.getActivePane().showNextItem()
item = atom.workspaceView.getActivePaneItem()
expect(atom.workspaceView.title).toBe "#{item.getTitle()} - #{atom.project.getPath()}"
describe "when the last pane item is removed", ->
it "updates the title to contain the project's path", ->
atom.rootView.getActivePane().remove()
expect(atom.rootView.getActivePaneItem()).toBeUndefined()
expect(atom.rootView.title).toBe atom.project.getPath()
atom.workspaceView.getActivePane().remove()
expect(atom.workspaceView.getActivePaneItem()).toBeUndefined()
expect(atom.workspaceView.title).toBe atom.project.getPath()
describe "when an inactive pane's item changes", ->
it "does not update the title", ->
pane = atom.rootView.getActivePane()
pane = atom.workspaceView.getActivePane()
pane.splitRight()
initialTitle = atom.rootView.title
initialTitle = atom.workspaceView.title
pane.showNextItem()
expect(atom.rootView.title).toBe initialTitle
expect(atom.workspaceView.title).toBe initialTitle
describe "when the root view is deserialized", ->
it "updates the title to contain the project's path", ->
rootView2 = atom.deserializers.deserialize(atom.rootView.serialize())
item = atom.rootView.getActivePaneItem()
expect(rootView2.title).toBe "#{item.getTitle()} - #{atom.project.getPath()}"
rootView2.remove()
workspaceView2 = atom.deserializers.deserialize(atom.workspaceView.serialize())
item = atom.workspaceView.getActivePaneItem()
expect(workspaceView2.title).toBe "#{item.getTitle()} - #{atom.project.getPath()}"
workspaceView2.remove()
describe "font size adjustment", ->
it "increases/decreases font size when increase/decrease-font-size events are triggered", ->
fontSizeBefore = atom.config.get('editor.fontSize')
atom.rootView.trigger 'window:increase-font-size'
atom.workspaceView.trigger 'window:increase-font-size'
expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore + 1
atom.rootView.trigger 'window:increase-font-size'
atom.workspaceView.trigger 'window:increase-font-size'
expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore + 2
atom.rootView.trigger 'window:decrease-font-size'
atom.workspaceView.trigger 'window:decrease-font-size'
expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore + 1
atom.rootView.trigger 'window:decrease-font-size'
atom.workspaceView.trigger 'window:decrease-font-size'
expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore
it "does not allow the font size to be less than 1", ->
atom.config.set("editor.fontSize", 1)
atom.rootView.trigger 'window:decrease-font-size'
atom.workspaceView.trigger 'window:decrease-font-size'
expect(atom.config.get('editor.fontSize')).toBe 1
describe ".openSync(filePath, options)", ->
describe "when there is no active pane", ->
beforeEach ->
spyOn(Pane.prototype, 'focus')
atom.rootView.getActivePane().remove()
expect(atom.rootView.getActivePane()).toBeUndefined()
atom.workspaceView.getActivePane().remove()
expect(atom.workspaceView.getActivePane()).toBeUndefined()
describe "when called with no path", ->
it "creates a empty edit session as an item on a new pane, and focuses the pane", ->
editor = atom.rootView.openSync()
expect(atom.rootView.getActivePane().activeItem).toBe editor
editor = atom.workspaceView.openSync()
expect(atom.workspaceView.getActivePane().activeItem).toBe editor
expect(editor.getPath()).toBeUndefined()
expect(atom.rootView.getActivePane().focus).toHaveBeenCalled()
expect(atom.workspaceView.getActivePane().focus).toHaveBeenCalled()
it "can create multiple empty edit sessions as an item on a new pane", ->
editor = atom.rootView.openSync()
editor2 = atom.rootView.openSync()
expect(atom.rootView.getActivePane().getItems().length).toBe 2
editor = atom.workspaceView.openSync()
editor2 = atom.workspaceView.openSync()
expect(atom.workspaceView.getActivePane().getItems().length).toBe 2
expect(editor).not.toBe editor2
describe "when called with a path", ->
it "creates an edit session for the given path as an item on a new pane, and focuses the pane", ->
editor = atom.rootView.openSync('b')
expect(atom.rootView.getActivePane().activeItem).toBe editor
editor = atom.workspaceView.openSync('b')
expect(atom.workspaceView.getActivePane().activeItem).toBe editor
expect(editor.getPath()).toBe require.resolve('./fixtures/dir/b')
expect(atom.rootView.getActivePane().focus).toHaveBeenCalled()
expect(atom.workspaceView.getActivePane().focus).toHaveBeenCalled()
describe "when the changeFocus option is false", ->
it "does not focus the new pane", ->
editor = atom.rootView.openSync('b', changeFocus: false)
expect(atom.rootView.getActivePane().focus).not.toHaveBeenCalled()
editor = atom.workspaceView.openSync('b', changeFocus: false)
expect(atom.workspaceView.getActivePane().focus).not.toHaveBeenCalled()
describe "when the split option is 'right'", ->
it "creates a new pane and opens the file in said pane", ->
editor = atom.rootView.openSync('b', split: 'right')
expect(atom.rootView.getActivePane().activeItem).toBe editor
editor = atom.workspaceView.openSync('b', split: 'right')
expect(atom.workspaceView.getActivePane().activeItem).toBe editor
expect(editor.getPath()).toBe require.resolve('./fixtures/dir/b')
describe "when there is an active pane", ->
[activePane, initialItemCount] = []
beforeEach ->
activePane = atom.rootView.getActivePane()
activePane = atom.workspaceView.getActivePane()
spyOn(activePane, 'focus')
initialItemCount = activePane.getItems().length
describe "when called with no path", ->
it "opens an edit session with an empty buffer as an item in the active pane and focuses it", ->
editor = atom.rootView.openSync()
editor = atom.workspaceView.openSync()
expect(activePane.getItems().length).toBe initialItemCount + 1
expect(activePane.activeItem).toBe editor
expect(editor.getPath()).toBeUndefined()
@@ -267,99 +261,99 @@ describe "RootView", ->
describe "when called with a path", ->
describe "when the active pane already has an edit session item for the path being opened", ->
it "shows the existing edit session in the pane", ->
previousEditSession = activePane.activeItem
previousEditor = activePane.activeItem
editor = atom.rootView.openSync('b')
editor = atom.workspaceView.openSync('b')
expect(activePane.activeItem).toBe editor
expect(editor).not.toBe previousEditSession
expect(editor).not.toBe previousEditor
editor = atom.rootView.openSync(previousEditSession.getPath())
expect(editor).toBe previousEditSession
editor = atom.workspaceView.openSync(previousEditor.getPath())
expect(editor).toBe previousEditor
expect(activePane.activeItem).toBe editor
expect(activePane.focus).toHaveBeenCalled()
describe "when the active pane does not have an edit session item for the path being opened", ->
it "creates a new edit session for the given path in the active editor", ->
editor = atom.rootView.openSync('b')
editor = atom.workspaceView.openSync('b')
expect(activePane.items.length).toBe 2
expect(activePane.activeItem).toBe editor
expect(activePane.focus).toHaveBeenCalled()
describe "when the changeFocus option is false", ->
it "does not focus the active pane", ->
editor = atom.rootView.openSync('b', changeFocus: false)
editor = atom.workspaceView.openSync('b', changeFocus: false)
expect(activePane.focus).not.toHaveBeenCalled()
describe "when the split option is 'right'", ->
it "creates a new pane and opens the file in said pane", ->
pane1 = atom.rootView.getActivePane()
pane1 = atom.workspaceView.getActivePane()
editor = atom.rootView.openSync('b', split: 'right')
pane2 = atom.rootView.getActivePane()
editor = atom.workspaceView.openSync('b', split: 'right')
pane2 = atom.workspaceView.getActivePane()
expect(pane2[0]).not.toBe pane1[0]
expect(editor.getPath()).toBe require.resolve('./fixtures/dir/b')
expect(atom.rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
expect(atom.workspaceView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
editor = atom.rootView.openSync('file1', split: 'right')
pane3 = atom.rootView.getActivePane()
editor = atom.workspaceView.openSync('file1', split: 'right')
pane3 = atom.workspaceView.getActivePane()
expect(pane3[0]).toBe pane2[0]
expect(editor.getPath()).toBe require.resolve('./fixtures/dir/file1')
expect(atom.rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
expect(atom.workspaceView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
describe ".openSingletonSync(filePath, options)", ->
describe "when there is an active pane", ->
[pane1] = []
beforeEach ->
spyOn(Pane.prototype, 'focus').andCallFake -> @makeActive()
pane1 = atom.rootView.getActivePane()
pane1 = atom.workspaceView.getActivePane()
it "creates a new pane and reuses the file when already open", ->
atom.rootView.openSingletonSync('b', split: 'right')
pane2 = atom.rootView.getActivePane()
atom.workspaceView.openSingletonSync('b', split: 'right')
pane2 = atom.workspaceView.getActivePane()
expect(pane2[0]).not.toBe pane1[0]
expect(pane1.itemForUri('b')).toBeFalsy()
expect(pane2.itemForUri('b')).not.toBeFalsy()
expect(atom.rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
expect(atom.workspaceView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
pane1.focus()
expect(atom.rootView.getActivePane()[0]).toBe pane1[0]
expect(atom.workspaceView.getActivePane()[0]).toBe pane1[0]
atom.rootView.openSingletonSync('b', split: 'right')
pane3 = atom.rootView.getActivePane()
atom.workspaceView.openSingletonSync('b', split: 'right')
pane3 = atom.workspaceView.getActivePane()
expect(pane3[0]).toBe pane2[0]
expect(pane1.itemForUri('b')).toBeFalsy()
expect(pane2.itemForUri('b')).not.toBeFalsy()
expect(atom.rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
expect(atom.workspaceView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
it "handles split: left by opening to the left pane when necessary", ->
atom.rootView.openSingletonSync('b', split: 'right')
pane2 = atom.rootView.getActivePane()
atom.workspaceView.openSingletonSync('b', split: 'right')
pane2 = atom.workspaceView.getActivePane()
expect(pane2[0]).not.toBe pane1[0]
atom.rootView.openSingletonSync('file1', split: 'left')
atom.workspaceView.openSingletonSync('file1', split: 'left')
activePane = atom.rootView.getActivePane()
activePane = atom.workspaceView.getActivePane()
expect(activePane[0]).toBe pane1[0]
expect(pane1.itemForUri('file1')).toBeTruthy()
expect(pane2.itemForUri('file1')).toBeFalsy()
expect(atom.rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
expect(atom.workspaceView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
pane2.focus()
expect(atom.rootView.getActivePane()[0]).toBe pane2[0]
expect(atom.workspaceView.getActivePane()[0]).toBe pane2[0]
atom.rootView.openSingletonSync('file1', split: 'left')
activePane = atom.rootView.getActivePane()
atom.workspaceView.openSingletonSync('file1', split: 'left')
activePane = atom.workspaceView.getActivePane()
expect(activePane[0]).toBe pane1[0]
expect(atom.rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
expect(atom.workspaceView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
it "reuses the file when already open", ->
atom.rootView.openSync('b')
atom.rootView.openSingletonSync('b', split: 'right')
expect(atom.rootView.panes.find('.pane').toArray()).toEqual [pane1[0]]
atom.workspaceView.openSync('b')
atom.workspaceView.openSingletonSync('b', split: 'right')
expect(atom.workspaceView.panes.find('.pane').toArray()).toEqual [pane1[0]]
describe ".open(filePath)", ->
beforeEach ->
@@ -367,60 +361,60 @@ describe "RootView", ->
describe "when there is no active pane", ->
beforeEach ->
atom.rootView.getActivePane().remove()
expect(atom.rootView.getActivePane()).toBeUndefined()
atom.workspaceView.getActivePane().remove()
expect(atom.workspaceView.getActivePane()).toBeUndefined()
describe "when called with no path", ->
it "creates a empty edit session as an item on a new pane, and focuses the pane", ->
editor = null
waitsForPromise ->
atom.rootView.open().then (o) -> editor = o
atom.workspaceView.open().then (o) -> editor = o
runs ->
expect(atom.rootView.getActivePane().activeItem).toBe editor
expect(atom.workspaceView.getActivePane().activeItem).toBe editor
expect(editor.getPath()).toBeUndefined()
expect(atom.rootView.getActivePane().focus).toHaveBeenCalled()
expect(atom.workspaceView.getActivePane().focus).toHaveBeenCalled()
it "can create multiple empty edit sessions as items on a pane", ->
editor1 = null
editor2 = null
waitsForPromise ->
atom.rootView.open()
atom.workspaceView.open()
.then (o) ->
editor1 = o
atom.rootView.open()
atom.workspaceView.open()
.then (o) ->
editor2 = o
runs ->
expect(atom.rootView.getActivePane().getItems().length).toBe 2
expect(atom.workspaceView.getActivePane().getItems().length).toBe 2
expect(editor1).not.toBe editor2
describe "when called with a path", ->
it "creates an edit session for the given path as an item on a new pane, and focuses the pane", ->
editor = null
waitsForPromise ->
atom.rootView.open('b').then (o) -> editor = o
atom.workspaceView.open('b').then (o) -> editor = o
runs ->
expect(atom.rootView.getActivePane().activeItem).toBe editor
expect(atom.workspaceView.getActivePane().activeItem).toBe editor
expect(editor.getPath()).toBe require.resolve('./fixtures/dir/b')
expect(atom.rootView.getActivePane().focus).toHaveBeenCalled()
expect(atom.workspaceView.getActivePane().focus).toHaveBeenCalled()
describe "when there is an active pane", ->
[activePane] = []
beforeEach ->
activePane = atom.rootView.getActivePane()
activePane = atom.workspaceView.getActivePane()
describe "when called with no path", ->
it "opens an edit session with an empty buffer as an item in the active pane and focuses it", ->
editor = null
waitsForPromise ->
atom.rootView.open().then (o) -> editor = o
atom.workspaceView.open().then (o) -> editor = o
runs ->
expect(activePane.getItems().length).toBe 2
@@ -431,21 +425,21 @@ describe "RootView", ->
describe "when called with a path", ->
describe "when the active pane already has an item for the given path", ->
it "shows the existing edit session in the pane", ->
previousEditSession = activePane.activeItem
previousEditor = activePane.activeItem
editor = null
waitsForPromise ->
atom.rootView.open('b').then (o) -> editor = o
atom.workspaceView.open('b').then (o) -> editor = o
runs ->
expect(activePane.activeItem).toBe editor
expect(editor).not.toBe previousEditSession
expect(editor).not.toBe previousEditor
waitsForPromise ->
atom.rootView.open(previousEditSession.getPath()).then (o) -> editor = o
atom.workspaceView.open(previousEditor.getPath()).then (o) -> editor = o
runs ->
expect(editor).toBe previousEditSession
expect(editor).toBe previousEditor
expect(activePane.activeItem).toBe editor
expect(activePane.focus).toHaveBeenCalled()
@@ -454,7 +448,7 @@ describe "RootView", ->
editor = null
waitsForPromise ->
atom.rootView.open('b').then (o) -> editor = o
atom.workspaceView.open('b').then (o) -> editor = o
runs ->
expect(activePane.activeItem).toBe editor
@@ -463,9 +457,9 @@ describe "RootView", ->
describe "window:toggle-invisibles event", ->
it "shows/hides invisibles in all open and future editors", ->
atom.rootView.height(200)
atom.rootView.attachToDom()
rightEditor = atom.rootView.getActiveView()
atom.workspaceView.height(200)
atom.workspaceView.attachToDom()
rightEditor = atom.workspaceView.getActiveView()
rightEditor.setText(" \t ")
leftEditor = rightEditor.splitLeft()
expect(rightEditor.find(".line:first").text()).toBe " "
@@ -473,23 +467,23 @@ describe "RootView", ->
withInvisiblesShowing = "#{rightEditor.invisibles.space}#{rightEditor.invisibles.tab} #{rightEditor.invisibles.space}#{rightEditor.invisibles.eol}"
atom.rootView.trigger "window:toggle-invisibles"
atom.workspaceView.trigger "window:toggle-invisibles"
expect(rightEditor.find(".line:first").text()).toBe withInvisiblesShowing
expect(leftEditor.find(".line:first").text()).toBe withInvisiblesShowing
lowerLeftEditor = leftEditor.splitDown()
expect(lowerLeftEditor.find(".line:first").text()).toBe withInvisiblesShowing
atom.rootView.trigger "window:toggle-invisibles"
atom.workspaceView.trigger "window:toggle-invisibles"
expect(rightEditor.find(".line:first").text()).toBe " "
expect(leftEditor.find(".line:first").text()).toBe " "
lowerRightEditor = rightEditor.splitDown()
expect(lowerRightEditor.find(".line:first").text()).toBe " "
describe ".eachEditor(callback)", ->
describe ".eachEditorView(callback)", ->
beforeEach ->
atom.rootView.attachToDom()
atom.workspaceView.attachToDom()
it "invokes the callback for existing editor", ->
count = 0
@@ -497,9 +491,9 @@ describe "RootView", ->
callback = (editor) ->
callbackEditor = editor
count++
atom.rootView.eachEditor(callback)
atom.workspaceView.eachEditorView(callback)
expect(count).toBe 1
expect(callbackEditor).toBe atom.rootView.getActiveView()
expect(callbackEditor).toBe atom.workspaceView.getActiveView()
it "invokes the callback for new editor", ->
count = 0
@@ -508,50 +502,21 @@ describe "RootView", ->
callbackEditor = editor
count++
atom.rootView.eachEditor(callback)
atom.workspaceView.eachEditorView(callback)
count = 0
callbackEditor = null
atom.rootView.getActiveView().splitRight()
atom.workspaceView.getActiveView().splitRight()
expect(count).toBe 1
expect(callbackEditor).toBe atom.rootView.getActiveView()
expect(callbackEditor).toBe atom.workspaceView.getActiveView()
it "returns a subscription that can be disabled", ->
count = 0
callback = (editor) -> count++
subscription = atom.rootView.eachEditor(callback)
subscription = atom.workspaceView.eachEditorView(callback)
expect(count).toBe 1
atom.rootView.getActiveView().splitRight()
atom.workspaceView.getActiveView().splitRight()
expect(count).toBe 2
subscription.off()
atom.rootView.getActiveView().splitRight()
atom.workspaceView.getActiveView().splitRight()
expect(count).toBe 2
describe ".eachBuffer(callback)", ->
beforeEach ->
atom.rootView.attachToDom()
it "invokes the callback for existing buffer", ->
count = 0
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.rootView.eachBuffer(callback)
expect(count).toBe 1
expect(callbackBuffer).toBe atom.rootView.getActiveView().getBuffer()
it "invokes the callback for new buffer", ->
count = 0
callbackBuffer = null
callback = (buffer) ->
callbackBuffer = buffer
count++
atom.rootView.eachBuffer(callback)
count = 0
callbackBuffer = null
atom.rootView.openSync(require.resolve('./fixtures/sample.txt'))
expect(count).toBe 1
expect(callbackBuffer).toBe atom.rootView.getActiveView().getBuffer()
+6 -6
Ver Arquivo
@@ -219,11 +219,11 @@ class AtomPackage extends Package
subscribeToActivationEvents: ->
return unless @metadata.activationEvents?
if _.isArray(@metadata.activationEvents)
atom.rootView.command(event, @handleActivationEvent) for event in @metadata.activationEvents
atom.workspaceView.command(event, @handleActivationEvent) for event in @metadata.activationEvents
else if _.isString(@metadata.activationEvents)
atom.rootView.command(@metadata.activationEvents, @handleActivationEvent)
atom.workspaceView.command(@metadata.activationEvents, @handleActivationEvent)
else
atom.rootView.command(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
atom.workspaceView.command(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
handleActivationEvent: (event) =>
bubblePathEventHandlers = @disableEventHandlersOnBubblePath(event)
@@ -234,11 +234,11 @@ class AtomPackage extends Package
unsubscribeFromActivationEvents: ->
if _.isArray(@metadata.activationEvents)
atom.rootView.off(event, @handleActivationEvent) for event in @metadata.activationEvents
atom.workspaceView.off(event, @handleActivationEvent) for event in @metadata.activationEvents
else if _.isString(@metadata.activationEvents)
atom.rootView.off(@metadata.activationEvents, @handleActivationEvent)
atom.workspaceView.off(@metadata.activationEvents, @handleActivationEvent)
else
atom.rootView.off(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
atom.workspaceView.off(event, selector, @handleActivationEvent) for event, selector of @metadata.activationEvents
disableEventHandlersOnBubblePath: (event) ->
bubblePathEventHandlers = []
+35 -19
Ver Arquivo
@@ -1,5 +1,6 @@
crypto = require 'crypto'
ipc = require 'ipc'
keytar = require 'keytar'
os = require 'os'
path = require 'path'
remote = require 'remote'
@@ -28,7 +29,7 @@ WindowEventHandler = require './window-event-handler'
# * `atom.contextMenu` - A {ContextMenuManager} instance
# * `atom.keymap` - A {Keymap} instance
# * `atom.menu` - A {MenuManager} instance
# * `atom.rootView` - A {RootView} instance
# * `atom.workspaceView` - A {WorkspaceView} instance
# * `atom.packages` - A {PackageManager} instance
# * `atom.pasteboard` - A {Pasteboard} instance
# * `atom.project` - A {Project} instance
@@ -40,7 +41,7 @@ class Atom
# Private:
constructor: ->
@rootViewParentSelector = 'body'
@workspaceViewParentSelector = 'body'
@deserializers = new DeserializerManager()
# Private: Initialize all the properties in this object.
@@ -140,14 +141,14 @@ class Atom
@setWindowState('project', @project)
# Private:
deserializeRootView: ->
RootView = require './root-view'
deserializeWorkspaceView: ->
WorkspaceView = require './workspace-view'
state = @getWindowState()
@rootView = @deserializers.deserialize(state.get('rootView'))
unless @rootView?
@rootView = new RootView()
state.set('rootView', @rootView.getState())
$(@rootViewParentSelector).append(@rootView)
@workspaceView = @deserializers.deserialize(state.get('workspaceView'))
unless @workspaceView?
@workspaceView = new WorkspaceView()
state.set('workspaceView', @workspaceView.getState())
$(@workspaceViewParentSelector).append(@workspaceView)
# Private:
deserializePackageStates: ->
@@ -159,7 +160,7 @@ class Atom
deserializeEditorWindow: ->
@deserializePackageStates()
@deserializeProject()
@deserializeRootView()
@deserializeWorkspaceView()
# Private: This method is only called when opening a real application window
startEditorWindow: ->
@@ -171,7 +172,7 @@ class Atom
@windowEventHandler = new WindowEventHandler
@restoreDimensions()
@config.load()
@config.setDefaults('core', require('./root-view').configDefaults)
@config.setDefaults('core', require('./workspace-view').configDefaults)
@config.setDefaults('editor', require('./editor-view').configDefaults)
@keymap.loadBundledKeymaps()
@themes.loadBaseStylesheets()
@@ -191,18 +192,19 @@ class Atom
# Private:
unloadEditorWindow: ->
return if not @project and not @rootView
return if not @project and not @workspaceView
windowState = @getWindowState()
windowState.set('project', @project)
windowState.set('syntax', @syntax.serialize())
windowState.set('rootView', @rootView.serialize())
windowState.set('workspaceView', @workspaceView.serialize())
@packages.deactivatePackages()
windowState.set('packageStates', @packages.packageStates)
@saveWindowState()
@rootView.remove()
@workspaceView.remove()
@project.destroy()
@windowEventHandler?.unsubscribe()
@windowState = null
# Set up the default event handlers and menus for a non-editor window.
#
@@ -319,7 +321,7 @@ class Atom
setImmediate =>
@show()
@focus()
@setFullScreen(true) if @rootView.getState().get('fullScreen')
@setFullScreen(true) if @workspaceView.getState().get('fullScreen')
# Public: Close the current window.
close: ->
@@ -352,6 +354,17 @@ class Atom
getVersion: ->
app.getVersion()
getGitHubAuthTokenName: ->
'Atom GitHub API Token'
# Public: Set the the github token in the keychain
setGitHubAuthToken: (token) ->
keytar.replacePassword(@getGitHubAuthTokenName(), 'github', token)
# Public: Get the github token from the keychain
getGitHubAuthToken: ->
keytar.getPassword(@getGitHubAuthTokenName(), 'github')
# Public: Get the directory path to Atom's configuration area.
#
# Returns the absolute path to ~/.atom
@@ -386,8 +399,8 @@ class Atom
windowState.set(keyPath, value)
windowState
# Private:
loadWindowState: ->
# Private
loadSerializedWindowState: ->
if windowStatePath = @getWindowStatePath()
if fs.existsSync(windowStatePath)
try
@@ -402,7 +415,10 @@ class Atom
catch error
console.warn "Error parsing window state: #{windowStatePath}", error.stack, error
doc = Document.deserialize(documentState) if documentState?
# Private:
loadWindowState: ->
serializedWindowState = @loadSerializedWindowState()
doc = Document.deserialize(serializedWindowState) if serializedWindowState?
doc ?= Document.create()
doc.registerModelClasses(require('./text-buffer'), require('./project'))
# TODO: Remove this when everything is using telepath models
@@ -443,7 +459,7 @@ class Atom
# Public: Visually and audibly trigger a beep.
beep: ->
shell.beep() if @config.get('core.audioBeep')
@rootView.trigger 'beep'
@workspaceView.trigger 'beep'
# Private:
requireUserInitScript: ->
+11 -3
Ver Arquivo
@@ -138,7 +138,7 @@ class AtomApplication
@on 'application:zoom', -> Menu.sendActionToFirstResponder('zoom:')
@on 'application:bring-all-windows-to-front', -> Menu.sendActionToFirstResponder('arrangeInFront:')
@on 'application:inspect', ({x,y}) -> @focusedWindow().browserWindow.inspectElement(x, y)
@on 'application:open-documentation', -> shell.openExternal('https://github-atom-io.herokuapp.com/docs/latest/?app=true')
@on 'application:open-documentation', -> shell.openExternal('https://www.atom.io/docs/latest/?app')
@on 'application:report-issue', -> shell.openExternal('https://github.com/atom/atom/issues/new')
@on 'application:show-settings', ->
if @focusedWindow()
@@ -245,6 +245,14 @@ class AtomApplication
# + initialSize:
# Object with height and width keys.
openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, initialSize}={}) ->
if devMode and not fs.existsSync(global.devResourcePath)
dialog.showMessageBox
type: 'warning'
buttons: ['OK']
message: 'Atom source directory not found.'
detail: 'To run a window in dev mode you need to have the atom/atom repo cloned to ~/github/atom'
return
if pathToOpen
[basename, initialLine] = path.basename(pathToOpen).split(':')
if initialLine
@@ -349,8 +357,8 @@ class AtomApplication
# A Boolean which controls whether any newly opened windows should be in
# dev mode or not.
promptForPath: ({devMode}={}) ->
pathsToOpen = dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory']
@openPaths({pathsToOpen, devMode})
dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory'], (pathsToOpen) =>
@openPaths({pathsToOpen, devMode})
# Public: If an update is available, it returns the new version string
# otherwise it returns null.
+2 -2
Ver Arquivo
@@ -10,7 +10,7 @@ _ = require 'underscore-plus'
# Private:
module.exports =
class AtomWindow
@iconPath: path.resolve(__dirname, '..', '..', 'atom.png')
@iconPath: path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
browserWindow: null
loaded: null
@@ -70,7 +70,7 @@ class AtomWindow
chosen = dialog.showMessageBox @browserWindow,
type: 'warning'
buttons: ['Close', 'Keep Waiting']
message: 'Editor is not responsing'
message: 'Editor is not responding'
detail: 'The editor is not responding. Would you like to force close it or just keep waiting?'
@browserWindow.destroy() if chosen is 0
+3 -5
Ver Arquivo
@@ -67,9 +67,7 @@ delegate.browserMainParts.preMainMessageLoopRun = ->
global.devResourcePath = path.join(app.getHomeDir(), 'github', 'atom')
setupCrashReporter = ->
crashReporter.setCompanyName 'GitHub'
crashReporter.setSubmissionUrl 'https://speakeasy.githubapp.com/submit_crash_log'
crashReporter.setAutoSubmit true
crashReporter.start(productName: 'Atom', companyName: 'GitHub')
setupAutoUpdater = ->
autoUpdater.setFeedUrl 'https://speakeasy.githubapp.com/apps/27/appcast.xml'
@@ -92,11 +90,11 @@ parseCommandLine = ->
options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.')
args = options.argv
if args.h
if args.help
process.stdout.write(options.help())
process.exit(0)
if args.v
if args.version
process.stdout.write("#{version}\n")
process.exit(0)
+16 -7
Ver Arquivo
@@ -32,10 +32,10 @@ module.exports =
callback = commandName
commandName = path.basename(commandPath, path.extname(commandPath))
installCallback = (error) ->
installCallback = (error, sourcePath, destinationPath) ->
if error?
console.warn "Failed to install `#{commandName}` binary", error
callback?(error)
callback?(error, sourcePath, destinationPath)
@findInstallDirectory (directory) ->
if directory?
@@ -44,16 +44,25 @@ module.exports =
if error?
installCallback(error)
else
symlinkCommand(commandPath, destinationPath, installCallback)
symlinkCommand commandPath, destinationPath, (error) ->
installCallback(error, commandPath, destinationPath)
else
installCallback(new Error("No destination directory exists to install"))
installAtomCommand: (callback) ->
{resourcePath} = atom.getLoadSettings()
installAtomCommand: (resourcePath, callback) ->
if _.isFunction(resourcePath)
callback = resourcePath
resourcePath = null
resourcePath ?= atom.getLoadSettings().resourcePath
commandPath = path.join(resourcePath, 'atom.sh')
@install(commandPath, callback)
installApmCommand: (callback) ->
{resourcePath} = atom.getLoadSettings()
installApmCommand: (resourcePath, callback) ->
if _.isFunction(resourcePath)
callback = resourcePath
resourcePath = null
resourcePath ?= atom.getLoadSettings().resourcePath
commandPath = path.join(resourcePath, 'node_modules', '.bin', 'apm')
@install(commandPath, callback)
+2 -2
Ver Arquivo
@@ -125,11 +125,11 @@ class Config
#
# keyPath - The {String} name of the key to retrieve
# defaultValue - The integer {Number} to fall back to if the value isn't
# positive
# positive, defaults to 0.
#
# Returns the value from Atom's default settings, the user's configuration file,
# or `defaultValue` if the key value isn't greater than zero.
getPositiveInt: (keyPath, defaultValue) ->
getPositiveInt: (keyPath, defaultValue=0) ->
Math.max(@getInt(keyPath), 0) or defaultValue
# Public: Sets the value for a configuration setting.
+1 -1
Ver Arquivo
@@ -14,7 +14,7 @@ class ContextMenuManager
@devModeDefinitions = {}
@activeElement = null
@devModeDefinitions['#root-view'] = [
@devModeDefinitions['.workspace'] = [
label: 'Inspect Element'
command: 'application:inspect'
executeAtBuild: (e) ->
-6
Ver Arquivo
@@ -584,12 +584,6 @@ class DisplayBuffer
line = @lineForRow(row).text
console.log row, line, line.length
getDebugSnapshot: ->
lines = ["Display Buffer:"]
for screenLine, row in @linesForRows(0, @getLastRow())
lines.push "#{row}: #{screenLine.text}"
lines.join('\n')
### Internal ###
handleTokenizedBufferChange: (tokenizedBufferChange) =>
+246 -241
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+16 -25
Ver Arquivo
@@ -12,7 +12,7 @@ TextMateScopeSelector = require('first-mate').ScopeSelector
# Public: The core model of Atom.
#
# An {Editor} represents a unique view of each document, with it's own
# An {Editor} represents a unique view of each document, with its own
# {Cursor}s and scroll position.
#
# For instance if a user creates a split, Atom creates a second {Editor}
@@ -22,13 +22,13 @@ TextMateScopeSelector = require('first-mate').ScopeSelector
#
# Almost all extension will interact primiarily with this class as it provides
# access to objects you'll most commonly interact with. To access it you'll
# want to register a callback on {RootView} which will be fired once for every
# want to register a callback on {WorkspaceView} which will be fired once for every
# existing {Editor} as well as any future {Editor}s.
#
# ## Example
# ```coffeescript
# global.rootView.eachEditSession (editor) ->
# editor.insertText('Hello World')
# atom.workspaceView.eachEditorView (editorView) ->
# editorView.insertText('Hello World')
# ```
#
# ## Collaboration builtin
@@ -75,7 +75,7 @@ class Editor
@addSelection(marker)
@setScrollTop(@state.get('scrollTop'))
@setScrollLeft(@state.get('scrollLeft'))
registerEditSession = true
registerEditor = true
else
{buffer, displayBuffer, tabLength, softTabs, softWrap, suppressCursorCreation, initialLine} = optionsOrState
@id = guid.create().toString()
@@ -107,7 +107,7 @@ class Editor
when 'scrollLeft'
@emit 'scroll-left-changed', newValue
atom.project.addEditSession(this) if registerEditSession
atom.project.addEditor(this) if registerEditor
# Private:
setBuffer: (@buffer) ->
@@ -143,7 +143,7 @@ class Editor
@buffer.release()
@displayBuffer.destroy()
@languageMode.destroy()
atom.project?.removeEditSession(this)
atom.project?.removeEditor(this)
@emit 'destroyed'
@off()
@@ -158,13 +158,13 @@ class Editor
tabLength = @getTabLength()
displayBuffer = @displayBuffer.copy()
softTabs = @getSoftTabs()
newEditSession = new Editor({@buffer, displayBuffer, tabLength, softTabs, suppressCursorCreation: true})
newEditSession.setScrollTop(@getScrollTop())
newEditSession.setScrollLeft(@getScrollLeft())
newEditor = new Editor({@buffer, displayBuffer, tabLength, softTabs, suppressCursorCreation: true})
newEditor.setScrollTop(@getScrollTop())
newEditor.setScrollLeft(@getScrollLeft())
for marker in @findMarkers(editorId: @id)
marker.copy(editorId: newEditSession.id, preserveFolds: true)
atom.project.addEditSession(newEditSession)
newEditSession
marker.copy(editorId: newEditor.id, preserveFolds: true)
atom.project.addEditor(newEditor)
newEditor
# Public: Retrieves the filename of the open file.
#
@@ -1251,11 +1251,9 @@ class Editor
# Public: Transposes the current text selections.
#
# FIXME: I have no idea what this function does.
#
# This only works if there is more than one selection. Each selection is transferred
# to the position of the selection after it. The last selection is transferred to the
# position of the first.
# The text in each selection is reversed so `abcd` would become `dcba`. The
# characters before and after the cursor are swapped when the selection is
# empty so `x|y` would become `y|x` where `|` is the cursor location.
transpose: ->
@mutateSelectedText (selection) =>
if selection.isEmpty()
@@ -1437,10 +1435,3 @@ class Editor
# Private:
getSelectionMarkerAttributes: ->
type: 'selection', editorId: @id, invalidate: 'never'
# Private:
getDebugSnapshot: ->
[
@displayBuffer.getDebugSnapshot()
@displayBuffer.tokenizedBuffer.getDebugSnapshot()
].join('\n\n')
+1 -1
Ver Arquivo
@@ -141,7 +141,7 @@ class Keymap
handleKeyEvent: (event) ->
element = event.target
element = atom.rootView if element == document.body
element = atom.workspaceView if element == document.body
keystroke = @keystrokeStringForEvent(event, @queuedKeystroke)
keyBindings = @keyBindingsForKeystrokeMatchingElement(keystroke, element)
+4
Ver Arquivo
@@ -226,6 +226,10 @@ class PackageManager
{@packageDependencies} = JSON.parse(fs.readFileSync(metadataPath)) ? {}
@packageDependencies ?= {}
# Temporarily ignore 'grunt-download-atom-shell' here, should remove this
# when it became a public npm module.
delete @packageDependencies['grunt-download-atom-shell']
@packageDependencies
# Public: Get an array of all the available package paths.
+1 -1
Ver Arquivo
@@ -70,7 +70,7 @@ class PaneAxis extends View
child.detach()
getContainer: ->
@closest('#panes').view()
@closest('.panes').view()
getActivePaneItem: ->
@getActivePane()?.activeItem
+2 -2
Ver Arquivo
@@ -2,7 +2,7 @@
Pane = require './pane'
telepath = require 'telepath'
# Private: Manages the list of panes within a {RootView}
# Private: Manages the list of panes within a {WorkspaceView}
module.exports =
class PaneContainer extends View
atom.deserializers.add(this)
@@ -16,7 +16,7 @@ class PaneContainer extends View
container
@content: ->
@div id: 'panes'
@div class: 'panes'
initialize: (state) ->
@destroyedItemStates = []
+2 -2
Ver Arquivo
@@ -412,7 +412,7 @@ class Pane extends View
# Private:
getContainer: ->
@closest('#panes').view()
@closest('.panes').view()
# Private:
copyActiveItem: ->
@@ -426,7 +426,7 @@ class Pane extends View
# Private:
beforeRemove: ->
if @is(':has(:focus)')
@getContainer().focusNextPane() or atom.rootView?.focus()
@getContainer().focusNextPane() or atom.workspaceView?.focus()
else if @isActive()
@getContainer().makeNextPaneActive()
+16 -25
Ver Arquivo
@@ -32,7 +32,7 @@ class Project extends telepath.Model
path.join(atom.config.get('core.projectHome'), repoName)
# Private: Called by telepath.
attached: ->
created: ->
for buffer in @buffers.getValues()
buffer.once 'destroyed', (buffer) => @removeBuffer(buffer)
@@ -62,8 +62,8 @@ class Project extends telepath.Model
unregisterOpener: (opener) -> _.remove(@openers, opener)
# Private:
destroy: ->
editor.destroy() for editor in @getEditSessions()
destroyed: ->
editor.destroy() for editor in @getEditors()
buffer.release() for buffer in @getBuffers()
@destroyRepo()
@@ -105,18 +105,6 @@ class Project extends telepath.Model
getRootDirectory: ->
@rootDirectory
# Public: Determines if a path is ignored via Atom configuration.
isPathIgnored: (path) ->
for segment in path.split("/")
ignoredNames = atom.config.get("core.ignoredNames") or []
return true if _.contains(ignoredNames, segment)
@ignoreRepositoryPath(path)
# Public: Determines if a given path is ignored via repository configuration.
ignoreRepositoryPath: (repositoryPath) ->
atom.config.get("core.hideGitIgnoredFiles") and @repo?.isPathIgnored(path.join(@getPath(), repositoryPath))
# Public: Given a uri, this resolves it relative to the project directory. If
# the path is already absolute or if it is prefixed with a scheme, it is
# returned unchanged.
@@ -161,7 +149,7 @@ class Project extends telepath.Model
Q(resource)
else
@bufferForPath(filePath).then (buffer) =>
@buildEditSessionForBuffer(buffer, options)
@buildEditorForBuffer(buffer, options)
# Private: Only be used in specs
openSync: (filePath, options={}) ->
@@ -169,21 +157,21 @@ class Project extends telepath.Model
for opener in @openers
return resource if resource = opener(filePath, options)
@buildEditSessionForBuffer(@bufferForPathSync(filePath), options)
@buildEditorForBuffer(@bufferForPathSync(filePath), options)
# Public: Retrieves all {Editor}s for all open files.
#
# Returns an {Array} of {Editor}s.
getEditSessions: ->
getEditors: ->
new Array(@editors...)
# Public: Add the given {Editor}.
addEditSession: (editor) ->
addEditor: (editor) ->
@editors.push editor
@emit 'editor-created', editor
# Public: Return and removes the given {Editor}.
removeEditSession: (editor) ->
removeEditor: (editor) ->
_.remove(@editors, editor)
# Private: Retrieves all the {TextBuffer}s in the project; that is, the
@@ -193,11 +181,13 @@ class Project extends telepath.Model
getBuffers: ->
new Array(@buffers.getValues()...)
# Private: Is the buffer for the given path modified?
isPathModified: (filePath) ->
@findBufferForPath(@resolve(filePath))?.isModified()
# Private:
findBufferForPath: (filePath) ->
_.find @buffers.getValues(), (buffer) -> buffer.getPath() == filePath
_.find @buffers.getValues(), (buffer) -> buffer.getPath() == filePath
# Private: Only to be used in specs
bufferForPathSync: (filePath) ->
@@ -333,6 +323,7 @@ class Project extends telepath.Model
task.on 'replace:path-replaced', iterator
for buffer in @buffers.getValues()
continue unless buffer.getPath() in filePaths
replacements = buffer.replace(regex, replacementText, iterator)
iterator({filePath: buffer.getPath(), replacements}) if replacements
@@ -342,14 +333,14 @@ class Project extends telepath.Model
deferred.promise
# Private:
buildEditSessionForBuffer: (buffer, editorOptions) ->
buildEditorForBuffer: (buffer, editorOptions) ->
editor = new Editor(_.extend({buffer}, editorOptions))
@addEditSession(editor)
@addEditor(editor)
editor
# Private:
eachEditSession: (callback) ->
callback(editor) for editor in @getEditSessions()
eachEditor: (callback) ->
callback(editor) for editor in @getEditors()
@on 'editor-created', (editor) -> callback(editor)
# Private:
+48 -16
Ver Arquivo
@@ -25,7 +25,10 @@ class SelectList extends View
inputThrottle: 50
cancelling: false
# Public:
# Public: Initialize the select list view.
#
# This method can be overridden by subclasses but `super` should always
# be called.
initialize: ->
@miniEditor.getBuffer().on 'changed', => @schedulePopulateList()
@miniEditor.hiddenInput.on 'focusout', => @cancel() unless @cancelling
@@ -57,12 +60,16 @@ class SelectList extends View
@populateList() if @isOnDom()
@scheduleTimeout = setTimeout(populateCallback, @inputThrottle)
# Public:
setArray: (@array) ->
# Public: Set the array of items to display in the list.
#
# * array: The array of model elements to display in the list.
setArray: (@array=[]) ->
@populateList()
@setLoading()
# Public:
# Public: Set the error message to display.
#
# * message: The error message.
setError: (message='') ->
if message.length is 0
@error.text('').hide()
@@ -70,7 +77,9 @@ class SelectList extends View
@setLoading()
@error.text(message).show()
# Public:
# Public: Set the loading message to display.
#
# * message: The loading message.
setLoading: (message='') ->
if message.length is 0
@loading.text("")
@@ -81,11 +90,18 @@ class SelectList extends View
@loading.text(message)
@loadingArea.show()
# Public:
# Public: Get the filter query to use when fuzzy filtering the visible
# elements.
#
# By default this method returns the text in the mini editor but it can be
# overridden by subclasses if needed.
#
# Returns a {String} to use when fuzzy filtering the elements to display.
getFilterQuery: ->
@miniEditor.getText()
# Public:
# Public: Build the DOM elements using the array from the last call to
# {.setArray}.
populateList: ->
return unless @array?
@@ -109,7 +125,12 @@ class SelectList extends View
else
@setError(@getEmptyMessage(@array.length, filteredArray.length))
# Public:
# Public: Get the message to display when there are no items.
#
# Subclasses may override this method to customize the message.
#
# * itemCount: The number of items in the array specified to {.setArray}
# * filteredItemCount: The number of items that pass the fuzzy filter test.
getEmptyMessage: (itemCount, filteredItemCount) -> 'No matches found'
# Private:
@@ -124,14 +145,14 @@ class SelectList extends View
item = @list.find('li:first') unless item.length
@selectItem(item)
# Public:
# Private:
selectItem: (item) ->
return unless item.length
@list.find('.selected').removeClass('selected')
item.addClass 'selected'
@scrollToItem(item)
# Public:
# Private:
scrollToItem: (item) ->
scrollTop = @list.scrollTop()
desiredTop = item.position().top + scrollTop
@@ -142,15 +163,19 @@ class SelectList extends View
else if desiredBottom > @list.scrollBottom()
@list.scrollBottom(desiredBottom)
# Public:
# Public: Get the selected DOM element.
#
# Call {.getSelectedElement} to get the selected model element.
getSelectedItem: ->
@list.find('li.selected')
# Public:
# Public: Get the selected model element.
#
# Call {.getSelectedItem} to get the selected DOM element.
getSelectedElement: ->
@getSelectedItem().data('select-list-element')
# Public:
# Private:
confirmSelection: ->
element = @getSelectedElement()
if element?
@@ -158,6 +183,13 @@ class SelectList extends View
else
@cancel()
# Public: Callback function for when a selection is made.
#
# This method should be overridden by subclasses.
#
# * element: The selected model element.
confirmed: (element) ->
# Private:
attach: ->
@storeFocusedElement()
@@ -171,14 +203,14 @@ class SelectList extends View
if @previouslyFocusedElement?.isOnDom()
@previouslyFocusedElement.focus()
else
atom.rootView.focus()
atom.workspaceView.focus()
# Public:
# Private:
cancelled: ->
@miniEditor.setText('')
@miniEditor.updateDisplay()
# Public:
# Public: Cancel and close the select list dialog.
cancel: ->
@list.empty()
@cancelling = true
+1 -2
Ver Arquivo
@@ -6,7 +6,6 @@ class SiteShim
setRootDocument: (@document) ->
@id = @document.siteId
@document.set('looseDocuments', [])
createDocument: (values) ->
@document.get('looseDocuments').push(values)
@document.create({values})
+11 -1
Ver Arquivo
@@ -17,7 +17,7 @@ jQuery.cleanData = (elements) ->
tooltipDefaults =
delay:
show: 500
show: 1000
hide: 100
container: 'body'
html: true
@@ -76,6 +76,16 @@ jQuery.fn.setTooltip = (tooltipOptions, {command, commandElement}={}) ->
this.tooltip(jQuery.extend({}, tooltipDefaults, tooltipOptions))
jQuery.fn.hideTooltip = ->
tip = @data('bs.tooltip')
if tip
tip.leave(currentTarget: this)
tip.hide()
jQuery.fn.destroyTooltip = ->
@hideTooltip()
@tooltip('destroy')
jQuery.fn.setTooltip.getKeystroke = getKeystroke
jQuery.fn.setTooltip.replaceModifiers = replaceModifiers
+8 -13
Ver Arquivo
@@ -38,7 +38,7 @@ class TextBuffer extends telepath.Model
@loadWhenAttached = @getState()?
# Private: Called by telepath.
attached: ->
created: ->
@loaded = false
@useSerializedText = @modifiedWhenLastPersisted != false
@@ -63,12 +63,13 @@ class TextBuffer extends telepath.Model
@updateCachedDiskContents().then => @finishLoading()
finishLoading: ->
@loaded = true
if @useSerializedText and @digestWhenLastPersisted is @file?.getDigest()
@emitModifiedStatusChanged(true)
else
@reload()
@text.clearUndoStack()
if @isAlive()
@loaded = true
if @useSerializedText and @digestWhenLastPersisted is @file?.getDigest()
@emitModifiedStatusChanged(true)
else
@reload()
@text.clearUndoStack()
this
### Internal ###
@@ -670,9 +671,3 @@ class TextBuffer extends telepath.Model
for row in [start..end]
line = @lineForRow(row)
console.log row, line, line.length
getDebugSnapshot: ->
lines = ['TextBuffer:']
for row in [0..@getLastRow()]
lines.push "#{row}: #{@lineForRow(row)}"
lines.join('\n')
+9
Ver Arquivo
@@ -157,7 +157,16 @@ class TextMateGrammar
ruleStack.pop()
else if ruleStack.length > previousRuleStackLength # Stack size increased with zero length match
[penultimateRule, lastRule] = ruleStack[-2..]
# Same exact rule was pushed but position wasn't advanced
if lastRule? and lastRule == penultimateRule
popStack = true
# Rule with same scope name as previous rule was pushed but position wasn't advanced
if lastRule?.scopeName? and penultimateRule.scopeName == lastRule.scopeName
popStack = true
if popStack
ruleStack.pop()
tokens.push(new Token(
value: line[position...line.length]
+4 -1
Ver Arquivo
@@ -53,10 +53,13 @@ class ThemeManager
# the first/top theme to override later themes in the stack.
themeNames = _.clone(themeNames).reverse()
@refreshLessCache() # Update cache for packages in core.themes config
@packageManager.activatePackage(themeName) for themeName in themeNames
@refreshLessCache()
@refreshLessCache() # Update cache again now that @getActiveThemes() is populated
@loadUserStylesheet()
@reloadBaseStylesheets()
@emit('reloaded')
# Internal-only:
+2 -3
Ver Arquivo
@@ -135,9 +135,8 @@ class Token
classes = 'hard-tab'
classes += ' indent-guide' if hasIndentGuide
classes += ' invisible-character' if invisibles.tab
html = @value.replace StartCharacterRegex, (match) =>
match = invisibles.tab ? match
"<span class='#{classes}'>#{@escapeString(match)}</span>"
value = if invisibles.tab then @value.replace(StartCharacterRegex, invisibles.tab) else @value
html = "<span class='#{classes}'>#{@escapeString(value)}</span>"
else
startIndex = 0
endIndex = @value.length
+3 -6
Ver Arquivo
@@ -50,6 +50,9 @@ class TokenizedBuffer
@subscribe @buffer, "changed", (e) => @handleBufferChange(e)
@subscribe @buffer, "path-changed", => @state.set('bufferPath', @buffer.getPath())
@subscribe atom.config.observe 'editor.tabLength', callNow: false, =>
@setTabLength(atom.config.getPositiveInt('editor.tabLength'))
@reloadGrammar()
serialize: -> @state.clone()
@@ -322,9 +325,3 @@ class TokenizedBuffer
for row in [start..end]
line = @lineForScreenRow(row).text
console.log row, line, line.length
getDebugSnapshot: ->
lines = ["Tokenized Buffer:"]
for screenLine, row in @linesForScreenRows(0, @getLastRow())
lines.push "#{row}: #{screenLine.text}"
lines.join('\n')
+3
Ver Arquivo
@@ -1,6 +1,9 @@
# Like sands through the hourglass, so are the days of our lives.
startTime = Date.now()
# Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
require './window'
Atom = require './atom'
+4 -4
Ver Arquivo
@@ -16,8 +16,8 @@ class WindowEventHandler
@subscribe ipc, 'command', (command, args...) ->
activeElement = document.activeElement
# Use root view if body has focus
if activeElement is document.body and atom.rootView?
activeElement = atom.rootView
if activeElement is document.body and atom.workspaceView?
activeElement = atom.workspaceView
$(activeElement).trigger(command, args...)
@subscribe ipc, 'context-command', (command, args...) ->
@@ -29,10 +29,10 @@ class WindowEventHandler
@subscribe $(window), 'window:open-path', (event, {pathToOpen, initialLine}) ->
unless fs.isDirectorySync(pathToOpen)
atom.rootView?.open(pathToOpen, {initialLine})
atom.workspaceView?.open(pathToOpen, {initialLine})
@subscribe $(window), 'beforeunload', =>
confirmed = atom.rootView?.confirmClose()
confirmed = atom.workspaceView?.confirmClose()
atom.hide() if confirmed and not @reloadRequested and atom.getCurrentWindow().isWebViewFocused()
@reloadRequested = false
confirmed
+12 -20
Ver Arquivo
@@ -37,7 +37,7 @@ Editor = require './editor'
# the front.
#
module.exports =
class RootView extends View
class WorkspaceView extends View
atom.deserializers.add(this, Pane, PaneRow, PaneColumn, EditorView)
@version: 1
@@ -54,14 +54,14 @@ class RootView extends View
# Private:
@content: (state) ->
@div id: 'root-view', tabindex: -1, =>
@div id: 'horizontal', outlet: 'horizontal', =>
@div id: 'vertical', outlet: 'vertical', =>
@div outlet: 'panes'
@div class: 'workspace', tabindex: -1, =>
@div class: 'horizontal', outlet: 'horizontal', =>
@div class: 'vertical', outlet: 'vertical', =>
@div class: 'panes', outlet: 'panes'
# Private:
@deserialize: (state) ->
new RootView(state)
new WorkspaceView(state)
# Private:
initialize: (state={}) ->
@@ -247,7 +247,7 @@ class RootView extends View
document.title = title
# Private: Returns an Array of all of the application's {EditorView}s.
getEditors: ->
getEditorViews: ->
@panes.find('.pane > .item-views > .editor').map(-> $(this).view()).toArray()
# Private: Retrieves all of the modified buffers that are open and unsaved.
@@ -264,7 +264,7 @@ class RootView extends View
#
# Returns an {Array} of {String}s.
getOpenBufferPaths: ->
_.uniq(_.flatten(@getEditors().map (editorView) -> editorView.getOpenBufferPaths()))
_.uniq(_.flatten(@getEditorViews().map (editorView) -> editorView.getOpenBufferPaths()))
# Public: Returns the currently focused {Pane}.
getActivePane: ->
@@ -305,23 +305,15 @@ class RootView extends View
indexOfPane: (pane) ->
@panes.indexOfPane(pane)
# Private: Fires a callback on each open {EditorView}.
eachEditor: (callback) ->
callback(editor) for editor in @getEditors()
# Public: Fires a callback on each open {EditorView}.
eachEditorView: (callback) ->
callback(editor) for editor in @getEditorViews()
attachedCallback = (e, editor) -> callback(editor)
@on('editor:attached', attachedCallback)
off: => @off('editor:attached', attachedCallback)
# Public: Fires a callback on each open {Editor}.
eachEditSession: (callback) ->
atom.project.eachEditSession(callback)
# Private: Fires a callback on each open {TextBuffer}.
eachBuffer: (callback) ->
atom.project.eachBuffer(callback)
# Private: Destroys everything.
remove: ->
editorView.remove() for editorView in @getEditors()
editorView.remove() for editorView in @getEditorViews()
atom.project?.destroy()
super
+7 -2
Ver Arquivo
@@ -1,9 +1,13 @@
// Import from the theme's variables with a fallback to /static/variables/ui-variables.less
// Import from the syntax theme's variables with a fallback to ./variables/syntax-variables.less
@import "syntax-variables";
// Import from the ui theme's variables with a fallback to ./variables/ui-variables.less
@import "ui-variables";
@import "octicon-utf-codes";
@import "octicon-mixins";
@import "root-view";
@import "workspace-view";
@import "bootstrap";
@import "buttons";
@import "icons";
@@ -19,5 +23,6 @@
@import "markdown";
@import "editor";
@import "select-list";
@import "syntax";
@import "utilities";
@import "octicons";
+5
Ver Arquivo
@@ -1,3 +1,4 @@
@import "ui-variables";
@import "octicon-utf-codes";
@import "octicon-mixins";
@@ -173,4 +174,8 @@
.scroll-view {
overflow: hidden;
}
.placeholder-text {
color: @text-color-subtle;
}
}
+1 -1
Ver Arquivo
@@ -22,6 +22,6 @@
}
</script>
</head>
<body class="workspace" tabindex="-1">
<body tabindex="-1">
</body>
</html>
+13
Ver Arquivo
@@ -1,3 +1,5 @@
@import "ui-variables";
.overlay {
position: absolute;
left: 50%;
@@ -8,6 +10,17 @@
background-color: #fff;
padding: 10px;
h1 {
margin-top: 0;
color: @text-color-highlight;
font-size: 1.6em;
font-weight: bold;
}
h2 {
font-size: 1.3em;
}
}
.overlay .editor.mini {
-7
Ver Arquivo
@@ -20,13 +20,6 @@
}
}
.focusable-panel {
opacity: 0.8;
&:focus {
opacity: 1;
}
}
.panel-heading {
margin: 0;
+21
Ver Arquivo
@@ -0,0 +1,21 @@
@import "syntax-variables";
.editor {
.lines {
.markup {
&.git-commit {
&.changed {
color: @syntax-color-modified;
}
&.deleted {
color: @syntax-color-removed;
}
&.inserted {
color: @syntax-color-added;
}
}
}
}
}
+8
Ver Arquivo
@@ -0,0 +1,8 @@
// This file has fallback variables. It specifies the syntax variables that
// themes must implement.
// Colors
@syntax-color-added: #5293d8;
@syntax-color-modified: #f78a46;
@syntax-color-removed: #c00;
@@ -21,19 +21,19 @@ h6 {
font-family: @font-family;
}
#root-view {
.workspace {
height: 100%;
overflow: hidden;
position: relative;
background-color: @app-background-color;
font-family: @font-family;
#horizontal {
.horizontal {
display: -webkit-flex;
height: 100%;
}
#vertical {
.vertical {
display: -webkit-flex;
-webkit-flex: 1;
-webkit-flex-flow: column;
@@ -45,7 +45,7 @@ h6 {
content: ""; // This is not a space, it is a skull and crossbones
}
padding: @component-icon-padding;
padding: 0 @component-icon-padding;
position: absolute;
top: 0;
right: 0;
@@ -57,7 +57,7 @@ h6 {
}
}
#panes {
.panes {
position: relative;
-webkit-flex: 1;
+3 -3
Ver Arquivo
@@ -22,14 +22,12 @@ module.exports = (grunt) ->
cp 'atom.sh', path.join(appDir, 'atom.sh')
cp 'package.json', path.join(appDir, 'package.json')
iconPath = path.resolve(__dirname, '..', 'resources', 'atom.png')
cp iconPath, path.join(appDir, 'atom.png')
packageDirectories = []
nonPackageDirectories = [
'benchmark'
'dot-atom'
'vendor'
'resources'
]
{devDependencies} = grunt.file.readJSON('package.json')
@@ -44,6 +42,8 @@ module.exports = (grunt) ->
path.join('git-utils', 'deps')
path.join('oniguruma', 'deps')
path.join('vendor', 'apm')
path.join('resources', 'mac')
path.join('resources', 'win')
]
ignoredPaths = ignoredPaths.map (ignoredPath) -> "(#{ignoredPath})"
nodeModulesFilter = new RegExp(ignoredPaths.join('|'))
+31 -22
Ver Arquivo
@@ -1,3 +1,4 @@
fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
@@ -6,27 +7,35 @@ module.exports = (grunt) ->
grunt.registerTask 'set-development-version', 'Sets version to current SHA-1', ->
done = @async()
if process.platform is 'darwin'
cmd = 'script/set-version'
args = [grunt.config.get('atom.buildDir')]
spawn {cmd, args}, (error, result, code) -> done(error)
else if process.platform is 'win32'
shellAppDir = grunt.config.get('atom.shellAppDir')
shellExePath = path.join(shellAppDir, 'atom.exe')
cmd = 'git'
args = ['rev-parse', '--short', 'HEAD']
spawn {cmd, args}, (error, result, code) ->
return done(error) if error?
cmd = 'git'
args = ['rev-parse', '--short', 'HEAD']
spawn {cmd, args}, (error, result, code) ->
if error?
done(error)
else
version = result.stdout.trim()
strings =
CompanyName: 'GitHub, Inc.'
FileDescription: 'The hackable, collaborative editor of tomorrow!'
LegalCopyright: 'Copyright (C) 2013 GitHub, Inc. All rights reserved'
ProductName: 'Atom'
ProductVersion: version
version = result.stdout.trim()
appDir = grunt.config.get('atom.appDir')
rcedit = require('rcedit')
rcedit(shellExePath, {'version-string': strings}, done)
# Replace version field of package.json.
packageJsonPath = path.join(appDir, 'package.json')
packageJson = require(packageJsonPath)
packageJson.version = version
packageJsonString = JSON.stringify(packageJson, null, 2)
fs.writeFileSync(packageJsonPath, packageJsonString)
if process.platform is 'darwin'
cmd = 'script/set-version'
args = [grunt.config.get('atom.buildDir'), version]
spawn {cmd, args}, (error, result, code) -> done(error)
else if process.platform is 'win32'
shellAppDir = grunt.config.get('atom.shellAppDir')
shellExePath = path.join(shellAppDir, 'atom.exe')
strings =
CompanyName: 'GitHub, Inc.'
FileDescription: 'The hackable, collaborative editor of tomorrow!'
LegalCopyright: 'Copyright (C) 2013 GitHub, Inc. All rights reserved'
ProductName: 'Atom'
ProductVersion: version
rcedit = require('rcedit')
rcedit(shellExePath, {'version-string': strings}, done)
-210
Ver Arquivo
@@ -1,210 +0,0 @@
fs = require 'fs'
path = require 'path'
os = require 'os'
request = require 'request'
formidable = require 'formidable'
unzip = require 'unzip'
module.exports = (grunt) ->
{spawn, mkdir, rm, cp} = require('./task-helpers')(grunt)
accessToken = null
getTokenFromKeychain = (callback) ->
accessToken ?= process.env['ATOM_ACCESS_TOKEN']
if accessToken
callback(null, accessToken)
return
spawn {cmd: 'security', args: ['-q', 'find-generic-password', '-ws', 'GitHub API Token']}, (error, result, code) ->
accessToken = result.stdout unless error?
callback(error, accessToken)
callAtomShellReposApi = (path, callback) ->
getTokenFromKeychain (error, accessToken) ->
if error
callback(error)
return
options =
url: "https://api.github.com/repos/atom/atom-shell#{path}"
proxy: process.env.http_proxy || process.env.https_proxy
headers:
authorization: "token #{accessToken}"
accept: 'application/vnd.github.manifold-preview'
'user-agent': 'Atom'
request options, (error, response, body) ->
if not error?
body = JSON.parse(body)
error = new Error(body.message) if response.statusCode != 200
callback(error, response, body)
findReleaseIdFromAtomShellVersion = (version, callback) ->
callAtomShellReposApi '/releases', (error, response, data) ->
if error?
grunt.log.error('GitHub API failed to access atom-shell releases')
callback(error)
else
for release in data when release.tag_name is version
callback(null, release.id)
return
grunt.log.error("There is no #{version} release of atom-shell")
callback(false)
getAtomShellDownloadUrl = (version, releaseId, callback) ->
callAtomShellReposApi "/releases/#{releaseId}/assets", (error, response, data) ->
if error?
grunt.log.error("Cannot get assets of atom-shell's #{version} release")
callback(error)
else
filename = "atom-shell-#{version}-#{process.platform}.zip"
for asset in data when asset.name is filename and asset.state is 'uploaded'
callback(null, asset.url)
return
grunt.log.error("Cannot get url of atom-shell's release asset")
callback(false)
getAtomShellVersion = ->
versionPath = path.join('atom-shell', 'version')
if grunt.file.isFile(versionPath)
grunt.file.read(versionPath).trim()
else
null
getTempDir = ->
if process.platform is 'win32' then os.tmpdir() else '/tmp'
getCachePath = (version) ->
path.join(getTempDir(), 'atom-cached-atom-shells', version)
isAtomShellVersionCached = (version) ->
grunt.file.isFile(getCachePath(version), 'version')
getDownloadOptions = (version, url, callback) ->
options =
url: url
followRedirect: false
proxy: process.env.http_proxy || process.env.https_proxy
# Only set headers for GitHub host, the url could also be a S3 link and
# setting headers for it would make the request fail.
if require('url').parse(url).hostname is 'api.github.com'
getTokenFromKeychain (error, accessToken) ->
options.headers =
authorization: "token #{accessToken}"
accept: 'application/octet-stream'
'user-agent': 'Atom'
callback(error, options)
else
callback(null, options)
downloadAtomShell = (version, url, callback) ->
getDownloadOptions version, url, (error, options) ->
if error
callback(error)
return
inputStream = request(options)
inputStream.on 'response', (response) ->
if response.statusCode is 302
# Manually handle redirection so headers would not be sent for S3.
downloadAtomShell(version, response.headers.location, callback)
else if response.statusCode is 200
grunt.verbose.writeln("Downloading atom-shell version #{version.cyan}")
cacheDirectory = getCachePath(version)
rm(cacheDirectory)
mkdir(cacheDirectory)
form = new formidable.IncomingForm()
form.uploadDir = cacheDirectory
form.maxFieldsSize = 100 * 1024 * 1024
form.on 'file', (name, file) ->
cacheFile = path.join(cacheDirectory, 'atom-shell.zip')
fs.renameSync(file.path, cacheFile)
callback(null, cacheFile)
form.parse response, (error) ->
if error
grunt.log.error("atom-shell #{version.cyan} failed to download")
else
if response.statusCode is 404
grunt.log.error("atom-shell #{version.cyan} not found")
else
grunt.log.error("atom-shell #{version.cyan} request failed")
callback(false)
downloadAtomShellOfVersion = (version, callback) ->
findReleaseIdFromAtomShellVersion version, (error, releaseId) ->
if error?
callback(error)
else
getAtomShellDownloadUrl version, releaseId, (error, url) ->
if error?
callback(error)
else
downloadAtomShell version, url, callback
unzipAtomShell = (zipPath, callback) ->
grunt.verbose.writeln('Unzipping atom-shell')
directoryPath = path.dirname(zipPath)
if process.platform is 'darwin'
# The zip archive of darwin build contains symbol links, only the "unzip"
# command can handle it correctly.
spawn {cmd: 'unzip', args: [zipPath, '-d', directoryPath]}, (error) ->
rm(zipPath)
callback(error)
else
fileStream = fs.createReadStream(zipPath)
fileStream.on('error', callback)
zipStream = fileStream.pipe(unzip.Extract(path: directoryPath))
zipStream.on('error', callback)
zipStream.on 'close', ->
rm(zipPath)
callback(null)
rebuildNativeModules = (previousVersion, callback) ->
newVersion = getAtomShellVersion()
if newVersion and newVersion isnt previousVersion
grunt.verbose.writeln("Rebuilding native modules for new atom-shell version #{newVersion.cyan}.")
cmd = path.join('node_modules', '.bin', 'apm')
cmd += ".cmd" if process.platform is 'win32'
spawn {cmd, args: ['rebuild']}, (error) -> callback(error)
else
callback()
installAtomShell = (version) ->
rm('atom-shell')
cp(getCachePath(version), 'atom-shell')
grunt.registerTask 'update-atom-shell', 'Update atom-shell', ->
done = @async()
{atomShellVersion} = grunt.file.readJSON('package.json')
if atomShellVersion
atomShellVersion = "v#{atomShellVersion}"
currentAtomShellVersion = getAtomShellVersion()
if atomShellVersion isnt currentAtomShellVersion
if isAtomShellVersionCached(atomShellVersion)
grunt.verbose.writeln("Installing cached atom-shell #{atomShellVersion.cyan}")
installAtomShell(atomShellVersion)
rebuildNativeModules(currentAtomShellVersion, done)
else
downloadAtomShellOfVersion atomShellVersion, (error, zipPath) ->
if error?
done(error)
else if zipPath?
unzipAtomShell zipPath, (error) ->
if error?
done(error)
else
grunt.verbose.writeln("Installing atom-shell #{atomShellVersion.cyan}")
installAtomShell(atomShellVersion)
rebuildNativeModules(currentAtomShellVersion, done)
else
done(false)
else
done()
else
grunt.log.error("atom-shell version missing from package.json")
done(false)
externo
+1 -1
Submodule vendor/apm updated: 809d8d42f7...5aa7984e15