From c8f072b59cc5c9bafc07ea1f86df4ed1b7bd4222 Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Mon, 2 Mar 2015 14:57:14 +0100 Subject: [PATCH 001/521] remove docs that have moved to atom/docs, update README --- docs/README.md | 20 +- docs/advanced/configuration.md | 58 -- docs/advanced/keymaps.md | 171 ----- docs/advanced/node-modules.md | 24 - docs/advanced/scopes-and-scope-descriptors.md | 87 --- docs/advanced/serialization.md | 75 --- docs/converting-a-text-mate-bundle.md | 52 -- docs/converting-a-text-mate-theme.md | 68 -- docs/creating-a-package.md | 515 --------------- docs/creating-a-theme.md | 148 ----- docs/customizing-atom.md | 193 ------ docs/debugging.md | 133 ---- docs/getting-started.md | 109 --- docs/index.md | 30 - docs/publishing-a-package.md | 114 ---- docs/theme-variables.md | 116 ---- docs/upgrading/upgrading-your-package.md | 625 ------------------ docs/upgrading/upgrading-your-syntax-theme.md | 24 - docs/upgrading/upgrading-your-ui-theme.md | 137 ---- docs/writing-specs.md | 136 ---- docs/your-first-package.md | 158 ----- 21 files changed, 18 insertions(+), 2975 deletions(-) delete mode 100644 docs/advanced/configuration.md delete mode 100644 docs/advanced/keymaps.md delete mode 100644 docs/advanced/node-modules.md delete mode 100644 docs/advanced/scopes-and-scope-descriptors.md delete mode 100644 docs/advanced/serialization.md delete mode 100644 docs/converting-a-text-mate-bundle.md delete mode 100644 docs/converting-a-text-mate-theme.md delete mode 100644 docs/creating-a-package.md delete mode 100644 docs/creating-a-theme.md delete mode 100644 docs/customizing-atom.md delete mode 100644 docs/debugging.md delete mode 100644 docs/getting-started.md delete mode 100644 docs/index.md delete mode 100644 docs/publishing-a-package.md delete mode 100644 docs/theme-variables.md delete mode 100644 docs/upgrading/upgrading-your-package.md delete mode 100644 docs/upgrading/upgrading-your-syntax-theme.md delete mode 100644 docs/upgrading/upgrading-your-ui-theme.md delete mode 100644 docs/writing-specs.md delete mode 100644 docs/your-first-package.md diff --git a/docs/README.md b/docs/README.md index e8863f520..c66788d87 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,21 @@ -# Welcome to the Atom Docs +# Atom Docs ![Atom](https://cloud.githubusercontent.com/assets/72919/2874231/3af1db48-d3dd-11e3-98dc-6066f8bc766f.png) -TODO: Write when docs move to a dedicated repo. +Most of the Atom user and developer documentation is contained in the [Atom Docs](https://github.com/atom/docs) repository. + +In this directory you can only find very specific build and API level documentation. Some of this may eventually move to the docs repository as well. + +## Build documentation + +Instructions for building Atom on various platforms from source. + +* [OS X](build-instructions/os-x.md) +* [Windows](build-instructions/windows.md) +* [Linux](build-instructions/linux.md) +* [FreeBSD](build-instructions/freebsd.md) + +## Other documentation here + +* [apm REST API](apm-rest-api.md) +* [Tips for contributing to packages](contributing-to-packages.md) diff --git a/docs/advanced/configuration.md b/docs/advanced/configuration.md deleted file mode 100644 index 82d821eb0..000000000 --- a/docs/advanced/configuration.md +++ /dev/null @@ -1,58 +0,0 @@ -## Configuration API - -### Reading Config Settings - -If you are writing a package that you want to make configurable, you'll need to -read config settings via the `atom.config` global. You can read the current -value of a namespaced config key with `atom.config.get`: - -```coffeescript -# read a value with `config.get` -@showInvisibles() if atom.config.get "editor.showInvisibles" -``` - -Or you can subscribe via `atom.config.observe` to track changes from any view -object. - -```coffeescript -{View} = require 'space-pen' - -class MyView extends View - attached: -> - @fontSizeObserveSubscription = - atom.config.observe 'editor.fontSize', (newValue, {previous}) => - @adjustFontSize() - - detached: -> - @fontSizeObserveSubscription.dispose() -``` - -The `atom.config.observe` method will call the given callback immediately with -the current value for the specified key path, and it will also call it in the -future whenever the value of that key path changes. If you only want to invoke -the callback when the next time the value changes, use `atom.config.onDidChange` -instead. - -Subscription methods return *disposable* subscription objects. Note in the -example above how we save the subscription to the `@fontSizeObserveSubscription` -instance variable and dispose of it when the view is detached. To group multiple -subscriptions together, you can add them all to a -[`CompositeDisposable`][composite-disposable] that you dispose when the view is -detached. - -### Writing Config Settings - -The `atom.config` database is populated on startup from `~/.atom/config.cson`, -but you can programmatically write to it with `atom.config.set`: - -```coffeescript -# basic key update -atom.config.set("core.showInvisibles", true) -``` - -If you're exposing package configuration via specific key paths, you'll want to -associate them with a schema in your package's main module. Read more about -schemas in the [config API docs][config-api]. - -[composite-disposable]: https://atom.io/docs/api/latest/CompositeDisposable -[config-api]: https://atom.io/docs/api/latest/Config diff --git a/docs/advanced/keymaps.md b/docs/advanced/keymaps.md deleted file mode 100644 index ee966a45d..000000000 --- a/docs/advanced/keymaps.md +++ /dev/null @@ -1,171 +0,0 @@ -# Keymaps In-Depth - -## Structure of a Keymap File - -Keymap files are encoded as JSON or CSON files containing nested hashes. They -work much like style sheets, but instead of applying style properties to elements -matching the selector, they specify the meaning of keystrokes on elements -matching the selector. Here is an example of some bindings that apply when -keystrokes pass through `atom-text-editor` elements: - -```coffee -'atom-text-editor': - 'cmd-delete': 'editor:delete-to-beginning-of-line' - 'alt-backspace': 'editor:delete-to-beginning-of-word' - 'ctrl-A': 'editor:select-to-first-character-of-line' - 'ctrl-shift-e': 'editor:select-to-end-of-line' - 'cmd-left': 'editor:move-to-first-character-of-line' - -'atom-text-editor:not([mini])': - 'cmd-alt-[': 'editor:fold-current-row' - 'cmd-alt-]': 'editor:unfold-current-row' -``` - -Beneath the first selector are several bindings, mapping specific *keystroke -patterns* to *commands*. When an element with the `atom-text-editor` class is focused and -`cmd-delete` is pressed, an custom DOM event called -`editor:delete-to-beginning-of-line` is emitted on the `atom-text-editor` element. - -The second selector group also targets editors, but only if they don't have the -`mini` attribute. In this example, the commands for code folding don't really -make sense on mini-editors, so the selector restricts them to regular editors. - -### Keystroke Patterns - -Keystroke patterns express one or more keystrokes combined with optional -modifier keys. For example: `ctrl-w v`, or `cmd-shift-up`. A keystroke is -composed of the following symbols, separated by a `-`. A multi-keystroke pattern -can be expressed as keystroke patterns separated by spaces. - - -| Type | Examples -| --------------------|---------------------------- -| Character literals | `a` `4` `$` -| Modifier keys | `cmd` `ctrl` `alt` `shift` -| Special keys | `enter` `escape` `backspace` `delete` `tab` `home` `end` `pageup` `pagedown` `left` `right` `up` `down` - -### Commands - -Commands are custom DOM events that are triggered when a keystroke matches a -binding. This allows user interface code to listen for named commands without -specifying the specific keybinding that triggers it. For example, the following -code creates a command to insert the current date in an editor: - -```coffee -atom.commands.add 'atom-text-editor', - 'user:insert-date': (event) -> - editor = @getModel() - editor.insertText(new Date().toLocaleString()) -``` - -`atom.commands` refers to the global {CommandRegistry} instance where all commands -are set and consequently picked up by the command palette. - -When you are looking to bind new keys, it is often useful to use the command -palette (`ctrl-shift-p`) to discover what commands are being listened for in a -given focus context. Commands are "humanized" following a simple algorithm, so a -command like `editor:fold-current-row` would appear as "Editor: Fold Current -Row". - -### "Composed" Commands - -A common question is, "How do I make a single keybinding execute two or more -commands?" There isn't any direct support for this in Atom, but it can be -achieved by creating a custom command that performs the multiple actions -you desire and then creating a keybinding for that command. For example, let's -say I want to create a "composed" command that performs a Select Line followed -by Cut. You could add the following to your `init.coffee`: - -```coffee -atom.commands.add 'atom-text-editor', 'custom:cut-line', -> - editor = atom.workspace.getActiveTextEditor() - editor.selectLinesContainingCursors() - editor.cutSelectedText() -``` - -Then let's say we want to map this custom command to `alt-ctrl-z`, you could -add the following to your keymap: - -```coffee -'atom-text-editor': - 'alt-ctrl-z': 'custom:cut-line' -``` - -### Specificity and Cascade Order - -As is the case with CSS applying styles, when multiple bindings match for a -single element, the conflict is resolved by choosing the most *specific* -selector. If two matching selectors have the same specificity, the binding -for the selector appearing later in the cascade takes precedence. - -Currently, there's no way to specify selector ordering within a single keymap, -because JSON objects do not preserve order. We eventually plan to introduce a -custom CSS-like file format for keymaps that allows for ordering within a single -file. For now, we've opted to handle cases where selector ordering is critical -by breaking the keymap into two separate files, such as `snippets-1.cson` and -`snippets-2.cson`. - -## Removing Bindings - -When the keymap system encounters a binding with the `unset!` directive as its -command, it will treat the current element as if it had no key bindings matching -the current keystroke sequence and continue searching from its parent. If you -want to remove a binding from a keymap you don't control, such as keymaps in -Atom core or in packages, use the `unset!` directive. - -For example, the following code removes the keybinding for `a` in the Tree View, -which is normally used to trigger the `tree-view:add-file` command: - -```coffee -'.tree-view': - 'a': 'unset!' -``` - -![](https://cloud.githubusercontent.com/assets/38924/3174771/e7f6ce64-ebf4-11e3-922d-f280bffb3fc5.png) - -## Forcing Chromium's Native Keystroke Handling - -If you want to force the native browser behavior for a given keystroke, use the -`native!` directive as the command of a binding. This can be useful to enable -the correct behavior in native input elements, for example. If you apply the -`.native-key-bindings` class to an element, all the keystrokes typically handled -by the browser will be assigned the `native!` directive. - -## Overloading Key Bindings - -Occasionally, it makes sense to layer multiple actions on top of the same key -binding. An example of this is the snippets package. Snippets are inserted by -typing a snippet prefix such as `for` and then pressing `tab`. Every time `tab` -is pressed, we want to execute code attempting to expand a snippet if one exists -for the text preceding the cursor. If a snippet *doesn't* exist, we want `tab` -to actually insert whitespace. - -To achieve this, the snippets package makes use of the `.abortKeyBinding()` -method on the event object representing the `snippets:expand` command. - -```coffee-script -# pseudo-code -editor.command 'snippets:expand', (e) => - if @cursorFollowsValidPrefix() - @expandSnippet() - else - e.abortKeyBinding() -``` - -When the event handler observes that the cursor does not follow a valid prefix, -it calls `e.abortKeyBinding()`, telling the keymap system to continue searching -for another matching binding. - -## Step-by-Step: How Keydown Events are Mapped to Commands - -* A keydown event occurs on a *focused* element. -* Starting at the focused element, the keymap walks upward towards the root of - the document, searching for the most specific CSS selector that matches the - current DOM element and also contains a keystroke pattern matching the keydown - event. -* When a matching keystroke pattern is found, the search is terminated and the - pattern's corresponding command is triggered on the current element. -* If `.abortKeyBinding()` is called on the triggered event object, the search - is resumed, triggering a binding on the next-most-specific CSS selector for - the same element or continuing upward to parent elements. -* If no bindings are found, the event is handled by Chromium normally. diff --git a/docs/advanced/node-modules.md b/docs/advanced/node-modules.md deleted file mode 100644 index 173713803..000000000 --- a/docs/advanced/node-modules.md +++ /dev/null @@ -1,24 +0,0 @@ -## Developing Node Modules - -Atom contains a number of packages that are Node modules instead of Atom packages. If you want to -make changes to the Node modules, for instance `atom-keymap`, you have to link them into the -development environment differently than you would a normal Atom package. - -### Linking a Node Module Into Your Atom Dev Environment - -Here are the steps to run a local version of a node module *not an apm* within Atom. We're using -`atom-keymap` as an example: - -```bash -$ git clone https://github.com/atom/atom-keymap.git -$ cd atom-keymap -$ npm install -$ npm link -$ apm rebuild # This is the special step, it makes the npm work with Atom's version of Node -$ cd WHERE-YOU-CLONED-ATOM -$ npm link atom-keymap -$ atom # Should work! -``` - -After this, you'll have to `npm install` and `apm rebuild` when you make a change to the node -module's code. diff --git a/docs/advanced/scopes-and-scope-descriptors.md b/docs/advanced/scopes-and-scope-descriptors.md deleted file mode 100644 index 7ee82995e..000000000 --- a/docs/advanced/scopes-and-scope-descriptors.md +++ /dev/null @@ -1,87 +0,0 @@ -# Scoped Settings, Scopes and Scope Descriptors - -Atom supports language-specific settings. You can soft wrap only Markdown files, or set the tab length to 4 in Python files. - -Language-specific settings are a subset of something more general we call "scoped settings". Scoped settings allow targeting down to a specific syntax token type. For example, you could conceivably set a setting to target only Ruby comments, only code inside Markdown files, or even only JavaScript function names. - -## Scope names in syntax tokens - -Each token in the editor has a collection of scope names. For example, the aformentioned JavaScript function name might have the scope names `function` and `name`. An open paren might have the scope names `punctuation`, `parameters`, `begin`. - -Scope names work just like CSS classes. In fact, in the editor, scope names are attached to a token's DOM node as CSS classes. - -Take this piece of JavaScript: - -```js -function functionName() { - console.log('Log it out'); -} -``` - -In the dev tools, the first line's markup looks like this. - -![screen shot 2014-10-14 at 11 21 35 am](https://cloud.githubusercontent.com/assets/69169/4634321/2b1b923c-53cf-11e4-9268-6e57bcb14ec8.png) - -All the class names on the spans are scope names. Any scope name can be used to target a setting's value. - -## Scope Selectors - -Scope selectors allow you to target specific tokens just like a CSS selector targets specific nodes in the DOM. Some examples: - -```coffee -'.source.js' # selects all javascript tokens -'.source.js .function.name' # selects all javascript function names -'.function.name' # selects all function names in any language -``` - -[Config::set][config-set] accepts a `scopeSelector`. If you'd like to set a setting for JavaScript function names, you can give it the js function name `scopeSelector`: - -```coffee -atom.config.set('.source.js .function.name', 'my-package.my-setting', 'special value') -``` - -## Scope Descriptors - -A scope descriptor is an [Object][scope-descriptor] that wraps an `Array` of -`String`s. The Array describes a path from the root of the syntax tree to a -token including _all_ scope names for the entire path. - -In our JavaScript example above, a scope descriptor for the function name token would be: - -```coffee -['source.js', 'meta.function.js', 'entity.name.function.js'] -``` - -[Config::get][config-get] accepts a `scopeDescriptor`. You can get the value for your setting scoped to JavaScript function names via: - -```coffee -scopeDescriptor = ['source.js', 'meta.function.js', 'entity.name.function.js'] -value = atom.config.get(scopeDescriptor, 'my-package.my-setting') -``` - -But, you do not need to generate scope descriptors by hand. There are a couple methods available to get the scope descriptor from the editor: - -* [Editor::getRootScopeDescriptor][editor-getRootScopeDescriptor] to get the language's descriptor. eg. `[".source.js"]` -* [Editor::scopeDescriptorForBufferPosition][editor-scopeDescriptorForBufferPosition] to get the descriptor at a specific position in the buffer. -* [Cursor::getScopeDescriptor][cursor-getScopeDescriptor] to get a cursor's descriptor based on position. eg. if the cursor were in the name of the method in our example it would return `["source.js", "meta.function.js", "entity.name.function.js"]` - -Let's revisit our example using these methods: - -```coffee -editor = atom.workspace.getActiveTextEditor() -cursor = editor.getLastCursor() -valueAtCursor = atom.config.get(cursor.getScopeDescriptor(), 'my-package.my-setting') -valueForLanguage = atom.config.get(editor.getRootScopeDescriptor(), 'my-package.my-setting') -``` - - -[config]:https://atom.io/docs/api/latest/Config -[config-get]:https://atom.io/docs/api/latest/Config#instance-get -[config-set]:https://atom.io/docs/api/latest/Config#instance-set -[config-observe]:https://atom.io/docs/api/latest/Config#instance-observe - -[editor-getRootScopeDescriptor]:https://atom.io/docs/api/latest/TextEditor#instance-getRootScopeDescriptor -[editor-scopeDescriptorForBufferPosition]:https://atom.io/docs/api/latest/TextEditor#instance-scopeDescriptorForBufferPosition - -[cursor-getScopeDescriptor]:https://atom.io/docs/api/latest/Cursor#instance-getScopeDescriptor -[scope-descriptor]:https://atom.io/docs/api/latest/ScopeDescriptor diff --git a/docs/advanced/serialization.md b/docs/advanced/serialization.md deleted file mode 100644 index c2a5f303a..000000000 --- a/docs/advanced/serialization.md +++ /dev/null @@ -1,75 +0,0 @@ -## Serialization in Atom - -When a window is refreshed or restored from a previous session, the view and its -associated objects are *deserialized* from a JSON representation that was stored -during the window's previous shutdown. For your own views and objects to be -compatible with refreshing, you'll need to make them play nicely with the -serializing and deserializing. - -### Package Serialization Hook - -Your package's main module can optionally include a `serialize` method, which -will be called before your package is deactivated. You should return JSON, which -will be handed back to you as an argument to `activate` next time it is called. -In the following example, the package keeps an instance of `MyObject` in the -same state across refreshes. - -```coffee-script -module.exports = - activate: (state) -> - @myObject = - if state - atom.deserializers.deserialize(state) - else - new MyObject("Hello") - - serialize: -> - @myObject.serialize() -``` - -### Serialization Methods - -```coffee-script -class MyObject - atom.deserializers.add(this) - - @deserialize: ({data}) -> new MyObject(data) - constructor: (@data) -> - serialize: -> { deserializer: 'MyObject', data: @data } -``` - -#### .serialize() -Objects that you want to serialize should implement `.serialize()`. This method -should return a serializable object, and it must contain a key named -`deserializer` whose value is the name of a registered deserializer that can -convert the rest of the data to an object. It's usually just the name of the -class itself. - -#### @deserialize(data) -The other side of the coin is the `deserialize` method, which is usually a -class-level method on the same class that implements `serialize`. This method's -job is to convert a state object returned from a previous call `serialize` back -into a genuine object. - -#### atom.deserializers.add(klass) -You need to call the `atom.deserializers.add` method with your class in -order to make it available to the deserialization system. Now you can call the -global `deserialize` method with state returned from `serialize`, and your -class's `deserialize` method will be selected automatically. - -### Versioning - -```coffee-script -class MyObject - atom.deserializers.add(this) - - @version: 2 - @deserialize: (state) -> ... - serialize: -> { version: @constructor.version, ... } -``` - -Your serializable class can optionally have a class-level `@version` property -and include a `version` key in its serialized state. When deserializing, Atom -will only attempt to call deserialize if the two versions match, and otherwise -return undefined. We plan on implementing a migration system in the future, but -this at least protects you from improperly deserializing old state. diff --git a/docs/converting-a-text-mate-bundle.md b/docs/converting-a-text-mate-bundle.md deleted file mode 100644 index 3471bc83b..000000000 --- a/docs/converting-a-text-mate-bundle.md +++ /dev/null @@ -1,52 +0,0 @@ -## Converting a TextMate Bundle - -This guide will show you how to convert a [TextMate][TextMate] bundle to an -Atom package. - -Converting a TextMate bundle will allow you to use its editor preferences, -snippets, and colorization inside Atom. - -### Install apm - -The `apm` command line utility that ships with Atom supports converting -a TextMate bundle to an Atom package. - -Check that you have `apm` installed by running the following command in your -terminal: - -```sh -apm help init -``` - -You should see a message print out with details about the `apm init` command. - -If you do not, launch Atom and run the _Atom > Install Shell Commands_ menu -to install the `apm` and `atom` commands. - -### Convert the Package - -Let's convert the TextMate bundle for the [R][R] programming language. You can find other existing TextMate bundles [here][TextMateOrg]. - -You can convert the R bundle with the following command: - -```sh -apm init --package ~/.atom/packages/language-r --convert https://github.com/textmate/r.tmbundle -``` - -You can now browse to `~/.atom/packages/language-r` to see the converted bundle. - -:tada: Your new package is now ready to use, launch Atom and open a `.r` file in -the editor to see it in action! - -### Further Reading - -* Check out [Publishing a Package](publishing-a-package.html) for more information - on publishing the package you just created to [atom.io][atomio]. - -[atomio]: https://atom.io -[CSS]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets -[Less]: http://lesscss.org -[plist]: https://en.wikipedia.org/wiki/Property_list -[R]: https://en.wikipedia.org/wiki/R_(programming_language) -[TextMate]: http://macromates.com -[TextMateOrg]: https://github.com/textmate diff --git a/docs/converting-a-text-mate-theme.md b/docs/converting-a-text-mate-theme.md deleted file mode 100644 index 79dacd523..000000000 --- a/docs/converting-a-text-mate-theme.md +++ /dev/null @@ -1,68 +0,0 @@ -## Converting a TextMate Theme - -This guide will show you how to convert a [TextMate][TextMate] theme to an Atom -theme. - -### Differences - -TextMate themes use [plist][plist] files while Atom themes use [CSS][CSS] or -[Less][Less] to style the UI and syntax in the editor. - -The utility that converts the theme first parses the theme's plist file and -then creates comparable CSS rules and properties that will style Atom similarly. - -### Install apm - -The `apm` command line utility that ships with Atom supports converting -a TextMate theme to an Atom theme. - -Check that you have `apm` installed by running the following command in your -terminal: - -```sh -apm help init -``` - -You should see a message print out with details about the `apm init` command. - -If you do not, launch Atom and run the _Atom > Install Shell Commands_ menu -to install the `apm` and `atom` commands. - -You can now run `apm help init` to see all the options for initializing new -packages and themes. - -### Convert the Theme - -Download the theme you wish to convert, you can browse existing TextMate themes -[here][TextMateThemes]. - -Now, let's say you've downloaded the theme to `~/Downloads/MyTheme.tmTheme`, -you can convert the theme with the following command: - -```sh -apm init --theme ~/.atom/packages/my-theme --convert ~/Downloads/MyTheme.tmTheme -``` - -You can browse to `~/.atom/packages/my-theme` to see the converted theme. - -### Activate the Theme - -Now that your theme is installed to `~/.atom/packages` you can enable it -by launching Atom and selecting the _Atom > Preferences..._ menu. - -Select the _Themes_ link on the left side and choose _My Theme_ from the -__Syntax Theme__ dropdown menu to enable your new theme. - -:tada: Your theme is now enabled, open an editor to see it in action! - -### Further Reading - -* Check out [Publishing a Package](publishing-a-package.html) for more information - on publishing the theme you just created to [atom.io][atomio]. - -[atomio]: https://atom.io -[CSS]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets -[Less]: http://lesscss.org -[plist]: https://en.wikipedia.org/wiki/Property_list -[TextMate]: http://macromates.com -[TextMateThemes]: http://wiki.macromates.com/Themes/UserSubmittedThemes diff --git a/docs/creating-a-package.md b/docs/creating-a-package.md deleted file mode 100644 index d00f6ecc1..000000000 --- a/docs/creating-a-package.md +++ /dev/null @@ -1,515 +0,0 @@ -# Creating Packages - -Packages are at the core of Atom. Nearly everything outside of the main editor -is handled by a package. That includes "core" pieces like the [file tree][file-tree], -[status bar][status-bar], [syntax highlighting][cs-syntax], and more. - -A package can contain a variety of different resource types to change Atom's -behavior. The basic package layout is as follows: - -```text -my-package/ - grammars/ - keymaps/ - lib/ - menus/ - spec/ - snippets/ - styles/ - index.coffee - package.json -``` - -Not every package will have (or need) all of these directories. - -We have [a tutorial on creating your first package][first-package]. - -There are also guides for converting [TextMate bundles][convert-bundle] and -[TextMate themes][convert-theme] so they work in Atom. - -## package.json - -Similar to [npm packages][npm], Atom packages contain a _package.json_ file -in their top-level directory. This file contains metadata about the package, -such as the path to its "main" module, library dependencies, and manifests -specifying the order in which its resources should be loaded. - -In addition to the regular [npm package.json keys][npm-keys] available, Atom -package.json files have their own additions. - -- `main` (**Required**): the path to the CoffeeScript file that's the entry point -to your package. -- `styles` (**Optional**): an Array of Strings identifying the order of the -style sheets your package needs to load. If not specified, style sheets in the -_styles_ directory are added alphabetically. -- `keymaps`(**Optional**): an Array of Strings identifying the order of the -key mappings your package needs to load. If not specified, mappings in the -_keymaps_ directory are added alphabetically. -- `menus`(**Optional**): an Array of Strings identifying the order of -the menu mappings your package needs to load. If not specified, mappings -in the _menus_ directory are added alphabetically. -- `snippets` (**Optional**): an Array of Strings identifying the order of the -snippets your package needs to load. If not specified, snippets in the -_snippets_ directory are added alphabetically. -- `activationCommands` (**Optional**): an Array of Strings identifying commands that -trigger your package's activation. You can delay the loading of your package -until one of these events is triggered. -- `providedServices` (**Optional**): an Object describing the services that your -package provides, which can be used by other packages. The keys of this object -are the names of the services, and the values are Objects with the following -keys: - - `description` (**Optional**) a String describing the service - - `versions` (**Required**) an Object whose keys are Semver version strings, - and whose values are names of methods in your package's top-level module - that return a value implementing the service. -- `consumedServices` (**Optional**): an Object describing the services that your -package uses, which can be provided by other packages. The keys of this object -are the names of the services, and the values are Objects with the following -keys: - - `versions` (**Required**) an Object whose keys are Semver version ranges - and whose values are names of methods in your package's top-level module - that are called with values implementing the service. - -## Source Code - -If you want to extend Atom's behavior, your package should contain a single -top-level module, which you export from _index.coffee_ (or whichever file is -indicated by the `main` key in your _package.json_ file). The remainder of your -code should be placed in the `lib` directory, and required from your top-level -file. - -Your package's top-level module is a singleton object that manages the lifecycle -of your extensions to Atom. Even if your package creates ten different views and -appends them to different parts of the DOM, it's all managed from your top-level -object. - -Your package's top-level module should implement the following methods: - -- `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 -the window is later restored, the data you returned is passed to your -module's `activate` method so you can restore your view to where the user left -off. - -- `deactivate()`: This **optional** method is called when the window is shutting -down, or when your package is being updated or disabled. If your package is -watching any files, holding external resources, providing commands or subscribing -to events, release them here. - -### Simple Package Code - -Your directory would look like this: - -```text -my-package/ - package.json - index.coffee - lib/ - my-package.coffee -``` - -`index.coffee` might be: -```coffeescript -module.exports = require "./lib/my-package" -``` - -`my-package/my-package.coffee` might start: -```coffeescript -module.exports = - activate: (state) -> # ... - deactivate: -> # ... - serialize: -> # ... -``` - -Beyond this simple contract, your package has access to [Atom's API][api]. Be aware -that the Atom 1.0 API is mostly frozen. Refer to the API documentation for what -is public. That said, please collaborate with us if you need an API that doesn't -exist. Our goal is to build out Atom's API organically based on the needs of -package authors like you. - -## Style Sheets - -Style sheets for your package should be placed in the _styles_ directory. -Any style sheets in this directory will be loaded and attached to the DOM when -your package is activated. Style sheets can be written as CSS or [Less], but -Less is recommended. - -Ideally, you won't need much in the way of styling. We've provided a standard -set of components which define both the colors and UI elements for any package -that fits into Atom seamlessly. You can view all of Atom's UI components by -opening the styleguide: open the command palette (`cmd-shift-P`) and search for -_styleguide_, or just type `cmd-ctrl-shift-G`. - -If you _do_ need special styling, try to keep only structural styles in the -package style sheets. If you _must_ specify colors and sizing, these should be -taken from the active theme's [ui-variables.less][ui-variables]. For more -information, see the [theme variables docs][theme-variables]. If you follow this -guideline, your package will look good out of the box with any theme! - -An optional `styleSheets` array in your _package.json_ can list the style sheets -by name to specify a loading order; otherwise, style sheets are loaded -alphabetically. - -## Keymaps - -It's recommended that you provide key bindings for commonly used actions for -your extension, especially if you're also adding a new command: - -```coffeescript -'.tree-view-scroller': - 'ctrl-V': 'changer:magic' -``` - -Keymaps are placed in the _keymaps_ subdirectory. By default, all keymaps are -loaded in alphabetical order. An optional `keymaps` array in your _package.json_ -can specify which keymaps to load and in what order. - - -Keybindings are executed by determining which element the keypress occurred on. -In the example above, `changer:magic` command is executed when pressing `ctrl-V` -on the `.tree-view-scroller` element. - -See the [main keymaps documentation][keymaps] for more detailed information on -how keymaps work. - -## Menus - -Menus are placed in the _menus_ subdirectory. By default, all menus are loaded -in alphabetical order. An optional `menus` array in your _package.json_ can -specify which menus to load and in what order. - -### Application Menu - -It's recommended that you create an application menu item for common actions -with your package that aren't tied to a specific element: - -```coffeescript -'menu': [ - { - 'label': 'Packages' - 'submenu': [ - { - 'label': 'My Package' - 'submenu': [ - { - 'label': 'Toggle' - 'command': 'my-package:toggle' - } - ] - } - ] - } -] -``` - -To add your own item to the application menu, simply create a top level `menu` -key in any menu configuration file in _menus_. This can be a JSON or [CSON] -file. - -The menu templates you specify are merged with all other templates provided -by other packages in the order which they were loaded. - -### Context Menu - -It's recommended to specify a context menu item for commands that are linked to -specific parts of the interface, like adding a file in the tree-view: - -```coffeescript -'context-menu': - '.tree-view': [ - {label: 'Add file', command: 'tree-view:add-file'} - ] - 'atom-workspace': [ - {label: 'Inspect Element', command: 'core:inspect'} - ] -``` - -To add your own item to the application menu simply create a top level -`context-menu` key in any menu configuration file in _menus_. This can be a -JSON or [CSON] file. - -Context menus are created by determining which element was selected and then -adding all of the menu items whose selectors match that element (in the order -which they were loaded). The process is then repeated for the elements until -reaching the top of the DOM tree. - -In the example above, the `Add file` item will only appear when the focused item -or one of its parents has the `tree-view` class applied to it. - -You can also add separators and submenus to your context menus. To add a -submenu, provide a `submenu` key instead of a command. To add a separator, add -an item with a single `type: 'separator'` key/value pair. - -```coffeescript -'context-menu': - 'atom-workspace': [ - { - label: 'Text' - submenu: [ - {label: 'Inspect Element', command: 'core:inspect'} - {type: 'separator'} - {label: 'Selector All', command: 'core:select-all'} - {type: 'separator'} - {label: 'Deleted Selected Text', command: 'core:delete'} - ] - } - ] -``` - -## Snippets - -An extension can supply language snippets in the _snippets_ directory which -allows the user to enter repetitive text quickly: - -```coffeescript -".source.coffee .specs": - "Expect": - prefix: "ex" - body: "expect($1).to$2" - "Describe": - prefix: "de" - body: """ - describe "${1:description}", -> - ${2:body} - """ -``` - -A snippets file contains scope selectors at its top level (`.source.coffee -.spec`). Each scope selector contains a hash of snippets keyed by their name -(`Expect`, `Describe`). Each snippet also specifies a `prefix` and a `body` key. -The `prefix` represents the first few letters to type before hitting the `tab` -key to autocomplete. The `body` defines the autofilled text. You can use -placeholders like `$1`, `$2`, to indicate regions in the body the user can -navigate to every time they hit `tab`. - -All files in the directory are automatically loaded, unless the _package.json_ -supplies a `snippets` key. As with all scoped items, snippets loaded later take -precedence over earlier snippets when two snippets match a scope with the same -specificity. - -## Language Grammars - -If you're developing a new language grammar, you'll want to place your file in -the _grammars_ directory. Each grammar is a pairing of two keys, `match` and -`captures`. `match` is a regular expression identifying the pattern to -highlight, while `captures` is an object representing what to do with each -matching group. - -For example: - - -```coffeescript -{ - 'match': '(?:^|\\s)(__[^_]+__)' - 'captures': - '1': 'name': 'markup.bold.gfm' -} -``` - -This indicates that the first matching capture (`(__[^_]+__)`) should have the -`markup.bold.gfm` token applied to it. - -To capture a single group, simply use the `name` key instead: - -```coffeescript -{ - 'match': '^#{1,6}\\s+.+$' - 'name': 'markup.heading.gfm' -} -``` - -This indicates that Markdown header lines (`#`, `##`, `###`) should be applied -with the `markup.heading.gfm` token. - -More information about the significance of these tokens can be found in -[section 12.4 of the TextMate Manual][tm-tokens]. - -Your grammar should also include a `filetypes` array, which is a list of file -extensions your grammar supports: - -```coffeescript -'fileTypes': [ - 'markdown' - 'md' - 'mkd' - 'mkdown' - 'ron' -] -``` - -## Adding Configuration Settings - -You can support config settings in your package that are editable in the -settings view. Specify a `config` key in your package main: - -```coffeescript -module.exports = - # Your config schema! - config: - someInt: - type: 'integer' - default: 23 - minimum: 1 - activate: (state) -> # ... - # ... -``` - -To define the configuration, we use [json schema][json-schema] which allows you -to indicate the type your value should be, its default, etc. - -See the [Config API Docs](https://atom.io/docs/api/latest/Config) for more -details specifying your configuration. - -## Interacting With Other Packages Via Services - -Atom packages can interact with each other through versioned APIs called -*services*. To provide a service, in your `package.json`, specify one or more -version numbers, each paired with the name of a method on your package's main module: - -```json -{ - "providedServices": { - "my-service": { - "description": "Does a useful thing", - "versions": { - "1.2.3": "provideMyServiceV1", - "2.3.4": "provideMyServiceV2", - } - } - } -} -``` - -In your package's main module, implement the methods named above. These methods -will be called any time a package is activated that consumes their corresponding -service. They should return a value that implements the service's API. - - -```coffeescript -module.exports = - activate: -> # ... - - provideMyServiceV1: -> - adaptToLegacyAPI(myService) - - provideMyServiceV2: -> - myService -``` - -Similarly, to consume a service, specify one or more [version *ranges*][version-ranges], -each paired with the name of a method on the package's main module: - -```json -{ - "consumedServices": { - "another-service": { - "versions": { - "^1.2.3": "consumeAnotherServiceV1", - ">=2.3.4 <2.5": "consumeAnotherServiceV2", - } - } - } -} -``` - -These methods will be called any time a package is activated that *provides* their -corresponding service. They will receive the service object as an argument. You -will usually need to perform some kind of cleanup in the event that the package -providing the service is deactivated. To do this, return a `Disposable` from -your service-consuming method: - -```coffeescript -{Disposable} = require 'atom' - -module.exports = - activate: -> # ... - - consumeAnotherServiceV1: (service) -> - useService(adaptServiceFromLegacyAPI(service)) - new Disposable -> stopUsingService(service) - - consumeAnotherServiceV2: (service) -> - useService(service) - new Disposable -> stopUsingService(service) -``` - -## Bundle External Resources - -It's common to ship external resources like images and fonts in the package, to -make it easy to reference the resources in HTML or CSS, you can use the `atom` -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 equivalent to -`~/.atom/packages/image-view/images/transparent-background.gif`. - -You can also use the `atom` protocol URLs in themes. - -## Writing Tests - -Your package **should** have tests, and if they're placed in the _spec_ -directory, they can be run by Atom. - -Under the hood, [Jasmine] executes your tests, so you can assume that any DSL -available there is also available to your package. - -## Running Tests - -Once you've got your test suite written, you can run it by pressing -`cmd-alt-ctrl-p` or via the _Developer > Run Package Specs_ menu. - -You can also use the `apm test` command to run them from the command line. It -prints the test output and results to the console and returns the proper status -code depending on whether the tests passed or failed. - -## Publishing - -Atom bundles a command line utility called apm which can be used to publish -Atom packages to the public registry. - -Once your package is written and ready for distribution you can run the -following to publish your package: - -```sh -cd my-package -apm publish minor -``` - -This will update your `package.json` to have a new minor `version`, commit the -change, create a new [Git tag][git-tag], and then upload the package to the -registry. - -Run `apm help publish` to see all the available options and `apm help` to see -all the other available commands. - -[api]: https://atom.io/docs/api/latest -[file-tree]: https://github.com/atom/tree-view -[status-bar]: https://github.com/atom/status-bar -[cs-syntax]: https://github.com/atom/language-coffee-script -[npm]: https://en.wikipedia.org/wiki/Npm_(software) -[npm-keys]: https://docs.npmjs.com/files/package.json -[git-tag]: http://git-scm.com/book/en/Git-Basics-Tagging -[wrap-guide]: https://github.com/atom/wrap-guide/ -[keymaps]: advanced/keymaps.md -[theme-variables]: theme-variables.md -[tm-tokens]: http://manual.macromates.com/en/language_grammars.html -[spacepen]: https://github.com/nathansobo/space-pen -[path]: http://nodejs.org/docs/latest/api/path.html -[jquery]: http://jquery.com/ -[underscore]: http://underscorejs.org/ -[jasmine]: http://jasmine.github.io -[cson]: https://github.com/atom/season -[Less]: http://lesscss.org -[ui-variables]: https://github.com/atom/atom-dark-ui/blob/master/styles/ui-variables.less -[first-package]: your-first-package.html -[convert-bundle]: converting-a-text-mate-bundle.html -[convert-theme]: converting-a-text-mate-theme.html -[json-schema]: http://json-schema.org/ -[version-ranges]: https://docs.npmjs.com/misc/semver#ranges diff --git a/docs/creating-a-theme.md b/docs/creating-a-theme.md deleted file mode 100644 index 6e8ab1dc4..000000000 --- a/docs/creating-a-theme.md +++ /dev/null @@ -1,148 +0,0 @@ -# Creating a Theme - -Atom's interface is rendered using HTML, and it's styled via [Less] which is a -superset of CSS. Don't worry if you haven't heard of Less before; it's just like -CSS, but with a few handy extensions. - -Atom supports two types of themes: _UI_ and _syntax_. UI themes style -elements such as the tree view, the tabs, drop-down lists, and the status bar. -Syntax themes style the code inside the editor. - -Themes can be installed and changed from the settings view which you can open -by selecting the _Atom > Preferences..._ menu and navigating to the _Install_ -section and the _Themes_ section on the left hand side. - -## Getting Started - -Themes are pretty straightforward but it's still helpful to be familiar with -a few things before starting: - -* Less is a superset of CSS, but it has some really handy features like - variables. If you aren't familiar with its syntax, take a few minutes - to [familiarize yourself][less-tutorial]. -* You may also want to review the concept of a _[package.json]_, too. This file - is used to help distribute your theme to Atom users. -* Your theme's _package.json_ must contain a `"theme"` key with a value - of `"ui"` or `"syntax"` for Atom to recognize and load it as a theme. -* You can find existing themes to install or fork on - [atom.io][atomio-themes]. - -## Creating a Syntax Theme - -Let's create your first theme. - -To get started, hit `cmd-shift-P`, and start typing "Generate Syntax Theme" to -generate a new theme package. Select "Generate Syntax Theme," and you'll be -asked for the path where your theme will be created. Let's call ours -_motif-syntax_. __Tip:__ syntax themes should end with _-syntax_. - -Atom will pop open a new window, showing the _motif-syntax_ theme, with a -default set of folders and files created for us. If you open the settings view -(`cmd-,`) and navigate to the _Themes_ section on the left, you'll see the -_Motif_ theme listed in the _Syntax Theme_ drop-down. Select it from the menu to -activate it, now when you open an editor you should see that your new -_motif-syntax_ theme in action. - -Open up _styles/colors.less_ to change the various colors variables which -have been already been defined. For example, turn `@red` into `#f4c2c1`. - -Then open _styles/base.less_ and modify the various selectors that have -been already been defined. These selectors style different parts of code in the -editor such as comments, strings and the line numbers in the gutter. - -As an example, let's make the `.gutter` `background-color` into `@red`. - -Reload Atom by pressing `cmd-alt-ctrl-l` to see the changes you made reflected -in your Atom window. Pretty neat! - -__Tip:__ You can avoid reloading to see changes you make by opening an atom -window in dev mode. To open a Dev Mode Atom window run `atom --dev .` in the -terminal, use `cmd-shift-o` or use the _View > Developer > Open in Dev Mode_ -menu. When you edit your theme, changes will instantly be reflected! - -> Note: It's advised to _not_ specify a `font-family` in your syntax theme because it will override the Font Family field in Atom's settings. If you still like to recommend a font that goes well with your theme, we recommend you do so in your README. - -## Creating an Interface Theme - -Interface themes **must** provide a `ui-variables.less` file which contains all -of the variables provided by the [core themes][ui-variables]. - -To create an interface UI theme, do the following: - -1. Fork one of the following repositories: - * [atom-dark-ui] - * [atom-light-ui] -2. Clone the forked repository to the local filesystem -3. Open a terminal in the forked theme's directory -4. Open your new theme in a Dev Mode Atom window run `atom --dev .` in the - terminal or use the _View > Developer > Open in Dev Mode_ menu -5. Change the name of the theme in the theme's `package.json` file -6. Name your theme end with a `-ui`. i.e. `super-white-ui` -7. Run `apm link` to symlink your repository to `~/.atom/packages` -8. Reload Atom using `cmd-alt-ctrl-L` -9. Enable the theme via _UI Theme_ drop-down in the _Themes_ section of the - settings view -10. Make changes! Since you opened the theme in a Dev Mode window, changes will - be instantly reflected in the editor without having to reload. - -## Development workflow - -There are a few of tools to help make theme development faster and easier. - -### Live Reload - -Reloading by hitting `cmd-alt-ctrl-L` after you make changes to your theme is -less than ideal. Atom supports [live updating][livereload] of styles on Dev Mode -Atom windows. - -To enable a Dev Mode window: - -1. Open your theme directory in a dev window by either going to the - __View > Developer > Open in Dev Mode__ menu or by hitting the `cmd-shift-o` - shortcut -2. Make a change to your theme file and save it. Your change should be - immediately applied! - -If you'd like to reload all the styles at any time, you can use the shortcut -`cmd-ctrl-shift-r`. - -### Developer Tools - -Atom is based on the Chrome browser, and supports Chrome's Developer Tools. You -can open them by selecting the _View > Toggle Developer Tools_ menu, or by -using the `cmd-alt-i` shortcut. - -The dev tools allow you to inspect elements and take a look at their CSS -properties. - -![devtools-img] - -Check out Google's [extensive tutorial][devtools-tutorial] for a short -introduction. - -### Atom Styleguide - -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 that -renders every component Atom supports. - -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] - -[atomio-themes]: https://atom.io/themes -[Less]: http://lesscss.org/ -[git]: http://git-scm.com/ -[atom]: https://atom.io/ -[package.json]: ./creating-a-package.html#package-json -[less-tutorial]: https://speakerdeck.com/danmatthews/less-css -[devtools-tutorial]: https://developer.chrome.com/devtools/docs/dom-and-styles -[ui-variables]: ./theme-variables.html -[livereload]: https://github.com/atom/dev-live-reload -[styleguide]: https://github.com/atom/styleguide -[atom-dark-ui]: https://github.com/atom/atom-dark-ui -[atom-light-ui]: https://github.com/atom/atom-light-ui -[styleguide-img]: https://f.cloud.github.com/assets/69169/1347390/2d431d98-36af-11e3-8f8e-3f4ce1e67adb.png -[devtools-img]: https://f.cloud.github.com/assets/69169/1347391/2d51f91c-36af-11e3-806f-f7b334af43e9.png -[themesettings-img]: https://f.cloud.github.com/assets/69169/1347569/3150bd0c-36b2-11e3-9d69-423503acfe3f.png diff --git a/docs/customizing-atom.md b/docs/customizing-atom.md deleted file mode 100644 index d56bd640a..000000000 --- a/docs/customizing-atom.md +++ /dev/null @@ -1,193 +0,0 @@ -# Customizing Atom - -To change a setting, configure a theme, or install a package just open the -Settings view in the current window by pressing `cmd-,`. - -## Changing The Theme - -Atom comes with both light and dark UI themes as well as several syntax themes. -You are also encouraged to [create or fork][create-theme] your own theme. - -To change the active theme just open the Settings view (`cmd-,`) and select the -`Themes` section from the left hand side. You will see a drop-down menu to -change the active _Syntax_ and _UI_ themes. - -You can also install more themes from here by browsing the featured themes or -searching for a specific theme. - -## Installing Packages - -You can install non-bundled packages by going to the `Packages` section on left -hand side of the Settings view (`cmd-,`). You will see several featured packages -and you can also search for packages from here. The packages listed here have -been published to [atom.io](http://atom.io/packages) which is the official -registry for Atom packages. - -You can also install packages from the command line using `apm`. - -Check that you have `apm` installed by running the following command in your -terminal: - -```sh -apm help install -``` - -You should see a message print out with details about the `apm install` command. - -If you do not, launch Atom and run the _Atom > Install Shell Commands_ menu -to install the `apm` and `atom` commands. - -You can also install packages by using the `apm install` command: - -* `apm install ` to install the latest version. - -* `apm install @` 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`. - -You can also use `apm` to find new packages to install: - -* `apm search coffee` to search for CoffeeScript packages. - -* `apm view emmet` to see more information about a specific package. - -## Customizing Key Bindings - -Atom keymaps work similarly to style sheets. Just as style sheets use selectors -to apply styles to elements, Atom keymaps use selectors to associate keystrokes -with events in specific contexts. Here's a small example, excerpted from Atom's -built-in keymaps: - -```coffee -'atom-text-editor': - 'enter': 'editor:newline' - -'atom-text-editor[mini] input': - 'enter': 'core:confirm' -``` - -This keymap defines the meaning of `enter` in two different contexts. In a -normal editor, pressing `enter` emits the `editor:newline` event, which causes -the editor to insert a newline. But if the same keystroke occurs inside of a -select list's mini-editor, it instead emits the `core:confirm` event based on -the binding in the more-specific selector. - -By default, `~/.atom/keymap.cson` is loaded when Atom is started. It will always -be loaded last, giving you the chance to override bindings that are defined by -Atom's core keymaps or third-party packages. - -You can open this file in an editor from the _Atom > Open Your Keymap_ menu. - -You'll want to know all the commands available to you. Open the Settings panel -(`cmd-,`) and select the _Keybindings_ tab. It will show you all the keybindings -currently in use. - -## Advanced Configuration - -Atom loads configuration settings from the `config.cson` file in your _~/.atom_ -directory, which contains [CoffeeScript-style JSON][CSON] (CSON): - -```coffee -'core': - 'excludeVcsIgnoredPaths': true -'editor': - 'fontSize': 18 -``` - -The configuration itself is grouped by the package name or one of the two core -namespaces: `core` and `editor`. - -You can open this file in an editor from the _Atom > Open Your Config_ menu. - -### Custom Configuration Location - -You can override the location that Atom stores configuration files and folders -in by setting the `ATOM_HOME` environment variable. The `ATOM_HOME` path will be -used instead of `~/.atom` when it is set. - -This option can be useful when you want to make Atom portable across machines. - -### Configuration Key Reference - -- `core` - - `disabledPackages`: An array of package names to disable - - `excludeVcsIgnoredPaths`: Don't search within files specified by _.gitignore_ - - `followSymlinks`: Follow symlinks when searching and scanning root directory - - `ignoredNames`: File names to ignore across all of Atom - - `projectHome`: The directory where projects are assumed to be located - - `themes`: An array of theme names to load, in cascading order -- `editor` - - `autoIndent`: Enable/disable basic auto-indent (defaults to `true`) - - `nonWordCharacters`: A string of non-word characters to define word boundaries - - `fontSize`: The editor font size - - `fontFamily`: The editor font family - - `invisibles`: Specify characters that Atom renders for invisibles in this hash - - `tab`: Hard tab characters - - `cr`: Carriage return (for Microsoft-style line endings) - - `eol`: `\n` characters - - `space`: Leading and trailing space characters - - `preferredLineLength`: Identifies the length of a line (defaults to `80`) - - `showInvisibles`: Whether to render placeholders for invisible characters (defaults to `false`) - - `showIndentGuide`: Show/hide indent indicators within the editor - - `showLineNumbers`: Show/hide line numbers within the gutter - - `softWrap`: Enable/disable soft wrapping of text within the editor - - `softWrapAtPreferredLineLength`: Enable/disable soft line wrapping at `preferredLineLength` - - `tabLength`: Number of spaces within a tab (defaults to `2`) -- `fuzzyFinder` - - `ignoredNames`: Files to ignore *only* in the fuzzy-finder -- `whitespace` - - `ensureSingleTrailingNewline`: Whether to reduce multiple newlines to one at the end of files - - `removeTrailingWhitespace`: Enable/disable striping of whitespace at the end of lines (defaults to `true`) -- `wrap-guide` - - `columns`: Array of hashes with a `pattern` and `column` key to match the - the path of the current editor to a column position. - -### Quick Personal Hacks - -### init.coffee - -When Atom finishes loading, it will evaluate _init.coffee_ in your _~/.atom_ -directory, giving you a chance to run arbitrary personal [CoffeeScript][] code to -make customizations. You have full access to Atom's API from code in this file. -If customizations become extensive, consider [creating a package][creating-a-package]. - -You can open this file in an editor from the _Atom > Open Your Init Script_ -menu. - -For example, if you have the Audio Beep configuration setting enabled, you -could add the following code to your _~/.atom/init.coffee_ file to have Atom -greet you with an audio beep every time it loads: - -```coffee -atom.beep() -``` - -This file can also be named _init.js_ and contain JavaScript code. - -### styles.less - -If you want to apply quick-and-dirty personal styling changes without creating -an entire theme that you intend to publish, you can add styles to the -_styles.less_ file in your _~/.atom_ directory. - -You can open this file in an editor from the _Atom > Open Your Stylesheet_ menu. - -For example, to change the color of the cursor, you could add the following -rule to your _~/.atom/styles.less_ file: - -```less -atom-text-editor::shadow .cursor { - border-color: pink; -} -``` - -Unfamiliar with Less? Read more about it [here][Less]. - -This file can also be named _styles.css_ and contain CSS. - -[creating-a-package]: creating-a-package.md -[create-theme]: creating-a-theme.md -[Less]: http://www.lesscss.org -[CSON]: https://github.com/atom/season -[CoffeeScript]: http://coffeescript.org/ diff --git a/docs/debugging.md b/docs/debugging.md deleted file mode 100644 index ec202e7f8..000000000 --- a/docs/debugging.md +++ /dev/null @@ -1,133 +0,0 @@ -# Debugging - -Atom provides several tools to help you understand unexpected behavior and debug problems. This guide describes some of those tools and a few approaches to help you debug and provide more helpful information when [submitting issues]: - -* [Update to the latest version](#update-to-the-latest-version) -* [Check for linked packages](#check-for-linked-packages) -* [Check Atom and package settings](#check-atom-and-package-settings) -* [Check the keybindings](#check-the-keybindings) -* [Check if the problem shows up in safe mode](#check-if-the-problem-shows-up-in-safe-mode) -* [Check your config files](#check-your-config-files) -* [Check for errors in the developer tools](#check-for-errors-in-the-developer-tools) - -## Update to the latest version - -You might be running into an issue which was already fixed in a more recent version of Atom than the one you're using. - -If you're building Atom from source, pull down the latest version of master and [re-build][building atom]. - -If you're using released version, check which version of Atom you're using: - -```shell -$ atom --version -0.99.0 -``` - -Head on over to the [list of releases][atom releases] and see if there's a more recent release. You can update to the most recent release by downloading Atom from the releases page, or with the in-app auto-updater. The in-app auto-updater checks for and downloads a new version after you restart Atom, or if you use the Atom > Check for Update menu option. - -## Check for linked packages - -If you develop or contribute to Atom packages, there may be left-over packages linked to your `~/.atom/packages` or `~/.atom/dev/packages` directories. You can use: - -```shell -$ apm links -``` - -to list all linked development packages. You can remove the links using the `apm unlink` command. See `apm unlink --help` for details. - -## Check Atom and package settings - -In some cases, unexpected behavior might be caused by misconfigured or unconfigured settings in Atom or in one of the packages. - -Open Atom's Settings View with `cmd-,` or the Atom > Preferences menu option. - -![Settings View] - -Check Atom's settings in the Settings pane, there's a description of each configuration option [here][customizing guide]. For example, if you want Atom to use hard tabs (real tabs) and not soft tabs (spaces), disable the "Soft Tabs" option. - -Since Atom ships with a set of packages and you can install additional packages yourself, check the list of packages and their settings. For example, if you'd like to get rid of the vertical line in the middle of the editor, disable the [Wrap Guide package]. And if you don't like it when Atom strips trailing whitespace or ensures that there's a single trailing newline in the file, you can configure that in the [Whitespace packages'][whitespace package] settings. - -![Package Settings] - -## Check the keybindings - -If a command is not executing when you hit a keystroke or the wrong command is executing, there might be an issue with the keybindings for that keystroke. Atom ships with the [Keybinding resolver][keybinding resolver package], a neat package which helps you understand which keybindings are executed. - -Show the keybinding resolver with cmd-. or with "Key Binding Resolver: Show" from the Command palette. With the keybinding resolver shown, hit a keystroke: - -![Keybinding Resolver] - -The keybinding resolver shows you a list of keybindings that exist for the keystroke, where each item in the list has the following: -* the command for the keybinding, -* the CSS selector used to define the context in which the keybinding is valid, and -* the file in which the keybinding is defined. - -Of all the keybinding that are listed (grey color), at most one keybinding is matched and executed (green color). If the command you wanted to trigger isn't listed, then a keybinding for that command hasn't been defined. More keybindings are provided by [packages] and you can [define your own keybindings][customizing keybindings]. - -If multiple keybindings are matched, Atom determines which keybinding will be executed based on the [specificity of the selectors and the order in which they were loaded][specificity and order]. If the command you wanted to trigger is listed in the Keybinding resolver, but wasn't the one that was executed, this is normally explained by one of two causes: -* the keystroke was not used in the context defined by the keybinding's selector. For example, you can't trigger the "Tree View: Add File" command if the Tree View is not focused, or -* there is another keybinding that took precedence. This often happens when you install a package which defines keybinding that conflict with existing keybindings. If the package's keybindings have selectors with higher specificity or were loaded later, they'll have priority over existing ones. - -Atom loads core Atom keybindings and package keybindings first, and user-defined keybindings after last. Since user-defined keybindings are loaded last, you can use your `keymap.cson` file to tweak the keybindings and sort out problems like these. For example, you can remove keybindings with [the `unset!` directive][unset directive]. - -If you notice that a package's keybindings are taking precedence over core Atom keybindings, it might be a good idea to report the issue on the package's GitHub repository. - -## Check if the problem shows up in safe mode - -A large part of Atom's functionality comes from packages you can install. In some cases, these packages might be causing unexpected behavior, problems, or performance issues. - -To determine if a package you installed is causing problems, start Atom from the terminal in safe mode: - -``` -$ atom --safe -``` - -This starts Atom, but does not load packages from `~/.atom/packages` or `~/.atom/dev/packages`. If you can no longer reproduce the problem in safe mode, it's likely it was caused by one of the packages. - -To figure out which package is causing trouble, start Atom normally again and open Settings (`cmd-,`). Since Settings allow you to disable each installed package, you can disable packages one by one until you can no longer reproduce the issue. Restart (`cmd-q`) or reload (`cmd-ctrl-alt-l`) Atom after you disable each package to make sure it's completely gone. - -When you find the problematic package, you can disable or uninstall the package, and consider creating an issue on the package's GitHub repository. - -## Check your config files - -You might have defined some custom functionality or styles in Atom's [Init script or Stylesheet]. In some situations, these personal hacks might be causing problems so try clearing those files and restarting Atom. - -## Check for errors in the developer tools - -When an error is thrown in Atom, the developer tools are automatically shown with the error logged in the Console tab. However, if the dev tools are open before the error is triggered, a full stack trace for the error will be logged: - -![devtools error] - -If you can reproduce the error, use this approach to get the full stack trace. The stack trace might point to a problem in your [Init script][init script or stylesheet] or a specific package you installed, which you can then disable and report an issue on its GitHub repository. - -## Check that you have a build toolchain installed - -If you are having issues installing a package using `apm install`, this could be -because the package has dependencies on libraries that contain native code -and so you will need to have a C++ compiler and Python installed to be able to -install it. - -You can run `apm install --check` to see if [apm][apm] can build native code on -your machine. - -Check out the pre-requisites in the [build instructions][build-instructions] for -your platform for more details. - -[apm]: https://github.com/atom/apm -[build-instructions]: https://github.com/atom/atom/tree/master/docs/build-instructions -[submitting issues]: https://github.com/atom/atom/blob/master/CONTRIBUTING.md#submitting-issues -[building atom]: https://github.com/atom/atom#building -[atom releases]: https://github.com/atom/atom/releases -[customizing guide]: https://atom.io/docs/latest/customizing-atom#configuration-key-reference -[settings view]: https://f.cloud.github.com/assets/671378/2241795/ba4827d8-9ce4-11e3-93a8-6666ee100917.png -[package settings]: https://cloud.githubusercontent.com/assets/38924/3173588/7e5f6b0c-ebe8-11e3-9ec3-e8d140967e79.png -[wrap guide package]: https://atom.io/packages/wrap-guide -[whitespace package]: https://atom.io/packages/whitespace -[keybinding resolver package]: https://atom.io/packages/keybinding-resolver -[keybinding resolver]: https://f.cloud.github.com/assets/671378/2241702/5dd5a102-9cde-11e3-9e3f-1d999930492f.png -[customizing keybindings]: https://atom.io/docs/latest/customizing-atom#customizing-key-bindings -[packages]: https://atom.io/packages -[specificity and order]: https://atom.io/docs/latest/advanced/keymaps#specificity-and-cascade-order -[unset directive]: https://atom.io/docs/latest/advanced/keymaps#removing-bindings -[init script or stylesheet]: https://atom.io/docs/latest/customizing-atom#quick-personal-hacks -[devtools error]: https://cloud.githubusercontent.com/assets/38924/3177710/11b4e510-ec13-11e3-96db-a2e8a7891773.png diff --git a/docs/getting-started.md b/docs/getting-started.md deleted file mode 100644 index 03e0a5abe..000000000 --- a/docs/getting-started.md +++ /dev/null @@ -1,109 +0,0 @@ -# Getting Started - -Welcome to Atom! This guide provides a quick introduction so you can be -productive as quickly as possible. There are also guides which cover -[configuring], [theming], and [extending] Atom. - -## The Command Palette - -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] - -## The Basics - -### Working With Files - -Atom windows are scoped to a single directory on disk. If you launch Atom from -the command line via the `atom` command and don't specify a path, Atom opens a -window for the current working directory. The current window's directory will be -visible as the root of the tree view on the left, and also serve as the context -for all file-related operations. - -#### Finding Files - -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. If you are using Git you can use `cmd-shift-b` to search the list of -files modified and untracked in your project's repository. - -You can also use the tree view to navigate to a file. To open and focus the -tree view, press `ctrl-0`. The tree view can be toggled open and closed with -`cmd-\`. - -#### Adding, Moving, Deleting Files - -You can add, move, and delete files and folders by right-clicking them in the -tree view and selecting the desired operation from the context menu. You can -also perform these operations from the keyboard by selecting a file or folder -and using `a` to add, `m` to move, and `delete` to delete. - -### Searching - -#### Find and Replace - -To search within a buffer use `cmd-f`. To search the entire project use -`cmd-shift-f`. - -#### Navigating By Symbols - -To jump to a symbol such as a method definition, press `cmd-r`. This opens a -list of all symbols in the current file, which you can fuzzy filter similarly to -`cmd-t`. - -To search for symbols across your project, use `cmd-shift-r`. First you'll need -to make sure you have `tags` (or `TAGS`) file generated for your project. -This can be done by installing [ctags](http://ctags.sourceforge.net/) and -running a command such as `ctags -R src/` from the command line in your -project's root directory. Using [Homebrew](http://brew.sh/)? Just run -`brew install ctags`. - -You can customize how tags are generated by creating your own `.ctags` file -in your home directory (`~/.ctags`). Here is [a good example][ctags] to start -from. - -### Split Panes - -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 its -editors with `cmd-w`, then press `cmd-w` one more time to close the pane. You -can configure panes to auto-close when empty in the Settings view. - -### Folding - -You can fold blocks of code by clicking the arrows that appear when you hover -your mouse cursor over the gutter. You can also fold and unfold from the -keyboard with `alt-cmd-[` and `alt-cmd-]`. To fold everything, use -`alt-cmd-shift-{` and to unfold everything use `alt-cmd-shift-}`. You can also -fold at a specific indentation level with `cmd-k cmd-N` where N is the -indentation depth. - -### Soft-Wrap - -If you want to toggle soft wrap, trigger the command from the command palette. -Press `cmd-shift-P` to open the palette, then type "wrap" to find the correct -command. By default, lines will wrap based on the size of the editor. If you -prefer to wrap at a specific line length, toggle "Wrap at preferred line length" -in preferences. - -## Configuration - -Press `cmd-,` to open the Settings view. This is the place to change settings, -install packages, and change the theme. - -For more advanced configuration see the [customization guide][customization]. - -[configuring]: customizing-atom.md -[theming]: creating-a-theme.md -[extending]: creating-a-package.md -[customization]: customizing-atom.md -[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/atom/symbols-view/blob/master/lib/.ctags diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index e034e5784..000000000 --- a/docs/index.md +++ /dev/null @@ -1,30 +0,0 @@ -## Guides - -* [Getting Started](getting-started.md) -* [Customizing Atom](customizing-atom.md) -* [Creating a Package](creating-a-package.md) -* [Creating a Theme](creating-a-theme.md) -* [Publishing a Package](publishing-a-package.md) -* [Writing Specs](writing-specs.md) -* [Converting a TextMate Bundle](converting-a-text-mate-bundle.md) -* [Converting a TextMate Theme](converting-a-text-mate-theme.md) -* [Contributing](contributing.md) -* [Contributing to Core Packages](contributing-to-packages.md) -* [Debugging](debugging.md) -* [Your First Package](your-first-package.md) - -### Advanced Topics - -* [Configuration](advanced/configuration.md) -* [Developing Node Modules](advanced/node-modules.md) -* [Keymaps](advanced/keymaps.md) -* [Serialization](advanced/serialization.md) -* [Scopes and Scope Descriptors](advanced/scopes-and-scope-descriptors.md) -* [Theme Variables](theme-variables.md) -* [apm REST API](apm-rest-api.md) - -### Upgrading to 1.0 APIs - -* [Upgrading Your Package](upgrading/upgrading-your-package.md) -* [Upgrading Your UI Theme Or Package Selectors](upgrading/upgrading-your-ui-theme.md) -* [Upgrading Your Syntax Theme](upgrading/upgrading-your-syntax-theme.md) diff --git a/docs/publishing-a-package.md b/docs/publishing-a-package.md deleted file mode 100644 index 264876c7a..000000000 --- a/docs/publishing-a-package.md +++ /dev/null @@ -1,114 +0,0 @@ -## Publishing a Package - -This guide will show you how to publish a package or theme to the -[atom.io][atomio] package registry. - -Publishing a package allows other people to install it and use it in Atom. It -is a great way to share what you've made and get feedback and contributions from -others. - -This guide assumes your package's name is `my-package` but you should pick a -better name. - -### Install apm - -The `apm` command line utility that ships with Atom supports publishing packages -to the atom.io registry. - -Check that you have `apm` installed by running the following command in your -terminal: - -```sh -apm help publish -``` - -You should see a message print out with details about the `apm publish` command. - -If you do not, launch Atom and run the _Atom > Install Shell Commands_ menu -to install the `apm` and `atom` commands. - -### Prepare Your Package - -If you've followed the steps in the [your first package][your-first-package] -doc then you should be ready to publish and you can skip to the next step. - -If not, there are a few things you should check before publishing: - - * Your *package.json* file has `name`, `description`, and `repository` fields. - * Your *package.json* file has a `version` field with a value of `"0.0.0"`. - * Your *package.json* file has an `engines` field that contains an entry - for Atom such as: `"engines": {"atom": ">=0.50.0"}`. - * Your package has a `README.md` file at the root. - * Your package is in a Git repository that has been pushed to - [GitHub][github]. Follow [this guide][repo-guide] if your package isn't - already on GitHub. - -### Publish Your Package - -Before you publish a package it is a good idea to check ahead of time if -a package with the same name has already been published to atom.io. You can do -that by visiting `https://atom.io/packages/my-package` to see if the package -already exists. If it does, update your package's name to something that is -available before proceeding. - -Now let's review what the `apm publish` command does: - - 1. Registers the package name on atom.io if it is being published for the - first time. - 2. Updates the `version` field in the *package.json* file and commits it. - 3. Creates a new [Git tag][git-tag] for the version being published. - 4. Pushes the tag and current branch up to GitHub. - 5. Updates atom.io with the new version being published. - -Now run the following commands to publish your package: - -```sh -cd ~/github/my-package -apm publish minor -``` - -If this is the first package you are publishing, the `apm publish` command may -prompt you for your GitHub username and password. This is required to publish -and you only need to enter this information the first time you publish. The -credentials are stored securely in your [keychain][keychain] once you login. - -:tada: Your package is now published and available on atom.io. Head on over to -`https://atom.io/packages/my-package` to see your package's page. - -With `apm publish`, you can bump the version and publish by using -```sh -apm publish -``` -where `` can be `major`, `minor` and `patch`. - -The `major` option to the publish command tells apm to increment the first -digit of the version before publishing so the published version will be `1.0.0` -and the Git tag created will be `v1.0.0`. - -The `minor` option to the publish command tells apm to increment the second -digit of the version before publishing so the published version will be `0.1.0` -and the Git tag created will be `v0.1.0`. - -The `patch` option to the publish command tells apm to increment the third -digit of the version before publishing so the published version will be `0.0.1` -and the Git tag created will be `v0.0.1`. - -Use `major` when you make a huge change, like a rewrite, or a large change to the functionality or interface. -Use `minor` when adding or removing a feature. -Use `patch` when you make a small change like a bug fix that does not add or remove features. - -### Further Reading - -* Check out [semantic versioning][semver] to learn more about versioning your - package releases. -* Consult the [Atom.io package API docs][apm-rest-api] to learn more about how - `apm` works. - -[atomio]: https://atom.io -[github]: https://github.com -[git-tag]: http://git-scm.com/book/en/Git-Basics-Tagging -[keychain]: https://en.wikipedia.org/wiki/Keychain_(Apple) -[repo-guide]: http://guides.github.com/overviews/desktop -[semver]: http://semver.org -[your-first-package]: your-first-package.html -[apm-rest-api]: apm-rest-api.md diff --git a/docs/theme-variables.md b/docs/theme-variables.md deleted file mode 100644 index 0316fc215..000000000 --- a/docs/theme-variables.md +++ /dev/null @@ -1,116 +0,0 @@ -# Style variables - -Atom's UI provides a set of variables you can use in your own themes and packages. - -## Use in Themes - -Each custom theme must specify a `ui-variables.less` file with all of the -following variables defined. The top-most theme specified in the theme settings -will be loaded and available for import. - -## Use in Packages - -In any of your package's `.less` files, you can access the theme variables -by importing the `ui-variables` file from Atom. - -Your package should generally only specify structural styling, and these should -come from [the style guide][styleguide]. Your package shouldn't specify colors, -padding sizes, or anything in absolute pixels. You should instead use the theme -variables. If you follow this guideline, your package will look good out of the -box with any theme! - -Here's an example `.less` file that a package can define using theme variables: - -```css -@import "ui-variables"; - -.my-selector { - background-color: @base-background-color; - padding: @component-padding; -} -``` - -## Variables - -### Text colors - -* `@text-color` -* `@text-color-subtle` -* `@text-color-highlight` -* `@text-color-selected` -* `@text-color-info` - A blue -* `@text-color-success`- A green -* `@text-color-warning`- An orange or yellow -* `@text-color-error` - A red - -### Background colors - -* `@background-color-info` - A blue -* `@background-color-success` - A green -* `@background-color-warning` - An orange or yellow -* `@background-color-error` - A red -* `@background-color-highlight` -* `@background-color-selected` -* `@app-background-color` - The app's background under all the editor components - -### Component colors - -* `@base-background-color` - -* `@base-border-color` - - -* `@pane-item-background-color` - -* `@pane-item-border-color` - - -* `@input-background-color` - -* `@input-border-color` - - -* `@tool-panel-background-color` - -* `@tool-panel-border-color` - - -* `@inset-panel-background-color` - -* `@inset-panel-border-color` - - -* `@panel-heading-background-color` - -* `@panel-heading-border-color` - - -* `@overlay-background-color` - -* `@overlay-border-color` - - -* `@button-background-color` - -* `@button-background-color-hover` - -* `@button-background-color-selected` - -* `@button-border-color` - - -* `@tab-bar-background-color` - -* `@tab-bar-border-color` - -* `@tab-background-color` - -* `@tab-background-color-active` - -* `@tab-border-color` - - -* `@tree-view-background-color` - -* `@tree-view-border-color` - - -* `@ui-site-color-1` - -* `@ui-site-color-2` - -* `@ui-site-color-3` - -* `@ui-site-color-4` - -* `@ui-site-color-5` - - -### Component sizes - -* `@disclosure-arrow-size` - - -* `@component-padding` - -* `@component-icon-padding` - -* `@component-icon-size` - -* `@component-line-height` - -* `@component-border-radius` - - -* `@tab-height` - - -### Fonts - -* `@font-size` - -* `@font-family` - - -[styleguide]: https://github.com/atom/styleguide diff --git a/docs/upgrading/upgrading-your-package.md b/docs/upgrading/upgrading-your-package.md deleted file mode 100644 index e7d603a36..000000000 --- a/docs/upgrading/upgrading-your-package.md +++ /dev/null @@ -1,625 +0,0 @@ -# Upgrading Your Package - -Atom is rapidly approaching 1.0. Much of the effort leading up to the 1.0 has been cleaning up APIs in an attempt to future proof, and make a more pleasant experience developing packages. - -This document will guide you through the large bits of upgrading your package to work with 1.0 APIs. - -## TL;DR - -We've set deprecation messages and errors in strategic places to help make sure you don't miss anything. You should be able to get 95% of the way to an updated package just by fixing errors and deprecations. There are a couple of things you can do to get the full effect of all the errors and deprecations. - -### Use atom-space-pen-views - -If you use any class from `require 'atom'` with a `$` or `View` in the name, add the `atom-space-pen-views` module to your package's `package.json` file's dependencies: - -```js -{ - "dependencies": { - "atom-space-pen-views": "^2.0.3" - } -} -``` - -Then run `apm install` in your package directory. - -### Require views from atom-space-pen-views - -Anywhere you are requiring one of the following from `atom` you need to require them from `atom-space-pen-views` instead. - -```coffee -# require these from 'atom-space-pen-views' rather than 'atom' -$ -$$ -$$$ -View -TextEditorView -ScrollView -SelectListView -``` - -So this: - -```coffee -# Old way -{$, TextEditorView, View, GitRepository} = require 'atom' -``` - -Would be replaced by this: - -```coffee -# New way -{GitRepository} = require 'atom' -{$, TextEditorView, View} = require 'atom-space-pen-views' -``` - -### Run specs and test your package - -You wrote specs, right!? Here's where they shine. Run them with `cmd-shift-P`, and search for `run package specs`. It will show all the deprecation messages and errors. - -### Update the engines field in package.json - -When you are deprecation free and all done converting, upgrade the `engines` field in your package.json: - -```json -{ - "engines": { - "atom": ">=0.174.0 <2.0.0" - } -} -``` - -### Examples - -We have upgraded all the core packages. Please see [this issue](https://github.com/atom/atom/issues/4011) for a link to all the upgrade PRs. - -## Deprecations - -All of the methods in Atom core that have changes will emit deprecation messages when called. These messages are shown in two places: your **package specs**, and in **Deprecation Cop**. - -### Specs - -Just run your specs, and all the deprecations will be displayed in yellow. - -![spec-deps](https://cloud.githubusercontent.com/assets/69169/5637943/b85114ba-95b5-11e4-8681-b81ea8f556d7.png) - -### Deprecation Cop - -Run an atom window in dev mode (`atom -d`) with your package loaded, and open Deprecation Cop (search for `deprecation` in the command palette). Deprecated methods will be appear in Deprecation Cop only after they have been called. - -![dep-cop](https://cloud.githubusercontent.com/assets/69169/5637914/6e702fa2-95b5-11e4-92cc-a236ddacee21.png) - -When deprecation cop is open, and deprecated methods are called, a `Refresh` button will appear in the top right of the Deprecation Cop interface. So exercise your package, then come back to Deprecation Cop and click the `Refresh` button. - -## Upgrading your Views - -Previous to 1.0, views were baked into Atom core. These views were based on jQuery and `space-pen`. They looked something like this: - -```coffee -# The old way: getting views from atom -{$, TextEditorView, View} = require 'atom' - -module.exports = -class SomeView extends View - @content: -> - @div class: 'find-and-replace', => - @div class: 'block', => - @subview 'myEditor', new TextEditorView(mini: true) - #... -``` - -### The New - -`require 'atom'` no longer provides view helpers or jQuery. Atom core is now 'view agnostic'. The preexisting view system is available from a new npm package: `atom-space-pen-views`. - -`atom-space-pen-views` now provides jQuery, `space-pen` views, and Atom specific views: - - -```coffee -# These are now provided by atom-space-pen-views -$ -$$ -$$$ -View -TextEditorView -ScrollView -SelectListView -``` - -### Adding the module dependencies - -To use the new views, you need to specify the `atom-space-pen-views` module in your package's `package.json` file's dependencies: - -```js -{ - "dependencies": { - "atom-space-pen-views": "^2.0.3" - } -} -``` - -`space-pen` bundles jQuery. If you do not need `space-pen` or any of the views, you can require jQuery directly. - -```js -{ - "dependencies": { - "jquery": "^2" - } -} -``` - -### Converting your views - -Sometimes it is as simple as converting the requires at the top of each view page. I assume you read the 'TL;DR' section and have updated all of your requires. - -### Upgrading classes extending any space-pen View - -#### `afterAttach` and `beforeRemove` updated - -The `afterAttach` and `beforeRemove` hooks have been replaced with -`attached` and `detached` and the semantics have changed. - -`afterAttach` was called whenever the node was attached to another DOM node, even if that parent node wasn't present in the DOM. `afterAttach` also was called with a boolean indicating whether or not the element and its parents were on the DOM. Now the `attached` hook is _only_ called when the node and all of its parents are actually on the DOM, and is not called with a boolean. - -`beforeRemove` was only called when `$.fn.remove` was called, which was typically used when the node was completely removed from the DOM. The new `detached` hook is called whenever the DOM node is _detached_, which could happen if the node is being detached for reattachment later. In short, if `beforeRemove` is called the node is never coming back. With `detached` it might be attached again later. - -```coffee -# Old way -{View} = require 'atom' -class MyView extends View - afterAttach: (onDom) -> - #... - - beforeRemove: -> - #... -``` - -```coffee -# New way -{View} = require 'atom-space-pen-views' -class MyView extends View - attached: -> - # Always called with the equivalent of @afterAttach(true)! - #... - - detached: -> - #... -``` - -#### `subscribe` and `subscribeToCommand` methods removed - -The `subscribe` and `subscribeToCommand` methods have been removed. See the Eventing and Disposables section for more info. - -### Upgrading to the new TextEditorView - -All of the atom-specific methods available on the `TextEditorView` have been moved to the `TextEditor`, available via `TextEditorView::getModel`. See the [`TextEditorView` docs][TextEditorView] and [`TextEditor` docs][TextEditor] for more info. - -### Upgrading classes extending ScrollView - -The `ScrollView` has very minor changes. - -You can no longer use `@off` to remove default behavior for `core:move-up`, `core:move-down`, etc. - -```coffee -# Old way to turn off default behavior -class ResultsView extends ScrollView - initialize: (@model) -> - super() - # turn off default scrolling behavior from ScrollView - @off 'core:move-up' - @off 'core:move-down' - @off 'core:move-left' - @off 'core:move-right' -``` - -```coffee -# New way to turn off default behavior -class ResultsView extends ScrollView - initialize: (@model) -> - disposable = super() - # turn off default scrolling behavior from ScrollView - disposable.dispose() -``` - -* Check out [an example](https://github.com/atom/find-and-replace/pull/311/files#diff-9) from find-and-replace. -* See the [docs][ScrollView] for all the options. - -### Upgrading classes extending SelectListView - -Your SelectListView might look something like this: - -```coffee -# Old! -class CommandPaletteView extends SelectListView - initialize: -> - super() - @addClass('command-palette overlay from-top') - atom.workspaceView.command 'command-palette:toggle', => @toggle() - - confirmed: ({name, jQuery}) -> - @cancel() - # do something with the result - - toggle: -> - if @hasParent() - @cancel() - else - @attach() - - attach: -> - @storeFocusedElement() - - items = [] # TODO: build items - @setItems(items) - - atom.workspaceView.append(this) - @focusFilterEditor() - - confirmed: ({name, jQuery}) -> - @cancel() -``` - -This attaches and detaches itself from the dom when toggled, canceling magically detaches it from the DOM, and it uses the classes `overlay` and `from-top`. - -The new SelectListView no longer automatically detaches itself from the DOM when cancelled. It's up to you to implement whatever cancel beahavior you want. Using the new APIs to mimic the sematics of the old class, it should look like this: - -```coffee -# New! -class CommandPaletteView extends SelectListView - initialize: -> - super() - # no more need for the `overlay` and `from-top` classes - @addClass('command-palette') - atom.commands.add 'atom-workspace', 'command-palette:toggle', => @toggle() - - # You need to implement the `cancelled` method and hide. - cancelled: -> - @hide() - - confirmed: ({name, jQuery}) -> - @cancel() - # do something with the result - - toggle: -> - # Toggling now checks panel visibility, - # and hides / shows rather than attaching to / detaching from the DOM. - if @panel?.isVisible() - @cancel() - else - @show() - - show: -> - # Now you will add your select list as a modal panel to the workspace - @panel ?= atom.workspace.addModalPanel(item: this) - @panel.show() - - @storeFocusedElement() - - items = [] # TODO: build items - @setItems(items) - - @focusFilterEditor() - - hide: -> - @panel?.hide() -``` - -* And check out the [conversion of CommandPaletteView][selectlistview-example] as a real-world example. -* See the [SelectListView docs][SelectListView] for all options. - -## Using the model layer rather than the view layer - -The API no longer exposes any specialized view objects or view classes. `atom.workspaceView`, and all the view classes: `WorkspaceView`, `EditorView`, `PaneView`, etc. have been globally deprecated. - -Nearly all of the atom-specific actions performed by the old view objects can now be managed via the model layer. For example, here's adding a panel to the interface using the `atom.workspace` model instead of the `workspaceView`: - -```coffee -# Old! -div = document.createElement('div') -atom.workspaceView.appendToTop(div) -``` - -```coffee -# New! -div = document.createElement('div') -atom.workspace.addTopPanel(item: div) -``` - -For actions that still require the view, such as dispatching commands or munging css classes, you'll access the view via the `atom.views.getView()` method. This will return a subclass of `HTMLElement` rather than a jQuery object or an instance of a deprecated view class (e.g. `WorkspaceView`). - -```coffee -# Old! -workspaceView = atom.workspaceView -editorView = workspaceView.getActiveEditorView() -paneView = editorView.getPaneView() -``` - -```coffee -# New! -# Generally, just use the models -workspace = atom.workspace -editor = workspace.getActiveTextEditor() -pane = editor.getPane() - -# If you need views, get them with `getView` -workspaceElement = atom.views.getView(atom.workspace) -editorElement = atom.views.getView(editor) -paneElement = atom.views.getView(pane) -``` - -## Updating Specs - -`atom.workspaceView`, the `WorkspaceView` class and the `EditorView` class have been deprecated. These two objects are used heavily throughout specs, mostly to dispatch events and commands. This section will explain how to remove them while still retaining the ability to dispatch events and commands. - -### Removing WorkspaceView references - -`WorkspaceView` has been deprecated. Everything you could do on the view, you can now do on the `Workspace` model. - -Requiring `WorkspaceView` from `atom` and accessing any methods on it will throw a deprecation warning. Many specs lean heavily on `WorkspaceView` to trigger commands and fetch `EditorView` objects. - -Your specs might contain something like this: - -```coffee -# Old! -{WorkspaceView} = require 'atom' -describe 'FindView', -> - beforeEach -> - atom.workspaceView = new WorkspaceView() -``` - -Instead, we will use the `atom.views.getView()` method. This will return a plain `HTMLElement`, not a `WorkspaceView` or jQuery object. - -```coffee -# New! -describe 'FindView', -> - workspaceElement = null - beforeEach -> - workspaceElement = atom.views.getView(atom.workspace) -``` - -### Attaching the workspace to the DOM - -The workspace needs to be attached to the DOM in some cases. For example, view hooks only work (`attached()` on `View`, `attachedCallback()` on custom elements) when there is a descendant attached to the DOM. - -You might see this in your specs: - -```coffee -# Old! -atom.workspaceView.attachToDom() -``` - -Change it to: - -```coffee -# New! -jasmine.attachToDOM(workspaceElement) -``` - -### Removing EditorView references - -Like `WorkspaceView`, `EditorView` has been deprecated. Everything you needed to do on the view you are now able to do on the `TextEditor` model. - -In many cases, you will not even need to get the editor's view anymore. Any of those instances should be updated to use the `TextEditor` instance instead. You should really only need the editor's view when you plan on triggering a command on the view in a spec. - -Your specs might contain something like this: - -```coffee -# Old! -describe 'Something', -> - [editorView] = [] - beforeEach -> - editorView = atom.workspaceView.getActiveView() -``` - -We're going to use `atom.views.getView()` again to get the editor element. As in the case of the `workspaceElement`, `getView` will return a subclass of `HTMLElement` rather than an `EditorView` or jQuery object. - -```coffee -# New! -describe 'Something', -> - [editor, editorElement] = [] - beforeEach -> - editor = atom.workspace.getActiveTextEditor() - editorElement = atom.views.getView(editor) -``` - -### Dispatching commands - -Since the `editorElement` objects are no longer `jQuery` objects, they no longer support `trigger()`. Additionally, Atom has a new command dispatcher, `atom.commands`, that we use rather than commandeering jQuery's `trigger` method. - -From this: - -```coffee -# Old! -workspaceView.trigger 'a-package:toggle' -editorView.trigger 'find-and-replace:show' -``` - -To this: - -```coffee -# New! -atom.commands.dispatch workspaceElement, 'a-package:toggle' -atom.commands.dispatch editorElement, 'find-and-replace:show' -``` - -## Eventing and Disposables - -A couple large things changed with respect to events: - -1. All model events are now exposed as event subscription methods that return [`Disposable`][disposable] objects -1. The `subscribe()` method is no longer available on `space-pen` `View` objects -1. An Emitter is now provided from `require 'atom'` - -### Consuming Events - -All events from the Atom API are now methods that return a [`Disposable`][disposable] object, on which you can call `dispose()` to unsubscribe. - -```coffee -# Old! -editor.on 'changed', -> -``` - -```coffee -# New! -disposable = editor.onDidChange -> - -# You can unsubscribe at some point in the future via `dispose()` -disposable.dispose() -``` - -Deprecation warnings will guide you toward the correct methods. - -#### Using a CompositeDisposable - -You can group multiple disposables into a single disposable with a `CompositeDisposable`. - -```coffee -{CompositeDisposable} = require 'atom' - -class Something - constructor: -> - editor = atom.workspace.getActiveTextEditor() - @disposables = new CompositeDisposable - @disposables.add editor.onDidChange -> - @disposables.add editor.onDidChangePath -> - - destroy: -> - @disposables.dispose() -``` - -### Removing View::subscribe and Subscriber::subscribe calls - -There were a couple permutations of `subscribe()`. In these examples, a `CompositeDisposable` is used as it will commonly be useful where conversion is necessary. - -#### subscribe(unsubscribable) - -This one is very straight forward. - -```coffee -# Old! -@subscribe editor.on 'changed', -> -``` - -```coffee -# New! -disposables = new CompositeDisposable -disposables.add editor.onDidChange -> -``` - -#### subscribe(modelObject, event, method) - -When the modelObject is an Atom model object, the change is very simple. Just use the correct event method, and add it to your CompositeDisposable. - -```coffee -# Old! -@subscribe editor, 'changed', -> -``` - -```coffee -# New! -disposables = new CompositeDisposable -disposables.add editor.onDidChange -> -``` - -#### subscribe(jQueryObject, selector(optional), event, method) - -Things are a little more complicated when subscribing to a DOM or jQuery element. Atom no longer provides helpers for subscribing to elements. You can use jQuery or the native DOM APIs, whichever you prefer. - -```coffee -# Old! -@subscribe $(window), 'focus', -> -``` - -```coffee -# New! -{Disposable, CompositeDisposable} = require 'atom' -disposables = new CompositeDisposable - -# New with jQuery -focusCallback = -> -$(window).on 'focus', focusCallback -disposables.add new Disposable -> - $(window).off 'focus', focusCallback - -# New with native APIs -focusCallback = -> -window.addEventListener 'focus', focusCallback -disposables.add new Disposable -> - window.removeEventListener 'focus', focusCallback -``` - -### Providing Events: Using the Emitter - -You no longer need to require `emissary` to get an emitter. We now provide an `Emitter` class from `require 'atom'`. We have a specific pattern for use of the `Emitter`. Rather than mixing it in, we instantiate a member variable, and create explicit subscription methods. For more information see the [`Emitter` docs][emitter]. - -```coffee -# New! -{Emitter} = require 'atom' - -class Something - constructor: -> - @emitter = new Emitter - - destroy: -> - @emitter.dispose() - - onDidChange: (callback) -> - @emitter.on 'did-change', callback - - methodThatFiresAChange: -> - @emitter.emit 'did-change', {data: 2} - -# Using the evented class -something = new Something -something.onDidChange (eventObject) -> - console.log eventObject.data # => 2 -something.methodThatFiresAChange() -``` - -## Subscribing To Commands - -`$.fn.command` and `View::subscribeToCommand` are no longer available. Now we use `atom.commands.add`, and collect the results in a `CompositeDisposable`. See [the docs][commands-add] for more info. - -```coffee -# Old! -atom.workspaceView.command 'core:close core:cancel', -> - -# When inside a View class, you might see this -@subscribeToCommand 'core:close core:cancel', -> -``` - -```coffee -# New! -@disposables.add atom.commands.add 'atom-workspace', - 'core:close': -> - 'core:cancel': -> - -# You can register commands directly on individual DOM elements in addition to -# using selectors. When in a View class, you should have a `@element` object -# available. `@element` is a plain HTMLElement object -@disposables.add atom.commands.add @element, - 'core:close': -> - 'core:cancel': -> -``` - -## Upgrading your stylesheet's selectors - -Many selectors have changed, and we have introduced the [Shadow DOM][shadowdom] to the editor. See the [Upgrading Your UI Theme And Package Selectors guide][upgrading-selectors] for more information in upgrading your package stylesheets. - -## Help us improve this guide! - -Did you hit something painful that wasn't in here? Want to reword some bit of it? Find something incorrect? Please edit [this file][guide], and send a pull request. Contributions are greatly appreciated. - - - - -[texteditorview]:https://github.com/atom/atom-space-pen-views#texteditorview -[scrollview]:https://github.com/atom/atom-space-pen-views#scrollview -[selectlistview]:https://github.com/atom/atom-space-pen-views#selectlistview -[selectlistview-example]:https://github.com/atom/command-palette/pull/19/files -[emitter]:https://atom.io/docs/api/latest/Emitter -[texteditor]:https://atom.io/docs/api/latest/TextEditor -[disposable]:https://atom.io/docs/api/latest/Disposable -[commands-add]:https://atom.io/docs/api/latest/CommandRegistry#instance-add -[upgrading-selectors]:https://atom.io/docs/latest/upgrading/upgrading-your-ui-theme -[shadowdom]:http://blog.atom.io/2014/11/18/avoiding-style-pollution-with-the-shadow-dom.html -[guide]:https://github.com/atom/atom/blob/master/docs/upgrading/upgrading-your-package.md diff --git a/docs/upgrading/upgrading-your-syntax-theme.md b/docs/upgrading/upgrading-your-syntax-theme.md deleted file mode 100644 index 3a8241ca0..000000000 --- a/docs/upgrading/upgrading-your-syntax-theme.md +++ /dev/null @@ -1,24 +0,0 @@ -# Upgrading Your Syntax Theme - -Text editor content is now rendered in the shadow DOM, which shields it from being styled by global style sheets to protect against accidental style pollution. For more background on the shadow DOM, check out the [Shadow DOM 101][shadow-dom-101] on HTML 5 Rocks. - -Syntax themes are specifically intended to style only text editor content, so they are automatically loaded directly into the text editor's shadow DOM when it is enabled. This happens automatically when the the theme's `package.json` contains a `theme: "syntax"` declaration, so you don't need to change anything to target the appropriate context. - -When theme style sheets are loaded into the text editor's shadow DOM, selectors intended to target the editor from the *outside* no longer make sense. Styles targeting the `.editor` and `.editor-colors` classes instead need to target the `:host` pseudo-element, which matches against the containing `atom-text-editor` node. Check out the [Shadow DOM 201][host-pseudo-element] article for more information about the `:host` pseudo-element. - -Here's an example from Atom's light syntax theme. Note that the `atom-text-editor` selector intended to target the editor from the outside has been retained to allow the theme to keep working during the transition phase when it is possible to disable the shadow DOM. - -```css -atom-text-editor, :host { /* :host added */ - background-color: @syntax-background-color; - color: @syntax-text-color; - - .invisible-character { - color: @syntax-invisible-character-color; - } - /* more nested selectors... */ -} -``` - -[shadow-dom-101]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom -[host-pseudo-element]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201#toc-style-host diff --git a/docs/upgrading/upgrading-your-ui-theme.md b/docs/upgrading/upgrading-your-ui-theme.md deleted file mode 100644 index 5be0344bb..000000000 --- a/docs/upgrading/upgrading-your-ui-theme.md +++ /dev/null @@ -1,137 +0,0 @@ -# Upgrading Your UI Theme Or Package Selectors - -In addition to changes in Atom's scripting API, we'll also be making some breaking changes to Atom's DOM structure, requiring style sheets and keymaps in both packages and themes to be updated. - -## Deprecation Cop - -Deprecation cop will list usages of deprecated selector patterns to guide you. You can access it via the command palette (`cmd-shift-p`, then search for `Deprecation`). It breaks the deprecations down by package: - -![dep-cop](https://cloud.githubusercontent.com/assets/69169/5078860/d38a5df4-6e64-11e4-95b6-eb585ee9bbfc.png) - -## Custom Tags - -Rather than adding classes to standard HTML elements to indicate their role, Atom now uses custom element names. For example, `
` has now been replaced with ``. Selectors should be updated accordingly. Note that tag names have lower specificity than classes in CSS, so you'll need to take care in converting things. - -Old Selector | New Selector ---------------------|-------------------------------- -`.editor` | `atom-text-editor` -`.editor.mini` | `atom-text-editor[mini]` -`.workspace` | `atom-workspace` -`.horizontal` | `atom-workspace-axis.horizontal` -`.vertical` | `atom-workspace-axis.vertical` -`.pane-container` | `atom-pane-container` -`.pane` | `atom-pane` -`.tool-panel` | `atom-panel` -`.panel-top` | `atom-panel.top` -`.panel-bottom` | `atom-panel.bottom` -`.panel-left` | `atom-panel.left` -`.panel-right` | `atom-panel.right` -`.overlay` | `atom-panel.modal` - -## Supporting the Shadow DOM - -Text editor content is now rendered in the shadow DOM, which shields it from being styled by global style sheets to protect against accidental style pollution. For more background on the shadow DOM, check out the [Shadow DOM 101][shadow-dom-101] on HTML 5 Rocks. If you need to style text editor content in a UI theme, you'll need to circumvent this protection for any rules that target the text editor's content. Some examples of the kinds of UI theme styles needing to be updated: - -* Highlight decorations -* Gutter decorations -* Line decorations -* Scrollbar styling -* Anything targeting a child selector of `.editor` - -During a transition phase, it will be possible to enable or disable the text editor's shadow DOM in the settings, so themes will need to be compatible with both approaches. - -### Shadow DOM Selectors - -Chromium provides two tools for bypassing shadow boundaries, the `::shadow` pseudo-element and the `/deep/` combinator. For an in-depth explanation of styling the shadow DOM, see the [Shadow DOM 201][shadow-dom-201] article on HTML 5 Rocks. - -#### ::shadow - -The `::shadow` pseudo-element allows you to bypass a single shadow root. For example, say you want to update a highlight decoration for a linter package. Initially, the style looks as follows: - -```css -// Without shadow DOM support -atom-text-editor .highlight.my-linter { - background: hotpink; -} -``` - -In order for this style to apply with the shadow DOM enabled, you will need to add a second selector with the `::shadow` pseudo-element. You should leave the original selector in place so your theme continues to work with the shadow DOM disabled during the transition period. - -```css -// With shadow DOM support -atom-text-editor .highlight.my-linter, -atom-text-editor::shadow .highlight.my-linter { - background: hotpink; -} -``` - -Check out the [find-and-replace][find-and-replace] package for another example of using `::shadow` to pierce the shadow DOM. - -#### /deep/ - -The `/deep/` combinator overrides *all* shadow boundaries, making it useful for rules you want to apply globally such as scrollbar styling. Here's a snippet containing scrollbar styling for the Atom Dark UI theme before shadow DOM support: - -```css -// Without shadow DOM support -.scrollbars-visible-always { - ::-webkit-scrollbar { - width: 8px; - height: 8px; - } - - ::-webkit-scrollbar-track, - ::-webkit-scrollbar-corner { - background: @scrollbar-background-color; - } - - ::-webkit-scrollbar-thumb { - background: @scrollbar-color; - border-radius: 5px; - box-shadow: 0 0 1px black inset; - } -} -``` - -To style scrollbars even inside of the shadow DOM, each rule needs to be prefixed with `/deep/`. We use `/deep/` instead of `::shadow` because we don't care about the selector of the host element in this case. We just want our styling to apply everywhere. - -```css -// With shadow DOM support using /deep/ -.scrollbars-visible-always { - /deep/ ::-webkit-scrollbar { - width: 8px; - height: 8px; - } - - /deep/ ::-webkit-scrollbar-track, - /deep/ ::-webkit-scrollbar-corner { - background: @scrollbar-background-color; - } - - /deep/ ::-webkit-scrollbar-thumb { - background: @scrollbar-color; - border-radius: 5px; - box-shadow: 0 0 1px black inset; - } -} -``` - -### Context-Targeted Style Sheets - -The selector features discussed above allow you to target shadow DOM content with specific selectors, but Atom also allows you to target a specific shadow DOM context with an entire style sheet. The context into which a style sheet is loaded is based on the file name. If you want to load a style sheet into the editor, name it with the `.atom-text-editor.less` or `.atom-text-editor.css` extensions. - -``` -my-ui-theme/ - styles/ - index.less # loaded globally - index.atom-text-editor.less # loaded in the text editor shadow DOM -``` - -Check out this [style sheet](https://github.com/atom/decoration-example/blob/master/styles/decoration-example.atom-text-editor.less) from the decoration-example package for an example of context-targeting. - -Inside a context-targeted style sheet, there's no need to use the `::shadow` or `/deep/` expressions. If you want to refer to the element containing the shadow root, you can use the `::host` pseudo-element. - -During the transition phase, style sheets targeting the `atom-text-editor` context will *also* be loaded globally. Make sure you update your selectors in a way that maintains compatibility with the shadow DOM being disabled. That means if you use a `::host` pseudo element, you should also include the same style rule matches against `atom-text-editor`. - -[shadow-dom-101]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom -[shadow-dom-201]: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201#toc-style-cat-hat -[find-and-replace]: https://github.com/atom/find-and-replace/blob/95351f261bc384960a69b66bf12eae8002da63f9/styles/find-and-replace.less#L10 diff --git a/docs/writing-specs.md b/docs/writing-specs.md deleted file mode 100644 index 38db57439..000000000 --- a/docs/writing-specs.md +++ /dev/null @@ -1,136 +0,0 @@ -# Writing specs - -Atom uses [Jasmine](http://jasmine.github.io/1.3/introduction.html) as its spec framework. Any new functionality should have specs to guard against regressions. - -## Create a new spec - -[Atom specs](https://github.com/atom/atom/tree/master/spec) and [package specs](https://github.com/atom/markdown-preview/tree/master/spec) are added to their respective `spec` directory. The example below creates a spec for Atom core. - -0. Create a spec file - - Spec files **must** end with `-spec` so add `sample-spec.coffee` to `atom/spec`. - -0. Add one or more `describe` methods - - The `describe` method takes two arguments, a description and a function. If the description explains a behavior it typically begins with `when`; if it is more like a unit test it begins with the method name. - - ```coffee - describe "when a test is written", -> - # contents - ``` - - or - - ```coffee - describe "Editor::moveUp", -> - # contents - ``` - -0. Add one or more `it` method - - The `it` method also takes two arguments, a description and a function. Try and make the description flow with the `it` method. For example, a description of `this should work` doesn't read well as `it this should work`. But a description of `should work` sounds great as `it should work`. - - ```coffee - describe "when a test is written", -> - it "has some expectations that should pass", -> - # Expectations - ``` - -0. Add one or more expectations - - The best way to learn about expectations is to read the [jasmine documentation](http://jasmine.github.io/1.3/introduction.html#section-Expectations) about them. Below is a simple example. - - ```coffee - describe "when a test is written", -> - it "has some expectations that should pass", -> - expect("apples").toEqual("apples") - expect("oranges").not.toEqual("apples") - ``` - -## Asynchronous specs - -Writing Asynchronous specs can be tricky at first. Some examples. - -0. Promises - - Working with promises is rather easy in Atom. You can use our `waitsForPromise` function. - - ```coffee - describe "when we open a file", -> - it "should be opened in an editor", -> - waitsForPromise -> - atom.workspace.open('c.coffee').then (editor) -> - expect(editor.getPath()).toContain 'c.coffee' - ``` - - This method can be used in the `describe`, `it`, `beforeEach` and `afterEach` functions. - - ```coffee - describe "when we open a file", -> - beforeEach -> - waitsForPromise -> - atom.workspace.open 'c.coffee' - - it "should be opened in an editor", -> - expect(atom.workspace.getActiveTextEditor().getPath()).toContain 'c.coffee' - - ``` - - If you need to wait for multiple promises use a new `waitsForPromise` function for each promise. (Caution: Without `beforeEach` this example will fail!) - - ```coffee - describe "waiting for the packages to load", -> - - beforeEach -> - waitsForPromise -> - atom.workspace.open('sample.js') - waitsForPromise -> - atom.packages.activatePackage('tabs') - waitsForPromise -> - atom.packages.activatePackage('tree-view') - - it 'should have waited long enough', -> - expect(atom.packages.isPackageActive('tabs')).toBe true - expect(atom.packages.isPackageActive('tree-view')).toBe true - ``` - -0. Asynchronous functions with callbacks - - Specs for asynchronous functions can be done using the `waitsFor` and `runs` functions. A simple example. - - ```coffee - describe "fs.readdir(path, cb)", -> - it "is async", -> - spy = jasmine.createSpy('fs.readdirSpy') - - fs.readdir('/tmp/example', spy) - waitsFor -> - spy.callCount > 0 - runs -> - exp = [null, ['example.coffee']] - expect(spy.mostRecentCall.args).toEqual exp - expect(spy).toHaveBeenCalledWith(null, ['example.coffee']) - ``` - -For a more detailed documentation on asynchronous tests please visit the [jasmine documentation](http://jasmine.github.io/1.3/introduction.html#section-Asynchronous_Support). - - -## Running specs - -Most of the time you'll want to run specs by triggering the `window:run-package-specs` command. This command is not only to run package specs, it is also for Atom core specs. This will run all the specs in the current project's spec directory. If you want to run the Atom core specs and **all** the default package specs trigger the `window:run-all-specs` command. - -To run a limited subset of specs use the `fdescribe` or `fit` methods. You can use those to focus a single spec or several specs. In the example above, focusing an individual spec looks like this: - -```coffee -describe "when a test is written", -> - fit "has some expectations that should pass", -> - expect("apples").toEqual("apples") - expect("oranges").not.toEqual("apples") -``` - -### Running on CI - -It is now easy to run the specs in a CI environment like Travis and AppVeyor. See the -[Travis CI For Your Packages](http://blog.atom.io/2014/04/25/ci-for-your-packages.html) -and [AppVeyor CI For Your Packages](http://blog.atom.io/2014/07/28/windows-ci-for-your-packages.html) -posts for more details. diff --git a/docs/your-first-package.md b/docs/your-first-package.md deleted file mode 100644 index 42aca7c31..000000000 --- a/docs/your-first-package.md +++ /dev/null @@ -1,158 +0,0 @@ -# Create Your First Package - -This tutorial will guide you though creating a simple command that replaces the -selected text with [ascii art](https://en.wikipedia.org/wiki/ASCII_art). When you -run our new command with the word "cool" selected, it will be replaced with: - -``` - ___ - /\_ \ - ___ ___ ___\//\ \ - /'___\ / __`\ / __`\\ \ \ -/\ \__//\ \L\ \/\ \L\ \\_\ \_ -\ \____\ \____/\ \____//\____\ - \/____/\/___/ \/___/ \/____/ -``` - -The final package can be viewed at -[https://github.com/atom/ascii-art](https://github.com/atom/ascii-art). - -To begin, press `cmd-shift-P` to bring up the [Command -Palette](https://github.com/atom/command-palette). Type "generate package" and -select the "Package Generator: Generate Package" command. Now we need to name -the package. Try to avoid naming your package with the *atom-* prefix, for -example we are going to call this package _ascii-art_. - -Atom will open a new window with the contents of our new _ascii-art_ package -displayed in the Tree View. Because this window is opened **after** the package -is created, the ASCII Art package will be loaded and available in our new -window. To verify this, toggle the Command Palette (`cmd-shift-P`) and type -"ASCII Art". You'll see a new `ASCII Art: Toggle` command. When triggered, this -command displays a default message. - -Now let's edit the package files to make our ASCII Art package do something -interesting. Since this package doesn't need any UI, we can remove all -view-related code. Start by opening up _lib/ascii-art.coffee_. Remove all view -code, so the `module.exports` section looks like this: - -```coffeescript -module.exports = - activate: -> -``` - -## Create a Command - -Now let's add a command. We recommend that you namespace your commands with the -package name followed by a `:`, so we'll call our command `ascii-art:convert`. -Register the command in _lib/ascii-art.coffee_: - -```coffeescript -module.exports = - activate: -> - atom.commands.add 'atom-workspace', "ascii-art:convert", => @convert() - - convert: -> - # This assumes the active pane item is an editor - editor = atom.workspace.getActivePaneItem() - editor.insertText('Hello, World!') -``` - -The `atom.commands.add` method takes a selector, command name, and a callback. -The callback executes when the command is triggered on an element matching the -selector. In this case, when the command is triggered the callback will call the -`convert` method and insert 'Hello, World!'. - -## Reload the Package - -Before we can trigger `ascii-art:convert`, we need to load the latest code for -our package by reloading the window. Run the command `window:reload` from the -command palette or by pressing `ctrl-alt-cmd-l`. - -## Trigger the Command - -Now open the command panel and search for the `ascii-art:convert` command. But -it's not there! To fix this, open _package.json_ and find the property called -`activationCommands`. Activation Commands speed up Atom's load time by allowing it to -delay a package's activation until it's needed. So remove the existing command -and add `ascii-art:convert` to the `activationCommands` array: - -```json -"activationCommands": ["ascii-art:convert"], -``` - -First, reload the window by running the command `window:reload`. Now when you -run the `ascii-art:convert` command it will output 'Hello, World!' - -## Add a Key Binding - -Now let's add a key binding to trigger the `ascii-art:convert` command. Open -_keymaps/ascii-art.cson_ and add a key binding linking `ctrl-alt-a` to the -`ascii-art:convert` command. You can delete the pre-existing key binding since -you don't need it anymore. When finished, the file will have this: - -```coffeescript -'atom-text-editor': - 'ctrl-alt-a': 'ascii-art:convert' -``` - -Notice `atom-text-editor` on the first line. Just like CSS, keymap selectors -*scope* key bindings so they only apply to specific elements. In this case, our -binding is only active for elements matching the `atom-text-editor` selector. If -the Tree View has focus, pressing `ctrl-alt-a` won't trigger the -`ascii-art:convert` command. But if the editor has focus, the -`ascii-art:convert` method *will* be triggered. More information on key bindings -can be found in the [keymaps](advanced/keymaps.html) documentation. - -Now reload the window and verify that the key binding works! You can also verify -that it **doesn't** work when the Tree View is focused. - -## Add the ASCII Art - -Now we need to convert the selected text to ASCII art. To do this we will use -the [figlet](https://npmjs.org/package/figlet) [node](http://nodejs.org/) module -from [npm](https://npmjs.org/). Open _package.json_ and add the latest version of -figlet to the dependencies: - -```json -"dependencies": { - "figlet": "1.0.8" -} -``` - -After saving the file, run the command 'update-package-dependencies:update' from -the Command Palette. This will install the package's node module dependencies, -only figlet in this case. You will need to run -'update-package-dependencies:update' whenever you update the dependencies field -in your _package.json_ file. - -Now require the figlet node module in _lib/ascii-art.coffee_ and instead of -inserting 'Hello, World!' convert the selected text to ASCII art. - -```coffeescript -convert: -> - # This assumes the active pane item is an editor - editor = atom.workspace.getActivePaneItem() - selection = editor.getLastSelection() - - figlet = require 'figlet' - figlet selection.getText(), {font: "Larry 3D 2"}, (error, asciiArt) -> - if error - console.error(error) - else - selection.insertText("\n#{asciiArt}\n") -``` - -Select some text in an editor window and hit `ctrl-alt-a`. :tada: You're now an -ASCII art professional! - -## Further reading - -* [Getting your project on GitHub guide](http://guides.github.com/overviews/desktop) - -* [Writing specs](writing-specs.md) for your package - -* [Creating a package guide](creating-a-package.html) for more information - on the mechanics of packages - -* [Publishing a package guide](publishing-a-package.html) for more information - on publishing your package to [atom.io](https://atom.io) From b6eec80c9f421b5280efb5ad60abb180f6fc8213 Mon Sep 17 00:00:00 2001 From: Alex Mayer Date: Fri, 16 Jan 2015 12:13:08 -0500 Subject: [PATCH 002/521] Add ._* to ignored file names Macs generate ._ files when saving to a filesystem other then HFS In shared environments this is a big problem --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 1796bb64c..078d7a40b 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -9,7 +9,7 @@ module.exports = properties: ignoredNames: type: 'array' - default: [".git", ".hg", ".svn", ".DS_Store", "Thumbs.db"] + default: [".git", ".hg", ".svn", ".DS_Store", "._*", "Thumbs.db"] items: type: 'string' excludeVcsIgnoredPaths: From 2aa3e5fd8c98a0ef5da13ffa58f355a3fcc882a6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 5 Mar 2015 09:01:28 +0100 Subject: [PATCH 003/521] :racehorse: Speed up `destroyFoldsIntersectingBufferRange` --- src/text-editor.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index b44b6e276..44389db17 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2776,8 +2776,11 @@ class TextEditor extends Model # Remove any {Fold}s found that intersect the given buffer row. destroyFoldsIntersectingBufferRange: (bufferRange) -> - for row in [bufferRange.start.row..bufferRange.end.row] - @unfoldBufferRow(row) + @unfoldBufferRow(bufferRange.start.row) + @unfoldBufferRow(bufferRange.end.row) + + for row in [bufferRange.end.row..bufferRange.start.row] + fold.destroy() for fold in @displayBuffer.foldsStartingAtBufferRow(row) # {Delegates to: DisplayBuffer.largestFoldContainingBufferRow} largestFoldContainingBufferRow: (bufferRow) -> From a6e8f8a08aebcdf968282faf2af8a4c47d7747b2 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 5 Mar 2015 15:05:36 -0800 Subject: [PATCH 004/521] Always open all CLI paths in the same window No more 'atom --multi-folder' --- spec/integration/startup-spec.coffee | 27 +-------------------------- src/browser/atom-application.coffee | 7 +------ src/browser/main.coffee | 4 +--- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/spec/integration/startup-spec.coffee b/spec/integration/startup-spec.coffee index f3253b81e..e0df3ad9b 100644 --- a/spec/integration/startup-spec.coffee +++ b/spec/integration/startup-spec.coffee @@ -87,7 +87,7 @@ describe "Starting Atom", -> nestedDir = path.join(otherTempDirPath, "nested-dir") fs.mkdirSync(nestedDir) - runAtom [tempDirPath, otherTempDirPath, "--multi-folder"], {ATOM_HOME: AtomHome}, (client) -> + runAtom [tempDirPath, otherTempDirPath], {ATOM_HOME: AtomHome}, (client) -> client .waitForExist("atom-workspace", 5000) .treeViewRootDirectories() @@ -100,31 +100,6 @@ describe "Starting Atom", -> .treeViewRootDirectories() .then ({value}) -> expect(value).toEqual([tempDirPath, otherTempDirPath]) - it "opens each path in its own window unless the --multi-folder flag is passed", -> - runAtom [tempDirPath, otherTempDirPath], {ATOM_HOME: AtomHome}, (client) -> - treeViewDirs = [] - - client - .waitForExist("atom-workspace", 5000) - .waitForWindowCount(2, 10000) - .then ({value: windowHandles}) -> - - @window(windowHandles[0]) - .waitForExist("atom-workspace") - .treeViewRootDirectories() - .then ({value}) -> - expect(value).toHaveLength(1) - treeViewDirs.push(value[0]) - - .window(windowHandles[1]) - .waitForExist("atom-workspace") - .treeViewRootDirectories() - .then ({value}) -> - expect(value).toHaveLength(1) - treeViewDirs.push(value[0]) - .then -> - expect(treeViewDirs.sort()).toEqual([tempDirPath, otherTempDirPath].sort()) - describe "when there is an existing window with no project path", -> describe "opening a directory", -> it "opens the directory in the existing window", -> diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 7324aa460..1ecbe9570 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -60,7 +60,7 @@ class AtomApplication exit: (status) -> app.exit(status) constructor: (options) -> - {@resourcePath, @version, @devMode, @safeMode, @socketPath, @enableMultiFolderProject} = options + {@resourcePath, @version, @devMode, @safeMode, @socketPath} = options # Normalize to make sure drive letter case is consistent on Windows @resourcePath = path.normalize(@resourcePath) if @resourcePath @@ -348,11 +348,6 @@ class AtomApplication # :windowDimensions - Object with height and width keys. # :window - {AtomWindow} to open file paths in. openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, window}={}) -> - if pathsToOpen?.length > 1 and not @enableMultiFolderProject - for pathToOpen in pathsToOpen - @openPath({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, window}) - return - pathsToOpen = (fs.normalize(pathToOpen) for pathToOpen in pathsToOpen) locationsToOpen = (@locationForPathToOpen(pathToOpen) for pathToOpen in pathsToOpen) diff --git a/src/browser/main.coffee b/src/browser/main.coffee index b73556307..09db16357 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -118,7 +118,6 @@ parseCommandLine = -> options.alias('v', 'version').boolean('v').describe('v', 'Print the version.') options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.') options.string('socket-path') - options.boolean('multi-folder') args = options.argv if args.help @@ -140,7 +139,6 @@ parseCommandLine = -> pidToKillWhenClosed = args['pid'] if args['wait'] logFile = args['log-file'] socketPath = args['socket-path'] - enableMultiFolderProject = args['multi-folder'] if args['resource-path'] devMode = true @@ -166,6 +164,6 @@ parseCommandLine = -> process.env.PATH = args['path-environment'] if args['path-environment'] {resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, - devMode, safeMode, newWindow, specDirectory, logFile, socketPath, enableMultiFolderProject} + devMode, safeMode, newWindow, specDirectory, logFile, socketPath} start() From 2e23dd9553e14c20b22d56660ed05c60b80d79d4 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Sun, 8 Mar 2015 09:31:13 +1100 Subject: [PATCH 005/521] windows build: `$env:GYP_MSVS_VERSION=2013` might still be required closes https://github.com/atom/atom/issues/5888 --- docs/build-instructions/windows.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index fddb941c7..3f8c27660 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -78,6 +78,7 @@ If none of this works, do install Github for Windows and use its Git shell. Make ``` $env:GYP_MSVS_VERSION=2013 ``` + * If you are using Visual Studio 2013 and the build fails with some other error message this environment variable might still be required. * Other `node-gyp` errors on first build attempt, even though the right node and python versions are installed. * Do try the build command one more time, as experience shows it often works on second try in many of these cases. From 722089be4531300e991b92bd384fc31d7ed44579 Mon Sep 17 00:00:00 2001 From: basarat Date: Sun, 8 Mar 2015 14:49:22 +1100 Subject: [PATCH 006/521] feat(typescript) initial commit of built in typescript support --- package.json | 1 + src/typescript-transpile.js | 152 ++++++++++++++++++++++++++++++++++++ src/typescript.coffee | 141 +++++++++++++++++++++++++++++++++ static/index.js | 7 ++ 4 files changed, 301 insertions(+) create mode 100644 src/typescript-transpile.js create mode 100644 src/typescript.coffee diff --git a/package.json b/package.json index 2ec0091a3..60f96cb34 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "temp": "0.8.1", "text-buffer": "^4.1.5", "theorist": "^1.0.2", + "typescript": "^1.4.1", "underscore-plus": "^1.6.6" }, "packageDependencies": { diff --git a/src/typescript-transpile.js b/src/typescript-transpile.js new file mode 100644 index 000000000..64d832d1c --- /dev/null +++ b/src/typescript-transpile.js @@ -0,0 +1,152 @@ +// From https://github.com/teppeis/typescript-simple/blob/master/index.js +// with https://github.com/teppeis/typescript-simple/pull/7 + +var fs = require('fs'); +var os = require('os'); +var path = require('path'); +var ts = require('typescript'); +var FILENAME_TS = 'file.ts'; +function tss(code, options) { + if (options) { + return new tss.TypeScriptSimple(options).compile(code); + } + else { + return defaultTss.compile(code); + } +} +var tss; +(function (tss) { + var TypeScriptSimple = (function () { + /** + * @param {ts.CompilerOptions=} options TypeScript compile options (some options are ignored) + */ + function TypeScriptSimple(options, doSemanticChecks) { + if (options === void 0) { options = {}; } + if (doSemanticChecks === void 0) { doSemanticChecks = true; } + this.doSemanticChecks = doSemanticChecks; + this.service = null; + this.outputs = {}; + this.files = {}; + if (options.target == null) { + options.target = ts.ScriptTarget.ES5; + } + if (options.module == null) { + options.module = ts.ModuleKind.None; + } + this.options = options; + } + /** + * @param {string} code TypeScript source code to compile + * @param {string} only needed if you plan to use sourceMaps. Provide the complete filePath relevant to you + * @return {string} The JavaScript with inline sourceMaps if sourceMaps were enabled + */ + TypeScriptSimple.prototype.compile = function (code, filename) { + if (filename === void 0) { filename = FILENAME_TS; } + if (!this.service) { + this.service = this.createService(); + } + var file = this.files[FILENAME_TS]; + file.text = code; + file.version++; + return this.toJavaScript(this.service, filename); + }; + TypeScriptSimple.prototype.createService = function () { + var _this = this; + var defaultLib = this.getDefaultLibFilename(this.options); + var defaultLibPath = path.join(this.getTypeScriptBinDir(), defaultLib); + this.files[defaultLib] = { version: 0, text: fs.readFileSync(defaultLibPath).toString() }; + this.files[FILENAME_TS] = { version: 0, text: '' }; + var servicesHost = { + getScriptFileNames: function () { return [_this.getDefaultLibFilename(_this.options), FILENAME_TS]; }, + getScriptVersion: function (filename) { return _this.files[filename] && _this.files[filename].version.toString(); }, + getScriptSnapshot: function (filename) { + var file = _this.files[filename]; + return { + getText: function (start, end) { return file.text.substring(start, end); }, + getLength: function () { return file.text.length; }, + getLineStartPositions: function () { return []; }, + getChangeRange: function (oldSnapshot) { return undefined; } + }; + }, + getCurrentDirectory: function () { return process.cwd(); }, + getScriptIsOpen: function () { return true; }, + getCompilationSettings: function () { return _this.options; }, + getDefaultLibFilename: function (options) { + return _this.getDefaultLibFilename(options); + }, + log: function (message) { return console.log(message); } + }; + return ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); + }; + TypeScriptSimple.prototype.getTypeScriptBinDir = function () { + return path.dirname(require.resolve('typescript')); + }; + TypeScriptSimple.prototype.getDefaultLibFilename = function (options) { + if (options.target === ts.ScriptTarget.ES6) { + return 'lib.es6.d.ts'; + } + else { + return 'lib.d.ts'; + } + }; + /** + * converts {"version":3,"file":"file.js","sourceRoot":"","sources":["file.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,MAAM,CAAC"} + * to {"version":3,"sources":["foo/test.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,MAAM,CAAC","file":"foo/test.ts","sourcesContent":["var x = 'test';"]} + * derived from : https://github.com/thlorenz/convert-source-map + */ + TypeScriptSimple.prototype.getInlineSourceMap = function (mapText, filename) { + var sourceMap = JSON.parse(mapText); + sourceMap.file = filename; + sourceMap.sources = [filename]; + sourceMap.sourcesContent = [this.files[FILENAME_TS].text]; + delete sourceMap.sourceRoot; + return JSON.stringify(sourceMap); + }; + TypeScriptSimple.prototype.toJavaScript = function (service, filename) { + if (filename === void 0) { filename = FILENAME_TS; } + var output = service.getEmitOutput(FILENAME_TS); + // Meaning of succeeded is driven by whether we need to check for semantic errors or not + var succeeded = output.emitOutputStatus === ts.EmitReturnStatus.Succeeded; + if (!this.doSemanticChecks) { + // We have an output. It implies syntactic success + if (!succeeded) + succeeded = !!output.outputFiles.length; + } + if (succeeded) { + var outputFilename = FILENAME_TS.replace(/ts$/, 'js'); + var file = output.outputFiles.filter(function (file) { return file.name === outputFilename; })[0]; + // Fixed in v1.5 https://github.com/Microsoft/TypeScript/issues/1653 + var text = file.text.replace(/\r\n/g, os.EOL); + // If we have sourceMaps convert them to inline sourceMaps + if (this.options.sourceMap) { + var sourceMapFilename = FILENAME_TS.replace(/ts$/, 'js.map'); + var sourceMapFile = output.outputFiles.filter(function (file) { return file.name === sourceMapFilename; })[0]; + // Transform sourcemap + var sourceMapText = sourceMapFile.text; + sourceMapText = this.getInlineSourceMap(sourceMapText, filename); + var base64SourceMapText = new Buffer(sourceMapText).toString('base64'); + text = text.replace('//# sourceMappingURL=' + sourceMapFilename, '//# sourceMappingURL=data:application/json;base64,' + base64SourceMapText); + } + return text; + } + var allDiagnostics = service.getCompilerOptionsDiagnostics().concat(service.getSyntacticDiagnostics(FILENAME_TS)); + if (this.doSemanticChecks) + allDiagnostics = allDiagnostics.concat(service.getSemanticDiagnostics(FILENAME_TS)); + throw new Error(this.formatDiagnostics(allDiagnostics)); + }; + TypeScriptSimple.prototype.formatDiagnostics = function (diagnostics) { + return diagnostics.map(function (d) { + if (d.file) { + return 'L' + d.file.getLineAndCharacterFromPosition(d.start).line + ': ' + d.messageText; + } + else { + return d.messageText; + } + }).join(os.EOL); + }; + return TypeScriptSimple; + })(); + tss.TypeScriptSimple = TypeScriptSimple; +})(tss || (tss = {})); +var defaultTss = new tss.TypeScriptSimple(); +module.exports = tss; diff --git a/src/typescript.coffee b/src/typescript.coffee new file mode 100644 index 000000000..e47e7b2a1 --- /dev/null +++ b/src/typescript.coffee @@ -0,0 +1,141 @@ +### +Cache for source code transpiled by TypeScript. + +Inspired by https://github.com/atom/atom/blob/7a719d585db96ff7d2977db9067e1d9d4d0adf1a/src/babel.coffee +### + +crypto = require 'crypto' +fs = require 'fs-plus' +path = require 'path' +tss = null # Defer until used + +stats = + hits: 0 + misses: 0 + +defaultOptions = + target: 1 + module: 'commonjs' + sourceMap: true + +### +shasum - Hash with an update() method. +value - Must be a value that could be returned by JSON.parse(). +### +updateDigestForJsonValue = (shasum, value) -> + # Implmentation is similar to that of pretty-printing a JSON object, except: + # * Strings are not escaped. + # * No effort is made to avoid trailing commas. + # These shortcuts should not affect the correctness of this function. + type = typeof value + if type is 'string' + shasum.update('"', 'utf8') + shasum.update(value, 'utf8') + shasum.update('"', 'utf8') + else if type in ['boolean', 'number'] + shasum.update(value.toString(), 'utf8') + else if value is null + shasum.update('null', 'utf8') + else if Array.isArray value + shasum.update('[', 'utf8') + for item in value + updateDigestForJsonValue(shasum, item) + shasum.update(',', 'utf8') + shasum.update(']', 'utf8') + else + # value must be an object: be sure to sort the keys. + keys = Object.keys value + keys.sort() + + shasum.update('{', 'utf8') + for key in keys + updateDigestForJsonValue(shasum, key) + shasum.update(': ', 'utf8') + updateDigestForJsonValue(shasum, value[key]) + shasum.update(',', 'utf8') + shasum.update('}', 'utf8') + +createTypeScriptVersionAndOptionsDigest = (version, options) -> + shasum = crypto.createHash('sha1') + # Include the version of typescript in the hash. + shasum.update('typescript', 'utf8') + shasum.update('\0', 'utf8') + shasum.update(version, 'utf8') + shasum.update('\0', 'utf8') + updateDigestForJsonValue(shasum, options) + shasum.digest('hex') + +cacheDir = null +jsCacheDir = null + +getCachePath = (sourceCode) -> + digest = crypto.createHash('sha1').update(sourceCode, 'utf8').digest('hex') + + unless jsCacheDir? + tsVersion = require('typescript/package.json').version + jsCacheDir = path.join(cacheDir, createTypeScriptVersionAndOptionsDigest(tsVersion, defaultOptions)) + + path.join(jsCacheDir, "#{digest}.js") + +getCachedJavaScript = (cachePath) -> + if fs.isFileSync(cachePath) + try + cachedJavaScript = fs.readFileSync(cachePath, 'utf8') + stats.hits++ + return cachedJavaScript + null + +# Returns the TypeScript options that should be used to transpile filePath. +createOptions = (filePath) -> + options = filename: filePath + for key, value of defaultOptions + options[key] = value + options + +transpile = (sourceCode, filePath, cachePath) -> + options = createOptions(filePath) + tss ?= new (require './typescript-transpile').TypeScriptSimple(options, false) + js = tss.compile(sourceCode, filePath) + stats.misses++ + + try + fs.writeFileSync(cachePath, js) + + js + +# Function that obeys the contract of an entry in the require.extensions map. +# Returns the transpiled version of the JavaScript code at filePath, which is +# either generated on the fly or pulled from cache. +loadFile = (module, filePath) -> + sourceCode = fs.readFileSync(filePath, 'utf8') + cachePath = getCachePath(sourceCode) + js = getCachedJavaScript(cachePath) ? transpile(sourceCode, filePath, cachePath) + module._compile(js, filePath) + +register = -> + Object.defineProperty(require.extensions, '.ts', { + enumerable: true + writable: false + value: loadFile + }) + +setCacheDirectory = (newCacheDir) -> + if cacheDir isnt newCacheDir + cacheDir = newCacheDir + jsCacheDir = null + +module.exports = + register: register + setCacheDirectory: setCacheDirectory + getCacheMisses: -> stats.misses + getCacheHits: -> stats.hits + + # Visible for testing. + createTypeScriptVersionAndOptionsDigest: createTypeScriptVersionAndOptionsDigest + + addPathToCache: (filePath) -> + return if path.extname(filePath) isnt '.ts' + + sourceCode = fs.readFileSync(filePath, 'utf8') + cachePath = getCachePath(sourceCode) + transpile(sourceCode, filePath, cachePath) diff --git a/static/index.js b/static/index.js index e8142a698..d99a9e9e7 100644 --- a/static/index.js +++ b/static/index.js @@ -47,6 +47,7 @@ window.onload = function() { setupCsonCache(cacheDir); setupSourceMapCache(cacheDir); setupBabel(cacheDir); + setupTypeScript(cacheDir); require(loadSettings.bootstrapScript); require('ipc').sendChannel('window-command', 'window:loaded'); @@ -95,6 +96,12 @@ var setupBabel = function(cacheDir) { babel.register(); } +var setupTypeScript = function(cacheDir) { + var typescript = require('../src/typescript'); + typescript.setCacheDirectory(path.join(cacheDir, 'typescript')); + typescript.register(); +} + var setupCsonCache = function(cacheDir) { require('season').setCacheDir(path.join(cacheDir, 'cson')); } From 0940c9216f4c95099cf6612d6dca5b7279b5e7dd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 9 Mar 2015 09:11:39 +0100 Subject: [PATCH 007/521] Update also @startRow and @endRow on `getState` --- src/text-editor-presenter.coffee | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 70eef98a9..ebcc5a5ca 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -61,6 +61,7 @@ class TextEditorPresenter @[flagName] = true else fn.apply(this) + @[flagName] = false @emitDidUpdateState() @@ -69,6 +70,11 @@ class TextEditorPresenter getState: -> @updating = true + @updateContentDimensions() + @updateScrollbarDimensions() + @updateStartRow() + @updateEndRow() + @updateFocusedState() if @shouldUpdateFocusedState @updateHeightState() if @shouldUpdateHeightState @updateVerticalScrollState() if @shouldUpdateVerticalScrollState @@ -83,20 +89,6 @@ class TextEditorPresenter @updateGutterState() if @shouldUpdateGutterState @updateLineNumbersState() if @shouldUpdateLineNumbersState - @shouldUpdateFocusedState = false - @shouldUpdateHeightState = false - @shouldUpdateVerticalScrollState = false - @shouldUpdateHorizontalScrollState = false - @shouldUpdateScrollbarsState = false - @shouldUpdateHiddenInputState = false - @shouldUpdateContentState = false - @shouldUpdateDecorations = false - @shouldUpdateLinesState = false - @shouldUpdateCursorsState = false - @shouldUpdateOverlaysState = false - @shouldUpdateGutterState = false - @shouldUpdateLineNumbersState = false - @updating = false @state From 8c297ba1fce64b8b824bdc8cf7b060c36513604e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 9 Mar 2015 13:43:33 +0100 Subject: [PATCH 008/521] :white_check_mark: Verify corrupted state graceful handling --- spec/text-editor-component-spec.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 548c88105..f5c9e7677 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -56,6 +56,17 @@ describe "TextEditorComponent", -> afterEach -> contentNode.style.width = '' + describe "async updates", -> + it "handles corrupted state gracefully", -> + # trigger state updates, e.g. presenter.updateLinesState + editor.insertNewline() + + # simulate state corruption + component.presenter.startRow = -1 + component.presenter.endRow = 9999 + + expect(nextAnimationFrame).not.toThrow() + describe "line rendering", -> it "renders the currently-visible lines plus the overdraw margin", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' From e476a9a171cab4def51abd0c5ef7bec1f891973b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 9 Mar 2015 09:28:47 -0700 Subject: [PATCH 009/521] :arrow_up: language-javascript@0.61 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ec0091a3..ffbf11eb1 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "language-html": "0.29.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.60.0", + "language-javascript": "0.61.0", "language-json": "0.12.0", "language-less": "0.25.0", "language-make": "0.13.0", From d68ea563c4c958867539f1a50b26d0284ec0fed8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 9 Mar 2015 09:57:20 -0700 Subject: [PATCH 010/521] :arrow_up: language-sass@0.36 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ffbf11eb1..d09c09e7d 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "language-python": "0.32.0", "language-ruby": "0.49.0", "language-ruby-on-rails": "0.20.0", - "language-sass": "0.35.0", + "language-sass": "0.36.0", "language-shellscript": "0.12.0", "language-source": "0.9.0", "language-sql": "0.14.0", From 537f5e0d6f3b83a47bf4ce7f307781850ca36064 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 9 Mar 2015 13:55:51 -0700 Subject: [PATCH 011/521] Add feedback package to main distribution --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d09c09e7d..dc8c8216b 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "dev-live-reload": "0.42.0", "encoding-selector": "0.18.0", "exception-reporting": "0.24.0", + "feedback": "0.34.0", "find-and-replace": "0.159.0", "fuzzy-finder": "0.70.0", "git-diff": "0.54.0", From b05a36d9f0667d68d06fc02fff1620deed9bbb0a Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 9 Mar 2015 17:20:43 -0700 Subject: [PATCH 012/521] Prepare 0.188.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dc8c8216b..60d6fe26f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.187.0", + "version": "0.188.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 7e9633a2519d65d83002c9ca39df0997626633a6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 10 Mar 2015 13:15:40 -0700 Subject: [PATCH 013/521] :arrow_up: language-javascript@0.62 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 60d6fe26f..1cfac41d4 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "language-html": "0.29.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.61.0", + "language-javascript": "0.62.0", "language-json": "0.12.0", "language-less": "0.25.0", "language-make": "0.13.0", From 914c41125a0f9f4a30fda78749521f77dd923653 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 10 Mar 2015 13:25:36 -0700 Subject: [PATCH 014/521] :arrow_up: language-shellscript@0.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1cfac41d4..615d748fc 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "language-ruby": "0.49.0", "language-ruby-on-rails": "0.20.0", "language-sass": "0.36.0", - "language-shellscript": "0.12.0", + "language-shellscript": "0.13.0", "language-source": "0.9.0", "language-sql": "0.14.0", "language-text": "0.6.0", From 200b72d2b64b94ca166604e043071773a2e5bf0f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 10 Mar 2015 13:29:35 -0700 Subject: [PATCH 015/521] :arrow_up: language-make@0.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 615d748fc..07b11f368 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "language-javascript": "0.62.0", "language-json": "0.12.0", "language-less": "0.25.0", - "language-make": "0.13.0", + "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", "language-perl": "0.13.0", From 0ec67e3ab6b8e2fcd21abee48eeea2b3723cb931 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 10 Mar 2015 13:37:46 -0700 Subject: [PATCH 016/521] :arrow_up: versions for pkgs using status-bar service api inc-pkgs bumped up 2 because of publish error --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 07b11f368..a36d6c3b9 100644 --- a/package.json +++ b/package.json @@ -91,16 +91,16 @@ "command-palette": "0.34.0", "deprecation-cop": "0.37.0", "dev-live-reload": "0.42.0", - "encoding-selector": "0.18.0", + "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", "feedback": "0.34.0", "find-and-replace": "0.159.0", "fuzzy-finder": "0.70.0", "git-diff": "0.54.0", "go-to-line": "0.30.0", - "grammar-selector": "0.45.0", + "grammar-selector": "0.46.0", "image-view": "0.49.0", - "incompatible-packages": "0.22.0", + "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", "markdown-preview": "0.139.0", @@ -108,7 +108,7 @@ "notifications": "0.31.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", - "release-notes": "0.51.0", + "release-notes": "0.52.0", "settings-view": "0.184.0", "snippets": "0.80.0", "spell-check": "0.55.0", From ac91c2341ea5a599d54283aa3af6e86ef8cdab3b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 10 Mar 2015 14:30:20 -0700 Subject: [PATCH 017/521] :arrow_up: fuzzy-finder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 07b11f368..c39889225 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "exception-reporting": "0.24.0", "feedback": "0.34.0", "find-and-replace": "0.159.0", - "fuzzy-finder": "0.70.0", + "fuzzy-finder": "0.71.0", "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.45.0", From 589d3f24ac7c3fcd05e71de0a07817627b0fe9c3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 10 Mar 2015 17:02:11 -0700 Subject: [PATCH 018/521] :arrow_up: language-perl@0.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec4354805..cb96983d7 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.13.0", + "language-perl": "0.14.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From 8db12c9aa0811493ca9005d0b2fed9303108ab7c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 10 Mar 2015 22:34:21 -0700 Subject: [PATCH 019/521] :arrow_up: fuzzy-finder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb96983d7..c6b2c0f9b 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "exception-reporting": "0.24.0", "feedback": "0.34.0", "find-and-replace": "0.159.0", - "fuzzy-finder": "0.71.0", + "fuzzy-finder": "0.72.0", "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", From 2b981922763170fcbbea5fd30c1797a5beba7638 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 11 Mar 2015 16:16:45 +0100 Subject: [PATCH 020/521] Destroy only containing folds on selection --- spec/text-editor-spec.coffee | 9 ++++++--- src/selection.coffee | 5 ++--- src/text-editor.coffee | 9 ++++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index c03990bf2..a7ff07df3 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1505,9 +1505,12 @@ describe "TextEditor", -> editor.setSelectedScreenRanges([[[6, 2], [6, 4]]]) expect(editor.getSelectedScreenRanges()).toEqual [[[6, 2], [6, 4]]] - it "merges intersecting selections and unfolds the fold", -> - editor.setSelectedScreenRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]]) - expect(editor.getSelectedScreenRanges()).toEqual [[[2, 2], [8, 5]]] + it "merges intersecting selections and unfolds the fold which contain them", -> + editor.foldBufferRow(0) + + # Use buffer ranges because only the first line is on screen + editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]]) + expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 5]]] it "recyles existing selection instances", -> selection = editor.getLastSelection() diff --git a/src/selection.coffee b/src/selection.coffee index 1ecd35157..2f4a16005 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -100,7 +100,7 @@ class Selection extends Model bufferRange = Range.fromObject(bufferRange) @needsAutoscroll = options.autoscroll options.reversed ?= @isReversed() - @editor.destroyFoldsIntersectingBufferRange(bufferRange) unless options.preserveFolds + @editor.destroyFoldsContainingBufferRange(bufferRange) unless options.preserveFolds @modifySelection => needsFlash = options.flash delete options.flash if options.flash? @@ -251,8 +251,7 @@ class Selection extends Model # Public: Selects all the text in the buffer. selectAll: -> - @editor.unfoldAll() - @setBufferRange(@editor.buffer.getRange(), autoscroll: false, preserveFolds: true) + @setBufferRange(@editor.buffer.getRange(), autoscroll: false) # Public: Selects all the text from the current cursor position to the # beginning of the line. diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 44389db17..44dc13c68 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2241,7 +2241,7 @@ class TextEditor extends Model # Returns the new {Selection}. addSelection: (marker, options={}) -> unless marker.getProperties().preserveFolds - @destroyFoldsIntersectingBufferRange(marker.getBufferRange()) + @destroyFoldsContainingBufferRange(marker.getBufferRange()) cursor = @addCursor(marker) selection = new Selection(_.extend({editor: this, marker, cursor}, options)) @selections.push(selection) @@ -2776,12 +2776,15 @@ class TextEditor extends Model # Remove any {Fold}s found that intersect the given buffer row. destroyFoldsIntersectingBufferRange: (bufferRange) -> - @unfoldBufferRow(bufferRange.start.row) - @unfoldBufferRow(bufferRange.end.row) + @destroyFoldsContainingBufferRange(bufferRange) for row in [bufferRange.end.row..bufferRange.start.row] fold.destroy() for fold in @displayBuffer.foldsStartingAtBufferRow(row) + destroyFoldsContainingBufferRange: (bufferRange) -> + @unfoldBufferRow(bufferRange.start.row) + @unfoldBufferRow(bufferRange.end.row) + # {Delegates to: DisplayBuffer.largestFoldContainingBufferRow} largestFoldContainingBufferRow: (bufferRow) -> @displayBuffer.largestFoldContainingBufferRow(bufferRow) From 73ee326bb37941c427b20b597b7a15f6d177174e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 11 Mar 2015 16:17:40 +0100 Subject: [PATCH 021/521] :memo: Document `destroyFoldsContainingBufferRange` ...and correct docs for `destroyFoldsIntersectingBufferRange`. --- src/text-editor.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 44dc13c68..b5c8c5290 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2774,13 +2774,14 @@ class TextEditor extends Model destroyFoldWithId: (id) -> @displayBuffer.destroyFoldWithId(id) - # Remove any {Fold}s found that intersect the given buffer row. + # Remove any {Fold}s found that intersect the given buffer range. destroyFoldsIntersectingBufferRange: (bufferRange) -> @destroyFoldsContainingBufferRange(bufferRange) for row in [bufferRange.end.row..bufferRange.start.row] fold.destroy() for fold in @displayBuffer.foldsStartingAtBufferRow(row) + # Remove any {Fold}s found that contain the given buffer range. destroyFoldsContainingBufferRange: (bufferRange) -> @unfoldBufferRow(bufferRange.start.row) @unfoldBufferRow(bufferRange.end.row) From 093ef6224c1f2b523c04eb2666e7b487134eb4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Wed, 11 Mar 2015 14:32:12 -0700 Subject: [PATCH 022/521] :arrow_up: notifications@0.32.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c6b2c0f9b..da0d7b191 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "link": "0.30.0", "markdown-preview": "0.139.0", "metrics": "0.45.0", - "notifications": "0.31.0", + "notifications": "0.32.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", From cdb1f05566fbf932f21ebfd015d8f7ddbe5bbac3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 11 Mar 2015 14:44:36 -0700 Subject: [PATCH 023/521] :arrow_up: language-perl@0.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da0d7b191..e2f2d712e 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.14.0", + "language-perl": "0.15.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From f8cbb679de361af3e5c2111b248c73d68cd40bf6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 11 Mar 2015 14:46:04 -0700 Subject: [PATCH 024/521] :arrow_up: language-todo@0.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e2f2d712e..0ed133fb2 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ "language-source": "0.9.0", "language-sql": "0.14.0", "language-text": "0.6.0", - "language-todo": "0.16.0", + "language-todo": "0.17.0", "language-toml": "0.15.0", "language-xml": "0.28.0", "language-yaml": "0.22.0" From 2b836cae0cd7b39a83ea3e8f8b3aa8105d1023b8 Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Wed, 11 Mar 2015 15:00:33 -0700 Subject: [PATCH 025/521] update README to point to new documentation --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7ebdf9252..4049a9aa9 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,13 @@ Visit [atom.io](https://atom.io) to learn more or visit the [Atom forum](https:/ Visit [issue #3684](https://github.com/atom/atom/issues/3684) to learn more about the Atom 1.0 roadmap. +## Documentation + +If you want to read about using Atom or developing packages in Atom, the [Atom Flight Manual](https://atom.io/docs/latest/) is free and available online, along with ePub, PDF and mobi versions. You can find the source to the manual in [atom/docs](https://github.com/atom/docs). + +The [API reference](https://atom.io/docs/api) for developing packages is also documented on Atom.io. + + ## Installing ### OS X @@ -55,7 +62,3 @@ repeat these steps to upgrade to future releases. * [OS X](docs/build-instructions/os-x.md) * [FreeBSD](docs/build-instructions/freebsd.md) * [Windows](docs/build-instructions/windows.md) - -## Developing - -Check out the [guides](https://atom.io/docs/latest) and the [API reference](https://atom.io/docs/api). From c79335d795e057d7d21f93bec8df46b948c28a6b Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Wed, 11 Mar 2015 15:05:48 -0700 Subject: [PATCH 026/521] update debugging url --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15e42f708..04fa80cf7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ propose changes to this document in a pull request. ## Submitting Issues -* Check the [debugging guide](https://atom.io/docs/latest/debugging) for tips +* Check the [debugging guide](https://atom.io/docs/latest/hacking-atom-debugging) for tips on debugging. You might be able to find the cause of the problem and fix things yourself. * Include the version of Atom you are using and the OS. From b3325d64b0785d6cece7c3802a76d72f4c2f1051 Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Wed, 11 Mar 2015 15:11:46 -0700 Subject: [PATCH 027/521] update internal docs links --- dot-atom/keymap.cson | 4 ++-- src/config.coffee | 10 +++++----- src/package.coffee | 2 +- src/scope-descriptor.coffee | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dot-atom/keymap.cson b/dot-atom/keymap.cson index ae63892bf..dea689c12 100644 --- a/dot-atom/keymap.cson +++ b/dot-atom/keymap.cson @@ -17,8 +17,8 @@ # 'ctrl-p': 'core:move-down' # # You can find more information about keymaps in these guides: -# * https://atom.io/docs/latest/customizing-atom#customizing-key-bindings -# * https://atom.io/docs/latest/advanced/keymaps +# * https://atom.io/docs/latest/using-atom-basic-customization#customizing-key-bindings +# * https://atom.io/docs/latest/behind-atom-keymaps-in-depth # # This file uses CoffeeScript Object Notation (CSON). # If you are unfamiliar with CSON, you can read more about it here: diff --git a/src/config.coffee b/src/config.coffee index 937bb1307..331e89af9 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -78,7 +78,7 @@ ScopeDescriptor = require './scope-descriptor' # # ... # ``` # -# See [Creating a Package](https://atom.io/docs/latest/creating-a-package) for +# See [package docs](https://atom.io/docs/latest/hacking-atom-package-word-count) for # more info. # # ## Config Schemas @@ -360,7 +360,7 @@ class Config # * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from # the root of the syntax tree to a token. Get one by calling # {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples. - # See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors) + # See [the scopes docs](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) # for more information. # * `callback` {Function} to call when the value of the key changes. # * `value` the new value of the key @@ -403,7 +403,7 @@ class Config # * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from # the root of the syntax tree to a token. Get one by calling # {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples. - # See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors) + # See [the scopes docs](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) # for more information. # * `callback` {Function} to call when the value of the key changes. # * `event` {Object} @@ -487,7 +487,7 @@ class Config # * `scope` (optional) {ScopeDescriptor} describing a path from # the root of the syntax tree to a token. Get one by calling # {editor.getLastCursor().getScopeDescriptor()} - # See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors) + # See [the scopes docs](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) # for more information. # # Returns the value from Atom's default settings, the user's configuration @@ -568,7 +568,7 @@ class Config # setting to the default value. # * `options` (optional) {Object} # * `scopeSelector` (optional) {String}. eg. '.source.ruby' - # See [the scopes docs](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors) + # See [the scopes docs](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) # for more information. # * `source` (optional) {String} The name of a file with which the setting # is associated. Defaults to the user's config file. diff --git a/src/package.coffee b/src/package.coffee index d8ba4a1d8..41d408329 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -174,7 +174,7 @@ class Package atom.config.setSchema @name, {type: 'object', properties: @mainModule.config} else if @mainModule.configDefaults? and typeof @mainModule.configDefaults is 'object' deprecate """Use a config schema instead. See the configuration section - of https://atom.io/docs/latest/creating-a-package and + of https://atom.io/docs/latest/hacking-atom-package-word-count and https://atom.io/docs/api/latest/Config for more details""" atom.config.setDefaults(@name, @mainModule.configDefaults) @mainModule.activateConfig?() diff --git a/src/scope-descriptor.coffee b/src/scope-descriptor.coffee index 5035810d6..d7ec263fd 100644 --- a/src/scope-descriptor.coffee +++ b/src/scope-descriptor.coffee @@ -15,7 +15,7 @@ # specific position in the buffer. # * {Cursor::getScopeDescriptor} to get a cursor's descriptor based on position. # -# See the [scopes and scope descriptor guide](https://atom.io/docs/latest/advanced/scopes-and-scope-descriptors) +# See the [scopes and scope descriptor guide](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) # for more information. module.exports = class ScopeDescriptor From 55ced560d4a90c1c9a894212d68006f2226c100f Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Wed, 11 Mar 2015 15:36:45 -0700 Subject: [PATCH 028/521] :arrow_up: pathwatcher ^4.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ed133fb2..754a5d392 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "nslog": "^2.0.0", "oniguruma": "^4.0.0", "optimist": "0.4.0", - "pathwatcher": "^3.3.3", + "pathwatcher": "^4.1.2", "property-accessors": "^1.1.3", "q": "^1.1.2", "random-words": "0.0.1", From f9bc31d3fbbb18b0a0534866997403f2ffcaa9d4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 11 Mar 2015 19:21:52 -0700 Subject: [PATCH 029/521] :arrow_up: atom-keymap for pathwatcher 4.x upgrade --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ed133fb2..8babe14b3 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.21.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^3.1.3", + "atom-keymap": "^3.1.4", "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", From bfb633b12265781b87df6a219b458d51acf69324 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 11 Mar 2015 19:37:28 -0700 Subject: [PATCH 030/521] :arrow_up: multiple packages for pathwatcher 4.x upgrade --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index aee7a0f92..d62bc3532 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "one-light-ui": "0.4.0", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", - "archive-view": "0.50.0", + "archive-view": "0.51.0", "autocomplete": "0.44.0", "autoflow": "0.22.0", "autosave": "0.20.0", @@ -90,7 +90,7 @@ "bracket-matcher": "0.71.0", "command-palette": "0.34.0", "deprecation-cop": "0.37.0", - "dev-live-reload": "0.42.0", + "dev-live-reload": "0.43.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", "feedback": "0.34.0", @@ -99,25 +99,25 @@ "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", - "image-view": "0.49.0", + "image-view": "0.50.0", "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.139.0", + "markdown-preview": "0.140.0", "metrics": "0.45.0", "notifications": "0.32.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.184.0", - "snippets": "0.80.0", + "snippets": "0.81.0", "spell-check": "0.55.0", "status-bar": "0.63.0", "styleguide": "0.44.0", - "symbols-view": "0.88.0", + "symbols-view": "0.89.0", "tabs": "0.67.0", "timecop": "0.31.0", - "tree-view": "0.164.0", + "tree-view": "0.165.0", "update-package-dependencies": "0.9.0", "welcome": "0.25.0", "whitespace": "0.29.0", From de73a70725599df8a7b2a9a4048f1e4040c3b1ae Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 11 Mar 2015 19:58:25 -0700 Subject: [PATCH 031/521] Revert ":arrow_up: pathwatcher ^4.1.2" --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d62bc3532..7f30c167c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "nslog": "^2.0.0", "oniguruma": "^4.0.0", "optimist": "0.4.0", - "pathwatcher": "^4.1.2", + "pathwatcher": "^3.3.3", "property-accessors": "^1.1.3", "q": "^1.1.2", "random-words": "0.0.1", From 2dd6c32daa1412b34be6a7aafab207e43f4cd88d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 11 Mar 2015 20:10:01 -0700 Subject: [PATCH 032/521] :arrow_up: packages and atom-keymap to roll back pathwatcher 4.x upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The upgrade to 4.x on text-buffer had a failing test suite, which I didn’t discover until upgrading everything else. We don’t want to have 2 major versions of pathwatcher shipping with Atom. --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7f30c167c..0a801ec95 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.21.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^3.1.4", + "atom-keymap": "^3.1.5", "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", @@ -81,7 +81,7 @@ "one-light-ui": "0.4.0", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", - "archive-view": "0.51.0", + "archive-view": "0.52.0", "autocomplete": "0.44.0", "autoflow": "0.22.0", "autosave": "0.20.0", @@ -90,7 +90,7 @@ "bracket-matcher": "0.71.0", "command-palette": "0.34.0", "deprecation-cop": "0.37.0", - "dev-live-reload": "0.43.0", + "dev-live-reload": "0.44.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", "feedback": "0.34.0", @@ -99,25 +99,25 @@ "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", - "image-view": "0.50.0", + "image-view": "0.51.0", "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.140.0", + "markdown-preview": "0.141.0", "metrics": "0.45.0", "notifications": "0.32.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.184.0", - "snippets": "0.81.0", + "snippets": "0.82.0", "spell-check": "0.55.0", "status-bar": "0.63.0", "styleguide": "0.44.0", - "symbols-view": "0.89.0", + "symbols-view": "0.90.0", "tabs": "0.67.0", "timecop": "0.31.0", - "tree-view": "0.165.0", + "tree-view": "0.166.0", "update-package-dependencies": "0.9.0", "welcome": "0.25.0", "whitespace": "0.29.0", From 9f1bb8245127135903f98c02f3a1204e7a08ad45 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 12 Mar 2015 10:04:05 +0100 Subject: [PATCH 033/521] Adjust `DisplayBuffer#getVisibleRowRange` logic This fixes #4596, where the calculation returned a wrong range. * :memo: State clearly that we'll return a closed interval in docs * :white_check_mark: Write tests to ensure a correct behavior --- spec/display-buffer-spec.coffee | 19 +++++++++++++++++++ src/display-buffer.coffee | 5 +++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 23b658c04..d5f554db7 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1247,3 +1247,22 @@ describe "DisplayBuffer", -> expect(displayBuffer.getScrollWidth()).toBe 10 * 63 + operatorWidth * 2 + cursorWidth expect(changedSpy.callCount).toBe 1 + + describe "::getVisibleRowRange()", -> + beforeEach -> + displayBuffer.setLineHeightInPixels(10) + displayBuffer.setHeight(100) + + it "returns a closed interval of visible rows", -> + displayBuffer.setScrollTop(0) + + expect(displayBuffer.getVisibleRowRange()).toEqual [0, 9] + + it "includes partially visible rows in the interval", -> + displayBuffer.setScrollTop(5) + expect(displayBuffer.getVisibleRowRange()).toEqual [0, 10] + + it "returns an empty interval when lineHeight is 0", -> + displayBuffer.setLineHeightInPixels(0) + + expect(displayBuffer.getVisibleRowRange()).toEqual [0, 0] diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index e09f1580c..9e5128553 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -348,12 +348,13 @@ class DisplayBuffer extends Model getScrollWidth: -> @scrollWidth + # Returns an {Array} of two numbers representing a closed interval of visible rows. getVisibleRowRange: -> return [0, 0] unless @getLineHeightInPixels() > 0 - heightInLines = Math.ceil(@getHeight() / @getLineHeightInPixels()) + 1 startRow = Math.floor(@getScrollTop() / @getLineHeightInPixels()) - endRow = Math.min(@getLineCount(), startRow + heightInLines) + endRow = Math.ceil((@getScrollTop() + @getHeight()) / @getLineHeightInPixels()) - 1 + endRow = Math.min(@getLineCount(), endRow) [startRow, endRow] From 912dd732a9e1f4d5c26461300752fdb7b3fd68c5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 12 Mar 2015 10:17:26 +0100 Subject: [PATCH 034/521] :art: Uniform new tests structure --- spec/display-buffer-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index d5f554db7..16eb663e4 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1260,6 +1260,7 @@ describe "DisplayBuffer", -> it "includes partially visible rows in the interval", -> displayBuffer.setScrollTop(5) + expect(displayBuffer.getVisibleRowRange()).toEqual [0, 10] it "returns an empty interval when lineHeight is 0", -> From faa2944232d3b0781ec4155f2a7f2f3424b7e815 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 12 Mar 2015 10:33:19 +0100 Subject: [PATCH 035/521] :white_check_mark: Cover edge case scenario ...where buffer rows are less than rows fitting on screen --- spec/display-buffer-spec.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 16eb663e4..783c13feb 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1267,3 +1267,8 @@ describe "DisplayBuffer", -> displayBuffer.setLineHeightInPixels(0) expect(displayBuffer.getVisibleRowRange()).toEqual [0, 0] + + it "ends at last buffer row even if there's more space available", -> + displayBuffer.setScrollTop(60) + + expect(displayBuffer.getVisibleRowRange()).toEqual [6, 13] From 3b5a0b292df3453939d88c8f01cbd56a066afb06 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 12 Mar 2015 12:32:18 +0100 Subject: [PATCH 036/521] :memo: Better and consistent naming across specs and docs --- spec/display-buffer-spec.coffee | 6 +++--- src/display-buffer.coffee | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 783c13feb..df7c13383 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1253,17 +1253,17 @@ describe "DisplayBuffer", -> displayBuffer.setLineHeightInPixels(10) displayBuffer.setHeight(100) - it "returns a closed interval of visible rows", -> + it "returns the first and the last visible rows", -> displayBuffer.setScrollTop(0) expect(displayBuffer.getVisibleRowRange()).toEqual [0, 9] - it "includes partially visible rows in the interval", -> + it "includes partially visible rows in the range", -> displayBuffer.setScrollTop(5) expect(displayBuffer.getVisibleRowRange()).toEqual [0, 10] - it "returns an empty interval when lineHeight is 0", -> + it "returns an empty range when lineHeight is 0", -> displayBuffer.setLineHeightInPixels(0) expect(displayBuffer.getVisibleRowRange()).toEqual [0, 0] diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 9e5128553..7845fa365 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -348,7 +348,7 @@ class DisplayBuffer extends Model getScrollWidth: -> @scrollWidth - # Returns an {Array} of two numbers representing a closed interval of visible rows. + # Returns an {Array} of two numbers representing the first and the last visible rows. getVisibleRowRange: -> return [0, 0] unless @getLineHeightInPixels() > 0 From 00122e76cdc884572bd392494ab55456fec591a7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 12 Mar 2015 08:11:31 -0700 Subject: [PATCH 037/521] :arrow_up: language-javascript@0.63 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a801ec95..10ec091c2 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "language-html": "0.29.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.62.0", + "language-javascript": "0.63.0", "language-json": "0.12.0", "language-less": "0.25.0", "language-make": "0.14.0", From e61b6fca97db5ecd51b6df8ad69cb029d6a79176 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 12 Mar 2015 09:51:44 -0700 Subject: [PATCH 038/521] :arrow_up: tree-view --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 10ec091c2..22235aad1 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "symbols-view": "0.90.0", "tabs": "0.67.0", "timecop": "0.31.0", - "tree-view": "0.166.0", + "tree-view": "0.167.0", "update-package-dependencies": "0.9.0", "welcome": "0.25.0", "whitespace": "0.29.0", From 0a0e1e6e2eddd94627f01c84f2635a9e78b0abe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Thu, 12 Mar 2015 11:24:14 -0700 Subject: [PATCH 039/521] Update link to guide for contributing to packages --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 04fa80cf7..32dccf299 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ many packages and themes that are stored in other repos under the [atom-light-ui](https://github.com/atom/atom-light-ui). For more information on how to work with Atom's official packages, see -[Contributing to Atom Packages](https://atom.io/docs/latest/contributing-to-packages.html) +[Contributing to Atom Packages](https://github.com/atom/atom/blob/master/docs/contributing-to-packages.md) ## Pull Requests From f4b791d33bbaa3599601c92a3d96f7960161b64c Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 13 Mar 2015 10:57:45 +0100 Subject: [PATCH 040/521] Use screenPosition to select above and below --- src/display-buffer.coffee | 12 ++++++++++++ src/selection.coffee | 20 ++++++++++++-------- src/text-editor.coffee | 8 ++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 7845fa365..5659d38a0 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -859,6 +859,18 @@ class DisplayBuffer extends Model column = screenLine.clipScreenColumn(column, options) new Point(row, column) + # Clip the start and end of the given range to valid positions on screen. + # See {::clipScreenPosition} for more information. + # + # * `range` The {Range} to clip. + # * `options` (optional) See {::clipScreenPosition} `options`. + # Returns a {Range}. + clipScreenRange: (range, options) -> + start = @clipScreenPosition(range.start, options) + end = @clipScreenPosition(range.end, options) + + new Range(start, end) + # Calculates a {Range} representing the start of the {TextBuffer} until the end. # # Returns a {Range}. diff --git a/src/selection.coffee b/src/selection.coffee index 1ecd35157..c094265b9 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -183,7 +183,7 @@ class Selection extends Model # Public: Clears the selection, moving the marker to the head. clear: -> - @marker.setProperties(goalBufferRange: null) + @marker.setProperties(goalBufferRange: null, goalScreenRange: null) @marker.clearTail() unless @retainSelection @finalize() @@ -657,38 +657,38 @@ class Selection extends Model # Public: Moves the selection down one row. addSelectionBelow: -> - range = (@getGoalBufferRange() ? @getBufferRange()).copy() + range = (@getGoalScreenRange() ? @getScreenRange()).copy() nextRow = range.end.row + 1 - for row in [nextRow..@editor.getLastBufferRow()] + for row in [nextRow..@editor.getLastScreenRow()] range.start.row = row range.end.row = row - clippedRange = @editor.clipBufferRange(range) + clippedRange = @editor.clipScreenRange(range) if range.isEmpty() continue if range.end.column > 0 and clippedRange.end.column is 0 else continue if clippedRange.isEmpty() - @editor.addSelectionForBufferRange(range, goalBufferRange: range) + @editor.addSelectionForScreenRange(range, goalScreenRange: range) break # Public: Moves the selection up one row. addSelectionAbove: -> - range = (@getGoalBufferRange() ? @getBufferRange()).copy() + range = (@getGoalScreenRange() ? @getScreenRange()).copy() previousRow = range.end.row - 1 for row in [previousRow..0] range.start.row = row range.end.row = row - clippedRange = @editor.clipBufferRange(range) + clippedRange = @editor.clipScreenRange(range) if range.isEmpty() continue if range.end.column > 0 and clippedRange.end.column is 0 else continue if clippedRange.isEmpty() - @editor.addSelectionForBufferRange(range, goalBufferRange: range) + @editor.addSelectionForScreenRange(range, goalScreenRange: range) break # Public: Combines the given selection into this selection and then destroys @@ -767,3 +767,7 @@ class Selection extends Model getGoalBufferRange: -> if goalBufferRange = @marker.getProperties().goalBufferRange Range.fromObject(goalBufferRange) + + getGoalScreenRange: -> + if goalScreenRange = @marker.getProperties().goalScreenRange + Range.fromObject(goalScreenRange) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 44389db17..d22d84649 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -1275,6 +1275,14 @@ class TextEditor extends Model # Returns a {Point}. clipScreenPosition: (screenPosition, options) -> @displayBuffer.clipScreenPosition(screenPosition, options) + # Extended: Clip the start and end of the given range to valid positions on screen. + # See {::clipScreenPosition} for more information. + # + # * `range` The {Range} to clip. + # * `options` (optional) See {::clipScreenPosition} `options`. + # Returns a {Range}. + clipScreenRange: (range, options) -> @displayBuffer.clipScreenRange(range, options) + ### Section: Decorations ### From 02ad2e8ff7876a25582aa959f0026ac5dd3df167 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 13 Mar 2015 11:32:42 +0100 Subject: [PATCH 041/521] :white_check_mark: Write specs for soft-wrapped lines selection --- spec/text-editor-spec.coffee | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index c03990bf2..2d7a8e5a9 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1623,7 +1623,31 @@ describe "TextEditor", -> [[6, 22], [6, 28]] ] + it "selects also soft-wrapped lines", -> + editor.setSoftWrapped(true) + editor.setDefaultCharWidth(10) + editor.setEditorWidthInChars(40) + + editor.setSelectedScreenRange([[6, 20], [6, 25]]) + editor.addSelectionBelow() + expect(editor.getSelectedScreenRanges()).toEqual [ + [[6, 20], [6, 25]] + [[7, 20], [7, 25]] + ] + describe "when the selection is empty", -> + it "does not skip soft-wrapped lines shorter than the current column", -> + editor.setSoftWrapped(true) + editor.setDefaultCharWidth(10) + editor.setEditorWidthInChars(40) + + editor.setCursorScreenPosition([6, 44]) + editor.addSelectionBelow() + expect(editor.getSelectedScreenRanges()).toEqual [ + [[6, 44], [6, 44]] + [[7, 26], [7, 26]] + ] + it "does not skip lines that are shorter than the current column", -> editor.setCursorBufferPosition([3, 36]) editor.addSelectionBelow() @@ -1687,7 +1711,31 @@ describe "TextEditor", -> [[3, 22], [3, 38]] ] + it "selects also soft-wrapped lines", -> + editor.setSoftWrapped(true) + editor.setDefaultCharWidth(10) + editor.setEditorWidthInChars(40) + + editor.setSelectedScreenRange([[7, 20], [7, 25]]) + editor.addSelectionAbove() + expect(editor.getSelectedScreenRanges()).toEqual [ + [[7, 20], [7, 25]] + [[6, 20], [6, 25]] + ] + describe "when the selection is empty", -> + it "does not skip soft-wrapped lines shorter than the current column", -> + editor.setSoftWrapped(true) + editor.setDefaultCharWidth(10) + editor.setEditorWidthInChars(40) + + editor.setCursorScreenPosition([6, 44]) + editor.addSelectionAbove() + expect(editor.getSelectedScreenRanges()).toEqual [ + [[6, 44], [6, 44]] + [[5, 30], [5, 30]] + ] + it "does not skip lines that are shorter than the current column", -> editor.setCursorBufferPosition([6, 36]) editor.addSelectionAbove() From c319b804642869758e6994a82420974debb4e28f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 13 Mar 2015 11:56:00 +0100 Subject: [PATCH 042/521] :white_check_mark: Write specs for atomic tokens --- spec/text-editor-spec.coffee | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 2d7a8e5a9..833128085 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1635,6 +1635,19 @@ describe "TextEditor", -> [[7, 20], [7, 25]] ] + it "takes atomic tokens into account", -> + waitsForPromise -> + atom.project.open('sample-with-tabs-and-leading-comment.coffee', autoIndent: false).then (o) -> editor = o + + runs -> + editor.setSelectedBufferRange([[2, 1], [2, 3]]) + editor.addSelectionBelow() + + expect(editor.getSelectedBufferRanges()).toEqual [ + [[2, 1], [2, 3]] + [[3, 1], [3, 2]] + ] + describe "when the selection is empty", -> it "does not skip soft-wrapped lines shorter than the current column", -> editor.setSoftWrapped(true) @@ -1723,6 +1736,19 @@ describe "TextEditor", -> [[6, 20], [6, 25]] ] + it "takes atomic tokens into account", -> + waitsForPromise -> + atom.project.open('sample-with-tabs-and-leading-comment.coffee', autoIndent: false).then (o) -> editor = o + + runs -> + editor.setSelectedBufferRange([[3, 1], [3, 2]]) + editor.addSelectionAbove() + + expect(editor.getSelectedBufferRanges()).toEqual [ + [[3, 1], [3, 2]] + [[2, 1], [2, 3]] + ] + describe "when the selection is empty", -> it "does not skip soft-wrapped lines shorter than the current column", -> editor.setSoftWrapped(true) From 8ac4848805f67c6640f8d7fd791caf31306419ca Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 13 Mar 2015 12:05:18 +0100 Subject: [PATCH 043/521] Skip soft-wrap indentation tokens while selecting * :art: Restructure specs a bit * :white_check_mark: Write specs for this new behavior --- spec/text-editor-spec.coffee | 64 +++++++++++++++++++++++++----------- src/selection.coffee | 8 ++--- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 833128085..afbc8aa7d 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1649,17 +1649,29 @@ describe "TextEditor", -> ] describe "when the selection is empty", -> - it "does not skip soft-wrapped lines shorter than the current column", -> - editor.setSoftWrapped(true) - editor.setDefaultCharWidth(10) - editor.setEditorWidthInChars(40) + describe "when lines are soft-wrapped", -> + beforeEach -> + editor.setSoftWrapped(true) + editor.setDefaultCharWidth(10) + editor.setEditorWidthInChars(40) - editor.setCursorScreenPosition([6, 44]) - editor.addSelectionBelow() - expect(editor.getSelectedScreenRanges()).toEqual [ - [[6, 44], [6, 44]] - [[7, 26], [7, 26]] - ] + it "skips soft-wrap indentation tokens", -> + editor.setCursorScreenPosition([6, 2]) + editor.addSelectionBelow() + + expect(editor.getSelectedScreenRanges()).toEqual [ + [[6, 2], [6, 2]] + [[7, 6], [7, 6]] + ] + + it "does not skip them if they're shorter than the current column", -> + editor.setCursorScreenPosition([6, 44]) + editor.addSelectionBelow() + + expect(editor.getSelectedScreenRanges()).toEqual [ + [[6, 44], [6, 44]] + [[7, 26], [7, 26]] + ] it "does not skip lines that are shorter than the current column", -> editor.setCursorBufferPosition([3, 36]) @@ -1750,17 +1762,29 @@ describe "TextEditor", -> ] describe "when the selection is empty", -> - it "does not skip soft-wrapped lines shorter than the current column", -> - editor.setSoftWrapped(true) - editor.setDefaultCharWidth(10) - editor.setEditorWidthInChars(40) + describe "when lines are soft-wrapped", -> + beforeEach -> + editor.setSoftWrapped(true) + editor.setDefaultCharWidth(10) + editor.setEditorWidthInChars(40) - editor.setCursorScreenPosition([6, 44]) - editor.addSelectionAbove() - expect(editor.getSelectedScreenRanges()).toEqual [ - [[6, 44], [6, 44]] - [[5, 30], [5, 30]] - ] + it "skips soft-wrap indentation tokens", -> + editor.setCursorScreenPosition([8, 0]) + editor.addSelectionAbove() + + expect(editor.getSelectedScreenRanges()).toEqual [ + [[8, 0], [8, 0]] + [[7, 6], [7, 6]] + ] + + it "does not skip them if they're shorter than the current column", -> + editor.setCursorScreenPosition([6, 44]) + editor.addSelectionAbove() + + expect(editor.getSelectedScreenRanges()).toEqual [ + [[6, 44], [6, 44]] + [[5, 30], [5, 30]] + ] it "does not skip lines that are shorter than the current column", -> editor.setCursorBufferPosition([6, 36]) diff --git a/src/selection.coffee b/src/selection.coffee index c094265b9..30a64d873 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -663,14 +663,14 @@ class Selection extends Model for row in [nextRow..@editor.getLastScreenRow()] range.start.row = row range.end.row = row - clippedRange = @editor.clipScreenRange(range) + clippedRange = @editor.clipScreenRange(range, skipSoftWrapIndentation: true) if range.isEmpty() continue if range.end.column > 0 and clippedRange.end.column is 0 else continue if clippedRange.isEmpty() - @editor.addSelectionForScreenRange(range, goalScreenRange: range) + @editor.addSelectionForScreenRange(clippedRange, goalScreenRange: range) break # Public: Moves the selection up one row. @@ -681,14 +681,14 @@ class Selection extends Model for row in [previousRow..0] range.start.row = row range.end.row = row - clippedRange = @editor.clipScreenRange(range) + clippedRange = @editor.clipScreenRange(range, skipSoftWrapIndentation: true) if range.isEmpty() continue if range.end.column > 0 and clippedRange.end.column is 0 else continue if clippedRange.isEmpty() - @editor.addSelectionForScreenRange(range, goalScreenRange: range) + @editor.addSelectionForScreenRange(clippedRange, goalScreenRange: range) break # Public: Combines the given selection into this selection and then destroys From 37f5a3311610ab14c0e393268c41d2cfdb162bef Mon Sep 17 00:00:00 2001 From: Bjoernsen Date: Fri, 13 Mar 2015 13:36:07 +0100 Subject: [PATCH 044/521] Enable multiple users Currently, it is not possible to use atom for multiple users on the same linux machine. The socket file '/tmp/atom.sock' belongs to the first user that starts atom. With this small change, a socket file will be created for each user. --- src/browser/atom-application.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 1ecbe9570..52fc08c21 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -18,7 +18,7 @@ DefaultSocketPath = if process.platform is 'win32' '\\\\.\\pipe\\atom-sock' else - path.join(os.tmpdir(), 'atom.sock') + path.join(os.tmpdir(), "atom_#{process.env['USER']}.sock") # The application's singleton class. # From 5067a25f422aa772287097173ddd7867f8003f9f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 13 Mar 2015 10:24:31 -0700 Subject: [PATCH 045/521] :arrow_up: language-perl@0.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22235aad1..90863fff3 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.15.0", + "language-perl": "0.16.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From 7ec46933bda7bc6396080a1631a3590b8b0bbbc3 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 13 Mar 2015 11:42:30 -0700 Subject: [PATCH 046/521] Batch service providers by package --- .../packages/package-with-provided-services/index.coffee | 3 +++ .../packages/package-with-provided-services/package.json | 1 + spec/package-manager-spec.coffee | 1 + src/package.coffee | 4 +++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/packages/package-with-provided-services/index.coffee b/spec/fixtures/packages/package-with-provided-services/index.coffee index b6413b119..86f319946 100644 --- a/spec/fixtures/packages/package-with-provided-services/index.coffee +++ b/spec/fixtures/packages/package-with-provided-services/index.coffee @@ -3,6 +3,9 @@ module.exports = deactivate: -> + provideFirstServiceV2: -> + 'first-service-v2' + provideFirstServiceV3: -> 'first-service-v3' diff --git a/spec/fixtures/packages/package-with-provided-services/package.json b/spec/fixtures/packages/package-with-provided-services/package.json index 144fc2dac..d95bbf9b7 100644 --- a/spec/fixtures/packages/package-with-provided-services/package.json +++ b/spec/fixtures/packages/package-with-provided-services/package.json @@ -5,6 +5,7 @@ "service-1": { "description": "The first service", "versions": { + "0.2.9": "provideFirstServiceV2", "0.3.1": "provideFirstServiceV3", "0.4.1": "provideFirstServiceV4" } diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 6efb17a55..758d7468f 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -522,6 +522,7 @@ describe "PackageManager", -> atom.packages.activatePackage("package-with-provided-services") runs -> + expect(consumerModule.consumeFirstServiceV3.callCount).toBe(1) expect(consumerModule.consumeFirstServiceV3).toHaveBeenCalledWith('first-service-v3') expect(consumerModule.consumeFirstServiceV4).toHaveBeenCalledWith('first-service-v4') expect(consumerModule.consumeSecondService).toHaveBeenCalledWith('second-service') diff --git a/src/package.coffee b/src/package.coffee index 422077dc9..4d244c50f 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -223,8 +223,10 @@ class Package activateServices: -> for name, {versions} of @metadata.providedServices + servicesByVersion = {} for version, methodName of versions - @activationDisposables.add atom.packages.serviceHub.provide(name, version, @mainModule[methodName]()) + servicesByVersion[version] = @mainModule[methodName]() + @activationDisposables.add atom.packages.serviceHub.provide(name, servicesByVersion) for name, {versions} of @metadata.consumedServices for version, methodName of versions From f476b19a13f9ca282de594e34637caf137551249 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 13 Mar 2015 12:27:56 -0700 Subject: [PATCH 047/521] :arrow_up: service-hub --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22235aad1..770003e92 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "season": "^5.1.4", "semver": "~4.2", "serializable": "^1", - "service-hub": "^0.4.0", + "service-hub": "^0.5.0", "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", From 28d617e799c784c7780b7fa1c511b32aff968d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Fri, 13 Mar 2015 14:31:17 -0700 Subject: [PATCH 048/521] :arrow_up: apm@0.143 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 7d894d573..b34351f7b 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.142.0" + "atom-package-manager": "0.143.0" } } From 587ebd753840517dca899982d6a4f3931a1f1b39 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 13 Mar 2015 15:07:44 -0700 Subject: [PATCH 049/521] Fix Project::relativePath w/ URLs --- spec/project-spec.coffee | 5 +++++ src/project.coffee | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 02ea81ff4..a1cdce662 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -486,6 +486,11 @@ describe "Project", -> randomPath = path.join("some", "random", "path") expect(atom.project.relativizePath(randomPath)).toEqual [null, randomPath] + describe "when the given path is a URL", -> + it "returns null for the root path, and the given path unchanged", -> + url = "http://the-path" + expect(atom.project.relativizePath(url)).toEqual [null, url] + describe ".contains(path)", -> it "returns whether or not the given path is in one of the root directories", -> rootPath = atom.project.getPaths()[0] diff --git a/src/project.coffee b/src/project.coffee index e0d4bfedd..69406dbda 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -288,7 +288,6 @@ class Project extends Model # * `relativePath` {String} The relative path from the project directory to # the given path. relativizePath: (fullPath) -> - return fullPath if fullPath?.match(/[A-Za-z0-9+-.]+:\/\//) # leave path alone if it has a scheme for rootDirectory in @rootDirectories relativePath = rootDirectory.relativize(fullPath) return [rootDirectory.getPath(), relativePath] unless relativePath is fullPath From bfe8f7c7406bd42ec3f8429b8bb1c3391fb8e288 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 14 Mar 2015 09:26:29 +0100 Subject: [PATCH 050/521] Fix soft-wrapping specs --- spec/text-editor-spec.coffee | 44 ++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index afbc8aa7d..fddaf573d 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1623,16 +1623,15 @@ describe "TextEditor", -> [[6, 22], [6, 28]] ] - it "selects also soft-wrapped lines", -> + it "can add selections to soft-wrapped line segments", -> editor.setSoftWrapped(true) - editor.setDefaultCharWidth(10) editor.setEditorWidthInChars(40) - editor.setSelectedScreenRange([[6, 20], [6, 25]]) + editor.setSelectedScreenRange([[3, 10], [3, 15]]) editor.addSelectionBelow() expect(editor.getSelectedScreenRanges()).toEqual [ - [[6, 20], [6, 25]] - [[7, 20], [7, 25]] + [[3, 10], [3, 15]] + [[4, 10], [4, 15]] ] it "takes atomic tokens into account", -> @@ -1652,25 +1651,24 @@ describe "TextEditor", -> describe "when lines are soft-wrapped", -> beforeEach -> editor.setSoftWrapped(true) - editor.setDefaultCharWidth(10) editor.setEditorWidthInChars(40) it "skips soft-wrap indentation tokens", -> - editor.setCursorScreenPosition([6, 2]) + editor.setCursorScreenPosition([3, 0]) editor.addSelectionBelow() expect(editor.getSelectedScreenRanges()).toEqual [ - [[6, 2], [6, 2]] - [[7, 6], [7, 6]] + [[3, 0], [3, 0]] + [[4, 4], [4, 4]] ] it "does not skip them if they're shorter than the current column", -> - editor.setCursorScreenPosition([6, 44]) + editor.setCursorScreenPosition([3, 37]) editor.addSelectionBelow() expect(editor.getSelectedScreenRanges()).toEqual [ - [[6, 44], [6, 44]] - [[7, 26], [7, 26]] + [[3, 37], [3, 37]] + [[4, 26], [4, 26]] ] it "does not skip lines that are shorter than the current column", -> @@ -1736,16 +1734,15 @@ describe "TextEditor", -> [[3, 22], [3, 38]] ] - it "selects also soft-wrapped lines", -> + it "can add selections to soft-wrapped line segments", -> editor.setSoftWrapped(true) - editor.setDefaultCharWidth(10) editor.setEditorWidthInChars(40) - editor.setSelectedScreenRange([[7, 20], [7, 25]]) + editor.setSelectedScreenRange([[4, 10], [4, 15]]) editor.addSelectionAbove() expect(editor.getSelectedScreenRanges()).toEqual [ - [[7, 20], [7, 25]] - [[6, 20], [6, 25]] + [[4, 10], [4, 15]] + [[3, 10], [3, 15]] ] it "takes atomic tokens into account", -> @@ -1765,25 +1762,24 @@ describe "TextEditor", -> describe "when lines are soft-wrapped", -> beforeEach -> editor.setSoftWrapped(true) - editor.setDefaultCharWidth(10) editor.setEditorWidthInChars(40) it "skips soft-wrap indentation tokens", -> - editor.setCursorScreenPosition([8, 0]) + editor.setCursorScreenPosition([5, 0]) editor.addSelectionAbove() expect(editor.getSelectedScreenRanges()).toEqual [ - [[8, 0], [8, 0]] - [[7, 6], [7, 6]] + [[5, 0], [5, 0]] + [[4, 4], [4, 4]] ] it "does not skip them if they're shorter than the current column", -> - editor.setCursorScreenPosition([6, 44]) + editor.setCursorScreenPosition([5, 29]) editor.addSelectionAbove() expect(editor.getSelectedScreenRanges()).toEqual [ - [[6, 44], [6, 44]] - [[5, 30], [5, 30]] + [[5, 29], [5, 29]] + [[4, 26], [4, 26]] ] it "does not skip lines that are shorter than the current column", -> From 0a23a219534327b60736dcaa0eb53f15fae8fbfb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 14 Mar 2015 09:48:19 +0100 Subject: [PATCH 051/521] :art: Get rid of goalBufferRange --- spec/text-editor-spec.coffee | 4 ++-- src/selection.coffee | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index fddaf573d..6154af055 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1456,8 +1456,8 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRanges()).toEqual [[[5, 5], [6, 6]]] it "merges intersecting selections", -> - editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]]) - expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 5]]] + editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 4]]]) + expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 4]]] it "does not merge non-empty adjacent selections", -> editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 3], [5, 5]]]) diff --git a/src/selection.coffee b/src/selection.coffee index 30a64d873..d4538f9dc 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -183,7 +183,7 @@ class Selection extends Model # Public: Clears the selection, moving the marker to the head. clear: -> - @marker.setProperties(goalBufferRange: null, goalScreenRange: null) + @marker.setProperties(goalScreenRange: null) @marker.clearTail() unless @retainSelection @finalize() @@ -695,15 +695,17 @@ class Selection extends Model # the given selection. # # * `otherSelection` A {Selection} to merge with. - # * `options` (optional) {Object} options matching those found in {::setBufferRange}. + # * `options` (optional) {Object} options matching those found in {::setScreenRange}. merge: (otherSelection, options) -> - myGoalBufferRange = @getGoalBufferRange() - otherGoalBufferRange = otherSelection.getGoalBufferRange() - if myGoalBufferRange? and otherGoalBufferRange? - options.goalBufferRange = myGoalBufferRange.union(otherGoalBufferRange) + myGoalScreenRange = @getGoalScreenRange() + otherGoalScreenRange = otherSelection.getGoalScreenRange() + + if myGoalScreenRange? and otherGoalScreenRange? + options.goalScreenRange = myGoalScreenRange.union(otherGoalScreenRange) else - options.goalBufferRange = myGoalBufferRange ? otherGoalBufferRange - @setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options) + options.goalScreenRange = myGoalScreenRange ? otherGoalScreenRange + + @setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()), options) otherSelection.destroy() ### @@ -764,10 +766,6 @@ class Selection extends Model plantTail: -> @marker.plantTail() - getGoalBufferRange: -> - if goalBufferRange = @marker.getProperties().goalBufferRange - Range.fromObject(goalBufferRange) - getGoalScreenRange: -> if goalScreenRange = @marker.getProperties().goalScreenRange Range.fromObject(goalScreenRange) From 6633c90af870c1c361da4ea59e5094b9289e6ae4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 14 Mar 2015 10:05:04 +0100 Subject: [PATCH 052/521] Use buffer ranges when merging selections --- spec/text-editor-spec.coffee | 4 ++-- src/selection.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 6154af055..fddaf573d 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1456,8 +1456,8 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRanges()).toEqual [[[5, 5], [6, 6]]] it "merges intersecting selections", -> - editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 4]]]) - expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 4]]] + editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]]) + expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 5]]] it "does not merge non-empty adjacent selections", -> editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 3], [5, 5]]]) diff --git a/src/selection.coffee b/src/selection.coffee index d4538f9dc..cada3aa6c 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -695,7 +695,7 @@ class Selection extends Model # the given selection. # # * `otherSelection` A {Selection} to merge with. - # * `options` (optional) {Object} options matching those found in {::setScreenRange}. + # * `options` (optional) {Object} options matching those found in {::setBufferRange}. merge: (otherSelection, options) -> myGoalScreenRange = @getGoalScreenRange() otherGoalScreenRange = otherSelection.getGoalScreenRange() @@ -705,7 +705,7 @@ class Selection extends Model else options.goalScreenRange = myGoalScreenRange ? otherGoalScreenRange - @setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()), options) + @setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options) otherSelection.destroy() ### From 66fa86e129a76fa2139ac6bc2f44cb22dcfb3057 Mon Sep 17 00:00:00 2001 From: Bjoernsen Date: Sat, 14 Mar 2015 13:42:54 +0100 Subject: [PATCH 053/521] Enable multiple users Enable atom for multiple users on same linux computer. --- src/browser/atom-application.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 52fc08c21..138448f52 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -18,7 +18,7 @@ DefaultSocketPath = if process.platform is 'win32' '\\\\.\\pipe\\atom-sock' else - path.join(os.tmpdir(), "atom_#{process.env['USER']}.sock") + path.join(os.tmpdir(), "atom_#{process.env.USER}.sock") # The application's singleton class. # From 1899e9b8a02642eca9fc378ccc3fe0ffb7358d31 Mon Sep 17 00:00:00 2001 From: "Machiste N. Quintana" Date: Sat, 14 Mar 2015 13:52:50 -0400 Subject: [PATCH 054/521] Add pane:close to atom-pane context menu --- menus/darwin.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/menus/darwin.cson b/menus/darwin.cson index 7283ba16f..d1518f8e3 100644 --- a/menus/darwin.cson +++ b/menus/darwin.cson @@ -225,5 +225,6 @@ {label: 'Split Down', command: 'pane:split-down'} {label: 'Split Left', command: 'pane:split-left'} {label: 'Split Right', command: 'pane:split-right'} + {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] From 55c5614bd40c9ea5a11ad8d158e25fd854518692 Mon Sep 17 00:00:00 2001 From: "Machiste N. Quintana" Date: Sat, 14 Mar 2015 16:30:17 -0400 Subject: [PATCH 055/521] Update darwin.cson Missed a spot --- menus/darwin.cson | 1 + 1 file changed, 1 insertion(+) diff --git a/menus/darwin.cson b/menus/darwin.cson index d1518f8e3..9454a7c34 100644 --- a/menus/darwin.cson +++ b/menus/darwin.cson @@ -217,6 +217,7 @@ {label: 'Split Down', command: 'pane:split-down'} {label: 'Split Left', command: 'pane:split-left'} {label: 'Split Right', command: 'pane:split-right'} + {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] 'atom-pane': [ From bd9e48e217116e386600eefc6414b9e98185ba3f Mon Sep 17 00:00:00 2001 From: "Machiste N. Quintana" Date: Sat, 14 Mar 2015 16:30:46 -0400 Subject: [PATCH 056/521] Add pane:close to atom-pane context menu (Win) --- menus/win32.cson | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menus/win32.cson b/menus/win32.cson index a3e5c8b8d..af26be7a5 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -196,6 +196,7 @@ {label: 'Split Down', command: 'pane:split-down'} {label: 'Split Left', command: 'pane:split-left'} {label: 'Split Right', command: 'pane:split-right'} + {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] 'atom-pane': [ @@ -204,5 +205,6 @@ {label: 'Split Down', command: 'pane:split-down'} {label: 'Split Left', command: 'pane:split-left'} {label: 'Split Right', command: 'pane:split-right'} + {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] From 8a6f966d87b24c212c47c25fbb5867994d3ce11c Mon Sep 17 00:00:00 2001 From: "Machiste N. Quintana" Date: Sat, 14 Mar 2015 16:31:23 -0400 Subject: [PATCH 057/521] Add pane:close to atom-pane context menu (Linux) --- menus/linux.cson | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menus/linux.cson b/menus/linux.cson index fc1e58785..a3b3875c4 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -174,6 +174,7 @@ {label: 'Split Down', command: 'pane:split-down'} {label: 'Split Left', command: 'pane:split-left'} {label: 'Split Right', command: 'pane:split-right'} + {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] 'atom-pane': [ @@ -182,5 +183,6 @@ {label: 'Split Down', command: 'pane:split-down'} {label: 'Split Left', command: 'pane:split-left'} {label: 'Split Right', command: 'pane:split-right'} + {label: 'Close Pane', command: 'pane:close'} {type: 'separator'} ] From d6338b0a2c1beb248f5892c62a56a4f555b09905 Mon Sep 17 00:00:00 2001 From: Bjoernsen Date: Mon, 16 Mar 2015 08:38:01 +0100 Subject: [PATCH 058/521] Update start-atom.coffee --- spec/integration/helpers/start-atom.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.coffee b/spec/integration/helpers/start-atom.coffee index b5f5a8c1f..9d57e93ae 100644 --- a/spec/integration/helpers/start-atom.coffee +++ b/spec/integration/helpers/start-atom.coffee @@ -9,7 +9,7 @@ webdriverio = require "../../../build/node_modules/webdriverio" AtomPath = remote.process.argv[0] AtomLauncherPath = path.join(__dirname, "..", "helpers", "atom-launcher.sh") ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'atom-shell', 'chromedriver', 'chromedriver') -SocketPath = path.join(temp.mkdirSync("socket-dir"), "atom.sock") +SocketPath = path.join(temp.mkdirSync("socket-dir"), "atom_#{process.env['USER']}.sock") ChromedriverPort = 9515 buildAtomClient = (args, env) -> From eaa72fc956e49699d19e1c352ff02206844e099c Mon Sep 17 00:00:00 2001 From: Bjoernsen Date: Mon, 16 Mar 2015 08:38:34 +0100 Subject: [PATCH 059/521] Update browser-process-startup.coffee --- benchmark/browser-process-startup.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/browser-process-startup.coffee b/benchmark/browser-process-startup.coffee index 06f2a0d48..53748f5d0 100755 --- a/benchmark/browser-process-startup.coffee +++ b/benchmark/browser-process-startup.coffee @@ -8,7 +8,7 @@ _ = require 'underscore-plus' temp = require 'temp' directoryToOpen = temp.mkdirSync('browser-process-startup-') -socketPath = path.join(os.tmpdir(), 'atom.sock') +socketPath = path.join(os.tmpdir(), "atom_#{process.env['USER']}.sock") numberOfRuns = 10 deleteSocketFile = -> From 823be8ca97b0f9a2907a67358160a331460a81f8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 09:37:31 -0700 Subject: [PATCH 060/521] :arrow_up: language-perl@0.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b94303387..cbce46ba8 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.16.0", + "language-perl": "0.17.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From 90bb96a23cf57d7971e7a006b4185fc2e1e83c6d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:37:38 -0700 Subject: [PATCH 061/521] :arrow_up: apm@0.145 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index b34351f7b..a989c7a83 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.143.0" + "atom-package-manager": "0.145.0" } } From 414b82f05ec60562563b9b94fa9cea42ac9a53d9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:49:59 -0700 Subject: [PATCH 062/521] Bump license overrides for new jschardet version --- build/tasks/license-overrides.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/license-overrides.coffee b/build/tasks/license-overrides.coffee index b32ebb545..287d44b63 100644 --- a/build/tasks/license-overrides.coffee +++ b/build/tasks/license-overrides.coffee @@ -65,7 +65,7 @@ module.exports = IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ - 'jschardet@1.1.0': + 'jschardet@1.1.1': license: 'LGPL' source: 'README.md in the repository' sourceText: """ From d61ceacc26bf4974cf377053cecc277973ccdada Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:42:00 -0700 Subject: [PATCH 063/521] Make One Dark the default UI/syntax themes --- dot-atom/config.cson | 4 ++-- src/config-schema.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dot-atom/config.cson b/dot-atom/config.cson index a93b83e66..a3a5984af 100644 --- a/dot-atom/config.cson +++ b/dot-atom/config.cson @@ -2,6 +2,6 @@ 'fontSize': 16 'core': 'themes': [ - 'atom-dark-ui' - 'atom-dark-syntax' + 'one-dark-ui' + 'one-dark-syntax' ] diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 078d7a40b..1f205ecbf 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -28,7 +28,7 @@ module.exports = type: 'string' themes: type: 'array' - default: ['atom-dark-ui', 'atom-dark-syntax'] + default: ['one-dark-ui', 'one-dark-syntax'] items: type: 'string' projectHome: From 46e881739c81527887392ce36b8553e96e5efb3f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 15:11:12 -0700 Subject: [PATCH 064/521] Set themes names at beginning of spec --- spec/theme-manager-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/theme-manager-spec.coffee b/spec/theme-manager-spec.coffee index 94e5fad61..5e65da1fa 100644 --- a/spec/theme-manager-spec.coffee +++ b/spec/theme-manager-spec.coffee @@ -129,6 +129,7 @@ describe "ThemeManager", -> expect(importPaths[0]).toContain 'atom-dark-ui' it 'adds theme-* classes to the workspace for each active theme', -> + atom.config.set('core.themes', ['atom-dark-ui', 'atom-dark-syntax']) workspaceElement = atom.views.getView(atom.workspace) themeManager.onDidChangeActiveThemes didChangeActiveThemesHandler = jasmine.createSpy() From 55a7ef352d16f6fb238f8b74de3c2d488fb1b9c2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:54:49 -0700 Subject: [PATCH 065/521] Deprecate all TextEditor::on calls --- src/text-editor.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 229335c11..7db2aa810 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -512,6 +512,9 @@ class TextEditor extends Model when 'scroll-left-changed' deprecate("Use TextEditor::onDidChangeScrollLeft instead") + else + deprecate("TextEditor::on is deprecated. Use documented event subscription methods instead.") + EmitterMixin::on.apply(this, arguments) # Retrieves the current {TextBuffer}. From 7c15ec36a35318f1d5e8d09c8da7833636e66171 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:56:40 -0700 Subject: [PATCH 066/521] Deprecate all Marker::on calls --- src/marker.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/marker.coffee b/src/marker.coffee index 98e3f0265..2224ca1c7 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -124,6 +124,8 @@ class Marker Grim.deprecate("Use Marker::onDidChange instead") when 'destroyed' Grim.deprecate("Use Marker::onDidDestroy instead") + else + Grim.deprecate("Marker::on is deprecated. Use documented event subscription methods instead.") EmitterMixin::on.apply(this, arguments) From 76df65b720dc280809a2eb3f4b0e4f9e871638f0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:57:12 -0700 Subject: [PATCH 067/521] Deprecate all Project::on calls --- src/project.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/project.coffee b/src/project.coffee index 69406dbda..b15f32615 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -121,6 +121,8 @@ class Project extends Model on: (eventName) -> if eventName is 'path-changed' Grim.deprecate("Use Project::onDidChangePaths instead") + else + Grim.deprecate("Project::on is deprecated. Use documented event subscription methods instead.") super ### From fd614572f168d08309b0f65a6338097ef6a387a1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 14:57:27 -0700 Subject: [PATCH 068/521] Deprecate all Selection::on calls --- src/selection.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/selection.coffee b/src/selection.coffee index c23d106fe..5b0fdae38 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -67,6 +67,8 @@ class Selection extends Model Grim.deprecate("Use Selection::onDidChangeRange instead. Call ::getScreenRange() yourself in your callback if you need the range.") when 'destroyed' Grim.deprecate("Use Selection::onDidDestroy instead.") + else + Grim.deprecate("Selection::on is deprecated. Use documented event subscription methods instead.") super From 03a59c570e30194c871100be36fed7c16a4e3cf0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 15:37:10 -0700 Subject: [PATCH 069/521] Subscribe to onDidDestroy when available --- src/pane.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pane.coffee b/src/pane.coffee index 5cdc3016a..1aee42715 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -1,6 +1,6 @@ {find, compact, extend, last} = require 'underscore-plus' {Model} = require 'theorist' -{Emitter} = require 'event-kit' +{CompositeDisposable, Emitter} = require 'event-kit' Serializable = require 'serializable' Grim = require 'grim' PaneAxis = require './pane-axis' @@ -34,6 +34,7 @@ class Pane extends Model super @emitter = new Emitter + @subscriptions = new CompositeDisposable @items = [] @addItems(compact(params?.items ? [])) @@ -340,6 +341,8 @@ class Pane extends Model addItem: (item, index=@getActiveItemIndex() + 1) -> return if item in @items + if typeof item.onDidDestroy is 'function' + @subscriptions.add item.onDidDestroy => @removeItem(item, true) if typeof item.on is 'function' @subscribe item, 'destroyed', => @removeItem(item, true) @@ -579,6 +582,7 @@ class Pane extends Model @container.activateNextPane() if @isActive() @emitter.emit 'did-destroy' @emitter.dispose() + @subscriptions.dispose() item.destroy?() for item in @items.slice() @container?.didDestroyPane(pane: this) From 2219abece186d26cf460b7d224342e1aa7db706e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 15:46:44 -0700 Subject: [PATCH 070/521] Don't use deprecated buffer events --- src/git-repository.coffee | 3 ++- src/project.coffee | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index d523b562f..c4a9d34f5 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -96,7 +96,8 @@ class GitRepository @subscriptions.add new Disposable(-> window.removeEventListener 'focus', onWindowFocus) if @project? - @subscriptions.add @project.eachBuffer (buffer) => @subscribeToBuffer(buffer) + @project.getBuffers().forEach (buffer) => @subscribeToBuffer(buffer) + @subscriptions.add @project.onDidAddBuffer (buffer) => @subscribeToBuffer(buffer) # Public: Destroy this {GitRepository} object. # diff --git a/src/project.coffee b/src/project.coffee index b15f32615..a54d5edd1 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -118,6 +118,9 @@ class Project extends Model onDidChangePaths: (callback) -> @emitter.on 'did-change-paths', callback + onDidAddBuffer: (callback) -> + @emitter.on 'did-add-buffer', callback + on: (eventName) -> if eventName is 'path-changed' Grim.deprecate("Use Project::onDidChangePaths instead") @@ -436,6 +439,7 @@ class Project extends Model @buffers.splice(index, 0, buffer) @subscribeToBuffer(buffer) @emit 'buffer-created', buffer + @emitter.emit 'did-add-buffer', buffer buffer # Removes a {TextBuffer} association from the project. From 4d344c16b3ca26c7356bd98b30995716ad5a54fc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 15:50:13 -0700 Subject: [PATCH 071/521] Don't call on when onDidDestroy exists --- src/pane.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pane.coffee b/src/pane.coffee index 1aee42715..6a36bec2b 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -343,7 +343,7 @@ class Pane extends Model if typeof item.onDidDestroy is 'function' @subscriptions.add item.onDidDestroy => @removeItem(item, true) - if typeof item.on is 'function' + else if typeof item.on is 'function' @subscribe item, 'destroyed', => @removeItem(item, true) @items.splice(index, 0, item) From 84f7e6048e69bf605c8e0502b842b3f280a05e85 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 16:22:02 -0700 Subject: [PATCH 072/521] :arrow_up: bracket-matcher@0.72 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cbce46ba8..e764aba90 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "autosave": "0.20.0", "background-tips": "0.23.0", "bookmarks": "0.35.0", - "bracket-matcher": "0.71.0", + "bracket-matcher": "0.72.0", "command-palette": "0.34.0", "deprecation-cop": "0.37.0", "dev-live-reload": "0.44.0", From 792a124668d64a27589929eb1914447308db1192 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 16:25:45 -0700 Subject: [PATCH 073/521] Add onDidChangeIcon event subscription --- src/text-editor.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 7db2aa810..f731810ae 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -457,6 +457,10 @@ class TextEditor extends Model onDidChangeScrollLeft: (callback) -> @emitter.on 'did-change-scroll-left', callback + # TODO Remove once the tabs package no longer uses .on subscriptions + onDidChangeIcon: (callback) -> + @emitter.on 'did-change-icon', callback + on: (eventName) -> switch eventName when 'title-changed' From 0a1637184591688315b9c909c9e4759f43732fc6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 16:35:16 -0700 Subject: [PATCH 074/521] Dispose of destroyed listener on remove item --- src/pane.coffee | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index 6a36bec2b..82f183e30 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -1,6 +1,6 @@ {find, compact, extend, last} = require 'underscore-plus' {Model} = require 'theorist' -{CompositeDisposable, Emitter} = require 'event-kit' +{Emitter} = require 'event-kit' Serializable = require 'serializable' Grim = require 'grim' PaneAxis = require './pane-axis' @@ -34,7 +34,7 @@ class Pane extends Model super @emitter = new Emitter - @subscriptions = new CompositeDisposable + @itemSubscriptions = new WeakMap @items = [] @addItems(compact(params?.items ? [])) @@ -342,7 +342,7 @@ class Pane extends Model return if item in @items if typeof item.onDidDestroy is 'function' - @subscriptions.add item.onDidDestroy => @removeItem(item, true) + @itemSubscriptions.set item, item.onDidDestroy => @removeItem(item, true) else if typeof item.on is 'function' @subscribe item, 'destroyed', => @removeItem(item, true) @@ -373,6 +373,9 @@ class Pane extends Model if typeof item.on is 'function' @unsubscribe item + @itemSubscriptions.get(item)?.dispose() + @itemSubscriptions.delete(item) + if item is @activeItem if @items.length is 1 @setActiveItem(undefined) @@ -582,8 +585,10 @@ class Pane extends Model @container.activateNextPane() if @isActive() @emitter.emit 'did-destroy' @emitter.dispose() - @subscriptions.dispose() - item.destroy?() for item in @items.slice() + for item in @items.slice() + @itemSubscriptions.get(item)?.dispose() + @itemSubscriptions.delete(item) + item.destroy?() @container?.didDestroyPane(pane: this) ### From 05bcebe583adb794cb148bdd44be80d8f359c5c8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Mar 2015 16:44:46 -0700 Subject: [PATCH 075/521] Add unsubscribe from item helper --- src/pane.coffee | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index 82f183e30..0f19c40bf 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -250,6 +250,10 @@ class Pane extends Model getPanes: -> [this] + unsubscribeFromItem: (item) -> + @itemSubscriptions.get(item)?.dispose() + @itemSubscriptions.delete(item) + ### Section: Items ### @@ -372,9 +376,7 @@ class Pane extends Model if typeof item.on is 'function' @unsubscribe item - - @itemSubscriptions.get(item)?.dispose() - @itemSubscriptions.delete(item) + @unsubscribeFromItem(item) if item is @activeItem if @items.length is 1 @@ -585,10 +587,7 @@ class Pane extends Model @container.activateNextPane() if @isActive() @emitter.emit 'did-destroy' @emitter.dispose() - for item in @items.slice() - @itemSubscriptions.get(item)?.dispose() - @itemSubscriptions.delete(item) - item.destroy?() + item.destroy?() for item in @items.slice() @container?.didDestroyPane(pane: this) ### From a43333ce234d86973f6d4adc5573afe9727d9d63 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 16 Mar 2015 18:55:11 -0700 Subject: [PATCH 076/521] :arrow_up: atom-dark-ui@0.49.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e764aba90..f3a11d19a 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ }, "packageDependencies": { "atom-dark-syntax": "0.26.0", - "atom-dark-ui": "0.47.0", + "atom-dark-ui": "0.49.0", "atom-light-syntax": "0.26.0", "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.25.0", From 8c5db29035bbd8984c53dae14e56a1bc4edee79b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 17 Mar 2015 10:46:30 -0700 Subject: [PATCH 077/521] :arrow_up: notifications@0.33.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f3a11d19a..964e2ecd8 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "link": "0.30.0", "markdown-preview": "0.141.0", "metrics": "0.45.0", - "notifications": "0.32.0", + "notifications": "0.33.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", From 916f3c0996053d010e80568ccfb3c1ce3bbf6015 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 11:33:12 -0700 Subject: [PATCH 078/521] :arrow_up: language-perl@0.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 964e2ecd8..163cffb09 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.17.0", + "language-perl": "0.18.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From fec8ea42729278e66f1b212bce38f5a7848275d0 Mon Sep 17 00:00:00 2001 From: vegar Date: Tue, 17 Mar 2015 20:09:37 +0100 Subject: [PATCH 079/521] Documentation: workspace.open( ) with no URI I just learned that [calling open on workspace](https://discuss.atom.io/t/how-can-we-help-you-write-packages/4268/67) without specifying an uri is the way to go for getting a new tab with a new document. I can't find anything about this in either the docs or the [api documentation.](https://atom.io/docs/api/v0.187.0/Workspace#instance-open) Should `uri` be marked optional, like the `options` params? And should it be added a line stating that no uri opens a blank editor? (and there's an extra `a` in the title..) --- src/workspace.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 49f84f9b8..c8040f920 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -371,9 +371,11 @@ class Workspace extends Model Section: Opening ### - # Essential: Open a given a URI in Atom asynchronously. - # - # * `uri` A {String} containing a URI. + # Essential: Open a given URI in Atom asynchronously. + # If no URI is given, or URI does not resolve to an existing file, + # a new empty text edtior is created. + # + # * `uri` (optional) A {String} containing a URI. # * `options` (optional) {Object} # * `initialLine` A {Number} indicating which row to move the cursor to # initially. Defaults to `0`. From ddb45566581147385735b7091062152f43c437af Mon Sep 17 00:00:00 2001 From: octref Date: Tue, 17 Mar 2015 15:27:02 -0400 Subject: [PATCH 080/521] Don't tokenize on NullGrammar For file format that Atom doesn't recognize as a programming language, such as log files, skip Tokenization since no syntax highlighting should be done. --- src/tokenized-buffer.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 67e4deb87..b068e587b 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -138,6 +138,7 @@ class TokenizedBuffer extends Model tokenizeInBackground: -> return if not @visible or @pendingChunk or not @isAlive() + return if @grammar is @grammar.registry.nullGrammar @pendingChunk = true _.defer => @pendingChunk = false From 7a4ad18f6a324e70ed46d3b230382ddcb94d658a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 17 Mar 2015 13:51:41 -0600 Subject: [PATCH 081/521] :arrow_up: markdown-preview --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 163cffb09..343a0c537 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.141.0", + "markdown-preview": "0.142.0", "metrics": "0.45.0", "notifications": "0.33.0", "open-on-github": "0.34.0", From 67b1d7890b4bd1f5ae78c67eb35c0cdb77812246 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 17 Mar 2015 22:05:43 +0100 Subject: [PATCH 082/521] Add soft-wrap hanging indentation spaces --- src/display-buffer.coffee | 10 +++++++++- src/tokenized-line.coffee | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 5659d38a0..ecdd36c6d 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -69,12 +69,17 @@ class DisplayBuffer extends Model scrollPastEnd: atom.config.get('editor.scrollPastEnd', scope: scopeDescriptor) softWrap: atom.config.get('editor.softWrap', scope: scopeDescriptor) softWrapAtPreferredLineLength: atom.config.get('editor.softWrapAtPreferredLineLength', scope: scopeDescriptor) + softWrapHangingIndentationSpaces: atom.config.get('editor.softWrapHangingIndentationSpaces', scope: scopeDescriptor) preferredLineLength: atom.config.get('editor.preferredLineLength', scope: scopeDescriptor) subscriptions.add atom.config.onDidChange 'editor.softWrap', scope: scopeDescriptor, ({newValue}) => @configSettings.softWrap = newValue @updateWrappedScreenLines() + subscriptions.add atom.config.onDidChange 'editor.softWrapHangingIndentationSpaces', scope: scopeDescriptor, ({newValue}) => + @configSettings.softWrapHangingIndentationSpaces = newValue + @updateWrappedScreenLines() + subscriptions.add atom.config.onDidChange 'editor.softWrapAtPreferredLineLength', scope: scopeDescriptor, ({newValue}) => @configSettings.softWrapAtPreferredLineLength = newValue @updateWrappedScreenLines() if @isSoftWrapped() @@ -1157,7 +1162,10 @@ class DisplayBuffer extends Model softWraps = 0 if @isSoftWrapped() while wrapScreenColumn = tokenizedLine.findWrapColumn(@getSoftWrapColumn()) - [wrappedLine, tokenizedLine] = tokenizedLine.softWrapAt(wrapScreenColumn) + [wrappedLine, tokenizedLine] = tokenizedLine.softWrapAt( + wrapScreenColumn, + hangingIndentationSpaces: @configSettings.softWrapHangingIndentationSpaces + ) break if wrappedLine.hasOnlySoftWrapIndentation() screenLines.push(wrappedLine) softWraps++ diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 3560c35a1..ab12d39c3 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -118,18 +118,23 @@ class TokenizedLine oddIndentLevel = @indentLevel - Math.floor(@indentLevel) Math.round(@tabLength * oddIndentLevel) - buildSoftWrapIndentationTokens: (token) -> + buildSoftWrapIndentationTokens: (token, hangingIndentationSpaces) -> indentTokens = [0...Math.floor(@indentLevel)].map => token.buildSoftWrapIndentationToken(@tabLength) if @getOddIndentationSpaces() - indentTokens.concat( - token.buildSoftWrapIndentationToken @getOddIndentationSpaces() + indentTokens.push( + token.buildSoftWrapIndentationToken(@getOddIndentationSpaces()) ) - else - indentTokens - softWrapAt: (column) -> + if hangingIndentationSpaces + indentTokens.push( + token.buildSoftWrapIndentationToken(hangingIndentationSpaces) + ) + + indentTokens + + softWrapAt: (column, {hangingIndentationSpaces}) -> return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 rightTokens = new Array(@tokens...) @@ -142,7 +147,7 @@ class TokenizedLine leftTextLength += nextToken.value.length leftTokens.push nextToken - indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0]) + indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0], hangingIndentationSpaces) leftFragment = new TokenizedLine( tokens: leftTokens From 6d39bd3657eb64bd1a1f4fb1589768bdf1553b72 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 17 Mar 2015 22:21:07 +0100 Subject: [PATCH 083/521] :white_check_mark: Verify that hanging indentation is tokenized --- spec/display-buffer-spec.coffee | 6 ++++++ src/tokenized-line.coffee | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index df7c13383..5a719198d 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -128,6 +128,12 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() + it "correctly tokenizes hanging indentation spaces", -> + atom.config.set("editor.softWrapHangingIndentationSpaces", 3) + expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() + expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() + expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[2].isSoftWrapIndentation).toBeTruthy() + describe "when the buffer changes", -> describe "when buffer lines are updated", -> describe "when whitespace is added after the max line length", -> diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index ab12d39c3..0437fbdcf 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -134,9 +134,11 @@ class TokenizedLine indentTokens - softWrapAt: (column, {hangingIndentationSpaces}) -> + softWrapAt: (column, options = {}) -> return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 + {hangingIndentationSpaces} = options + rightTokens = new Array(@tokens...) leftTokens = [] leftTextLength = 0 From c4d2e0eac8c62e2aafb5784813e7b2ae1a4c28cc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 17 Mar 2015 22:42:51 +0100 Subject: [PATCH 084/521] Add default editor.softWrapHangingIndentationSpaces --- src/config-schema.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 1f205ecbf..74fc719a4 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -149,6 +149,9 @@ module.exports = softWrapAtPreferredLineLength: type: 'boolean' default: false + softWrapHangingIndentationSpaces: + type: 'integer' + default: 0 scrollSensitivity: type: 'integer' default: 40 From 6ac8af2a6e7799cbf72e2fc6998f9329159e40d0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 17 Mar 2015 22:58:14 +0100 Subject: [PATCH 085/521] :white_check_mark: Check leading spaces as well --- spec/display-buffer-spec.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 5a719198d..1306174aa 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -128,8 +128,15 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() + describe "when editor.softWrapHangingIndentationSpaces is set", -> + beforeEach -> + atom.config.set('editor.softWrapHangingIndentationSpaces', 3) + + it "further indents wrapped lines", -> + expect(displayBuffer.tokenizedLineForScreenRow(11).text).toBe " sort(left).concat(pivot).concat(sort(right)" + expect(displayBuffer.tokenizedLineForScreenRow(12).text).toBe " );" + it "correctly tokenizes hanging indentation spaces", -> - atom.config.set("editor.softWrapHangingIndentationSpaces", 3) expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[2].isSoftWrapIndentation).toBeTruthy() From 5dc537778f7897a6226d821bcff86f05f6cf45c5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 14:45:09 -0700 Subject: [PATCH 086/521] :arrow_up: pathwatcher@4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 343a0c537..9863433fd 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "nslog": "^2.0.0", "oniguruma": "^4.0.0", "optimist": "0.4.0", - "pathwatcher": "^3.3.3", + "pathwatcher": "^4.2", "property-accessors": "^1.1.3", "q": "^1.1.2", "random-words": "0.0.1", From 408c1d31777704a643e4dec34446073be6f3f456 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 14:46:52 -0700 Subject: [PATCH 087/521] :arrow_up: text-buffer@5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9863433fd..42a5ff0de 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^4.1.5", + "text-buffer": "^5", "theorist": "^1.0.2", "underscore-plus": "^1.6.6" }, From 782b7fd873f4847a8b44cca9941a6b35d67a29ae Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 14:52:02 -0700 Subject: [PATCH 088/521] :arrow_up: atom-keymap@4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 42a5ff0de..f31f725f9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.21.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^3.1.5", + "atom-keymap": "^4", "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", From db487baaa62ca26313831b54c8591b69c48a5ed5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:00:37 -0700 Subject: [PATCH 089/521] :arrow_up: archive-view@0.53 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f31f725f9..c8eb8da22 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "one-light-ui": "0.4.0", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", - "archive-view": "0.52.0", + "archive-view": "0.53.0", "autocomplete": "0.44.0", "autoflow": "0.22.0", "autosave": "0.20.0", From 090b47d3501c70db5b8cfd614f3fc648aa60b82e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:02:20 -0700 Subject: [PATCH 090/521] :arrow_up: dev-live-reload@0.45 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8eb8da22..9b046a5a9 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "bracket-matcher": "0.72.0", "command-palette": "0.34.0", "deprecation-cop": "0.37.0", - "dev-live-reload": "0.44.0", + "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", "feedback": "0.34.0", From cb2f9bdf2d110609167fd6e0c3a6f63cfc4b0869 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:04:53 -0700 Subject: [PATCH 091/521] :arrow_up: image-view@0.52 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b046a5a9..85278ecc2 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", - "image-view": "0.51.0", + "image-view": "0.52.0", "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", From 5b34ba645c00258f18c139b87c97c050c1bfbd99 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:18:44 -0700 Subject: [PATCH 092/521] :arrow_up: pathwatcher@4.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85278ecc2..a4b66bd40 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "nslog": "^2.0.0", "oniguruma": "^4.0.0", "optimist": "0.4.0", - "pathwatcher": "^4.2", + "pathwatcher": "^4.3", "property-accessors": "^1.1.3", "q": "^1.1.2", "random-words": "0.0.1", From 862b990a8088948957140dfc0a63dd9bab2a0bc2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:29:52 -0700 Subject: [PATCH 093/521] :arrow_up: markdown-preview@0.143 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a4b66bd40..eb078dd26 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.142.0", + "markdown-preview": "0.143.0", "metrics": "0.45.0", "notifications": "0.33.0", "open-on-github": "0.34.0", From e15cde0b2237f13745259a0dc41a1e1925145eee Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:41:02 -0700 Subject: [PATCH 094/521] :arrow_up: snippets@0.83 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb078dd26..b9015e8f3 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.184.0", - "snippets": "0.82.0", + "snippets": "0.83.0", "spell-check": "0.55.0", "status-bar": "0.63.0", "styleguide": "0.44.0", From 6df9fa85118a0181d8b4254c15b1f9886ce51e43 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:42:07 -0700 Subject: [PATCH 095/521] :arrow_up: symbols-view@0.91 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b9015e8f3..7e3eafbe8 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "spell-check": "0.55.0", "status-bar": "0.63.0", "styleguide": "0.44.0", - "symbols-view": "0.90.0", + "symbols-view": "0.91.0", "tabs": "0.67.0", "timecop": "0.31.0", "tree-view": "0.167.0", From 2e2b4355e3a28a90e109e15d1d69249b871f8c92 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 15:43:09 -0700 Subject: [PATCH 096/521] :arrow_up: tree-view@0.168 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e3eafbe8..018424cbc 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "symbols-view": "0.91.0", "tabs": "0.67.0", "timecop": "0.31.0", - "tree-view": "0.167.0", + "tree-view": "0.168.0", "update-package-dependencies": "0.9.0", "welcome": "0.25.0", "whitespace": "0.29.0", From 9e28d31054ffcc18735167e92bb47322646195a8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 16:09:47 -0700 Subject: [PATCH 097/521] :arrow_up: pathwatcher@4.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 018424cbc..dad0a1b0c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "nslog": "^2.0.0", "oniguruma": "^4.0.0", "optimist": "0.4.0", - "pathwatcher": "^4.3", + "pathwatcher": "^4.3.1", "property-accessors": "^1.1.3", "q": "^1.1.2", "random-words": "0.0.1", From eb63556b27a347772007ffae389a621b53b6e1b0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 16:51:52 -0700 Subject: [PATCH 098/521] Use - in socket file name --- benchmark/browser-process-startup.coffee | 2 +- spec/integration/helpers/start-atom.coffee | 2 +- src/browser/atom-application.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmark/browser-process-startup.coffee b/benchmark/browser-process-startup.coffee index 53748f5d0..2b06eaaa4 100755 --- a/benchmark/browser-process-startup.coffee +++ b/benchmark/browser-process-startup.coffee @@ -8,7 +8,7 @@ _ = require 'underscore-plus' temp = require 'temp' directoryToOpen = temp.mkdirSync('browser-process-startup-') -socketPath = path.join(os.tmpdir(), "atom_#{process.env['USER']}.sock") +socketPath = path.join(os.tmpdir(), "atom-#{process.env.USER}.sock") numberOfRuns = 10 deleteSocketFile = -> diff --git a/spec/integration/helpers/start-atom.coffee b/spec/integration/helpers/start-atom.coffee index 9d57e93ae..4be2efab8 100644 --- a/spec/integration/helpers/start-atom.coffee +++ b/spec/integration/helpers/start-atom.coffee @@ -9,7 +9,7 @@ webdriverio = require "../../../build/node_modules/webdriverio" AtomPath = remote.process.argv[0] AtomLauncherPath = path.join(__dirname, "..", "helpers", "atom-launcher.sh") ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'atom-shell', 'chromedriver', 'chromedriver') -SocketPath = path.join(temp.mkdirSync("socket-dir"), "atom_#{process.env['USER']}.sock") +SocketPath = path.join(temp.mkdirSync("socket-dir"), "atom-#{process.env.USER}.sock") ChromedriverPort = 9515 buildAtomClient = (args, env) -> diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 138448f52..8fa888730 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -18,7 +18,7 @@ DefaultSocketPath = if process.platform is 'win32' '\\\\.\\pipe\\atom-sock' else - path.join(os.tmpdir(), "atom_#{process.env.USER}.sock") + path.join(os.tmpdir(), "atom-#{process.env.USER}.sock") # The application's singleton class. # From cd5adb6ab72bdd30168888161972469a77299a52 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 17:41:22 -0700 Subject: [PATCH 099/521] Clear invalid rows when short-circuiting for null grammar --- spec/tokenized-buffer-spec.coffee | 22 ++++++++++++++++++++++ src/tokenized-buffer.coffee | 19 ++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index 0adcd2756..c1b16ff08 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -878,3 +878,25 @@ describe "TokenizedBuffer", -> expect(tokenizedBuffer.tokenizedLineForRow(6).foldable).toBe true expect(tokenizedBuffer.tokenizedLineForRow(7).foldable).toBe false expect(tokenizedBuffer.tokenizedLineForRow(8).foldable).toBe false + + describe "when the buffer is configured with the null grammar", -> + it "uses the placeholder tokens and does not actually tokenize using the grammar", -> + spyOn(atom.grammars.nullGrammar, 'tokenizeLine').andCallThrough() + buffer = atom.project.bufferForPathSync('sample.will-use-the-null-grammar') + buffer.setText('a\nb\nc') + + tokenizedBuffer = new TokenizedBuffer({buffer}) + tokenizeCallback = jasmine.createSpy('onDidTokenize') + tokenizedBuffer.onDidTokenize(tokenizeCallback) + + fullyTokenize(tokenizedBuffer) + + expect(tokenizeCallback.callCount).toBe 1 + expect(atom.grammars.nullGrammar.tokenizeLine.callCount).toBe 0 + + expect(tokenizedBuffer.tokenizedLineForRow(0).tokens.length).toBe 1 + expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0].value).toBe 'a' + expect(tokenizedBuffer.tokenizedLineForRow(1).tokens.length).toBe 1 + expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0].value).toBe 'b' + expect(tokenizedBuffer.tokenizedLineForRow(2).tokens.length).toBe 1 + expect(tokenizedBuffer.tokenizedLineForRow(2).tokens[0].value).toBe 'c' diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index b068e587b..b8a9bdab7 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -138,13 +138,19 @@ class TokenizedBuffer extends Model tokenizeInBackground: -> return if not @visible or @pendingChunk or not @isAlive() - return if @grammar is @grammar.registry.nullGrammar + @pendingChunk = true _.defer => @pendingChunk = false @tokenizeNextChunk() if @isAlive() and @buffer.isAlive() tokenizeNextChunk: -> + # Short circuit null grammar which can just use the placeholder tokens + if @grammar is atom.grammars.nullGrammar and @firstInvalidRow()? + @invalidRows = [] + @markTokenizationComplete() + return + rowsRemaining = @chunkSize while @firstInvalidRow()? and rowsRemaining > 0 @@ -178,10 +184,13 @@ class TokenizedBuffer extends Model if @firstInvalidRow()? @tokenizeInBackground() else - unless @fullyTokenized - @emit 'tokenized' - @emitter.emit 'did-tokenize' - @fullyTokenized = true + @markTokenizationComplete() + + markTokenizationComplete: -> + unless @fullyTokenized + @emit 'tokenized' + @emitter.emit 'did-tokenize' + @fullyTokenized = true firstInvalidRow: -> @invalidRows[0] From 67754506953457119896da96d6d462e1ff9f34b6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 17 Mar 2015 18:00:34 -0700 Subject: [PATCH 100/521] :arrow_up: snippets@0.84 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dad0a1b0c..6fea8211a 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.184.0", - "snippets": "0.83.0", + "snippets": "0.84.0", "spell-check": "0.55.0", "status-bar": "0.63.0", "styleguide": "0.44.0", From 9f536c99cf28917eae9ae252c0bd998072789b56 Mon Sep 17 00:00:00 2001 From: Daniel Hengeveld Date: Tue, 17 Mar 2015 23:28:46 -0700 Subject: [PATCH 101/521] :arrow_up: settings-view@0.185 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fea8211a..cb7b27bd5 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.184.0", + "settings-view": "0.185.0", "snippets": "0.84.0", "spell-check": "0.55.0", "status-bar": "0.63.0", From e7e754eb3068e86d1e19eec7c70dfc2d0d4ab51b Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Wed, 18 Mar 2015 17:40:49 +1100 Subject: [PATCH 102/521] :memo: document where to add the tests and how to run them --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 32dccf299..6be3b8778 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ For more information on how to work with Atom's official packages, see [JavaScript](https://github.com/styleguide/javascript), and [CSS](https://github.com/styleguide/css) styleguides. * Include thoughtfully-worded, well-structured - [Jasmine](http://jasmine.github.io/) specs. + [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. Run them using `script/grunt run-specs` target with atom closed. * Document new code based on the [Documentation Styleguide](#documentation-styleguide) * End files with a newline. From 8793bebfab542915a7b8fde58228ff86f8d506fc Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Wed, 18 Mar 2015 17:53:15 +1100 Subject: [PATCH 103/521] :white_check_mark: tests for typescript transpiling --- spec/fixtures/typescript/invalid.ts | 1 + spec/fixtures/typescript/valid.ts | 2 ++ spec/typescript-spec.coffee | 36 +++++++++++++++++++++++++++++ src/typescript.coffee | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/typescript/invalid.ts create mode 100644 spec/fixtures/typescript/valid.ts create mode 100644 spec/typescript-spec.coffee diff --git a/spec/fixtures/typescript/invalid.ts b/spec/fixtures/typescript/invalid.ts new file mode 100644 index 000000000..7a8d0b6d0 --- /dev/null +++ b/spec/fixtures/typescript/invalid.ts @@ -0,0 +1 @@ +var foo = 123 123; // Syntax error diff --git a/spec/fixtures/typescript/valid.ts b/spec/fixtures/typescript/valid.ts new file mode 100644 index 000000000..46cf54693 --- /dev/null +++ b/spec/fixtures/typescript/valid.ts @@ -0,0 +1,2 @@ +var inc = v => v + 1 +export = inc diff --git a/spec/typescript-spec.coffee b/spec/typescript-spec.coffee new file mode 100644 index 000000000..408e9fb77 --- /dev/null +++ b/spec/typescript-spec.coffee @@ -0,0 +1,36 @@ +typescript = require '../src/typescript' +crypto = require 'crypto' + +describe "TypeScript transpiler support", -> + beforeEach -> + jasmine.snapshotDeprecations() + + afterEach -> + jasmine.restoreDeprecationsSnapshot() + + describe "::createTypeScriptVersionAndOptionsDigest", -> + it "returns a digest for the library version and specified options", -> + defaultOptions = + target: 1 # ES5 + module: 'commonjs' + sourceMap: true + version = '1.4.1' + shasum = crypto.createHash('sha1') + shasum.update('typescript', 'utf8') + shasum.update('\0', 'utf8') + shasum.update(version, 'utf8') + shasum.update('\0', 'utf8') + shasum.update('{"target": 1,"module": "commonjs","sourceMap": true,}') + expectedDigest = shasum.digest('hex') + + observedDigest = typescript.createTypeScriptVersionAndOptionsDigest(version, defaultOptions) + expect(observedDigest).toEqual expectedDigest + + describe "when there is a .ts file", -> + it "transpiles it using typescript", -> + transpiled = require('./fixtures/typescript/valid.ts') + expect(transpiled(3)).toBe 4 + + describe "when the .ts file is invalid", -> + it "does not transpile", -> + expect(-> require('./fixtures/typescript/invalid.ts')).toThrow() diff --git a/src/typescript.coffee b/src/typescript.coffee index e47e7b2a1..e336eceff 100644 --- a/src/typescript.coffee +++ b/src/typescript.coffee @@ -14,7 +14,7 @@ stats = misses: 0 defaultOptions = - target: 1 + target: 1 # ES5 module: 'commonjs' sourceMap: true From f0b9bb7ce3e75f716c0d0297bbcacee5fe289f81 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 11:17:34 +0100 Subject: [PATCH 104/521] Show indent guides on hanging indentation too --- spec/display-buffer-spec.coffee | 1 + src/tokenized-line.coffee | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 1306174aa..1b3ef3c8a 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -140,6 +140,7 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[2].isSoftWrapIndentation).toBeTruthy() + expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[3].isSoftWrapIndentation).toBeTruthy() describe "when the buffer changes", -> describe "when buffer lines are updated", -> diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 0437fbdcf..14208e36b 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -111,28 +111,26 @@ class TokenizedLine return maxColumn - # Calculates how many trailing spaces in this line's indentation cannot fit in a single tab. + # For a given `indentLevel`, calculates how many trailing spaces cannot fit in a single tab. # - # Returns a {Number} representing the odd indentation spaces in this line. - getOddIndentationSpaces: -> - oddIndentLevel = @indentLevel - Math.floor(@indentLevel) + # indentLevel - {Number} + # Returns a {Number} representing the odd indentation spaces for `indentLevel`. + oddIndentationSpacesForIndentLevel: (indentLevel) -> + oddIndentLevel = indentLevel - Math.floor(indentLevel) Math.round(@tabLength * oddIndentLevel) buildSoftWrapIndentationTokens: (token, hangingIndentationSpaces) -> - indentTokens = [0...Math.floor(@indentLevel)].map => + hangingIndentLevel = hangingIndentationSpaces / @tabLength + indentLevel = @indentLevel + hangingIndentLevel + indentTokens = [0...Math.floor(indentLevel)].map => token.buildSoftWrapIndentationToken(@tabLength) - if @getOddIndentationSpaces() - indentTokens.push( - token.buildSoftWrapIndentationToken(@getOddIndentationSpaces()) + if oddIndentationSpaces = @oddIndentationSpacesForIndentLevel(indentLevel) + indentTokens.concat( + token.buildSoftWrapIndentationToken(oddIndentationSpaces) ) - - if hangingIndentationSpaces - indentTokens.push( - token.buildSoftWrapIndentationToken(hangingIndentationSpaces) - ) - - indentTokens + else + indentTokens softWrapAt: (column, options = {}) -> return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 From ae2c92a1dc15385ee0bf262c3199f8defd0d4c7a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 11:29:39 +0100 Subject: [PATCH 105/521] :memo: --- src/tokenized-line.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 14208e36b..dfc8cac83 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -114,7 +114,7 @@ class TokenizedLine # For a given `indentLevel`, calculates how many trailing spaces cannot fit in a single tab. # # indentLevel - {Number} - # Returns a {Number} representing the odd indentation spaces for `indentLevel`. + # Returns a {Number} representing the odd indentation spaces in `indentLevel`. oddIndentationSpacesForIndentLevel: (indentLevel) -> oddIndentLevel = indentLevel - Math.floor(indentLevel) Math.round(@tabLength * oddIndentLevel) From e5fa44171df82962efb185d6b5d36ab2b8329f86 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 14:15:52 +0100 Subject: [PATCH 106/521] :bug: Hanging indent must be a positive value --- src/config-schema.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 74fc719a4..92d80069f 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -152,6 +152,7 @@ module.exports = softWrapHangingIndentationSpaces: type: 'integer' default: 0 + minimum: 0 scrollSensitivity: type: 'integer' default: 40 From 7c33b9bf41681f0eb21a1264370e62f6056119a9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 14:18:27 +0100 Subject: [PATCH 107/521] :art: Rename to softWrapHangingIndent --- spec/display-buffer-spec.coffee | 4 ++-- src/config-schema.coffee | 2 +- src/display-buffer.coffee | 8 ++++---- src/tokenized-line.coffee | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 1b3ef3c8a..4f2046434 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -128,9 +128,9 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() - describe "when editor.softWrapHangingIndentationSpaces is set", -> + describe "when editor.softWrapHangingIndent is set", -> beforeEach -> - atom.config.set('editor.softWrapHangingIndentationSpaces', 3) + atom.config.set('editor.softWrapHangingIndent', 3) it "further indents wrapped lines", -> expect(displayBuffer.tokenizedLineForScreenRow(11).text).toBe " sort(left).concat(pivot).concat(sort(right)" diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 92d80069f..c2944911b 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -149,7 +149,7 @@ module.exports = softWrapAtPreferredLineLength: type: 'boolean' default: false - softWrapHangingIndentationSpaces: + softWrapHangingIndent: type: 'integer' default: 0 minimum: 0 diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index ecdd36c6d..c8ec23e07 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -69,15 +69,15 @@ class DisplayBuffer extends Model scrollPastEnd: atom.config.get('editor.scrollPastEnd', scope: scopeDescriptor) softWrap: atom.config.get('editor.softWrap', scope: scopeDescriptor) softWrapAtPreferredLineLength: atom.config.get('editor.softWrapAtPreferredLineLength', scope: scopeDescriptor) - softWrapHangingIndentationSpaces: atom.config.get('editor.softWrapHangingIndentationSpaces', scope: scopeDescriptor) + softWrapHangingIndent: atom.config.get('editor.softWrapHangingIndent', scope: scopeDescriptor) preferredLineLength: atom.config.get('editor.preferredLineLength', scope: scopeDescriptor) subscriptions.add atom.config.onDidChange 'editor.softWrap', scope: scopeDescriptor, ({newValue}) => @configSettings.softWrap = newValue @updateWrappedScreenLines() - subscriptions.add atom.config.onDidChange 'editor.softWrapHangingIndentationSpaces', scope: scopeDescriptor, ({newValue}) => - @configSettings.softWrapHangingIndentationSpaces = newValue + subscriptions.add atom.config.onDidChange 'editor.softWrapHangingIndent', scope: scopeDescriptor, ({newValue}) => + @configSettings.softWrapHangingIndent = newValue @updateWrappedScreenLines() subscriptions.add atom.config.onDidChange 'editor.softWrapAtPreferredLineLength', scope: scopeDescriptor, ({newValue}) => @@ -1164,7 +1164,7 @@ class DisplayBuffer extends Model while wrapScreenColumn = tokenizedLine.findWrapColumn(@getSoftWrapColumn()) [wrappedLine, tokenizedLine] = tokenizedLine.softWrapAt( wrapScreenColumn, - hangingIndentationSpaces: @configSettings.softWrapHangingIndentationSpaces + hangingIndent: @configSettings.softWrapHangingIndent ) break if wrappedLine.hasOnlySoftWrapIndentation() screenLines.push(wrappedLine) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index dfc8cac83..a949a6e11 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -119,8 +119,8 @@ class TokenizedLine oddIndentLevel = indentLevel - Math.floor(indentLevel) Math.round(@tabLength * oddIndentLevel) - buildSoftWrapIndentationTokens: (token, hangingIndentationSpaces) -> - hangingIndentLevel = hangingIndentationSpaces / @tabLength + buildSoftWrapIndentationTokens: (token, hangingIndent) -> + hangingIndentLevel = hangingIndent / @tabLength indentLevel = @indentLevel + hangingIndentLevel indentTokens = [0...Math.floor(indentLevel)].map => token.buildSoftWrapIndentationToken(@tabLength) @@ -135,7 +135,7 @@ class TokenizedLine softWrapAt: (column, options = {}) -> return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 - {hangingIndentationSpaces} = options + {hangingIndent} = options rightTokens = new Array(@tokens...) leftTokens = [] @@ -147,7 +147,7 @@ class TokenizedLine leftTextLength += nextToken.value.length leftTokens.push nextToken - indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0], hangingIndentationSpaces) + indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0], hangingIndent) leftFragment = new TokenizedLine( tokens: leftTokens From f5de75126b7619cc84d4a6bcd5dca1826e5ddfd7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 09:24:26 -0700 Subject: [PATCH 108/521] :arrow_up: language-perl@0.19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb7b27bd5..b2a05ad0a 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.18.0", + "language-perl": "0.19.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From a79384c6f6da85ef30318be7e2baa4279141a349 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 09:30:23 -0700 Subject: [PATCH 109/521] :arrow_up: language-go@0.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2a05ad0a..fd906dd53 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "language-css": "0.28.0", "language-gfm": "0.67.0", "language-git": "0.10.0", - "language-go": "0.21.0", + "language-go": "0.22.0", "language-html": "0.29.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", From 85595262156bfe30eb2fb3aaf184168f1c4dab05 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 17:42:25 +0100 Subject: [PATCH 110/521] :white_check_mark: Write a more comprehensive spec --- spec/display-buffer-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 4f2046434..c61733836 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -133,6 +133,7 @@ describe "DisplayBuffer", -> atom.config.set('editor.softWrapHangingIndent', 3) it "further indents wrapped lines", -> + expect(displayBuffer.tokenizedLineForScreenRow(10).text).toBe " return " expect(displayBuffer.tokenizedLineForScreenRow(11).text).toBe " sort(left).concat(pivot).concat(sort(right)" expect(displayBuffer.tokenizedLineForScreenRow(12).text).toBe " );" From f5e1e40edd5fcc06734e013e22b9ad87ea43d79d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 17:44:35 +0100 Subject: [PATCH 111/521] Avoid named parameter to save an allocation --- src/display-buffer.coffee | 2 +- src/tokenized-line.coffee | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index c8ec23e07..8e8bd8dcd 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -1164,7 +1164,7 @@ class DisplayBuffer extends Model while wrapScreenColumn = tokenizedLine.findWrapColumn(@getSoftWrapColumn()) [wrappedLine, tokenizedLine] = tokenizedLine.softWrapAt( wrapScreenColumn, - hangingIndent: @configSettings.softWrapHangingIndent + @configSettings.softWrapHangingIndent ) break if wrappedLine.hasOnlySoftWrapIndentation() screenLines.push(wrappedLine) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index a949a6e11..98224e189 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -132,11 +132,9 @@ class TokenizedLine else indentTokens - softWrapAt: (column, options = {}) -> + softWrapAt: (column, hangingIndent) -> return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 - {hangingIndent} = options - rightTokens = new Array(@tokens...) leftTokens = [] leftTextLength = 0 From fbfe19825b545d71a29a0309e8da3d68da4325dc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 18:00:31 +0100 Subject: [PATCH 112/521] Even more descriptive specs :sparkles: --- spec/display-buffer-spec.coffee | 34 +++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index c61733836..1703a24d1 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -124,9 +124,16 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(3).tokens[1].isHardTab).toBeTruthy() describe "when a line is wrapped", -> - it "correctly tokenizes soft wrap indentation tokens", -> - expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() - expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() + it "breaks soft-wrap indentation into a token for each indentation level to support indent guides", -> + tokenizedLine = displayBuffer.tokenizedLineForScreenRow(4) + + expect(tokenizedLine.tokens[0].value).toBe(" ") + expect(tokenizedLine.tokens[0].isSoftWrapIndentation).toBeTruthy() + + expect(tokenizedLine.tokens[1].value).toBe(" ") + expect(tokenizedLine.tokens[1].isSoftWrapIndentation).toBeTruthy() + + expect(tokenizedLine.tokens[2].isSoftWrapIndentation).toBeFalsy() describe "when editor.softWrapHangingIndent is set", -> beforeEach -> @@ -137,11 +144,22 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(11).text).toBe " sort(left).concat(pivot).concat(sort(right)" expect(displayBuffer.tokenizedLineForScreenRow(12).text).toBe " );" - it "correctly tokenizes hanging indentation spaces", -> - expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[0].isSoftWrapIndentation).toBeTruthy() - expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[1].isSoftWrapIndentation).toBeTruthy() - expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[2].isSoftWrapIndentation).toBeTruthy() - expect(displayBuffer.tokenizedLineForScreenRow(4).tokens[3].isSoftWrapIndentation).toBeTruthy() + it "includes hanging indent when breaking soft-wrap indentation into tokens", -> + tokenizedLine = displayBuffer.tokenizedLineForScreenRow(4) + + expect(tokenizedLine.tokens[0].value).toBe(" ") + expect(tokenizedLine.tokens[0].isSoftWrapIndentation).toBeTruthy() + + expect(tokenizedLine.tokens[1].value).toBe(" ") + expect(tokenizedLine.tokens[1].isSoftWrapIndentation).toBeTruthy() + + expect(tokenizedLine.tokens[2].value).toBe(" ") # hanging indent + expect(tokenizedLine.tokens[2].isSoftWrapIndentation).toBeTruthy() + + expect(tokenizedLine.tokens[3].value).toBe(" ") # odd space + expect(tokenizedLine.tokens[3].isSoftWrapIndentation).toBeTruthy() + + expect(tokenizedLine.tokens[4].isSoftWrapIndentation).toBeFalsy() describe "when the buffer changes", -> describe "when buffer lines are updated", -> From 522e82ebf1eb71370f60af55b6970943677cf0e6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 18 Mar 2015 18:07:07 +0100 Subject: [PATCH 113/521] :art: Refactor buildSoftWrapIndentationTokens ...as suggested by @nathansobo :sparkles: --- src/tokenized-line.coffee | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 98224e189..2a807d84a 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -111,26 +111,16 @@ class TokenizedLine return maxColumn - # For a given `indentLevel`, calculates how many trailing spaces cannot fit in a single tab. - # - # indentLevel - {Number} - # Returns a {Number} representing the odd indentation spaces in `indentLevel`. - oddIndentationSpacesForIndentLevel: (indentLevel) -> - oddIndentLevel = indentLevel - Math.floor(indentLevel) - Math.round(@tabLength * oddIndentLevel) - buildSoftWrapIndentationTokens: (token, hangingIndent) -> - hangingIndentLevel = hangingIndent / @tabLength - indentLevel = @indentLevel + hangingIndentLevel - indentTokens = [0...Math.floor(indentLevel)].map => - token.buildSoftWrapIndentationToken(@tabLength) + totalIndentSpaces = (@indentLevel * @tabLength) + hangingIndent + indentTokens = [] + while totalIndentSpaces > 0 + tokenLength = Math.min(@tabLength, totalIndentSpaces) + indentToken = token.buildSoftWrapIndentationToken(tokenLength) + indentTokens.push(indentToken) + totalIndentSpaces -= tokenLength - if oddIndentationSpaces = @oddIndentationSpacesForIndentLevel(indentLevel) - indentTokens.concat( - token.buildSoftWrapIndentationToken(oddIndentationSpaces) - ) - else - indentTokens + indentTokens softWrapAt: (column, hangingIndent) -> return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 From cac361e6dfffe1a17209f68781b9b7bb05b055f0 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 18 Mar 2015 15:34:28 -0700 Subject: [PATCH 114/521] add packages for new spec Signed-off-by: Kevin Sawicki --- .../index.coffee | 4 ++++ .../package.json | 11 +++++++++++ .../index.coffee | 4 ++++ .../package.json | 12 ++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 spec/fixtures/packages/package-with-missing-consumed-services/index.coffee create mode 100644 spec/fixtures/packages/package-with-missing-consumed-services/package.json create mode 100644 spec/fixtures/packages/package-with-missing-provided-services/index.coffee create mode 100644 spec/fixtures/packages/package-with-missing-provided-services/package.json diff --git a/spec/fixtures/packages/package-with-missing-consumed-services/index.coffee b/spec/fixtures/packages/package-with-missing-consumed-services/index.coffee new file mode 100644 index 000000000..0f1fc41e0 --- /dev/null +++ b/spec/fixtures/packages/package-with-missing-consumed-services/index.coffee @@ -0,0 +1,4 @@ +module.exports = + activate: -> + + deactivate: -> diff --git a/spec/fixtures/packages/package-with-missing-consumed-services/package.json b/spec/fixtures/packages/package-with-missing-consumed-services/package.json new file mode 100644 index 000000000..d0e0ddfcb --- /dev/null +++ b/spec/fixtures/packages/package-with-missing-consumed-services/package.json @@ -0,0 +1,11 @@ +{ + "name": "package-with-missing-consumed-services", + + "consumedServices": { + "service-1": { + "versions": { + ">=0.1": "consumeMissingService" + } + } + } +} diff --git a/spec/fixtures/packages/package-with-missing-provided-services/index.coffee b/spec/fixtures/packages/package-with-missing-provided-services/index.coffee new file mode 100644 index 000000000..0f1fc41e0 --- /dev/null +++ b/spec/fixtures/packages/package-with-missing-provided-services/index.coffee @@ -0,0 +1,4 @@ +module.exports = + activate: -> + + deactivate: -> diff --git a/spec/fixtures/packages/package-with-missing-provided-services/package.json b/spec/fixtures/packages/package-with-missing-provided-services/package.json new file mode 100644 index 000000000..a090354a2 --- /dev/null +++ b/spec/fixtures/packages/package-with-missing-provided-services/package.json @@ -0,0 +1,12 @@ +{ + "name": "package-with-missing-provided-services", + + "providedServices": { + "service-1": { + "description": "The first service", + "versions": { + "0.2.9": "provideMissingService" + } + } + } +} From a787242e7a845c9f6d16a3a8f7fa5892007403de Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 18 Mar 2015 15:37:16 -0700 Subject: [PATCH 115/521] check that services method exists Signed-off-by: Kevin Sawicki --- src/package.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index 4d244c50f..54dc75f2b 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -225,12 +225,14 @@ class Package for name, {versions} of @metadata.providedServices servicesByVersion = {} for version, methodName of versions - servicesByVersion[version] = @mainModule[methodName]() + if typeof @mainModule[methodName] is 'function' + servicesByVersion[version] = @mainModule[methodName]() @activationDisposables.add atom.packages.serviceHub.provide(name, servicesByVersion) for name, {versions} of @metadata.consumedServices for version, methodName of versions - @activationDisposables.add atom.packages.serviceHub.consume(name, version, @mainModule[methodName].bind(@mainModule)) + if typeof @mainModule[methodName] is 'function' + @activationDisposables.add atom.packages.serviceHub.consume(name, version, @mainModule[methodName].bind(@mainModule)) return loadKeymaps: -> From 2c46748307e765bd7796c092535048d5827bd4f2 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 18 Mar 2015 15:38:13 -0700 Subject: [PATCH 116/521] add spec to check missing service methods are skipped Signed-off-by: Kevin Sawicki --- spec/package-manager-spec.coffee | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 758d7468f..2789f36c3 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -547,6 +547,21 @@ describe "PackageManager", -> expect(consumerModule.consumeFirstServiceV4).not.toHaveBeenCalled() expect(consumerModule.consumeSecondService).not.toHaveBeenCalled() + it "ignores provided and consumed services that do not exist", -> + addErrorHandler = jasmine.createSpy() + atom.notifications.onDidAddNotification(addErrorHandler) + + waitsForPromise -> + atom.packages.activatePackage("package-with-missing-consumed-services") + + waitsForPromise -> + atom.packages.activatePackage("package-with-missing-provided-services") + + runs -> + expect(atom.packages.isPackageActive("package-with-missing-consumed-services")).toBe true + expect(atom.packages.isPackageActive("package-with-missing-provided-services")).toBe true + expect(addErrorHandler.callCount).toBe 0 + describe "::deactivatePackage(id)", -> afterEach -> atom.packages.unloadPackages() From 2aa566b7c6eaa81b5650e7e1e7ece6cc68a10eac Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Thu, 19 Mar 2015 10:56:55 +1100 Subject: [PATCH 117/521] :memo: document where to add the tests and how to run them --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6be3b8778..a5ebdd5f5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ For more information on how to work with Atom's official packages, see [JavaScript](https://github.com/styleguide/javascript), and [CSS](https://github.com/styleguide/css) styleguides. * Include thoughtfully-worded, well-structured - [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. Run them using `script/grunt run-specs` target with atom closed. + [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. Run them using `apm test`. * Document new code based on the [Documentation Styleguide](#documentation-styleguide) * End files with a newline. From c2f258c679796520493d535ba84dc4b16b22bd3d Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Thu, 19 Mar 2015 11:45:13 +1100 Subject: [PATCH 118/521] Addressed code review --- package.json | 1 + spec/typescript-spec.coffee | 8 +- src/typescript-transpile.js | 152 ------------------------------------ src/typescript.coffee | 45 +---------- 4 files changed, 6 insertions(+), 200 deletions(-) delete mode 100644 src/typescript-transpile.js diff --git a/package.json b/package.json index 60f96cb34..9f12fe358 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "text-buffer": "^4.1.5", "theorist": "^1.0.2", "typescript": "^1.4.1", + "typescript-simple": "^1.0.0", "underscore-plus": "^1.6.6" }, "packageDependencies": { diff --git a/spec/typescript-spec.coffee b/spec/typescript-spec.coffee index 408e9fb77..493715d36 100644 --- a/spec/typescript-spec.coffee +++ b/spec/typescript-spec.coffee @@ -2,12 +2,6 @@ typescript = require '../src/typescript' crypto = require 'crypto' describe "TypeScript transpiler support", -> - beforeEach -> - jasmine.snapshotDeprecations() - - afterEach -> - jasmine.restoreDeprecationsSnapshot() - describe "::createTypeScriptVersionAndOptionsDigest", -> it "returns a digest for the library version and specified options", -> defaultOptions = @@ -20,7 +14,7 @@ describe "TypeScript transpiler support", -> shasum.update('\0', 'utf8') shasum.update(version, 'utf8') shasum.update('\0', 'utf8') - shasum.update('{"target": 1,"module": "commonjs","sourceMap": true,}') + shasum.update(JSON.stringify(defaultOptions)) expectedDigest = shasum.digest('hex') observedDigest = typescript.createTypeScriptVersionAndOptionsDigest(version, defaultOptions) diff --git a/src/typescript-transpile.js b/src/typescript-transpile.js deleted file mode 100644 index 64d832d1c..000000000 --- a/src/typescript-transpile.js +++ /dev/null @@ -1,152 +0,0 @@ -// From https://github.com/teppeis/typescript-simple/blob/master/index.js -// with https://github.com/teppeis/typescript-simple/pull/7 - -var fs = require('fs'); -var os = require('os'); -var path = require('path'); -var ts = require('typescript'); -var FILENAME_TS = 'file.ts'; -function tss(code, options) { - if (options) { - return new tss.TypeScriptSimple(options).compile(code); - } - else { - return defaultTss.compile(code); - } -} -var tss; -(function (tss) { - var TypeScriptSimple = (function () { - /** - * @param {ts.CompilerOptions=} options TypeScript compile options (some options are ignored) - */ - function TypeScriptSimple(options, doSemanticChecks) { - if (options === void 0) { options = {}; } - if (doSemanticChecks === void 0) { doSemanticChecks = true; } - this.doSemanticChecks = doSemanticChecks; - this.service = null; - this.outputs = {}; - this.files = {}; - if (options.target == null) { - options.target = ts.ScriptTarget.ES5; - } - if (options.module == null) { - options.module = ts.ModuleKind.None; - } - this.options = options; - } - /** - * @param {string} code TypeScript source code to compile - * @param {string} only needed if you plan to use sourceMaps. Provide the complete filePath relevant to you - * @return {string} The JavaScript with inline sourceMaps if sourceMaps were enabled - */ - TypeScriptSimple.prototype.compile = function (code, filename) { - if (filename === void 0) { filename = FILENAME_TS; } - if (!this.service) { - this.service = this.createService(); - } - var file = this.files[FILENAME_TS]; - file.text = code; - file.version++; - return this.toJavaScript(this.service, filename); - }; - TypeScriptSimple.prototype.createService = function () { - var _this = this; - var defaultLib = this.getDefaultLibFilename(this.options); - var defaultLibPath = path.join(this.getTypeScriptBinDir(), defaultLib); - this.files[defaultLib] = { version: 0, text: fs.readFileSync(defaultLibPath).toString() }; - this.files[FILENAME_TS] = { version: 0, text: '' }; - var servicesHost = { - getScriptFileNames: function () { return [_this.getDefaultLibFilename(_this.options), FILENAME_TS]; }, - getScriptVersion: function (filename) { return _this.files[filename] && _this.files[filename].version.toString(); }, - getScriptSnapshot: function (filename) { - var file = _this.files[filename]; - return { - getText: function (start, end) { return file.text.substring(start, end); }, - getLength: function () { return file.text.length; }, - getLineStartPositions: function () { return []; }, - getChangeRange: function (oldSnapshot) { return undefined; } - }; - }, - getCurrentDirectory: function () { return process.cwd(); }, - getScriptIsOpen: function () { return true; }, - getCompilationSettings: function () { return _this.options; }, - getDefaultLibFilename: function (options) { - return _this.getDefaultLibFilename(options); - }, - log: function (message) { return console.log(message); } - }; - return ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); - }; - TypeScriptSimple.prototype.getTypeScriptBinDir = function () { - return path.dirname(require.resolve('typescript')); - }; - TypeScriptSimple.prototype.getDefaultLibFilename = function (options) { - if (options.target === ts.ScriptTarget.ES6) { - return 'lib.es6.d.ts'; - } - else { - return 'lib.d.ts'; - } - }; - /** - * converts {"version":3,"file":"file.js","sourceRoot":"","sources":["file.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,MAAM,CAAC"} - * to {"version":3,"sources":["foo/test.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,MAAM,CAAC","file":"foo/test.ts","sourcesContent":["var x = 'test';"]} - * derived from : https://github.com/thlorenz/convert-source-map - */ - TypeScriptSimple.prototype.getInlineSourceMap = function (mapText, filename) { - var sourceMap = JSON.parse(mapText); - sourceMap.file = filename; - sourceMap.sources = [filename]; - sourceMap.sourcesContent = [this.files[FILENAME_TS].text]; - delete sourceMap.sourceRoot; - return JSON.stringify(sourceMap); - }; - TypeScriptSimple.prototype.toJavaScript = function (service, filename) { - if (filename === void 0) { filename = FILENAME_TS; } - var output = service.getEmitOutput(FILENAME_TS); - // Meaning of succeeded is driven by whether we need to check for semantic errors or not - var succeeded = output.emitOutputStatus === ts.EmitReturnStatus.Succeeded; - if (!this.doSemanticChecks) { - // We have an output. It implies syntactic success - if (!succeeded) - succeeded = !!output.outputFiles.length; - } - if (succeeded) { - var outputFilename = FILENAME_TS.replace(/ts$/, 'js'); - var file = output.outputFiles.filter(function (file) { return file.name === outputFilename; })[0]; - // Fixed in v1.5 https://github.com/Microsoft/TypeScript/issues/1653 - var text = file.text.replace(/\r\n/g, os.EOL); - // If we have sourceMaps convert them to inline sourceMaps - if (this.options.sourceMap) { - var sourceMapFilename = FILENAME_TS.replace(/ts$/, 'js.map'); - var sourceMapFile = output.outputFiles.filter(function (file) { return file.name === sourceMapFilename; })[0]; - // Transform sourcemap - var sourceMapText = sourceMapFile.text; - sourceMapText = this.getInlineSourceMap(sourceMapText, filename); - var base64SourceMapText = new Buffer(sourceMapText).toString('base64'); - text = text.replace('//# sourceMappingURL=' + sourceMapFilename, '//# sourceMappingURL=data:application/json;base64,' + base64SourceMapText); - } - return text; - } - var allDiagnostics = service.getCompilerOptionsDiagnostics().concat(service.getSyntacticDiagnostics(FILENAME_TS)); - if (this.doSemanticChecks) - allDiagnostics = allDiagnostics.concat(service.getSemanticDiagnostics(FILENAME_TS)); - throw new Error(this.formatDiagnostics(allDiagnostics)); - }; - TypeScriptSimple.prototype.formatDiagnostics = function (diagnostics) { - return diagnostics.map(function (d) { - if (d.file) { - return 'L' + d.file.getLineAndCharacterFromPosition(d.start).line + ': ' + d.messageText; - } - else { - return d.messageText; - } - }).join(os.EOL); - }; - return TypeScriptSimple; - })(); - tss.TypeScriptSimple = TypeScriptSimple; -})(tss || (tss = {})); -var defaultTss = new tss.TypeScriptSimple(); -module.exports = tss; diff --git a/src/typescript.coffee b/src/typescript.coffee index e336eceff..3814a6c66 100644 --- a/src/typescript.coffee +++ b/src/typescript.coffee @@ -18,43 +18,6 @@ defaultOptions = module: 'commonjs' sourceMap: true -### -shasum - Hash with an update() method. -value - Must be a value that could be returned by JSON.parse(). -### -updateDigestForJsonValue = (shasum, value) -> - # Implmentation is similar to that of pretty-printing a JSON object, except: - # * Strings are not escaped. - # * No effort is made to avoid trailing commas. - # These shortcuts should not affect the correctness of this function. - type = typeof value - if type is 'string' - shasum.update('"', 'utf8') - shasum.update(value, 'utf8') - shasum.update('"', 'utf8') - else if type in ['boolean', 'number'] - shasum.update(value.toString(), 'utf8') - else if value is null - shasum.update('null', 'utf8') - else if Array.isArray value - shasum.update('[', 'utf8') - for item in value - updateDigestForJsonValue(shasum, item) - shasum.update(',', 'utf8') - shasum.update(']', 'utf8') - else - # value must be an object: be sure to sort the keys. - keys = Object.keys value - keys.sort() - - shasum.update('{', 'utf8') - for key in keys - updateDigestForJsonValue(shasum, key) - shasum.update(': ', 'utf8') - updateDigestForJsonValue(shasum, value[key]) - shasum.update(',', 'utf8') - shasum.update('}', 'utf8') - createTypeScriptVersionAndOptionsDigest = (version, options) -> shasum = crypto.createHash('sha1') # Include the version of typescript in the hash. @@ -62,7 +25,7 @@ createTypeScriptVersionAndOptionsDigest = (version, options) -> shasum.update('\0', 'utf8') shasum.update(version, 'utf8') shasum.update('\0', 'utf8') - updateDigestForJsonValue(shasum, options) + shasum.update(JSON.stringify(options)) shasum.digest('hex') cacheDir = null @@ -72,8 +35,8 @@ getCachePath = (sourceCode) -> digest = crypto.createHash('sha1').update(sourceCode, 'utf8').digest('hex') unless jsCacheDir? - tsVersion = require('typescript/package.json').version - jsCacheDir = path.join(cacheDir, createTypeScriptVersionAndOptionsDigest(tsVersion, defaultOptions)) + tssVersion = require('typescript-simple/package.json').version + jsCacheDir = path.join(cacheDir, createTypeScriptVersionAndOptionsDigest(tssVersion, defaultOptions)) path.join(jsCacheDir, "#{digest}.js") @@ -94,7 +57,7 @@ createOptions = (filePath) -> transpile = (sourceCode, filePath, cachePath) -> options = createOptions(filePath) - tss ?= new (require './typescript-transpile').TypeScriptSimple(options, false) + tss ?= new (require 'typescript-simple').TypeScriptSimple(options, false) js = tss.compile(sourceCode, filePath) stats.misses++ From 030dd4c690d339fc938f20b66bee459c2f7c2c2b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 19 Mar 2015 09:17:35 +0800 Subject: [PATCH 119/521] :arrow_up: atom-shell@0.22.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd906dd53..11bc09810 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "url": "http://github.com/atom/atom/raw/master/LICENSE.md" } ], - "atomShellVersion": "0.21.3", + "atomShellVersion": "0.22.1", "dependencies": { "async": "0.2.6", "atom-keymap": "^4", From bc00ad3f01b34fa910fb25189daa0d04e7c4737f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 19 Mar 2015 09:17:54 +0800 Subject: [PATCH 120/521] :arrow_up: apm@0.146.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index a989c7a83..6b3001029 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.145.0" + "atom-package-manager": "0.146.0" } } From 56020b11b0e2d1d43c69df54b550995cfab5f2f7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 19 Mar 2015 11:36:55 +0100 Subject: [PATCH 121/521] :bug: Avoid soft-wrapping on indentation --- spec/display-buffer-spec.coffee | 18 ++++++++++++++++++ src/tokenized-line.coffee | 26 +++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 1703a24d1..95f22acca 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -115,6 +115,24 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(3).text).toBe ' var pivot = items.shift(), current, left = [], ' expect(displayBuffer.tokenizedLineForScreenRow(4).text).toBe ' right = [];' + describe "when the only whitespace characters are at the beginning of the line", -> + beforeEach -> + displayBuffer.setEditorWidthInChars(10) + + it "wraps the line at the max length when indented with tabs", -> + buffer.setTextInRange([[0, 0], [1, 0]], '\t\tabcdefghijklmnopqrstuvwxyz') + + expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe ' abcdef' + expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe ' ghijkl' + expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe ' mnopqr' + + it "wraps the line at the max length when indented with spaces", -> + buffer.setTextInRange([[0, 0], [1, 0]], ' abcdefghijklmnopqrstuvwxyz') + + expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe ' abcdef' + expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe ' ghijkl' + expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe ' mnopqr' + describe "when there are hard tabs", -> beforeEach -> buffer.setText(buffer.getText().replace(new RegExp(' ', 'g'), '\t')) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 2a807d84a..513ad5b4b 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -106,7 +106,7 @@ class TokenizedLine return @text.length else # search backward for the start of the word on the boundary - for column in [maxColumn..0] when @isColumnOutsideSoftWrapIndentation(column) + for column in [maxColumn..0] when @isColumnOutsideIndentation(column) return column + 1 if /\s/.test(@text[column]) return maxColumn @@ -127,12 +127,13 @@ class TokenizedLine rightTokens = new Array(@tokens...) leftTokens = [] - leftTextLength = 0 - while leftTextLength < column - if leftTextLength + rightTokens[0].value.length > column - rightTokens[0..0] = rightTokens[0].splitAt(column - leftTextLength) + leftScreenColumn = 0 + + while leftScreenColumn < column + if leftScreenColumn + rightTokens[0].screenDelta > column + rightTokens[0..0] = rightTokens[0].splitAt(column - leftScreenColumn) nextToken = rightTokens.shift() - leftTextLength += nextToken.value.length + leftScreenColumn += nextToken.screenDelta leftTokens.push nextToken indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0], hangingIndent) @@ -160,6 +161,9 @@ class TokenizedLine isSoftWrapped: -> @lineEnding is null + isColumnOutsideIndentation: (column) -> + column >= @firstNonWhitespaceIndex and @isColumnOutsideSoftWrapIndentation(column) + isColumnOutsideSoftWrapIndentation: (column) -> return true if @softWrapIndentationTokens.length == 0 @@ -209,15 +213,15 @@ class TokenizedLine outputTokens markLeadingAndTrailingWhitespaceTokens: -> - firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex) - if firstNonWhitespaceIndex > 0 and isPairedCharacter(@text, firstNonWhitespaceIndex - 1) - firstNonWhitespaceIndex-- + @firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex) + if @firstNonWhitespaceIndex > 0 and isPairedCharacter(@text, @firstNonWhitespaceIndex - 1) + @firstNonWhitespaceIndex-- firstTrailingWhitespaceIndex = @text.search(TrailingWhitespaceRegex) @lineIsWhitespaceOnly = firstTrailingWhitespaceIndex is 0 index = 0 for token in @tokens - if index < firstNonWhitespaceIndex - token.firstNonWhitespaceIndex = Math.min(index + token.value.length, firstNonWhitespaceIndex - index) + if index < @firstNonWhitespaceIndex + token.firstNonWhitespaceIndex = Math.min(index + token.value.length, @firstNonWhitespaceIndex - index) # Only the *last* segment of a soft-wrapped line can have trailing whitespace if @lineEnding? and (index + token.value.length > firstTrailingWhitespaceIndex) token.firstTrailingWhitespaceIndex = Math.max(0, firstTrailingWhitespaceIndex - index) From 61cc9b97eabb8f3c7d7e0dd8503768884f076a5d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 19 Mar 2015 11:45:54 +0100 Subject: [PATCH 122/521] :green_heart: Fix failing spec --- spec/text-editor-component-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index f5c9e7677..20ddcdcab 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1937,14 +1937,14 @@ describe "TextEditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(11), metaKey: true)) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(11), metaKey: true)) - expect(editor.getSelectedScreenRanges()).toEqual [[[7, 4], [7, 6]], [[10, 0], [20, 0]]] + expect(editor.getSelectedScreenRanges()).toEqual [[[7, 4], [7, 6]], [[10, 0], [19, 0]]] it "merges overlapping selections", -> gutterNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenRowInGutter(17), metaKey: true)) gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(9), metaKey: true)) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(9), metaKey: true)) - expect(editor.getSelectedScreenRanges()).toEqual [[[5, 0], [20, 0]]] + expect(editor.getSelectedScreenRanges()).toEqual [[[5, 0], [19, 0]]] describe "when the gutter is shift-clicked and dragged", -> describe "when the shift-click is below the existing selection's tail", -> From 03b526a76b38984be939a9a87f6af3b09ae45761 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 19 Mar 2015 11:48:10 +0100 Subject: [PATCH 123/521] :art: Use only @firstNonWhitespaceIndex --- src/tokenized-line.coffee | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 513ad5b4b..489714ae3 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -11,6 +11,7 @@ module.exports = class TokenizedLine endOfLineInvisibles: null lineIsWhitespaceOnly: false + firstNonWhitespaceIndex: 0 foldable: false constructor: ({tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold, @tabLength, @indentLevel, @invisibles}) -> @@ -162,12 +163,7 @@ class TokenizedLine @lineEnding is null isColumnOutsideIndentation: (column) -> - column >= @firstNonWhitespaceIndex and @isColumnOutsideSoftWrapIndentation(column) - - isColumnOutsideSoftWrapIndentation: (column) -> - return true if @softWrapIndentationTokens.length == 0 - - column > @softWrapIndentationDelta + column >= @firstNonWhitespaceIndex isColumnInsideSoftWrapIndentation: (column) -> return false if @softWrapIndentationTokens.length == 0 From 0e0eeb34263fcb3d574614dc17701cec2eeba3b4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 19 Mar 2015 12:23:10 +0100 Subject: [PATCH 124/521] :fire: Delete TokenizedLine#isColumnOutsideIndentation --- src/tokenized-line.coffee | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 489714ae3..b62ab316f 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -97,6 +97,7 @@ class TokenizedLine # Returns a {Number} representing the `line` position where the wrap would take place. # Returns `null` if a wrap wouldn't occur. findWrapColumn: (maxColumn) -> + return unless maxColumn? return unless @text.length > maxColumn if /\s/.test(@text[maxColumn]) @@ -107,7 +108,7 @@ class TokenizedLine return @text.length else # search backward for the start of the word on the boundary - for column in [maxColumn..0] when @isColumnOutsideIndentation(column) + for column in [maxColumn..@firstNonWhitespaceIndex] return column + 1 if /\s/.test(@text[column]) return maxColumn @@ -162,9 +163,6 @@ class TokenizedLine isSoftWrapped: -> @lineEnding is null - isColumnOutsideIndentation: (column) -> - column >= @firstNonWhitespaceIndex - isColumnInsideSoftWrapIndentation: (column) -> return false if @softWrapIndentationTokens.length == 0 From 2863fddff307fcded2736e6edb1ff2b80d95a92d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 09:35:26 -0700 Subject: [PATCH 125/521] :arrow_up: language-ruby-on-rails@0.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd906dd53..c50afafb1 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "language-property-list": "0.8.0", "language-python": "0.32.0", "language-ruby": "0.49.0", - "language-ruby-on-rails": "0.20.0", + "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0", "language-shellscript": "0.13.0", "language-source": "0.9.0", From dccf88063bf9241d83250554a8427ceb4b437389 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 09:37:20 -0700 Subject: [PATCH 126/521] :arrow_up: bracket-matcher@0.73 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c50afafb1..801aac11c 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "autosave": "0.20.0", "background-tips": "0.23.0", "bookmarks": "0.35.0", - "bracket-matcher": "0.72.0", + "bracket-matcher": "0.73.0", "command-palette": "0.34.0", "deprecation-cop": "0.37.0", "dev-live-reload": "0.45.0", From 6345799cf3dba3706a8eebb258da6e867c85144c Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 19 Mar 2015 12:47:58 -0600 Subject: [PATCH 127/521] Revert "Don't soft-wrap on indentation" --- spec/display-buffer-spec.coffee | 18 ---------------- spec/text-editor-component-spec.coffee | 4 ++-- src/tokenized-line.coffee | 30 ++++++++++++++------------ 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 95f22acca..1703a24d1 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -115,24 +115,6 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(3).text).toBe ' var pivot = items.shift(), current, left = [], ' expect(displayBuffer.tokenizedLineForScreenRow(4).text).toBe ' right = [];' - describe "when the only whitespace characters are at the beginning of the line", -> - beforeEach -> - displayBuffer.setEditorWidthInChars(10) - - it "wraps the line at the max length when indented with tabs", -> - buffer.setTextInRange([[0, 0], [1, 0]], '\t\tabcdefghijklmnopqrstuvwxyz') - - expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe ' abcdef' - expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe ' ghijkl' - expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe ' mnopqr' - - it "wraps the line at the max length when indented with spaces", -> - buffer.setTextInRange([[0, 0], [1, 0]], ' abcdefghijklmnopqrstuvwxyz') - - expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe ' abcdef' - expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe ' ghijkl' - expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe ' mnopqr' - describe "when there are hard tabs", -> beforeEach -> buffer.setText(buffer.getText().replace(new RegExp(' ', 'g'), '\t')) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 20ddcdcab..f5c9e7677 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1937,14 +1937,14 @@ describe "TextEditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(11), metaKey: true)) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(11), metaKey: true)) - expect(editor.getSelectedScreenRanges()).toEqual [[[7, 4], [7, 6]], [[10, 0], [19, 0]]] + expect(editor.getSelectedScreenRanges()).toEqual [[[7, 4], [7, 6]], [[10, 0], [20, 0]]] it "merges overlapping selections", -> gutterNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenRowInGutter(17), metaKey: true)) gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(9), metaKey: true)) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(9), metaKey: true)) - expect(editor.getSelectedScreenRanges()).toEqual [[[5, 0], [19, 0]]] + expect(editor.getSelectedScreenRanges()).toEqual [[[5, 0], [20, 0]]] describe "when the gutter is shift-clicked and dragged", -> describe "when the shift-click is below the existing selection's tail", -> diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index b62ab316f..2a807d84a 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -11,7 +11,6 @@ module.exports = class TokenizedLine endOfLineInvisibles: null lineIsWhitespaceOnly: false - firstNonWhitespaceIndex: 0 foldable: false constructor: ({tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold, @tabLength, @indentLevel, @invisibles}) -> @@ -97,7 +96,6 @@ class TokenizedLine # Returns a {Number} representing the `line` position where the wrap would take place. # Returns `null` if a wrap wouldn't occur. findWrapColumn: (maxColumn) -> - return unless maxColumn? return unless @text.length > maxColumn if /\s/.test(@text[maxColumn]) @@ -108,7 +106,7 @@ class TokenizedLine return @text.length else # search backward for the start of the word on the boundary - for column in [maxColumn..@firstNonWhitespaceIndex] + for column in [maxColumn..0] when @isColumnOutsideSoftWrapIndentation(column) return column + 1 if /\s/.test(@text[column]) return maxColumn @@ -129,13 +127,12 @@ class TokenizedLine rightTokens = new Array(@tokens...) leftTokens = [] - leftScreenColumn = 0 - - while leftScreenColumn < column - if leftScreenColumn + rightTokens[0].screenDelta > column - rightTokens[0..0] = rightTokens[0].splitAt(column - leftScreenColumn) + leftTextLength = 0 + while leftTextLength < column + if leftTextLength + rightTokens[0].value.length > column + rightTokens[0..0] = rightTokens[0].splitAt(column - leftTextLength) nextToken = rightTokens.shift() - leftScreenColumn += nextToken.screenDelta + leftTextLength += nextToken.value.length leftTokens.push nextToken indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0], hangingIndent) @@ -163,6 +160,11 @@ class TokenizedLine isSoftWrapped: -> @lineEnding is null + isColumnOutsideSoftWrapIndentation: (column) -> + return true if @softWrapIndentationTokens.length == 0 + + column > @softWrapIndentationDelta + isColumnInsideSoftWrapIndentation: (column) -> return false if @softWrapIndentationTokens.length == 0 @@ -207,15 +209,15 @@ class TokenizedLine outputTokens markLeadingAndTrailingWhitespaceTokens: -> - @firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex) - if @firstNonWhitespaceIndex > 0 and isPairedCharacter(@text, @firstNonWhitespaceIndex - 1) - @firstNonWhitespaceIndex-- + firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex) + if firstNonWhitespaceIndex > 0 and isPairedCharacter(@text, firstNonWhitespaceIndex - 1) + firstNonWhitespaceIndex-- firstTrailingWhitespaceIndex = @text.search(TrailingWhitespaceRegex) @lineIsWhitespaceOnly = firstTrailingWhitespaceIndex is 0 index = 0 for token in @tokens - if index < @firstNonWhitespaceIndex - token.firstNonWhitespaceIndex = Math.min(index + token.value.length, @firstNonWhitespaceIndex - index) + if index < firstNonWhitespaceIndex + token.firstNonWhitespaceIndex = Math.min(index + token.value.length, firstNonWhitespaceIndex - index) # Only the *last* segment of a soft-wrapped line can have trailing whitespace if @lineEnding? and (index + token.value.length > firstTrailingWhitespaceIndex) token.firstTrailingWhitespaceIndex = Math.max(0, firstTrailingWhitespaceIndex - index) From b4f911f6d39d263adb9a9f966f8399b5972db265 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 10:28:59 -0700 Subject: [PATCH 128/521] Add task to log loop returns --- build/tasks/output-for-loop-returns.coffee | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 build/tasks/output-for-loop-returns.coffee diff --git a/build/tasks/output-for-loop-returns.coffee b/build/tasks/output-for-loop-returns.coffee new file mode 100644 index 000000000..47523aa45 --- /dev/null +++ b/build/tasks/output-for-loop-returns.coffee @@ -0,0 +1,22 @@ +path = require 'path' + +module.exports = (grunt) -> + grunt.registerTask 'output-for-loop-returns', 'Log methods that end with a for loop', -> + appDir = grunt.config.get('atom.appDir') + + jsPaths = [] + grunt.file.recurse path.join(appDir, 'src'), (absolutePath, rootPath, relativePath, fileName) -> + jsPaths.push(absolutePath) if path.extname(fileName) is '.js' + + jsPaths.forEach (jsPath) -> + js = grunt.file.read(jsPath) + method = null + for line, index in js.split('\n') + [match, className, methodName] = /^\s*([a-zA-Z]+)\.prototype\.([a-zA-Z]+)\s*=\s*function\(/.exec(line) ? [] + if className and methodName + method = "#{className}::#{methodName}" + else + [match, ctorName] = /^\s*function\s+([a-zA-Z]+)\(/.exec(line) ? [] + + if /^\s*return\s+_results;\s*$/.test(line) + console.log(method ? "#{path.basename(jsPath)}:#{index}") From f728bc7aec2b9773c8a23e4f23e56f09b12f2bbb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 14:54:30 -0700 Subject: [PATCH 129/521] Add explicit returns to browser process classes --- src/browser/application-menu.coffee | 5 +++-- src/browser/atom-application.coffee | 2 ++ src/browser/auto-update-manager.coffee | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/browser/application-menu.coffee b/src/browser/application-menu.coffee index 5218ff304..4544a963d 100644 --- a/src/browser/application-menu.coffee +++ b/src/browser/application-menu.coffee @@ -82,7 +82,8 @@ class ApplicationMenu # window specific items. enableWindowSpecificItems: (enable) -> for item in @flattenMenuItems(@menu) - item.enabled = enable if item.metadata?['windowSpecific'] + item.enabled = enable if item.metadata?.windowSpecific + return # Replaces VERSION with the current version. substituteVersion: (template) -> @@ -145,7 +146,7 @@ class ApplicationMenu if item.command item.accelerator = @acceleratorForCommand(item.command, keystrokesByCommand) item.click = -> global.atomApplication.sendCommand(item.command) - item.metadata['windowSpecific'] = true unless /^application:/.test(item.command) + item.metadata.windowSpecific = true unless /^application:/.test(item.command) @translateTemplate(item.submenu, keystrokesByCommand) if item.submenu template diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 8fa888730..d79b2bf76 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -388,11 +388,13 @@ class AtomApplication # Kill all processes associated with opened windows. killAllProcesses: -> @killProcess(pid) for pid of @pidsToOpenWindows + return # Kill process associated with the given opened window. killProcessForWindow: (openedWindow) -> for pid, trackedWindow of @pidsToOpenWindows @killProcess(pid) if trackedWindow is openedWindow + return # Kill the process with the given pid. killProcess: (pid) -> diff --git a/src/browser/auto-update-manager.coffee b/src/browser/auto-update-manager.coffee index a0c1f2da8..3ee0fce3d 100644 --- a/src/browser/auto-update-manager.coffee +++ b/src/browser/auto-update-manager.coffee @@ -65,6 +65,7 @@ class AutoUpdateManager return unless @releaseVersion? for atomWindow in windows atomWindow.sendMessage('update-available', {@releaseVersion}) + return setState: (state) -> return if @state is state From 6e464ac35c6e35cd6c2f0283fa74a2c66d325872 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 15:18:55 -0700 Subject: [PATCH 130/521] Catch non-protype functions --- build/tasks/output-for-loop-returns.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/output-for-loop-returns.coffee b/build/tasks/output-for-loop-returns.coffee index 47523aa45..f9b036120 100644 --- a/build/tasks/output-for-loop-returns.coffee +++ b/build/tasks/output-for-loop-returns.coffee @@ -12,7 +12,7 @@ module.exports = (grunt) -> js = grunt.file.read(jsPath) method = null for line, index in js.split('\n') - [match, className, methodName] = /^\s*([a-zA-Z]+)\.prototype\.([a-zA-Z]+)\s*=\s*function\(/.exec(line) ? [] + [match, className, methodName] = /^\s*([a-zA-Z]+)\.(?:prototype\.)?([a-zA-Z]+)\s*=\s*function\(/.exec(line) ? [] if className and methodName method = "#{className}::#{methodName}" else From 590a4b0fd5cccef210e236991ddd4a3a3ee521b9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 15:19:19 -0700 Subject: [PATCH 131/521] Add explicit return after for loop --- src/atom.coffee | 1 + src/command-registry.coffee | 2 ++ src/config.coffee | 3 +++ src/context-menu-manager.coffee | 1 + src/cursors-component.coffee | 2 ++ src/custom-event-mixin.coffee | 2 ++ src/deserializer-manager.coffee | 2 ++ src/display-buffer.coffee | 4 ++++ src/gutter-component.coffee | 2 ++ src/highlights-component.coffee | 4 ++++ src/language-mode.coffee | 4 ++++ src/lines-component.coffee | 3 +++ src/marker.coffee | 1 + src/package-manager.coffee | 2 ++ src/package.coffee | 4 ++++ src/pane-container.coffee | 2 ++ src/pane.coffee | 3 +++ src/project.coffee | 1 + src/row-map.coffee | 1 + src/selection.coffee | 7 +++++++ src/style-manager.coffee | 2 ++ src/styles-element.coffee | 1 + 22 files changed, 54 insertions(+) diff --git a/src/atom.coffee b/src/atom.coffee index e03502dee..188d0b3a6 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -825,6 +825,7 @@ class Atom extends Model delete window[key] else window[key] = value + return onUpdateAvailable: (callback) -> @emitter.on 'update-available', callback diff --git a/src/command-registry.coffee b/src/command-registry.coffee index ead4415d2..479d972fa 100644 --- a/src/command-registry.coffee +++ b/src/command-registry.coffee @@ -50,6 +50,7 @@ class CommandRegistry destroy: -> for commandName of @registeredCommands window.removeEventListener(commandName, @handleCommandEvent, true) + return # Public: Add one or more command listeners associated with a selector. # @@ -187,6 +188,7 @@ class CommandRegistry @selectorBasedListenersByCommandName = {} for commandName, listeners of snapshot @selectorBasedListenersByCommandName[commandName] = listeners.slice() + return handleCommandEvent: (originalEvent) => propagationStopped = false diff --git a/src/config.coffee b/src/config.coffee index 331e89af9..4901f21dc 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -301,6 +301,7 @@ class Config for typeName, functions of filters for name, enforcerFunction of functions @addSchemaEnforcer(typeName, enforcerFunction) + return @executeSchemaEnforcers: (keyPath, value, schema) -> error = null @@ -898,6 +899,7 @@ class Config @transact => @settings = {} @set(key, value, save: false) for key, value of newSettings + return getRawValue: (keyPath, options) -> unless options?.excludeSources?.indexOf(@getUserConfigPath()) >= 0 @@ -958,6 +960,7 @@ class Config @setRawDefault(keyPath, defaults) catch e console.warn("'#{keyPath}' could not set the default. Attempted default: #{JSON.stringify(defaults)}; Schema: #{JSON.stringify(@getSchema(keyPath))}") + return deepClone: (object) -> if object instanceof Color diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 3f281afb1..ed91f5e6c 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -132,6 +132,7 @@ class ContextMenuManager new Disposable => for itemSet in addedItemSets @itemSets.splice(@itemSets.indexOf(itemSet), 1) + return templateForElement: (target) -> @templateForEvent({target}) diff --git a/src/cursors-component.coffee b/src/cursors-component.coffee index f4f5d749f..bd530ce2b 100644 --- a/src/cursors-component.coffee +++ b/src/cursors-component.coffee @@ -35,6 +35,8 @@ class CursorsComponent @domNode.appendChild(cursorNode) @updateCursorNode(id, cursorState) + return + updateCursorNode: (id, newCursorState) -> cursorNode = @cursorNodesById[id] oldCursorState = (@oldState.cursors[id] ?= {}) diff --git a/src/custom-event-mixin.coffee b/src/custom-event-mixin.coffee index 1a3bb4d88..12785c89c 100644 --- a/src/custom-event-mixin.coffee +++ b/src/custom-event-mixin.coffee @@ -7,9 +7,11 @@ CustomEventMixin = for name, listeners in @customEventListeners for listener in listeners @getDOMNode().removeEventListener(name, listener) + return addCustomEventListeners: (customEventListeners) -> for name, listener of customEventListeners @customEventListeners[name] ?= [] @customEventListeners[name].push(listener) @getDOMNode().addEventListener(name, listener) + return diff --git a/src/deserializer-manager.coffee b/src/deserializer-manager.coffee index 50becb31a..40c5ea7f3 100644 --- a/src/deserializer-manager.coffee +++ b/src/deserializer-manager.coffee @@ -35,10 +35,12 @@ class DeserializerManager @deserializers[deserializer.name] = deserializer for deserializer in deserializers new Disposable => delete @deserializers[deserializer.name] for deserializer in deserializers + return remove: (classes...) -> Grim.deprecate("Call .dispose() on the Disposable return from ::add instead") delete @deserializers[name] for {name} in classes + return # Public: Deserialize the state and params. # diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 8e8bd8dcd..4ab65d0f7 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -538,6 +538,7 @@ class DisplayBuffer extends Model # bufferRow - The buffer row {Number} to check against unfoldBufferRow: (bufferRow) -> fold.destroy() for fold in @foldsContainingBufferRow(bufferRow) + return # Given a buffer row, this returns the largest fold that starts there. # @@ -1082,6 +1083,7 @@ class DisplayBuffer extends Model pauseMarkerChangeEvents: -> marker.pauseChangeEvents() for marker in @getMarkers() + return resumeMarkerChangeEvents: -> marker.resumeChangeEvents() for marker in @getMarkers() @@ -1091,6 +1093,7 @@ class DisplayBuffer extends Model refreshMarkerScreenPositions: -> for marker in @getMarkers() marker.notifyObservers(textChanged: false) + return destroyed: -> marker.unsubscribe() for id, marker of @markers @@ -1102,6 +1105,7 @@ class DisplayBuffer extends Model for row in [start..end] line = @tokenizedLineForScreenRow(row).text console.log row, @bufferRowForScreenRow(row), line, line.length + return getRootScopeDescriptor: -> @tokenizedBuffer.rootScopeDescriptor diff --git a/src/gutter-component.coffee b/src/gutter-component.coffee index 6eb11ff1f..072ac99a0 100644 --- a/src/gutter-component.coffee +++ b/src/gutter-component.coffee @@ -84,6 +84,8 @@ class GutterComponent delete @lineNumberNodesById[id] delete @oldState.lineNumbers[id] + return + buildLineNumberHTML: (lineNumberState) -> {screenRow, bufferRow, softWrapped, top, decorationClasses} = lineNumberState if screenRow? diff --git a/src/highlights-component.coffee b/src/highlights-component.coffee index 3bd5197fe..e2c629cb9 100644 --- a/src/highlights-component.coffee +++ b/src/highlights-component.coffee @@ -39,6 +39,8 @@ class HighlightsComponent @domNode.appendChild(highlightNode) @updateHighlightNode(id, highlightState) + return + updateHighlightNode: (id, newHighlightState) -> highlightNode = @highlightNodesById[id] oldHighlightState = (@oldState[id] ?= {regions: [], flashCount: 0}) @@ -92,6 +94,8 @@ class HighlightsComponent else regionNode.style[property] = '' + return + flashHighlightNodeIfRequested: (id, newHighlightState) -> oldHighlightState = @oldState[id] return unless newHighlightState.flashCount > oldHighlightState.flashCount diff --git a/src/language-mode.coffee b/src/language-mode.coffee index b7a52280b..125b15ff6 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -104,11 +104,13 @@ class LanguageMode [startRow, endRow] = @rowRangeForFoldAtBufferRow(currentRow) ? [] continue unless startRow? @editor.createFold(startRow, endRow) + return # Unfolds all the foldable lines in the buffer. unfoldAll: -> for row in [@buffer.getLastRow()..0] fold.destroy() for fold in @editor.displayBuffer.foldsStartingAtBufferRow(row) + return # Fold all comment and code blocks at a given indentLevel # @@ -122,6 +124,7 @@ class LanguageMode # assumption: startRow will always be the min indent level for the entire range if @editor.indentationForBufferRow(startRow) == indentLevel @editor.createFold(startRow, endRow) + return # Given a buffer row, creates a fold at it. # @@ -276,6 +279,7 @@ class LanguageMode # endRow - The row {Number} to end at autoIndentBufferRows: (startRow, endRow) -> @autoIndentBufferRow(row) for row in [startRow..endRow] + return # Given a buffer row, this indents it. # diff --git a/src/lines-component.coffee b/src/lines-component.coffee index fa4ab23b0..8389a1ae9 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -89,6 +89,7 @@ class LinesComponent removeLineNodes: -> @removeLineNode(id) for id of @oldState.lines + return removeLineNode: (id) -> @lineNodesByLineId[id].remove() @@ -126,6 +127,8 @@ class LinesComponent @lineNodesByLineId[id] = lineNode @domNode.appendChild(lineNode) + return + buildLineHTML: (id) -> {scrollWidth} = @newState {screenRow, tokens, text, top, lineEnding, fold, isSoftWrapped, indentLevel, decorationClasses} = @newState.lines[id] diff --git a/src/marker.coffee b/src/marker.coffee index 2224ca1c7..22460c1f8 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -396,6 +396,7 @@ class Marker for event in deferredChangeEvents @emit 'changed', event @emitter.emit 'did-change', event + return getPixelRange: -> @displayBuffer.pixelRangeForScreenRange(@getScreenRange(), false) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 9f53d45e2..444497c5b 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -394,6 +394,7 @@ class PackageManager for pack in packages promise = @activatePackage(pack.name) promises.push(promise) unless pack.hasActivationCommands() + return @observeDisabledPackages() promises @@ -413,6 +414,7 @@ class PackageManager deactivatePackages: -> atom.config.transact => @deactivatePackage(pack.name) for pack in @getLoadedPackages() + return @unobserveDisabledPackages() # Deactivate the package with the given name diff --git a/src/package.coffee b/src/package.coffee index 4d244c50f..44516261a 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -238,12 +238,14 @@ class Package @keymaps = (["#{atom.packages.resourcePath}#{path.sep}#{keymapPath}", keymapObject] for keymapPath, keymapObject of packagesCache[@name].keymaps) else @keymaps = @getKeymapPaths().map (keymapPath) -> [keymapPath, CSON.readFileSync(keymapPath) ? {}] + return loadMenus: -> if @bundledPackage and packagesCache[@name]? @menus = (["#{atom.packages.resourcePath}#{path.sep}#{menuPath}", menuObject] for menuPath, menuObject of packagesCache[@name].menus) else @menus = @getMenuPaths().map (menuPath) -> [menuPath, CSON.readFileSync(menuPath) ? {}] + return getKeymapPaths: -> keymapsDirPath = path.join(@path, 'keymaps') @@ -447,6 +449,7 @@ class Package @activateNow() break currentTarget = currentTarget.parentElement + return getActivationCommands: -> return @activationCommands if @activationCommands? @@ -505,6 +508,7 @@ class Package for modulePath in fs.listSync(nodeModulesPath) nativeModulePaths.push(modulePath) if @isNativeModule(modulePath) traversePath(path.join(modulePath, 'node_modules')) + return traversePath(path.join(@path, 'node_modules')) nativeModulePaths diff --git a/src/pane-container.coffee b/src/pane-container.coffee index 14fa25a44..61ff9f207 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -151,6 +151,7 @@ class PaneContainer extends Model saveAll: -> pane.saveItems() for pane in @getPanes() + return confirmClose: (options) -> allSaved = true @@ -186,6 +187,7 @@ class PaneContainer extends Model destroyEmptyPanes: -> pane.destroy() for pane in @getPanes() when pane.items.length is 0 + return willDestroyPaneItem: (event) -> @emitter.emit 'will-destroy-pane-item', event diff --git a/src/pane.coffee b/src/pane.coffee index 0f19c40bf..a1239acb5 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -440,10 +440,12 @@ class Pane extends Model # Public: Destroy all items. destroyItems: -> @destroyItem(item) for item in @getItems() + return # Public: Destroy all items except for the active item. destroyInactiveItems: -> @destroyItem(item) for item in @getItems() when item isnt @activeItem + return promptToSaveItem: (item, options={}) -> return true unless item.shouldPromptToSave?(options) @@ -518,6 +520,7 @@ class Pane extends Model # Public: Save all items. saveItems: -> @saveItem(item) for item in @getItems() + return # Public: Return the first item that matches the given URI or undefined if # none exists. diff --git a/src/project.coffee b/src/project.coffee index a54d5edd1..299ba920b 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -83,6 +83,7 @@ class Project extends Model destroyUnretainedBuffers: -> buffer.destroy() for buffer in @getBuffers() when not buffer.isRetained() + return ### Section: Serialization diff --git a/src/row-map.coffee b/src/row-map.coffee index fd5dfb2ea..5510c1421 100644 --- a/src/row-map.coffee +++ b/src/row-map.coffee @@ -112,6 +112,7 @@ class RowMap @regions.splice index - 1, 2, bufferRows: leftRegion.bufferRows + rightRegion.bufferRows screenRows: leftRegion.screenRows + rightRegion.screenRows + return # Public: Returns an array of strings describing the map's regions. inspect: -> diff --git a/src/selection.coffee b/src/selection.coffee index 5b0fdae38..375498c41 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -538,6 +538,7 @@ class Selection extends Model for row in [start..end] if matchLength = buffer.lineForRow(row).match(leadingTabRegex)?[0].length buffer.delete [[row, 0], [row, matchLength]] + return # Public: Sets the indentation level of all selected rows to values suggested # by the relevant grammars. @@ -620,6 +621,7 @@ class Selection extends Model currentIndentLevel = @editor.indentLevelForLine(lines[i]) indentLevel = Math.max(0, currentIndentLevel + indentAdjustment) lines[i] = line.replace(/^[\t ]+/, @editor.buildIndentString(indentLevel)) + return # Indent the current line(s). # @@ -651,6 +653,7 @@ class Selection extends Model [start, end] = @getBufferRowRange() for row in [start..end] @editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) == 0 + return ### Section: Managing multiple selections @@ -674,6 +677,8 @@ class Selection extends Model @editor.addSelectionForScreenRange(clippedRange, goalScreenRange: range) break + return + # Public: Moves the selection up one row. addSelectionAbove: -> range = (@getGoalScreenRange() ? @getScreenRange()).copy() @@ -692,6 +697,8 @@ class Selection extends Model @editor.addSelectionForScreenRange(clippedRange, goalScreenRange: range) break + return + # Public: Combines the given selection into this selection and then destroys # the given selection. # diff --git a/src/style-manager.coffee b/src/style-manager.coffee index c891223b9..cfe86b3fe 100644 --- a/src/style-manager.coffee +++ b/src/style-manager.coffee @@ -152,6 +152,8 @@ class StyleManager for styleElement in styleElementsToRestore @addStyleElement(styleElement) unless styleElement in existingStyleElements + return + ### Section: Paths ### diff --git a/src/styles-element.coffee b/src/styles-element.coffee index d333a2e45..fc3b888cf 100644 --- a/src/styles-element.coffee +++ b/src/styles-element.coffee @@ -46,6 +46,7 @@ class StylesElement extends HTMLElement @styleElementRemoved(child) for child in Array::slice.call(@children) @context = @getAttribute('context') @styleElementAdded(styleElement) for styleElement in atom.styles.getStyleElements() + return styleElementAdded: (styleElement) -> return unless @styleElementMatchesContext(styleElement) From d9a5aff919087133f8f3cd223cf4ec4b391be32e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 18 Mar 2015 15:34:50 -0700 Subject: [PATCH 132/521] Add explicit return after for loop --- src/text-editor-presenter.coffee | 11 +++++++++++ src/text-editor.coffee | 20 +++++++++++++++++--- src/tokenized-buffer.coffee | 2 ++ src/tokenized-line.coffee | 3 +++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index ebcc5a5ca..babd7725b 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -124,6 +124,7 @@ class TextEditorPresenter @disposables.add @model.onDidChangeScrollLeft(@setScrollLeft.bind(this)) @observeDecoration(decoration) for decoration in @model.getDecorations() @observeCursor(cursor) for cursor in @model.getCursors() + return observeConfig: -> configParams = {scope: @model.getRootScopeDescriptor()} @@ -273,6 +274,7 @@ class TextEditorPresenter for id, line of @state.content.lines unless visibleLineIds.hasOwnProperty(id) delete @state.content.lines[id] + return updateLineState: (row, line) -> lineState = @state.content.lines[line.id] @@ -296,6 +298,7 @@ class TextEditorPresenter updateCursorsState: -> @batch "shouldUpdateCursorsState", -> @state.content.cursors = {} @updateCursorState(cursor) for cursor in @model.cursors # using property directly to avoid allocation + return updateCursorState: (cursor, destroyOnly = false) -> delete @state.content.cursors[cursor.id] @@ -331,6 +334,8 @@ class TextEditorPresenter for id of @state.content.overlays delete @state.content.overlays[id] unless visibleDecorationIds[id] + return + updateGutterState: -> @batch "shouldUpdateGutterState", -> @state.gutter.visible = not @model.isMini() and (@model.isGutterVisible() ? true) and @showLineNumbers @state.gutter.maxLineNumberDigits = @model.getLineCount().toString().length @@ -382,6 +387,8 @@ class TextEditorPresenter for id of @state.gutter.lineNumbers delete @state.gutter.lineNumbers[id] unless visibleLineNumberIds[id] + return + updateStartRow: -> return unless @scrollTop? and @lineHeight? @@ -873,11 +880,13 @@ class TextEditorPresenter unless visibleHighlights[id] delete @state.content.highlights[id] + return removeFromLineDecorationCaches: (decoration, range) -> for row in [range.start.row..range.end.row] by 1 delete @lineDecorationsByScreenRow[row]?[decoration.id] delete @lineNumberDecorationsByScreenRow[row]?[decoration.id] + return addToLineDecorationCaches: (decoration, range) -> marker = decoration.getMarker() @@ -903,6 +912,8 @@ class TextEditorPresenter @lineNumberDecorationsByScreenRow[row] ?= {} @lineNumberDecorationsByScreenRow[row][decoration.id] = decoration + return + updateHighlightState: (decoration) -> return unless @startRow? and @endRow? and @lineHeight? and @hasPixelPositionRequirements() diff --git a/src/text-editor.coffee b/src/text-editor.coffee index f731810ae..d29013280 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -842,7 +842,9 @@ class TextEditor extends Model # {Number} index of that selection. mutateSelectedText: (fn) -> @mergeIntersectingSelections => - @transact => fn(selection, index) for selection, index in @getSelections() + @transact => + fn(selection, index) for selection, index in @getSelections() + return # Move lines intersection the most recent selection up by one row in screen # coordinates. @@ -978,6 +980,7 @@ class TextEditor extends Model selection.setBufferRange(selectedBufferRange.translate([delta, 0])) for [foldStartRow, foldEndRow] in foldedRowRanges @createFold(foldStartRow + delta, foldEndRow + delta) + return # Deprecated: Use {::duplicateLines} instead. duplicateLine: -> @@ -1013,6 +1016,7 @@ class TextEditor extends Model while ++row < end.row @addSelectionForBufferRange([[row, 0], [row, Infinity]]) @addSelectionForBufferRange([[end.row, 0], [end.row, end.column]]) unless end.column is 0 + return # Extended: For each selection, transpose the selected text. # @@ -1779,7 +1783,7 @@ class TextEditor extends Model # Extended: Get an Array of all {Cursor}s. getCursors: -> - cursor for cursor in @cursors + @cursors.slice() # Extended: Get all {Cursors}s, ordered by their position in the buffer # instead of the order in which they were added. @@ -1822,6 +1826,7 @@ class TextEditor extends Model cursor.destroy() else positions[position] = true + return preserveCursorPositionOnBufferReload: -> cursorPosition = null @@ -1886,6 +1891,7 @@ class TextEditor extends Model selections[i].setBufferRange(bufferRange, options) else @addSelectionForBufferRange(bufferRange, options) + return # Essential: Get the {Range} of the most recently added selection in screen # coordinates. @@ -1932,6 +1938,7 @@ class TextEditor extends Model selections[i].setScreenRange(screenRange, options) else @addSelectionForScreenRange(screenRange, options) + return # Essential: Add a selection for the given range in buffer coordinates. # @@ -2159,7 +2166,7 @@ class TextEditor extends Model # # Returns: An {Array} of {Selection}s. getSelections: -> - selection for selection in @selections + @selections.slice() # Extended: Get all {Selection}s, ordered by their position in the buffer # instead of the order in which they were added. @@ -2206,15 +2213,18 @@ class TextEditor extends Model expandSelectionsForward: (fn) -> @mergeIntersectingSelections => fn(selection) for selection in @getSelections() + return # Calls the given function with each selection, then merges selections in the # reversed orientation expandSelectionsBackward: (fn) -> @mergeIntersectingSelections reversed: true, => fn(selection) for selection in @getSelections() + return finalizeSelections: -> selection.finalize() for selection in @getSelections() + return selectionsForScreenRows: (startRow, endRow) -> @getSelections().filter (selection) -> selection.intersectsScreenRowRange(startRow, endRow) @@ -2620,6 +2630,7 @@ class TextEditor extends Model else selection.copy(maintainClipboard, false) maintainClipboard = true + return # Essential: For each selection, cut the selected text. cutSelectedText: -> @@ -2714,6 +2725,7 @@ class TextEditor extends Model # Extended: For each selection, fold the rows it intersects. foldSelectedLines: -> selection.fold() for selection in @getSelections() + return # Extended: Fold all foldable lines. foldAll: -> @@ -2796,6 +2808,8 @@ class TextEditor extends Model for row in [bufferRange.end.row..bufferRange.start.row] fold.destroy() for fold in @displayBuffer.foldsStartingAtBufferRow(row) + return + # Remove any {Fold}s found that contain the given buffer range. destroyFoldsContainingBufferRange: (bufferRange) -> @unfoldBufferRow(bufferRange.start.row) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index b8a9bdab7..cf7d15c28 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -197,6 +197,7 @@ class TokenizedBuffer extends Model validateRow: (row) -> @invalidRows.shift() while @invalidRows[0] <= row + return invalidateRow: (row) -> @invalidRows.push(row) @@ -468,3 +469,4 @@ class TokenizedBuffer extends Model for row in [start..end] line = @tokenizedLineForRow(row).text console.log row, line, line.length + return diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 2a807d84a..f67d754c8 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -222,6 +222,7 @@ class TokenizedLine if @lineEnding? and (index + token.value.length > firstTrailingWhitespaceIndex) token.firstTrailingWhitespaceIndex = Math.max(0, firstTrailingWhitespaceIndex - index) index += token.value.length + return substituteInvisibleCharacters: -> invisibles = @invisibles @@ -309,6 +310,8 @@ class TokenizedLine for j in [i...desiredScopeDescriptor.length] scopeStack.push(new Scope(desiredScopeDescriptor[j])) + return + class Scope constructor: (@scope) -> @children = [] From a9803d3c4d9fc371edf6f3c600f79a5299284ddf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 10:53:55 -0700 Subject: [PATCH 133/521] Add explicit return after for loop --- src/window-event-handler.coffee | 3 +++ src/workspace-view.coffee | 1 - src/workspace.coffee | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 1384f0c4a..593d33476 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -32,6 +32,8 @@ class WindowEventHandler unless fs.isDirectorySync(pathToOpen) atom.workspace?.open(pathToOpen, {initialLine, initialColumn}) + return + when 'update-available' atom.updateAvailable(detail) @@ -156,6 +158,7 @@ class WindowEventHandler continue unless tabIndex >= 0 callback(element, tabIndex) + return focusNext: => focusedTabIndex = parseInt($(':focus').attr('tabindex')) or -Infinity diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index addfe63c5..6a4a685d8 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -222,7 +222,6 @@ class WorkspaceView extends View for editorElement in @panes.element.querySelectorAll('atom-pane > .item-views > atom-text-editor') $(editorElement).view() - ### Section: Deprecated ### diff --git a/src/workspace.coffee b/src/workspace.coffee index 49f84f9b8..4afce1f37 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -110,6 +110,7 @@ class Workspace extends Model packageNames.push(packageName) for scopeName in includedGrammarScopes ? [] addGrammar(atom.grammars.grammarForScopeName(scopeName)) + return editors = @getTextEditors() addGrammar(editor.getGrammar()) for editor in editors From 23eacc1e58201e592167c4db860a0126c0dcfa77 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 10:56:42 -0700 Subject: [PATCH 134/521] Add explicit return after for loop --- src/menu-helpers.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/menu-helpers.coffee b/src/menu-helpers.coffee index a91523b82..aa346200c 100644 --- a/src/menu-helpers.coffee +++ b/src/menu-helpers.coffee @@ -17,6 +17,8 @@ merge = (menu, item, itemSpecificity=Infinity) -> else unless item.type is 'separator' and _.last(menu)?.type is 'separator' menu.push(item) + return + unmerge = (menu, item) -> matchingItemIndex = findMatchingItemIndex(menu, item) matchingItem = menu[matchingItemIndex] unless matchingItemIndex is - 1 From 9f31afcbc9ad7d80186e389cd1f39865cbd6764d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 10:57:55 -0700 Subject: [PATCH 135/521] Add explicit return after while loop --- src/package.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/package.coffee b/src/package.coffee index 44516261a..c0ab284e9 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -449,6 +449,7 @@ class Package @activateNow() break currentTarget = currentTarget.parentElement + return return getActivationCommands: -> From a72b1ccdf406d95be39f4f7eb3a929c520542b59 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 11:10:15 -0700 Subject: [PATCH 136/521] Mention array copying and explicit returns --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5ebdd5f5..d2cf02bef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,6 +104,9 @@ For more information on how to work with Atom's official packages, see should be lower-case: * `getURI` instead of `getUri` * `uriToOpen` instead of `URIToOpen` +* Use `slice()` to copy an array +* Add an explicit `return` when your function ends with a `for`/`while` loop and + you don't want it to return a collected array. ## Documentation Styleguide From 576e00fb9363ffda732b646021fe166e443b0de0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 11:57:16 -0700 Subject: [PATCH 137/521] Keep returning array from TextEditor::mutateSelectedText --- src/text-editor.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index d29013280..6ccb97392 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -844,7 +844,6 @@ class TextEditor extends Model @mergeIntersectingSelections => @transact => fn(selection, index) for selection, index in @getSelections() - return # Move lines intersection the most recent selection up by one row in screen # coordinates. From 2bfd30c832d0fea8001b021d697ef43879964db3 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 19 Mar 2015 14:37:39 -0600 Subject: [PATCH 138/521] Revert "Revert "Don't soft-wrap on indentation"" --- spec/display-buffer-spec.coffee | 18 ++++++++++++++++ spec/text-editor-component-spec.coffee | 4 ++-- src/tokenized-line.coffee | 30 ++++++++++++-------------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 1703a24d1..95f22acca 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -115,6 +115,24 @@ describe "DisplayBuffer", -> expect(displayBuffer.tokenizedLineForScreenRow(3).text).toBe ' var pivot = items.shift(), current, left = [], ' expect(displayBuffer.tokenizedLineForScreenRow(4).text).toBe ' right = [];' + describe "when the only whitespace characters are at the beginning of the line", -> + beforeEach -> + displayBuffer.setEditorWidthInChars(10) + + it "wraps the line at the max length when indented with tabs", -> + buffer.setTextInRange([[0, 0], [1, 0]], '\t\tabcdefghijklmnopqrstuvwxyz') + + expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe ' abcdef' + expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe ' ghijkl' + expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe ' mnopqr' + + it "wraps the line at the max length when indented with spaces", -> + buffer.setTextInRange([[0, 0], [1, 0]], ' abcdefghijklmnopqrstuvwxyz') + + expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe ' abcdef' + expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe ' ghijkl' + expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe ' mnopqr' + describe "when there are hard tabs", -> beforeEach -> buffer.setText(buffer.getText().replace(new RegExp(' ', 'g'), '\t')) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index f5c9e7677..20ddcdcab 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1937,14 +1937,14 @@ describe "TextEditorComponent", -> gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(11), metaKey: true)) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(11), metaKey: true)) - expect(editor.getSelectedScreenRanges()).toEqual [[[7, 4], [7, 6]], [[10, 0], [20, 0]]] + expect(editor.getSelectedScreenRanges()).toEqual [[[7, 4], [7, 6]], [[10, 0], [19, 0]]] it "merges overlapping selections", -> gutterNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenRowInGutter(17), metaKey: true)) gutterNode.dispatchEvent(buildMouseEvent('mousemove', clientCoordinatesForScreenRowInGutter(9), metaKey: true)) nextAnimationFrame() gutterNode.dispatchEvent(buildMouseEvent('mouseup', clientCoordinatesForScreenRowInGutter(9), metaKey: true)) - expect(editor.getSelectedScreenRanges()).toEqual [[[5, 0], [20, 0]]] + expect(editor.getSelectedScreenRanges()).toEqual [[[5, 0], [19, 0]]] describe "when the gutter is shift-clicked and dragged", -> describe "when the shift-click is below the existing selection's tail", -> diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 2a807d84a..b62ab316f 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -11,6 +11,7 @@ module.exports = class TokenizedLine endOfLineInvisibles: null lineIsWhitespaceOnly: false + firstNonWhitespaceIndex: 0 foldable: false constructor: ({tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold, @tabLength, @indentLevel, @invisibles}) -> @@ -96,6 +97,7 @@ class TokenizedLine # Returns a {Number} representing the `line` position where the wrap would take place. # Returns `null` if a wrap wouldn't occur. findWrapColumn: (maxColumn) -> + return unless maxColumn? return unless @text.length > maxColumn if /\s/.test(@text[maxColumn]) @@ -106,7 +108,7 @@ class TokenizedLine return @text.length else # search backward for the start of the word on the boundary - for column in [maxColumn..0] when @isColumnOutsideSoftWrapIndentation(column) + for column in [maxColumn..@firstNonWhitespaceIndex] return column + 1 if /\s/.test(@text[column]) return maxColumn @@ -127,12 +129,13 @@ class TokenizedLine rightTokens = new Array(@tokens...) leftTokens = [] - leftTextLength = 0 - while leftTextLength < column - if leftTextLength + rightTokens[0].value.length > column - rightTokens[0..0] = rightTokens[0].splitAt(column - leftTextLength) + leftScreenColumn = 0 + + while leftScreenColumn < column + if leftScreenColumn + rightTokens[0].screenDelta > column + rightTokens[0..0] = rightTokens[0].splitAt(column - leftScreenColumn) nextToken = rightTokens.shift() - leftTextLength += nextToken.value.length + leftScreenColumn += nextToken.screenDelta leftTokens.push nextToken indentationTokens = @buildSoftWrapIndentationTokens(leftTokens[0], hangingIndent) @@ -160,11 +163,6 @@ class TokenizedLine isSoftWrapped: -> @lineEnding is null - isColumnOutsideSoftWrapIndentation: (column) -> - return true if @softWrapIndentationTokens.length == 0 - - column > @softWrapIndentationDelta - isColumnInsideSoftWrapIndentation: (column) -> return false if @softWrapIndentationTokens.length == 0 @@ -209,15 +207,15 @@ class TokenizedLine outputTokens markLeadingAndTrailingWhitespaceTokens: -> - firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex) - if firstNonWhitespaceIndex > 0 and isPairedCharacter(@text, firstNonWhitespaceIndex - 1) - firstNonWhitespaceIndex-- + @firstNonWhitespaceIndex = @text.search(NonWhitespaceRegex) + if @firstNonWhitespaceIndex > 0 and isPairedCharacter(@text, @firstNonWhitespaceIndex - 1) + @firstNonWhitespaceIndex-- firstTrailingWhitespaceIndex = @text.search(TrailingWhitespaceRegex) @lineIsWhitespaceOnly = firstTrailingWhitespaceIndex is 0 index = 0 for token in @tokens - if index < firstNonWhitespaceIndex - token.firstNonWhitespaceIndex = Math.min(index + token.value.length, firstNonWhitespaceIndex - index) + if index < @firstNonWhitespaceIndex + token.firstNonWhitespaceIndex = Math.min(index + token.value.length, @firstNonWhitespaceIndex - index) # Only the *last* segment of a soft-wrapped line can have trailing whitespace if @lineEnding? and (index + token.value.length > firstTrailingWhitespaceIndex) token.firstTrailingWhitespaceIndex = Math.max(0, firstTrailingWhitespaceIndex - index) From 5f76979fc83367d916e8962a6dd31c12983eff57 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 19 Mar 2015 15:08:36 -0600 Subject: [PATCH 139/521] Fix random editor spec now for indented soft-wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We previously implemented soft-wrap logic again just for this test. Since the purpose of this test is just to make sure that mutation occurs correctly, we now instead construct a fresh editor for comparison so that changes to soft-wrap logic are reflected. /cc @as-cii Took care of this, so you don’t need to worry about my previous comment on your PR. Sorry for the noise. --- spec/random-editor-spec.coffee | 44 +++++++++------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/spec/random-editor-spec.coffee b/spec/random-editor-spec.coffee index bb5028d9a..d235ebc25 100644 --- a/spec/random-editor-spec.coffee +++ b/spec/random-editor-spec.coffee @@ -4,7 +4,7 @@ TextBuffer = require 'text-buffer' TextEditor = require '../src/text-editor' describe "TextEditor", -> - [editor, tokenizedBuffer, buffer, steps, previousSteps] = [] + [editor, tokenizedBuffer, buffer, steps] = [] softWrapColumn = 80 @@ -13,8 +13,6 @@ describe "TextEditor", -> atom.config.set('editor.preferredLineLength', softWrapColumn) it "properly renders soft-wrapped lines when randomly mutated", -> - previousSteps = JSON.parse(localStorage.steps ? '[]') - times 10, (i) -> buffer = new TextBuffer editor = new TextEditor({buffer}) @@ -47,6 +45,9 @@ describe "TextEditor", -> {bufferRows, screenLines} = getReferenceScreenLines() for bufferRow, screenRow in bufferRows console.log screenRow, bufferRow, screenLines[screenRow].text + console.log "==== steps to reproduce this failure: ===" + for step in steps + console.log 'editor.' + step[0] + '('+ step[1..].map((a) -> JSON.stringify(a)).join(', ') + ')' randomlyMutateEditor = -> if Math.random() < .2 @@ -79,34 +80,11 @@ describe "TextEditor", -> text getReferenceScreenLines = -> - if editor.isSoftWrapped() - screenLines = [] - bufferRows = [] - for bufferRow in [0..tokenizedBuffer.getLastRow()] - for screenLine in softWrapLine(tokenizedBuffer.tokenizedLineForRow(bufferRow)) - screenLines.push(screenLine) - bufferRows.push(bufferRow) - else - screenLines = tokenizedBuffer.tokenizedLines.slice() - bufferRows = [0..tokenizedBuffer.getLastRow()] + referenceEditor = new TextEditor({}) + referenceEditor.setEditorWidthInChars(80) + referenceEditor.setText(editor.getText()) + referenceEditor.setSoftWrapped(editor.isSoftWrapped()) + screenLines = referenceEditor.tokenizedLinesForScreenRows(0, referenceEditor.getLastScreenRow()) + bufferRows = referenceEditor.bufferRowsForScreenRows(0, referenceEditor.getLastScreenRow()) + {screenLines, bufferRows} - - softWrapLine = (tokenizedLine) -> - wrappedLines = [] - while tokenizedLine.text.length > softWrapColumn and wrapScreenColumn = findWrapColumn(tokenizedLine.text) - [wrappedLine, tokenizedLine] = tokenizedLine.softWrapAt(wrapScreenColumn) - wrappedLines.push(wrappedLine) - wrappedLines.push(tokenizedLine) - wrappedLines - - findWrapColumn = (line) -> - if /\s/.test(line[softWrapColumn]) - # search forward for the start of a word past the boundary - for column in [softWrapColumn..line.length] - return column if /\S/.test(line[column]) - return line.length - else - # search backward for the start of the word on the boundary - for column in [softWrapColumn..0] - return column + 1 if /\s/.test(line[column]) - return softWrapColumn From 9c74d1084994f2a20a7188cf6030abbdd742efe5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 15:34:50 -0700 Subject: [PATCH 140/521] :arrow_up: text-buffer@5.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 801aac11c..bf610bb2a 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^5", + "text-buffer": "^5.0.1", "theorist": "^1.0.2", "underscore-plus": "^1.6.6" }, From 706222ce8ad67d315dbdab31cce0e2c80946a5df Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 15:51:51 -0700 Subject: [PATCH 141/521] :arrow_up: apm@0.147 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index a989c7a83..374a7d98a 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.145.0" + "atom-package-manager": "0.147.0" } } From 2efee4a1a79657d3cebbcf4f927f703d226d4677 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 19 Mar 2015 16:06:55 -0700 Subject: [PATCH 142/521] :arrow_down: text-buffer@5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf610bb2a..801aac11c 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^5.0.1", + "text-buffer": "^5", "theorist": "^1.0.2", "underscore-plus": "^1.6.6" }, From 679840cada23adec621b25a085c751ab719ef5d9 Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Fri, 20 Mar 2015 10:58:52 +1100 Subject: [PATCH 143/521] chore: remove unneeded dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 9f12fe358..256df223a 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,6 @@ "temp": "0.8.1", "text-buffer": "^4.1.5", "theorist": "^1.0.2", - "typescript": "^1.4.1", "typescript-simple": "^1.0.0", "underscore-plus": "^1.6.6" }, From c4ae567e8f1644a35ecc9212e5d484dc040c253b Mon Sep 17 00:00:00 2001 From: postcasio Date: Fri, 20 Mar 2015 09:19:06 +0000 Subject: [PATCH 144/521] Fix deprecated calls and recommendations in deprecated methods --- src/project.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index 150e28d9a..752de03cc 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -419,7 +419,7 @@ class Project extends Model # Deprecated: delegate registerOpener: (opener) -> deprecate("Use Workspace::addOpener instead") - atom.workspace.registerOpener(opener) + atom.workspace.addOpener(opener) # Deprecated: delegate unregisterOpener: (opener) -> @@ -428,10 +428,10 @@ class Project extends Model # Deprecated: delegate eachEditor: (callback) -> - deprecate("Use Workspace::eachEditor instead") - atom.workspace.eachEditor(callback) + deprecate("Use Workspace::observeTextEditors instead") + atom.workspace.observeTextEditors(callback) # Deprecated: delegate getEditors: -> - deprecate("Use Workspace::getEditors instead") - atom.workspace.getEditors() + deprecate("Use Workspace::getTextEditors instead") + atom.workspace.getTextEditors() From 895686575248808c2bb159c49c067dff98521c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Fri, 20 Mar 2015 15:46:55 +0100 Subject: [PATCH 145/521] :arrow_up: language-json@0.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 801aac11c..1f3be78ed 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-hyperlink": "0.12.2", "language-java": "0.14.0", "language-javascript": "0.63.0", - "language-json": "0.12.0", + "language-json": "0.13.0", "language-less": "0.25.0", "language-make": "0.14.0", "language-mustache": "0.11.0", From 6f17a4dae2758f753e636a1a3d61da24ee2e29d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Fri, 20 Mar 2015 16:00:03 +0100 Subject: [PATCH 146/521] :arrow_down: language-json@0.12 See https://github.com/atom/language-json/pull/16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f3be78ed..801aac11c 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-hyperlink": "0.12.2", "language-java": "0.14.0", "language-javascript": "0.63.0", - "language-json": "0.13.0", + "language-json": "0.12.0", "language-less": "0.25.0", "language-make": "0.14.0", "language-mustache": "0.11.0", From a47744fd4842b8ff72cbab7b266e1f26554c261b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 20 Mar 2015 10:49:06 -0600 Subject: [PATCH 147/521] :arrow_up: text-buffer to 5.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 801aac11c..a9faaa391 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^5", + "text-buffer": "^5.0.2", "theorist": "^1.0.2", "underscore-plus": "^1.6.6" }, From 6c38562e96821091b743e31c8a4fadd0aa4cd133 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Fri, 20 Mar 2015 16:31:09 -0700 Subject: [PATCH 148/521] :arrow_up: feedback@0.35.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9faaa391..78560289a 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", - "feedback": "0.34.0", + "feedback": "0.35.0", "find-and-replace": "0.159.0", "fuzzy-finder": "0.72.0", "git-diff": "0.54.0", From a4003f31da2bfae13c54ec7d2fedcc7995c061fe Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 23 Mar 2015 18:03:43 +0800 Subject: [PATCH 149/521] :arrow_up: atom-shell@0.22.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 11bc09810..a3078ddc0 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "url": "http://github.com/atom/atom/raw/master/LICENSE.md" } ], - "atomShellVersion": "0.22.1", + "atomShellVersion": "0.22.2", "dependencies": { "async": "0.2.6", "atom-keymap": "^4", From eb6e15790a26f8e68f3073d735510b76bd7e6a34 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 23 Mar 2015 18:24:42 +0800 Subject: [PATCH 150/521] :arrow_up: apm@0.148.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 374a7d98a..ccfa1995e 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.147.0" + "atom-package-manager": "0.148.0" } } From d50e051c191c48c99cfdb6f68a86d609a9834576 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 09:31:35 -0700 Subject: [PATCH 151/521] :arrow_up: language-html@0.30 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 78560289a..2abad0f5e 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "language-gfm": "0.67.0", "language-git": "0.10.0", "language-go": "0.22.0", - "language-html": "0.29.0", + "language-html": "0.30.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", "language-javascript": "0.63.0", From 5840eacf577eed608552f7b93ea67b13019d33a1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 09:32:53 -0700 Subject: [PATCH 152/521] :arrow_up: language-json@0.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2abad0f5e..e9bce42a8 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-hyperlink": "0.12.2", "language-java": "0.14.0", "language-javascript": "0.63.0", - "language-json": "0.12.0", + "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", "language-mustache": "0.11.0", From 7bdd456a4d8e815219d9f629703b5a2defcac625 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 09:34:52 -0700 Subject: [PATCH 153/521] :arrow_up: status-bar@0.64 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9bce42a8..a857370ad 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "settings-view": "0.185.0", "snippets": "0.84.0", "spell-check": "0.55.0", - "status-bar": "0.63.0", + "status-bar": "0.64.0", "styleguide": "0.44.0", "symbols-view": "0.91.0", "tabs": "0.67.0", From 9700561fb94c84462a01c3b976f3877f0d3774be Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 09:35:07 -0700 Subject: [PATCH 154/521] :arrow_up: fs-plus@2.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a857370ad..284b88c29 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "emissary": "^1.3.3", "event-kit": "^1.0.3", "first-mate": "^3.0.0", - "fs-plus": "^2.5", + "fs-plus": "^2.6", "fstream": "0.1.24", "fuzzaldrin": "^2.1", "git-utils": "^3.0.0", From d30f614718ecdc6b9406f2a61cfa05c07691bed6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 09:35:29 -0700 Subject: [PATCH 155/521] :arrow_up: oniguruma@4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 284b88c29..fc0712886 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "marked": "^0.3", "mixto": "^1", "nslog": "^2.0.0", - "oniguruma": "^4.0.0", + "oniguruma": "^4.1", "optimist": "0.4.0", "pathwatcher": "^4.3.1", "property-accessors": "^1.1.3", From 5b346da58d153be63b61aa21fea28891e421690e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 09:37:15 -0700 Subject: [PATCH 156/521] :arrow_up: language-perl@0.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc0712886..73a4f7467 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.19.0", + "language-perl": "0.20.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From 6d4ab5087e0eb5cd86db14cb9e7df3d8378005ff Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 10:06:27 -0700 Subject: [PATCH 157/521] :arrow_up: language-perl@0.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 73a4f7467..f73a58ffc 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.20.0", + "language-perl": "0.21.0", "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", From f875cdcba54aefae2345fa018de0dab862035922 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Mon, 23 Mar 2015 11:28:52 -0700 Subject: [PATCH 158/521] :arrow_up: markdown-preview@0.144.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f73a58ffc..f3b3252b5 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.143.0", + "markdown-preview": "0.144.0", "metrics": "0.45.0", "notifications": "0.33.0", "open-on-github": "0.34.0", From 14316b1cd744f50ecb42bba86096269c26115236 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Mon, 23 Mar 2015 15:38:38 -0700 Subject: [PATCH 159/521] Add `Repository::getType()`. For `GitRepository`, this will return `"git"`. --- spec/git-repository-provider-spec.coffee | 1 + src/git-repository.coffee | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/spec/git-repository-provider-spec.coffee b/spec/git-repository-provider-spec.coffee index 59e3f55af..15e1dcc60 100644 --- a/spec/git-repository-provider-spec.coffee +++ b/spec/git-repository-provider-spec.coffee @@ -16,6 +16,7 @@ describe "GitRepositoryProvider", -> expect(result).toBeInstanceOf GitRepository expect(provider.pathToRepository[result.getPath()]).toBeTruthy() expect(result.statusTask).toBeTruthy() + expect(result.getType()).toBe 'git' it "returns the same GitRepository for different Directory objects in the same repo", -> provider = new GitRepositoryProvider atom.project diff --git a/src/git-repository.coffee b/src/git-repository.coffee index c4a9d34f5..ae10e7459 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -169,6 +169,12 @@ class GitRepository Section: Repository Details ### + # Public: A {String} indicating the type of version control system used by + # this repository. + # + # Returns `"git"`. + getType: -> 'git' + # Public: Returns the {String} path of the repository. getPath: -> @path ?= fs.absolute(@getRepo().getPath()) From 2620c95d86dc98aae2f5730a193f23c7ff46f803 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 24 Mar 2015 12:06:03 +0800 Subject: [PATCH 160/521] String.contains is not a standard method in Chrome 41 --- spec/default-directory-provider-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/default-directory-provider-spec.coffee b/spec/default-directory-provider-spec.coffee index 780f2afd5..236283d27 100644 --- a/spec/default-directory-provider-spec.coffee +++ b/spec/default-directory-provider-spec.coffee @@ -15,8 +15,8 @@ describe "DefaultDirectoryProvider", -> provider = new DefaultDirectoryProvider() tmp = temp.mkdirSync() nonNormalizedPath = tmp + path.sep + ".." + path.sep + path.basename(tmp) - expect(tmp.contains("..")).toBe false - expect(nonNormalizedPath.contains("..")).toBe true + expect(tmp.includes("..")).toBe false + expect(nonNormalizedPath.includes("..")).toBe true directory = provider.directoryForURISync(nonNormalizedPath) expect(directory.getPath()).toEqual tmp From 6f1b061dac48210f46335d28769fa03dc103ffa0 Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Tue, 24 Mar 2015 18:05:30 +1100 Subject: [PATCH 161/521] Added TypeScript to the compile-cache --- spec/compile-cache-spec.coffee | 13 ++++++++++++- src/compile-cache.coffee | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/spec/compile-cache-spec.coffee b/spec/compile-cache-spec.coffee index 534457157..6eb6556d0 100644 --- a/spec/compile-cache-spec.coffee +++ b/spec/compile-cache-spec.coffee @@ -3,26 +3,37 @@ CSON = require 'season' CoffeeCache = require 'coffee-cash' babel = require '../src/babel' +typescript = require '../src/typescript' CompileCache = require '../src/compile-cache' describe "Compile Cache", -> describe ".addPathToCache(filePath)", -> - it "adds the path to the correct CSON, CoffeeScript, or babel cache", -> + it "adds the path to the correct CSON, CoffeeScript, babel or typescript cache", -> spyOn(CSON, 'readFileSync').andCallThrough() spyOn(CoffeeCache, 'addPathToCache').andCallThrough() spyOn(babel, 'addPathToCache').andCallThrough() + spyOn(typescript, 'addPathToCache').andCallThrough() CompileCache.addPathToCache(path.join(__dirname, 'fixtures', 'cson.cson')) expect(CSON.readFileSync.callCount).toBe 1 expect(CoffeeCache.addPathToCache.callCount).toBe 0 expect(babel.addPathToCache.callCount).toBe 0 + expect(typescript.addPathToCache.callCount).toBe 0 CompileCache.addPathToCache(path.join(__dirname, 'fixtures', 'coffee.coffee')) expect(CSON.readFileSync.callCount).toBe 1 expect(CoffeeCache.addPathToCache.callCount).toBe 1 expect(babel.addPathToCache.callCount).toBe 0 + expect(typescript.addPathToCache.callCount).toBe 0 CompileCache.addPathToCache(path.join(__dirname, 'fixtures', 'babel', 'babel-double-quotes.js')) expect(CSON.readFileSync.callCount).toBe 1 expect(CoffeeCache.addPathToCache.callCount).toBe 1 expect(babel.addPathToCache.callCount).toBe 1 + expect(typescript.addPathToCache.callCount).toBe 0 + + CompileCache.addPathToCache(path.join(__dirname, 'fixtures', 'typescript', 'valid.ts')) + expect(CSON.readFileSync.callCount).toBe 1 + expect(CoffeeCache.addPathToCache.callCount).toBe 1 + expect(babel.addPathToCache.callCount).toBe 1 + expect(typescript.addPathToCache.callCount).toBe 1 diff --git a/src/compile-cache.coffee b/src/compile-cache.coffee index c31f5bdd1..8fe8d6711 100644 --- a/src/compile-cache.coffee +++ b/src/compile-cache.coffee @@ -2,6 +2,7 @@ path = require 'path' CSON = require 'season' CoffeeCache = require 'coffee-cash' babel = require './babel' +typescript = require './typescript' # This file is required directly by apm so that files can be cached during # package install so that the first package load in Atom doesn't have to @@ -16,6 +17,7 @@ exports.addPathToCache = (filePath, atomHome) -> CoffeeCache.setCacheDirectory(path.join(cacheDir, 'coffee')) CSON.setCacheDir(path.join(cacheDir, 'cson')) babel.setCacheDirectory(path.join(cacheDir, 'js', 'babel')) + typescript.setCacheDirectory(path.join(cacheDir, 'ts')) switch path.extname(filePath) when '.coffee' @@ -24,3 +26,5 @@ exports.addPathToCache = (filePath, atomHome) -> CSON.readFileSync(filePath) when '.js' babel.addPathToCache(filePath) + when '.ts' + typescript.addPathToCache(filePath) From 1a73d4cb229f27f96279bf03d3af16e2b2d9fd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Tue, 24 Mar 2015 14:22:05 +0100 Subject: [PATCH 162/521] :arrow_up: snippets@0.85.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f3b3252b5..4753fe11d 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.185.0", - "snippets": "0.84.0", + "snippets": "0.85.0", "spell-check": "0.55.0", "status-bar": "0.64.0", "styleguide": "0.44.0", From 37be2e02ec3d3a3052ffc687a5f73cbd38d9522f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 11:12:29 -0700 Subject: [PATCH 163/521] :arrow_up: language-javascript@0.64 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4753fe11d..237e487cf 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "language-html": "0.30.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.63.0", + "language-javascript": "0.64.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 63e6df8022d6872624751f93c5714eb3feb9bbb5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 13:12:49 -0700 Subject: [PATCH 164/521] Move .npmrc file to build folder apm commands appear to be picking it up as a config file when bootstrapping from the root of the repo causing cache clashes between build modules and core packages. --- .npmrc => build/.npmrc | 0 script/bootstrap | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .npmrc => build/.npmrc (100%) diff --git a/.npmrc b/build/.npmrc similarity index 100% rename from .npmrc rename to build/.npmrc diff --git a/script/bootstrap b/script/bootstrap index 270abff7c..4c9435852 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -35,7 +35,7 @@ function bootstrap() { var npmPath = path.resolve(__dirname, '..', 'build', 'node_modules', '.bin', 'npm'); var initialNpmCommand = fs.existsSync(npmPath) ? npmPath : 'npm'; - var npmFlags = ' --userconfig=' + path.resolve('.npmrc') + ' '; + var npmFlags = ' --userconfig=' + path.resolve(__dirname, '..', 'build', '.npmrc') + ' '; var packagesToDedupe = [ 'abbrev', From 40b4e36c0975847748a61400d67d319769f76576 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 14:00:16 -0700 Subject: [PATCH 165/521] Add custom formatting for Less errors --- src/package.coffee | 8 ++++++++ src/theme-manager.coffee | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/package.coffee b/src/package.coffee index 8b63b50a8..aa6afc3ce 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -572,6 +572,14 @@ class Package SyntaxError: #{error.message} at #{location} """ + else if error.type and error.filename and error.column? and error.line? + # Less errors + location = "#{error.filename}:#{error.line}:#{error.column}" + detail = "#{error.message} in #{location}" + stack = """ + Error: #{error.message} + at #{location} + """ else detail = error.message stack = error.stack ? error diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 650c1d168..f6025d4d4 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -319,6 +319,9 @@ class ThemeManager @lessCache.read(lessStylesheetPath) catch error if error.line? + # Adjust line numbers for import fallbacks + error.line -= 2 if importFallbackVariables + message = "Error compiling Less stylesheet: `#{lessStylesheetPath}`" detail = """ Line number: #{error.line} From af111651f328cc48633be603d50ea968ad95ba77 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 16:25:56 -0700 Subject: [PATCH 166/521] :arrow_up: notifications@0.34 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 237e487cf..1d57689b7 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "link": "0.30.0", "markdown-preview": "0.144.0", "metrics": "0.45.0", - "notifications": "0.33.0", + "notifications": "0.34.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", From ddae58bd9981ce3028a90615b1df4c8dcd22bb21 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 23 Mar 2015 16:55:47 -0700 Subject: [PATCH 167/521] :arrow_up: notifications@0.35 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d57689b7..fcd9486ee 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "link": "0.30.0", "markdown-preview": "0.144.0", "metrics": "0.45.0", - "notifications": "0.34.0", + "notifications": "0.35.0", "open-on-github": "0.34.0", "package-generator": "0.38.0", "release-notes": "0.52.0", From 27ffac5f1a73dff7914080d5cab7a1179592504e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 08:42:41 -0700 Subject: [PATCH 168/521] Set less property on caught error --- src/package.coffee | 4 ++-- src/theme-manager.coffee | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index aa6afc3ce..ebc771123 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -572,12 +572,12 @@ class Package SyntaxError: #{error.message} at #{location} """ - else if error.type and error.filename and error.column? and error.line? + else if error.less and error.filename and error.column? and error.line? # Less errors location = "#{error.filename}:#{error.line}:#{error.column}" detail = "#{error.message} in #{location}" stack = """ - Error: #{error.message} + LessError: #{error.message} at #{location} """ else diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index f6025d4d4..0ff42c4d2 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -318,6 +318,7 @@ class ThemeManager else @lessCache.read(lessStylesheetPath) catch error + error.less = true if error.line? # Adjust line numbers for import fallbacks error.line -= 2 if importFallbackVariables From 856a6f91f66ecd51a4ba77f41e1bfa9b348f61ae Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 11:06:01 -0700 Subject: [PATCH 169/521] :arrow_up: apm@0.149 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 374a7d98a..544292634 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.147.0" + "atom-package-manager": "0.149.0" } } From c23cfc14a712d58a4504c837cd499163952bba49 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 16:06:31 -0700 Subject: [PATCH 170/521] Prepare 0.189 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fcd9486ee..6b0aaaffb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.188.0", + "version": "0.189.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 606ade06b812b99fc8c01d76a5f8458b6789e005 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 16:18:01 -0700 Subject: [PATCH 171/521] :arrow_up: open-on-github@0.35 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b0aaaffb..8ae2b6784 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "markdown-preview": "0.144.0", "metrics": "0.45.0", "notifications": "0.35.0", - "open-on-github": "0.34.0", + "open-on-github": "0.35.0", "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.185.0", From 927cdfc14957bfff35bfb899ed56ab2e52fe93c3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 16:20:00 -0700 Subject: [PATCH 172/521] :arrow_up: symbols-view@0.92 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ae2b6784..7d3382f4f 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "spell-check": "0.55.0", "status-bar": "0.64.0", "styleguide": "0.44.0", - "symbols-view": "0.91.0", + "symbols-view": "0.92.0", "tabs": "0.67.0", "timecop": "0.31.0", "tree-view": "0.168.0", From 869cf2f2006ea1b5e91d581f3c94238a03d24d79 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 24 Mar 2015 16:38:34 -0700 Subject: [PATCH 173/521] :arrow_up: open-on-github@0.36 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d3382f4f..ba6a8a12c 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "markdown-preview": "0.144.0", "metrics": "0.45.0", "notifications": "0.35.0", - "open-on-github": "0.35.0", + "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.185.0", From 7d66288e1ac3c5db14701fe94db6082fe3e1b608 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Tue, 24 Mar 2015 16:53:58 -0700 Subject: [PATCH 174/521] :arrow_up: markdown-preview@0.1450 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba6a8a12c..5b9cefb8e 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.144.0", + "markdown-preview": "0.145.0", "metrics": "0.45.0", "notifications": "0.35.0", "open-on-github": "0.36.0", From 3e90553180508755037ab74f4a81c3ea7892f1a1 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 25 Mar 2015 09:49:54 +0800 Subject: [PATCH 175/521] :arrow_up: apm@0.150.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 544292634..7e4037d74 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.149.0" + "atom-package-manager": "0.150.0" } } From 2421125479e9946e429cd66bf069a966bf9ffdcf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 16:48:38 -0700 Subject: [PATCH 176/521] :arrow_up: welcome@0.26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee66a9b42..719e337d1 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "timecop": "0.31.0", "tree-view": "0.168.0", "update-package-dependencies": "0.9.0", - "welcome": "0.25.0", + "welcome": "0.26.0", "whitespace": "0.29.0", "wrap-guide": "0.31.0", "language-c": "0.41.0", From 13f2d9d48149656442e05e217191d98fd6c023cf Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 25 Mar 2015 17:54:42 -0700 Subject: [PATCH 177/521] :arrow_up: text-buffer@5.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 719e337d1..47a9a7c29 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^5.0.2", + "text-buffer": "^5.1.0", "theorist": "^1.0.2", "underscore-plus": "^1.6.6" }, From c0d4103fef936211236be01dbc1f2849ff39f46c Mon Sep 17 00:00:00 2001 From: "Machiste N. Quintana" Date: Thu, 26 Mar 2015 10:50:12 -0400 Subject: [PATCH 178/521] Update set-version-task.coffee Wooo 2015 --- build/tasks/set-version-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 6f7a68c61..48b6091c4 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -46,7 +46,7 @@ module.exports = (grunt) -> strings = CompanyName: 'GitHub, Inc.' FileDescription: 'Atom' - LegalCopyright: 'Copyright (C) 2014 GitHub, Inc. All rights reserved' + LegalCopyright: 'Copyright (C) 2015 GitHub, Inc. All rights reserved' ProductName: 'Atom' ProductVersion: version From 05c53f378e08a24832a6244a166760fb8da5f6a1 Mon Sep 17 00:00:00 2001 From: "Machiste N. Quintana" Date: Thu, 26 Mar 2015 10:52:57 -0400 Subject: [PATCH 179/521] Update LICENSE.md :memo: Update copyright --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 4d231b456..bbb875dc2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2014 GitHub Inc. +Copyright (c) 2015 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the From 307e2ad5655139819cd88ac8db64f7ee00c28f3b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 09:04:20 -0700 Subject: [PATCH 180/521] :arrow_up: language-sql@0.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 47a9a7c29..c67459112 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "language-sass": "0.36.0", "language-shellscript": "0.13.0", "language-source": "0.9.0", - "language-sql": "0.14.0", + "language-sql": "0.15.0", "language-text": "0.6.0", "language-todo": "0.17.0", "language-toml": "0.15.0", From 06da4153e8cb725061f5a9d757d269c9b423f92d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:09:15 -0700 Subject: [PATCH 181/521] Build on fedora 21 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 76fa18eae..be5624b21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # DESCRIPTION: Image to build Atom and create a .rpm file # Base docker image -FROM fedora:20 +FROM fedora:21 # Install dependencies RUN yum install -y \ From dafa40fd4dba56282f82920e7e240711c40fd444 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:13:49 -0700 Subject: [PATCH 182/521] Try using canonical nodejs npm packages --- Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index be5624b21..c8eca8804 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,9 @@ RUN yum install -y \ glibc-devel \ git-core \ libgnome-keyring-devel \ - rpmdevtools - -# Install node -RUN curl -sL https://rpm.nodesource.com/setup | bash - -RUN yum install -y nodejs + rpmdevtools \ + nodejs \ + npm ADD . /atom WORKDIR /atom From ad87ed5c40ef6f9a839575d66179db26a972e559 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:23:56 -0700 Subject: [PATCH 183/521] Log detected version --- script/utils/verify-requirements.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/utils/verify-requirements.js b/script/utils/verify-requirements.js index 554c27dd0..693af4a2b 100644 --- a/script/utils/verify-requirements.js +++ b/script/utils/verify-requirements.js @@ -57,7 +57,7 @@ function verifyNpm(cb) { var npmMajorVersion = +versionArray[0] || 0; var npmMinorVersion = +versionArray[1] || 0; if (npmMajorVersion === 1 && npmMinorVersion < 4) - cb("npm v1.4+ is required to build Atom."); + cb("npm v1.4+ is required to build Atom. Version " + npmVersion + " was detected"); else cb(null, "npm: v" + npmVersion); }); From a08c939699246472d55c0c30fd13f6baef61f1d5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:25:05 -0700 Subject: [PATCH 184/521] Disable npm version check on CI --- script/utils/verify-requirements.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/utils/verify-requirements.js b/script/utils/verify-requirements.js index 693af4a2b..36bf85b21 100644 --- a/script/utils/verify-requirements.js +++ b/script/utils/verify-requirements.js @@ -56,7 +56,7 @@ function verifyNpm(cb) { var versionArray = npmVersion.split('.'); var npmMajorVersion = +versionArray[0] || 0; var npmMinorVersion = +versionArray[1] || 0; - if (npmMajorVersion === 1 && npmMinorVersion < 4) + if (npmMajorVersion === 1 && npmMinorVersion < 4 && !process.env.JANKY_SHA1) cb("npm v1.4+ is required to build Atom. Version " + npmVersion + " was detected"); else cb(null, "npm: v" + npmVersion); From 9bc723f4907dfb16527e9a792753e7fe8609f312 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:27:34 -0700 Subject: [PATCH 185/521] Upgrade to npm 1.4 on Fedora --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index c8eca8804..31726e401 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,5 +16,7 @@ RUN yum install -y \ nodejs \ npm +RUN npm install -g npm@1.4.28 + ADD . /atom WORKDIR /atom From 67843c8ebd19f537266e44cfc6af4a923317ebbf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:33:21 -0700 Subject: [PATCH 186/521] Remove Janky bypass of npm version check --- script/utils/verify-requirements.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/utils/verify-requirements.js b/script/utils/verify-requirements.js index 36bf85b21..890172753 100644 --- a/script/utils/verify-requirements.js +++ b/script/utils/verify-requirements.js @@ -56,8 +56,8 @@ function verifyNpm(cb) { var versionArray = npmVersion.split('.'); var npmMajorVersion = +versionArray[0] || 0; var npmMinorVersion = +versionArray[1] || 0; - if (npmMajorVersion === 1 && npmMinorVersion < 4 && !process.env.JANKY_SHA1) - cb("npm v1.4+ is required to build Atom. Version " + npmVersion + " was detected"); + if (npmMajorVersion === 1 && npmMinorVersion < 4) + cb("npm v1.4+ is required to build Atom. Version " + npmVersion + " was detected."); else cb(null, "npm: v" + npmVersion); }); From 871c32b75dc5aa9cd10610db2e8d1e9995209af7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 10:38:58 -0700 Subject: [PATCH 187/521] Only log install errors --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 31726e401..d792c30c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN yum install -y \ nodejs \ npm -RUN npm install -g npm@1.4.28 +RUN npm install -g npm@1.4.28 --loglevel error ADD . /atom WORKDIR /atom From 2f5d97533802ea5f348e2d684d46fe60bf319538 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 26 Mar 2015 11:12:37 -0700 Subject: [PATCH 188/521] Remove autoscroll-related legacy editor view support Signed-off-by: Nathan Sobo --- spec/display-buffer-spec.coffee | 10 ++-------- spec/text-editor-spec.coffee | 12 +----------- src/cursor.coffee | 13 ++----------- src/display-buffer.coffee | 14 +++----------- src/selection.coffee | 7 +------ src/text-editor-component.coffee | 1 - src/text-editor.coffee | 8 +++----- 7 files changed, 12 insertions(+), 53 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 95f22acca..386cbf062 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -48,7 +48,6 @@ describe "DisplayBuffer", -> expect(displayBuffer.getLineCount()).toBe 100 + originalLineCount it "reassigns the scrollTop if it exceeds the max possible value after lines are removed", -> - displayBuffer.manageScrollPosition = true displayBuffer.setHeight(50) displayBuffer.setLineHeightInPixels(10) displayBuffer.setScrollTop(80) @@ -287,7 +286,6 @@ describe "DisplayBuffer", -> it "sets ::scrollLeft to 0 and keeps it there when soft wrapping is enabled", -> displayBuffer.setDefaultCharWidth(10) displayBuffer.setWidth(85) - displayBuffer.manageScrollPosition = true displayBuffer.setSoftWrapped(false) displayBuffer.setScrollLeft(Infinity) @@ -1174,7 +1172,6 @@ describe "DisplayBuffer", -> describe "::setScrollTop", -> beforeEach -> - displayBuffer.manageScrollPosition = true displayBuffer.setLineHeightInPixels(10) it "disallows negative values", -> @@ -1196,7 +1193,6 @@ describe "DisplayBuffer", -> describe "when editor.scrollPastEnd is false", -> beforeEach -> atom.config.set("editor.scrollPastEnd", false) - displayBuffer.manageScrollPosition = true displayBuffer.setLineHeightInPixels(10) it "does not add the height of the view to the scroll height", -> @@ -1209,7 +1205,6 @@ describe "DisplayBuffer", -> describe "when editor.scrollPastEnd is true", -> beforeEach -> atom.config.set("editor.scrollPastEnd", true) - displayBuffer.manageScrollPosition = true displayBuffer.setLineHeightInPixels(10) it "adds the height of the view to the scroll height", -> @@ -1221,7 +1216,6 @@ describe "DisplayBuffer", -> describe "::setScrollLeft", -> beforeEach -> - displayBuffer.manageScrollPosition = true displayBuffer.setLineHeightInPixels(10) displayBuffer.setDefaultCharWidth(10) @@ -1242,7 +1236,6 @@ describe "DisplayBuffer", -> describe "::scrollToScreenPosition(position, [options])", -> beforeEach -> - displayBuffer.manageScrollPosition = true displayBuffer.setLineHeightInPixels(10) displayBuffer.setDefaultCharWidth(10) displayBuffer.setHorizontalScrollbarHeight(0) @@ -1320,6 +1313,7 @@ describe "DisplayBuffer", -> expect(displayBuffer.getVisibleRowRange()).toEqual [0, 0] it "ends at last buffer row even if there's more space available", -> + displayBuffer.setHeight(150) displayBuffer.setScrollTop(60) - expect(displayBuffer.getVisibleRowRange()).toEqual [6, 13] + expect(displayBuffer.getVisibleRowRange()).toEqual [0, 13] diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index cddb8bdf6..bd412ca98 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -921,7 +921,6 @@ describe "TextEditor", -> describe "autoscroll", -> beforeEach -> - editor.manageScrollPosition = true editor.setVerticalScrollMargin(2) editor.setHorizontalScrollMargin(2) editor.setLineHeightInPixels(10) @@ -1254,7 +1253,6 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRange()).toEqual [[0,0], [2,0]] it "autoscrolls to the selection", -> - editor.manageScrollPosition = true editor.setLineHeightInPixels(10) editor.setDefaultCharWidth(10) editor.setHeight(50) @@ -1523,10 +1521,9 @@ describe "TextEditor", -> describe ".setSelectedBufferRange(range)", -> describe "when the 'autoscroll' option is true", -> it "autoscrolls to the selection", -> - editor.manageScrollPosition = true editor.setLineHeightInPixels(10) editor.setDefaultCharWidth(10) - editor.setHeight(50) + editor.setHeight(70) editor.setWidth(50) editor.setHorizontalScrollbarHeight(0) @@ -1560,8 +1557,6 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [0, 0]], [[3, 4], [5, 6]]] it "autoscrolls to the added selection if needed", -> - editor.manageScrollPosition = true - editor.setLineHeightInPixels(10) editor.setDefaultCharWidth(10) editor.setHeight(50) @@ -1922,7 +1917,6 @@ describe "TextEditor", -> expect(cursor2.getBufferPosition()).toEqual [2, 7] it "autoscrolls to the last cursor", -> - editor.manageScrollPosition = true editor.setCursorScreenPosition([1, 2]) editor.addCursorAtScreenPosition([10, 4]) editor.setLineHeightInPixels(10) @@ -4072,8 +4066,6 @@ describe "TextEditor", -> describe ".pageUp/Down()", -> it "scrolls one screen height up or down and moves the cursor one page length", -> - editor.manageScrollPosition = true - editor.setLineHeightInPixels(10) editor.setHeight(50) expect(editor.getScrollHeight()).toBe 130 @@ -4097,8 +4089,6 @@ describe "TextEditor", -> describe ".selectPageUp/Down()", -> it "selects one screen height of text up or down", -> - editor.manageScrollPosition = true - editor.setLineHeightInPixels(10) editor.setHeight(50) expect(editor.getScrollHeight()).toBe 130 diff --git a/src/cursor.coffee b/src/cursor.coffee index 33f50ca9c..2a0665485 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -15,7 +15,6 @@ class Cursor extends Model bufferPosition: null goalColumn: null visible: true - needsAutoscroll: null # Instantiated by a {TextEditor} constructor: ({@editor, @marker, id}) -> @@ -30,9 +29,7 @@ class Cursor extends Model {textChanged} = e return if oldHeadScreenPosition.isEqual(newHeadScreenPosition) - # Supports old editor view - @needsAutoscroll ?= @isLastCursor() and !textChanged - @autoscroll() if @editor.manageScrollPosition and @isLastCursor() and textChanged + @autoscroll() if @isLastCursor() and textChanged @goalColumn = null @@ -53,7 +50,6 @@ class Cursor extends Model @emit 'destroyed' @emitter.emit 'did-destroy' @emitter.dispose() - @needsAutoscroll = true destroy: -> @marker.destroy() @@ -600,7 +596,6 @@ class Cursor extends Model setVisible: (visible) -> if @visible != visible @visible = visible - @needsAutoscroll ?= true if @visible and @isLastCursor() @emit 'visibility-changed', @visible @emitter.emit 'did-change-visibility', @visible @@ -628,7 +623,6 @@ class Cursor extends Model # Public: Prevents this cursor from causing scrolling. clearAutoscroll: -> - @needsAutoscroll = null # Public: Deselects the current selection. clearSelection: -> @@ -656,11 +650,8 @@ class Cursor extends Model changePosition: (options, fn) -> @clearSelection() - @needsAutoscroll = options.autoscroll ? @isLastCursor() fn() - if @needsAutoscroll - @emit 'autoscrolled' # Support legacy editor - @autoscroll() if @needsAutoscroll and @editor.manageScrollPosition # Support react editor view + @autoscroll() if options.autoscroll ? @isLastCursor() getPixelRect: -> @editor.pixelRectForScreenRange(@getScreenRange()) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 4ab65d0f7..059d04909 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -22,7 +22,6 @@ class DisplayBuffer extends Model Serializable.includeInto(this) @properties - manageScrollPosition: false softWrapped: null editorWidthInChars: null lineHeightInPixels: null @@ -268,10 +267,7 @@ class DisplayBuffer extends Model getScrollTop: -> @scrollTop setScrollTop: (scrollTop) -> - if @manageScrollPosition - @scrollTop = Math.round(Math.max(0, Math.min(@getMaxScrollTop(), scrollTop))) - else - @scrollTop = Math.round(scrollTop) + @scrollTop = Math.round(Math.max(0, Math.min(@getMaxScrollTop(), scrollTop))) getMaxScrollTop: -> @getScrollHeight() - @getClientHeight() @@ -283,11 +279,7 @@ class DisplayBuffer extends Model getScrollLeft: -> @scrollLeft setScrollLeft: (scrollLeft) -> - if @manageScrollPosition - @scrollLeft = Math.round(Math.max(0, Math.min(@getScrollWidth() - @getClientWidth(), scrollLeft))) - @scrollLeft - else - @scrollLeft = Math.round(scrollLeft) + @scrollLeft = Math.round(Math.max(0, Math.min(@getScrollWidth() - @getClientWidth(), scrollLeft))) getMaxScrollLeft: -> @getScrollWidth() - @getClientWidth() @@ -1113,7 +1105,7 @@ class DisplayBuffer extends Model handleTokenizedBufferChange: (tokenizedBufferChange) => {start, end, delta, bufferChange} = tokenizedBufferChange @updateScreenLines(start, end + 1, delta, delayChangeEvent: bufferChange?) - @setScrollTop(Math.min(@getScrollTop(), @getMaxScrollTop())) if @manageScrollPosition and delta < 0 + @setScrollTop(Math.min(@getScrollTop(), @getMaxScrollTop())) if delta < 0 updateScreenLines: (startBufferRow, endBufferRow, bufferDelta=0, options={}) -> startBufferRow = @rowMap.bufferRowRangeForBufferRow(startBufferRow)[0] diff --git a/src/selection.coffee b/src/selection.coffee index 375498c41..524f1bd9b 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -14,7 +14,6 @@ class Selection extends Model editor: null initialScreenRange: null wordwise: false - needsAutoscroll: null constructor: ({@cursor, @marker, @editor, id}) -> @emitter = new Emitter @@ -100,15 +99,13 @@ class Selection extends Model # * `autoscroll` if `true`, the {TextEditor} scrolls to the new selection. setBufferRange: (bufferRange, options={}) -> bufferRange = Range.fromObject(bufferRange) - @needsAutoscroll = options.autoscroll options.reversed ?= @isReversed() @editor.destroyFoldsContainingBufferRange(bufferRange) unless options.preserveFolds @modifySelection => needsFlash = options.flash delete options.flash if options.flash? - @cursor.needsAutoscroll = false if @needsAutoscroll? @marker.setBufferRange(bufferRange, options) - @autoscroll() if @needsAutoscroll and @editor.manageScrollPosition + @autoscroll() if options.autoscroll @decoration.flash('flash', @editor.selectionFlashDuration) if needsFlash # Public: Returns the starting and ending buffer rows the selection is @@ -359,7 +356,6 @@ class Selection extends Model @editor.unfoldBufferRow(oldBufferRange.end.row) wasReversed = @isReversed() @clear() - @cursor.needsAutoscroll = @cursor.isLastCursor() autoIndentFirstLine = false precedingText = @editor.getTextInRange([[oldBufferRange.start.row, 0], oldBufferRange.start]) @@ -758,7 +754,6 @@ class Selection extends Model @editor.scrollToScreenRange(@getScreenRange()) clearAutoscroll: -> - @needsAutoscroll = null modifySelection: (fn) -> @retainSelection = true diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 75a9a5136..63a7f9a1c 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -39,7 +39,6 @@ class TextEditorComponent @lineOverdrawMargin = lineOverdrawMargin if lineOverdrawMargin? @disposables = new CompositeDisposable - @editor.manageScrollPosition = true @observeConfig() @setScrollSensitivity(atom.config.get('editor.scrollSensitivity')) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 6ccb97392..114df486a 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -76,7 +76,7 @@ class TextEditor extends Model @delegatesProperties '$lineHeightInPixels', '$defaultCharWidth', '$height', '$width', '$verticalScrollbarWidth', '$horizontalScrollbarHeight', '$scrollTop', '$scrollLeft', - 'manageScrollPosition', toProperty: 'displayBuffer' + toProperty: 'displayBuffer' constructor: ({@softTabs, initialLine, initialColumn, tabLength, softWrapped, @displayBuffer, buffer, registerEditor, suppressCursorCreation, @mini, @placeholderText, @gutterVisible}) -> super @@ -1132,12 +1132,10 @@ class TextEditor extends Model # Essential: Undo the last change. undo: -> - @getLastCursor().needsAutoscroll = true @buffer.undo(this) # Essential: Redo the last change. redo: -> - @getLastCursor().needsAutoscroll = true @buffer.redo(this) # Extended: Batch multiple operations as a single undo/redo step. @@ -1950,7 +1948,7 @@ class TextEditor extends Model addSelectionForBufferRange: (bufferRange, options={}) -> @markBufferRange(bufferRange, _.defaults(@getSelectionMarkerAttributes(), options)) selection = @getLastSelection() - selection.autoscroll() if @manageScrollPosition + selection.autoscroll() selection # Essential: Add a selection for the given range in screen coordinates. @@ -1964,7 +1962,7 @@ class TextEditor extends Model addSelectionForScreenRange: (screenRange, options={}) -> @markScreenRange(screenRange, _.defaults(@getSelectionMarkerAttributes(), options)) selection = @getLastSelection() - selection.autoscroll() if @manageScrollPosition + selection.autoscroll() selection # Essential: Select from the current cursor position to the given position in From e2f3ecf156e5c28453c88dd51c4a19e5e4d3a0fd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 12:18:08 -0700 Subject: [PATCH 189/521] :arrow_up: snippets@0.86 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c67459112..64ee17f6e 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.185.0", - "snippets": "0.85.0", + "snippets": "0.86.0", "spell-check": "0.55.0", "status-bar": "0.64.0", "styleguide": "0.44.0", From 3deb16b522e63794435a43ba5851daad14524e58 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 12:33:32 -0700 Subject: [PATCH 190/521] Set log level to error npm install --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index af5f789e1..c63d5dbf6 100755 --- a/script/cibuild +++ b/script/cibuild @@ -48,7 +48,7 @@ function removeNodeModules() { readEnvironmentVariables(); removeNodeModules(); -cp.safeExec.bind(global, 'npm install npm', {cwd: path.resolve(__dirname, '..', 'build')}, function() { +cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve(__dirname, '..', 'build')}, function() { cp.safeExec.bind(global, 'node script/bootstrap', function(error) { if (error) process.exit(1); From d9527fd8add798aaf87364d0adee6d5d3123941b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 12:59:38 -0700 Subject: [PATCH 191/521] :arrow_up: apm@0.151 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 7e4037d74..f43d9e024 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.150.0" + "atom-package-manager": "0.151.0" } } From 45afc9eb463613ab2cd70bd46afdfd8adcb44188 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 13:29:30 -0700 Subject: [PATCH 192/521] Handle EISDIR save errors Closes #6100 --- src/pane.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pane.coffee b/src/pane.coffee index a1239acb5..a6e456d6a 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -686,7 +686,7 @@ class Pane extends Model true handleSaveError: (error) -> - if error.message.endsWith('is a directory') + if error.code is 'EISDIR' or error.message.endsWith('is a directory') atom.notifications.addWarning("Unable to save file: #{error.message}") else if error.code is 'EACCES' and error.path? atom.notifications.addWarning("Unable to save file: Permission denied '#{error.path}'") From b6d0099242a5f834abbe9fe0eb9c532b031027fd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 13:46:08 -0700 Subject: [PATCH 193/521] :arrow_up: symbols-view@0.93 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 64ee17f6e..ebb5997bd 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "spell-check": "0.55.0", "status-bar": "0.64.0", "styleguide": "0.44.0", - "symbols-view": "0.92.0", + "symbols-view": "0.93.0", "tabs": "0.67.0", "timecop": "0.31.0", "tree-view": "0.168.0", From 6d827f31d0b0cdc227672e32ce3b677ded8b3f0f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 13:55:59 -0700 Subject: [PATCH 194/521] :arrow_up: language-ruby@0.50 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ebb5997bd..97b20430a 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "language-php": "0.21.0", "language-property-list": "0.8.0", "language-python": "0.32.0", - "language-ruby": "0.49.0", + "language-ruby": "0.50.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0", "language-shellscript": "0.13.0", From 10458a5b454b09a54ac9133434ece18beeb13739 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 26 Mar 2015 15:30:53 -0600 Subject: [PATCH 195/521] Always autoscroll when the range of the last selection changes Signed-off-by: Max Brunsfeld --- spec/display-buffer-spec.coffee | 6 ++- spec/text-editor-presenter-spec.coffee | 4 +- spec/text-editor-spec.coffee | 46 ++++++++++++--------- src/cursor.coffee | 4 +- src/display-buffer.coffee | 56 ++++++++++++++++++-------- src/selection.coffee | 8 +++- src/text-editor.coffee | 11 +++-- 7 files changed, 85 insertions(+), 50 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 386cbf062..2893fd5a4 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1240,13 +1240,17 @@ describe "DisplayBuffer", -> displayBuffer.setDefaultCharWidth(10) displayBuffer.setHorizontalScrollbarHeight(0) displayBuffer.setHeight(50) - displayBuffer.setWidth(50) + displayBuffer.setWidth(150) it "sets the scroll top and scroll left so the given screen position is in view", -> displayBuffer.scrollToScreenPosition([8, 20]) expect(displayBuffer.getScrollBottom()).toBe (9 + displayBuffer.getVerticalScrollMargin()) * 10 expect(displayBuffer.getScrollRight()).toBe (20 + displayBuffer.getHorizontalScrollMargin()) * 10 + displayBuffer.scrollToScreenPosition([8, 20]) + expect(displayBuffer.getScrollBottom()).toBe (9 + displayBuffer.getVerticalScrollMargin()) * 10 + expect(displayBuffer.getScrollRight()).toBe (20 + displayBuffer.getHorizontalScrollMargin()) * 10 + describe "when the 'center' option is true", -> it "vertically scrolls to center the given position vertically", -> displayBuffer.scrollToScreenPosition([8, 20], center: true) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 4ad319cc1..0cf0c7e53 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -351,11 +351,11 @@ describe "TextEditorPresenter", -> expectValues presenter.getState().hiddenInput, {top: 0, left: 0} expectStateUpdate presenter, -> editor.setCursorBufferPosition([11, 43]) - expectValues presenter.getState().hiddenInput, {top: 50 - 10, left: 300 - 10} + expectValues presenter.getState().hiddenInput, {top: 11 * 10 - editor.getScrollTop(), left: 43 * 10 - editor.getScrollLeft()} newCursor = null expectStateUpdate presenter, -> newCursor = editor.addCursorAtBufferPosition([6, 10]) - expectValues presenter.getState().hiddenInput, {top: (6 * 10) - 40, left: (10 * 10) - 70} + expectValues presenter.getState().hiddenInput, {top: (6 * 10) - editor.getScrollTop(), left: (10 * 10) - editor.getScrollLeft()} expectStateUpdate presenter, -> newCursor.destroy() expectValues presenter.getState().hiddenInput, {top: 50 - 10, left: 300 - 10} diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index bd412ca98..afebf591d 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1519,23 +1519,28 @@ describe "TextEditor", -> expect(selection1.getScreenRange()).toEqual [[2, 2], [3, 4]] describe ".setSelectedBufferRange(range)", -> - describe "when the 'autoscroll' option is true", -> - it "autoscrolls to the selection", -> - editor.setLineHeightInPixels(10) - editor.setDefaultCharWidth(10) - editor.setHeight(70) - editor.setWidth(50) - editor.setHorizontalScrollbarHeight(0) + it "autoscrolls the selection if it is last unless the 'autoscroll' option is false", -> + editor.setVerticalScrollMargin(2) + editor.setHorizontalScrollMargin(2) + editor.setLineHeightInPixels(10) + editor.setDefaultCharWidth(10) + editor.setHeight(70) + editor.setWidth(100) + editor.setHorizontalScrollbarHeight(0) - expect(editor.getScrollTop()).toBe 0 + expect(editor.getScrollTop()).toBe 0 - editor.setSelectedBufferRange([[5, 6], [6, 8]], autoscroll: true) - expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10 - expect(editor.getScrollRight()).toBe 50 + editor.setSelectedBufferRange([[5, 6], [6, 8]]) + expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10 + expect(editor.getScrollRight()).toBe (8 + editor.getHorizontalScrollMargin()) * 10 - editor.setSelectedBufferRange([[6, 6], [6, 8]], autoscroll: true) - expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10 - expect(editor.getScrollRight()).toBe (8 + editor.getHorizontalScrollMargin()) * 10 + editor.setSelectedBufferRange([[0, 0], [0, 0]]) + expect(editor.getScrollTop()).toBe 0 + expect(editor.getScrollLeft()).toBe 0 + + editor.setSelectedBufferRange([[6, 6], [6, 8]]) + expect(editor.getScrollBottom()).toBe (7 + editor.getVerticalScrollMargin()) * 10 + expect(editor.getScrollRight()).toBe (8 + editor.getHorizontalScrollMargin()) * 10 describe ".selectMarker(marker)", -> describe "if the marker is valid", -> @@ -1557,14 +1562,15 @@ describe "TextEditor", -> expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [0, 0]], [[3, 4], [5, 6]]] it "autoscrolls to the added selection if needed", -> + editor.setVerticalScrollMargin(2) + editor.setHorizontalScrollMargin(2) editor.setLineHeightInPixels(10) editor.setDefaultCharWidth(10) - editor.setHeight(50) - editor.setWidth(50) - + editor.setHeight(80) + editor.setWidth(100) editor.addSelectionForBufferRange([[8, 10], [8, 15]]) - expect(editor.getScrollTop()).toBe 75 - expect(editor.getScrollLeft()).toBe 160 + expect(editor.getScrollBottom()).toBe (9 * 10) + (2 * 10) + expect(editor.getScrollRight()).toBe (15 * 10) + (2 * 10) describe ".addSelectionBelow()", -> describe "when the selection is non-empty", -> @@ -4050,7 +4056,7 @@ describe "TextEditor", -> editor.setLineHeightInPixels(10) editor.setDefaultCharWidth(10) editor.setHeight(60) - editor.setWidth(50) + editor.setWidth(130) editor.setHorizontalScrollbarHeight(0) expect(editor.getScrollTop()).toBe 0 expect(editor.getScrollLeft()).toBe 0 diff --git a/src/cursor.coffee b/src/cursor.coffee index 2a0665485..d0602a2f4 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -29,8 +29,6 @@ class Cursor extends Model {textChanged} = e return if oldHeadScreenPosition.isEqual(newHeadScreenPosition) - @autoscroll() if @isLastCursor() and textChanged - @goalColumn = null movedEvent = @@ -651,7 +649,7 @@ class Cursor extends Model changePosition: (options, fn) -> @clearSelection() fn() - @autoscroll() if options.autoscroll ? @isLastCursor() + @autoscroll() if options.autoscroll getPixelRect: -> @editor.pixelRectForScreenRange(@getScreenRange()) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 059d04909..b60113661 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -199,12 +199,22 @@ class DisplayBuffer extends Model # visible - A {Boolean} indicating of the tokenized buffer is shown setVisible: (visible) -> @tokenizedBuffer.setVisible(visible) - getVerticalScrollMargin: -> @verticalScrollMargin + getVerticalScrollMargin: -> Math.min(@verticalScrollMargin, (@getHeight() - @getLineHeightInPixels()) / 2) setVerticalScrollMargin: (@verticalScrollMargin) -> @verticalScrollMargin - getHorizontalScrollMargin: -> @horizontalScrollMargin + getVerticalScrollMarginInPixels: -> + scrollMarginInPixels = @getVerticalScrollMargin() * @getLineHeightInPixels() + maxScrollMarginInPixels = (@getHeight() - @getLineHeightInPixels()) / 2 + Math.min(scrollMarginInPixels, maxScrollMarginInPixels) + + getHorizontalScrollMargin: -> Math.min(@horizontalScrollMargin, (@getWidth() - @getDefaultCharWidth()) / 2) setHorizontalScrollMargin: (@horizontalScrollMargin) -> @horizontalScrollMargin + getHorizontalScrollMarginInPixels: -> + scrollMarginInPixels = @getHorizontalScrollMargin() * @getDefaultCharWidth() + maxScrollMarginInPixels = (@getWidth() - @getDefaultCharWidth()) / 2 + Math.min(scrollMarginInPixels, maxScrollMarginInPixels) + getHorizontalScrollbarHeight: -> @horizontalScrollbarHeight setHorizontalScrollbarHeight: (@horizontalScrollbarHeight) -> @horizontalScrollbarHeight @@ -272,7 +282,7 @@ class DisplayBuffer extends Model getMaxScrollTop: -> @getScrollHeight() - @getClientHeight() - getScrollBottom: -> @scrollTop + @height + getScrollBottom: -> @scrollTop + @getClientHeight() setScrollBottom: (scrollBottom) -> @setScrollTop(scrollBottom - @getClientHeight()) @getScrollBottom() @@ -364,15 +374,16 @@ class DisplayBuffer extends Model @intersectsVisibleRowRange(start.row, end.row + 1) scrollToScreenRange: (screenRange, options) -> - verticalScrollMarginInPixels = @getVerticalScrollMargin() * @getLineHeightInPixels() - horizontalScrollMarginInPixels = @getHorizontalScrollMargin() * @getDefaultCharWidth() + verticalScrollMarginInPixels = @getVerticalScrollMarginInPixels() + horizontalScrollMarginInPixels = @getHorizontalScrollMarginInPixels() - {top, left, height, width} = @pixelRectForScreenRange(screenRange) - bottom = top + height - right = left + width + {top, left} = @pixelRectForScreenRange(new Range(screenRange.start, screenRange.start)) + {top: endTop, left: endLeft, height: endHeight} = @pixelRectForScreenRange(new Range(screenRange.end, screenRange.end)) + bottom = endTop + endHeight + right = endLeft if options?.center - desiredScrollCenter = top + height / 2 + desiredScrollCenter = (top + bottom) / 2 unless @getScrollTop() < desiredScrollCenter < @getScrollBottom() desiredScrollTop = desiredScrollCenter - @getHeight() / 2 desiredScrollBottom = desiredScrollCenter + @getHeight() / 2 @@ -383,15 +394,26 @@ class DisplayBuffer extends Model desiredScrollLeft = left - horizontalScrollMarginInPixels desiredScrollRight = right + horizontalScrollMarginInPixels - if desiredScrollTop < @getScrollTop() - @setScrollTop(desiredScrollTop) - else if desiredScrollBottom > @getScrollBottom() - @setScrollBottom(desiredScrollBottom) + if options?.reversed ? true + if desiredScrollBottom > @getScrollBottom() + @setScrollBottom(desiredScrollBottom) + if desiredScrollTop < @getScrollTop() + @setScrollTop(desiredScrollTop) - if desiredScrollLeft < @getScrollLeft() - @setScrollLeft(desiredScrollLeft) - else if desiredScrollRight > @getScrollRight() - @setScrollRight(desiredScrollRight) + if desiredScrollRight > @getScrollRight() + @setScrollRight(desiredScrollRight) + if desiredScrollLeft < @getScrollLeft() + @setScrollLeft(desiredScrollLeft) + else + if desiredScrollTop < @getScrollTop() + @setScrollTop(desiredScrollTop) + if desiredScrollBottom > @getScrollBottom() + @setScrollBottom(desiredScrollBottom) + + if desiredScrollLeft < @getScrollLeft() + @setScrollLeft(desiredScrollLeft) + if desiredScrollRight > @getScrollRight() + @setScrollRight(desiredScrollRight) scrollToScreenPosition: (screenPosition, options) -> @scrollToScreenRange(new Range(screenPosition, screenPosition), options) diff --git a/src/selection.coffee b/src/selection.coffee index 524f1bd9b..df0e4a5d1 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -733,6 +733,12 @@ class Selection extends Model {oldHeadBufferPosition, oldTailBufferPosition} = e {oldHeadScreenPosition, oldTailScreenPosition} = e + if this is @editor.getLastSelection() + if @marker.hasTail() + @autoscroll() + else + @cursor.autoscroll() + eventObject = oldBufferRange: new Range(oldHeadBufferPosition, oldTailBufferPosition) oldScreenRange: new Range(oldHeadScreenPosition, oldTailScreenPosition) @@ -751,7 +757,7 @@ class Selection extends Model @linewise = false autoscroll: -> - @editor.scrollToScreenRange(@getScreenRange()) + @editor.scrollToScreenRange(@getScreenRange(), reversed: @isReversed()) clearAutoscroll: -> diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 114df486a..820737834 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -1947,9 +1947,7 @@ class TextEditor extends Model # Returns the added {Selection}. addSelectionForBufferRange: (bufferRange, options={}) -> @markBufferRange(bufferRange, _.defaults(@getSelectionMarkerAttributes(), options)) - selection = @getLastSelection() - selection.autoscroll() - selection + @getLastSelection() # Essential: Add a selection for the given range in screen coordinates. # @@ -1961,9 +1959,7 @@ class TextEditor extends Model # Returns the added {Selection}. addSelectionForScreenRange: (screenRange, options={}) -> @markScreenRange(screenRange, _.defaults(@getSelectionMarkerAttributes(), options)) - selection = @getLastSelection() - selection.autoscroll() - selection + @getLastSelection() # Essential: Select from the current cursor position to the given position in # buffer coordinates. @@ -2269,11 +2265,14 @@ class TextEditor extends Model @selections.push(selection) selectionBufferRange = selection.getBufferRange() @mergeIntersectingSelections(preserveFolds: marker.getProperties().preserveFolds) + if selection.destroyed for selection in @getSelections() if selection.intersectsBufferRange(selectionBufferRange) + selection.autoscroll() return selection else + selection.autoscroll() @emit 'selection-added', selection @emitter.emit 'did-add-selection', selection selection From a70be30ee7017b86114592800d9d4bdccff88aa8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 14:37:30 -0700 Subject: [PATCH 196/521] :art: --- src/typescript.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/typescript.coffee b/src/typescript.coffee index 3814a6c66..3a54941f3 100644 --- a/src/typescript.coffee +++ b/src/typescript.coffee @@ -57,7 +57,9 @@ createOptions = (filePath) -> transpile = (sourceCode, filePath, cachePath) -> options = createOptions(filePath) - tss ?= new (require 'typescript-simple').TypeScriptSimple(options, false) + unless tss? + {TypeScriptSimple} = require 'typescript-simple' + tss = new TypeScriptSimple(options, false) js = tss.compile(sourceCode, filePath) stats.misses++ From 9cdbda5c148c96dc18064b03898960ffdd3b1938 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 14:42:33 -0700 Subject: [PATCH 197/521] :arrow_up: language-c@0.42 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac4c5569b..96db70912 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "welcome": "0.26.0", "whitespace": "0.29.0", "wrap-guide": "0.31.0", - "language-c": "0.41.0", + "language-c": "0.42.0", "language-clojure": "0.13.0", "language-coffee-script": "0.39.0", "language-csharp": "0.5.0", From 99c437ccecff469d2fc4ba70ff3ff9a0f694f9e6 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 26 Mar 2015 16:48:21 -0600 Subject: [PATCH 198/521] Allow autoscroll override option in cursor/selection methods Signed-off-by: Max Brunsfeld --- spec/text-editor-component-spec.coffee | 6 +++--- spec/text-editor-presenter-spec.coffee | 12 ++++++------ spec/text-editor-spec.coffee | 24 ++++++++++++++++++++++++ src/cursor.coffee | 16 +++++++++++----- src/selection.coffee | 24 +++++++++++++++++++----- src/text-editor.coffee | 19 ++++++++++++++----- 6 files changed, 77 insertions(+), 24 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 20ddcdcab..135e551a3 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -693,7 +693,7 @@ describe "TextEditorComponent", -> describe "cursor rendering", -> it "renders the currently visible cursors", -> cursor1 = editor.getLastCursor() - cursor1.setScreenPosition([0, 5]) + cursor1.setScreenPosition([0, 5], autoscroll: false) wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * lineHeightInPixels + 'px' @@ -706,8 +706,8 @@ describe "TextEditorComponent", -> expect(cursorNodes[0].offsetWidth).toBe charWidth expect(cursorNodes[0].style['-webkit-transform']).toBe "translate(#{5 * charWidth}px, #{0 * lineHeightInPixels}px)" - cursor2 = editor.addCursorAtScreenPosition([8, 11]) - cursor3 = editor.addCursorAtScreenPosition([4, 10]) + cursor2 = editor.addCursorAtScreenPosition([8, 11], autoscroll: false) + cursor3 = editor.addCursorAtScreenPosition([4, 10], autoscroll: false) nextAnimationFrame() cursorNodes = componentNode.querySelectorAll('.cursor') diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 0cf0c7e53..b62391db8 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -1417,33 +1417,33 @@ describe "TextEditorPresenter", -> expect(stateForSelection(presenter, 1)).toBeUndefined() # moving into view - expectStateUpdate presenter, -> editor.getSelections()[1].setBufferRange([[2, 4], [2, 6]]) + expectStateUpdate presenter, -> editor.getSelections()[1].setBufferRange([[2, 4], [2, 6]], autoscroll: false) expectValues stateForSelection(presenter, 1), { regions: [{top: 2 * 10, left: 4 * 10, width: 2 * 10, height: 10}] } # becoming empty - expectStateUpdate presenter, -> editor.getSelections()[1].clear() + expectStateUpdate presenter, -> editor.getSelections()[1].clear(autoscroll: false) expect(stateForSelection(presenter, 1)).toBeUndefined() # becoming non-empty - expectStateUpdate presenter, -> editor.getSelections()[1].setBufferRange([[2, 4], [2, 6]]) + expectStateUpdate presenter, -> editor.getSelections()[1].setBufferRange([[2, 4], [2, 6]], autoscroll: false) expectValues stateForSelection(presenter, 1), { regions: [{top: 2 * 10, left: 4 * 10, width: 2 * 10, height: 10}] } # moving out of view - expectStateUpdate presenter, -> editor.getSelections()[1].setBufferRange([[3, 4], [3, 6]]) + expectStateUpdate presenter, -> editor.getSelections()[1].setBufferRange([[3, 4], [3, 6]], autoscroll: false) expect(stateForSelection(presenter, 1)).toBeUndefined() # adding - expectStateUpdate presenter, -> editor.addSelectionForBufferRange([[1, 4], [1, 6]]) + expectStateUpdate presenter, -> editor.addSelectionForBufferRange([[1, 4], [1, 6]], autoscroll: false) expectValues stateForSelection(presenter, 2), { regions: [{top: 1 * 10, left: 4 * 10, width: 2 * 10, height: 10}] } # moving added selection - expectStateUpdate presenter, -> editor.getSelections()[2].setBufferRange([[1, 4], [1, 8]]) + expectStateUpdate presenter, -> editor.getSelections()[2].setBufferRange([[1, 4], [1, 8]], autoscroll: false) expectValues stateForSelection(presenter, 2), { regions: [{top: 1 * 10, left: 4 * 10, width: 4 * 10, height: 10}] } diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index afebf591d..49b75bafd 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -993,6 +993,30 @@ describe "TextEditor", -> editor.undo() expect(editor.getScrollTop()).toBe 0 + it "honors the autoscroll option on cursor and selection manipulation methods", -> + expect(editor.getScrollTop()).toBe 0 + editor.addCursorAtScreenPosition([11, 11], autoscroll: false) + editor.addCursorAtBufferPosition([11, 11], autoscroll: false) + editor.setCursorScreenPosition([11, 11], autoscroll: false) + editor.setCursorBufferPosition([11, 11], autoscroll: false) + editor.addSelectionForBufferRange([[11, 11], [11, 11]], autoscroll: false) + editor.addSelectionForScreenRange([[11, 11], [11, 12]], autoscroll: false) + editor.setSelectedBufferRange([[11, 0], [11, 1]], autoscroll: false) + editor.setSelectedScreenRange([[11, 0], [11, 6]], autoscroll: false) + editor.clearSelections(autoscroll: false) + expect(editor.getScrollTop()).toBe 0 + + editor.addSelectionForScreenRange([[0, 0], [0, 4]]) + + editor.getCursors()[0].setScreenPosition([11, 11], autoscroll: true) + expect(editor.getScrollTop()).toBeGreaterThan 0 + editor.getCursors()[0].setBufferPosition([0, 0], autoscroll: true) + expect(editor.getScrollTop()).toBe 0 + editor.getSelections()[0].setScreenRange([[11, 0], [11, 4]], autoscroll: true) + expect(editor.getScrollTop()).toBeGreaterThan 0 + editor.getSelections()[0].setBufferRange([[0, 0], [0, 4]], autoscroll: true) + expect(editor.getScrollTop()).toBe 0 + describe '.logCursorScope()', -> beforeEach -> spyOn(atom.notifications, 'addInfo') diff --git a/src/cursor.coffee b/src/cursor.coffee index d0602a2f4..2e67ab43b 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -122,8 +122,9 @@ class Cursor extends Model # # * `bufferPosition` {Array} of two numbers: the buffer row, and the buffer column. # * `options` (optional) {Object} with the following keys: - # * `autoscroll` A Boolean which, if `true`, scrolls the {TextEditor} to wherever - # the cursor moves to. + # * `autoscroll` {Boolean} indicating whether to autoscroll to the new + # position. Defaults to `true` if this is the most recently added cursor, + # `false` otherwise. setBufferPosition: (bufferPosition, options={}) -> @changePosition options, => @marker.setHeadBufferPosition(bufferPosition, options) @@ -648,8 +649,12 @@ class Cursor extends Model changePosition: (options, fn) -> @clearSelection() - fn() - @autoscroll() if options.autoscroll + @editor.suppressAutoscroll = true if options.autoscroll is false + try + fn() + finally + @editor.suppressAutoscroll = false if options?.autoscroll is false + @autoscroll() if options.autoscroll is true getPixelRect: -> @editor.pixelRectForScreenRange(@getScreenRange()) @@ -659,7 +664,8 @@ class Cursor extends Model new Range(new Point(row, column), new Point(row, column + 1)) autoscroll: (options) -> - @editor.scrollToScreenRange(@getScreenRange(), options) + unless @editor.suppressAutoscroll + @editor.scrollToScreenRange(@getScreenRange(), options) getBeginningOfNextParagraphBufferPosition: -> start = @getBufferPosition() diff --git a/src/selection.coffee b/src/selection.coffee index df0e4a5d1..4987708eb 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -95,8 +95,11 @@ class Selection extends Model # # * `screenRange` The new {Range} to select. # * `options` (optional) {Object} with the keys: - # * `preserveFolds` if `true`, the fold settings are preserved after the selection moves. - # * `autoscroll` if `true`, the {TextEditor} scrolls to the new selection. + # * `preserveFolds` if `true`, the fold settings are preserved after the + # selection moves. + # * `autoscroll` {Boolean} indicating whether to autoscroll to the new + # range. Defaults to `true` if this is the most recently added selection, + # `false` otherwise. setBufferRange: (bufferRange, options={}) -> bufferRange = Range.fromObject(bufferRange) options.reversed ?= @isReversed() @@ -104,8 +107,10 @@ class Selection extends Model @modifySelection => needsFlash = options.flash delete options.flash if options.flash? + @editor.suppressAutoscroll = true if options.autoscroll is false @marker.setBufferRange(bufferRange, options) - @autoscroll() if options.autoscroll + @editor.suppressAutoscroll = false if options.autoscroll is false + @autoscroll() if options?.autoscroll is true @decoration.flash('flash', @editor.selectionFlashDuration) if needsFlash # Public: Returns the starting and ending buffer rows the selection is @@ -181,9 +186,17 @@ class Selection extends Model ### # Public: Clears the selection, moving the marker to the head. - clear: -> + # + # * `options` (optional) {Object} with the following keys: + # * `autoscroll` {Boolean} indicating whether to autoscroll to the new + # range. Defaults to `true` if this is the most recently added selection, + # `false` otherwise. + clear: (options) -> + @editor.suppressAutoscroll = true if options?.autoscroll is false @marker.setProperties(goalScreenRange: null) @marker.clearTail() unless @retainSelection + @editor.suppressAutoscroll = false if options?.autoscroll is false + @autoscroll() if options?.autoscroll is true @finalize() # Public: Selects the text from the current cursor position to a given screen @@ -757,7 +770,8 @@ class Selection extends Model @linewise = false autoscroll: -> - @editor.scrollToScreenRange(@getScreenRange(), reversed: @isReversed()) + unless @editor.suppressAutoscroll + @editor.scrollToScreenRange(@getScreenRange(), reversed: @isReversed()) clearAutoscroll: -> diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 820737834..beaf4aaac 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -69,6 +69,7 @@ class TextEditor extends Model suppressSelectionMerging: false updateBatchDepth: 0 selectionFlashDuration: 500 + suppressAutoscroll: false @delegatesMethods 'suggestedIndentForBufferRow', 'autoIndentBufferRow', 'autoIndentBufferRows', 'autoDecreaseIndentForBufferRow', 'toggleLineCommentForBufferRow', 'toggleLineCommentsForBufferRows', @@ -1606,8 +1607,10 @@ class TextEditor extends Model # * `bufferPosition` A {Point} or {Array} of `[row, column]` # # Returns a {Cursor}. - addCursorAtBufferPosition: (bufferPosition) -> + addCursorAtBufferPosition: (bufferPosition, options) -> + @suppressAutoscroll = true if options?.autoscroll is false @markBufferPosition(bufferPosition, @getSelectionMarkerAttributes()) + @suppressAutoscroll = false if options?.autoscroll is false @getLastSelection().cursor # Essential: Add a cursor at the position in screen coordinates. @@ -1615,8 +1618,10 @@ class TextEditor extends Model # * `screenPosition` A {Point} or {Array} of `[row, column]` # # Returns a {Cursor}. - addCursorAtScreenPosition: (screenPosition) -> + addCursorAtScreenPosition: (screenPosition, options) -> + @suppressAutoscroll = true if options?.autoscroll is false @markScreenPosition(screenPosition, @getSelectionMarkerAttributes()) + @suppressAutoscroll = false if options?.autoscroll is false @getLastSelection().cursor # Essential: Returns {Boolean} indicating whether or not there are multiple cursors. @@ -1946,7 +1951,9 @@ class TextEditor extends Model # # Returns the added {Selection}. addSelectionForBufferRange: (bufferRange, options={}) -> + @suppressAutoscroll = true if options.autoscroll is false @markBufferRange(bufferRange, _.defaults(@getSelectionMarkerAttributes(), options)) + @suppressAutoscroll = false if options.autoscroll is false @getLastSelection() # Essential: Add a selection for the given range in screen coordinates. @@ -1958,7 +1965,9 @@ class TextEditor extends Model # # Returns the added {Selection}. addSelectionForScreenRange: (screenRange, options={}) -> + @suppressAutoscroll = true if options.autoscroll is false @markScreenRange(screenRange, _.defaults(@getSelectionMarkerAttributes(), options)) + @suppressAutoscroll = false if options.autoscroll is false @getLastSelection() # Essential: Select from the current cursor position to the given position in @@ -2272,7 +2281,7 @@ class TextEditor extends Model selection.autoscroll() return selection else - selection.autoscroll() + selection.autoscroll() unless options.autoscroll is false @emit 'selection-added', selection @emitter.emit 'did-add-selection', selection selection @@ -2285,9 +2294,9 @@ class TextEditor extends Model # Reduce one or more selections to a single empty selection based on the most # recently added cursor. - clearSelections: -> + clearSelections: (options) -> @consolidateSelections() - @getLastSelection().clear() + @getLastSelection().clear(options) # Reduce multiple selections to the most recently added selection. consolidateSelections: -> From ae4f7f6170da83c786ba06235f0997e52e806b10 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 26 Mar 2015 16:48:24 -0600 Subject: [PATCH 199/521] Explicitly autoscroll when needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than when the selection’s marker changes. This is simpler than suppressing autoscroll via state when we don’t want it. It also captures the intent to autoscroll when attempting to move the cursor at the beginning or end of the document. Signed-off-by: Max Brunsfeld --- spec/text-editor-component-spec.coffee | 4 ++-- spec/text-editor-spec.coffee | 11 +++++++++-- src/cursor.coffee | 17 ++++++---------- src/selection.coffee | 27 ++++++++++++-------------- src/text-editor.coffee | 19 +++++++----------- 5 files changed, 36 insertions(+), 42 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 135e551a3..656dca0f0 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1524,7 +1524,7 @@ describe "TextEditorComponent", -> expect(inputNode.offsetLeft).toBe 0 # In bounds, not focused - editor.setCursorBufferPosition([5, 4]) + editor.setCursorBufferPosition([5, 4], autoscroll: false) nextAnimationFrame() expect(inputNode.offsetTop).toBe 0 expect(inputNode.offsetLeft).toBe 0 @@ -1542,7 +1542,7 @@ describe "TextEditorComponent", -> expect(inputNode.offsetLeft).toBe 0 # Out of bounds, not focused - editor.setCursorBufferPosition([1, 2]) + editor.setCursorBufferPosition([1, 2], autoscroll: false) nextAnimationFrame() expect(inputNode.offsetTop).toBe 0 expect(inputNode.offsetLeft).toBe 0 diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 49b75bafd..d87952e85 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -970,9 +970,8 @@ describe "TextEditor", -> it "scrolls left when the last cursor gets closer than ::horizontalScrollMargin to the left of the editor", -> editor.setScrollRight(editor.getScrollWidth()) - editor.setCursorScreenPosition([6, 62]) - expect(editor.getScrollRight()).toBe editor.getScrollWidth() + editor.setCursorScreenPosition([6, 62], autoscroll: false) editor.moveLeft() expect(editor.getScrollLeft()).toBe 59 * 10 @@ -996,13 +995,21 @@ describe "TextEditor", -> it "honors the autoscroll option on cursor and selection manipulation methods", -> expect(editor.getScrollTop()).toBe 0 editor.addCursorAtScreenPosition([11, 11], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.addCursorAtBufferPosition([11, 11], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.setCursorScreenPosition([11, 11], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.setCursorBufferPosition([11, 11], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.addSelectionForBufferRange([[11, 11], [11, 11]], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.addSelectionForScreenRange([[11, 11], [11, 12]], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.setSelectedBufferRange([[11, 0], [11, 1]], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.setSelectedScreenRange([[11, 0], [11, 6]], autoscroll: false) + expect(editor.getScrollTop()).toBe 0 editor.clearSelections(autoscroll: false) expect(editor.getScrollTop()).toBe 0 diff --git a/src/cursor.coffee b/src/cursor.coffee index 2e67ab43b..c96f2eff5 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -624,8 +624,8 @@ class Cursor extends Model clearAutoscroll: -> # Public: Deselects the current selection. - clearSelection: -> - @selection?.clear() + clearSelection: (options) -> + @selection?.clear(options) # Public: Get the RegExp used by the cursor to determine what a "word" is. # @@ -648,13 +648,9 @@ class Cursor extends Model ### changePosition: (options, fn) -> - @clearSelection() - @editor.suppressAutoscroll = true if options.autoscroll is false - try - fn() - finally - @editor.suppressAutoscroll = false if options?.autoscroll is false - @autoscroll() if options.autoscroll is true + @clearSelection(options) + fn() + @autoscroll() if options.autoscroll ? @isLastCursor() getPixelRect: -> @editor.pixelRectForScreenRange(@getScreenRange()) @@ -664,8 +660,7 @@ class Cursor extends Model new Range(new Point(row, column), new Point(row, column + 1)) autoscroll: (options) -> - unless @editor.suppressAutoscroll - @editor.scrollToScreenRange(@getScreenRange(), options) + @editor.scrollToScreenRange(@getScreenRange(), options) getBeginningOfNextParagraphBufferPosition: -> start = @getBufferPosition() diff --git a/src/selection.coffee b/src/selection.coffee index 4987708eb..0bee6f7de 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -1,6 +1,6 @@ {Point, Range} = require 'text-buffer' {Model} = require 'theorist' -{pick} = require 'underscore-plus' +{pick} = _ = require 'underscore-plus' {Emitter} = require 'event-kit' Grim = require 'grim' @@ -34,6 +34,9 @@ class Selection extends Model destroy: -> @marker.destroy() + isLastSelection: -> + this is @editor.getLastSelection() + ### Section: Event Subscription ### @@ -107,10 +110,8 @@ class Selection extends Model @modifySelection => needsFlash = options.flash delete options.flash if options.flash? - @editor.suppressAutoscroll = true if options.autoscroll is false @marker.setBufferRange(bufferRange, options) - @editor.suppressAutoscroll = false if options.autoscroll is false - @autoscroll() if options?.autoscroll is true + @autoscroll() if options?.autoscroll ? @isLastSelection() @decoration.flash('flash', @editor.selectionFlashDuration) if needsFlash # Public: Returns the starting and ending buffer rows the selection is @@ -192,11 +193,9 @@ class Selection extends Model # range. Defaults to `true` if this is the most recently added selection, # `false` otherwise. clear: (options) -> - @editor.suppressAutoscroll = true if options?.autoscroll is false @marker.setProperties(goalScreenRange: null) @marker.clearTail() unless @retainSelection - @editor.suppressAutoscroll = false if options?.autoscroll is false - @autoscroll() if options?.autoscroll is true + @autoscroll() if options?.autoscroll ? @isLastSelection() @finalize() # Public: Selects the text from the current cursor position to a given screen @@ -407,6 +406,8 @@ class Selection extends Model else if options.autoDecreaseIndent and NonWhitespaceRegExp.test(text) @editor.autoDecreaseIndentForBufferRow(newBufferRange.start.row) + @autoscroll() if @isLastSelection() + newBufferRange # Public: Removes the first character before the selection if the selection @@ -722,7 +723,7 @@ class Selection extends Model else options.goalScreenRange = myGoalScreenRange ? otherGoalScreenRange - @setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options) + @setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), _.extend(autoscroll: false, options)) otherSelection.destroy() ### @@ -746,12 +747,6 @@ class Selection extends Model {oldHeadBufferPosition, oldTailBufferPosition} = e {oldHeadScreenPosition, oldTailScreenPosition} = e - if this is @editor.getLastSelection() - if @marker.hasTail() - @autoscroll() - else - @cursor.autoscroll() - eventObject = oldBufferRange: new Range(oldHeadBufferPosition, oldTailBufferPosition) oldScreenRange: new Range(oldHeadScreenPosition, oldTailScreenPosition) @@ -770,8 +765,10 @@ class Selection extends Model @linewise = false autoscroll: -> - unless @editor.suppressAutoscroll + if @marker.hasTail() @editor.scrollToScreenRange(@getScreenRange(), reversed: @isReversed()) + else + @cursor.autoscroll() clearAutoscroll: -> diff --git a/src/text-editor.coffee b/src/text-editor.coffee index beaf4aaac..355a644b8 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -69,7 +69,6 @@ class TextEditor extends Model suppressSelectionMerging: false updateBatchDepth: 0 selectionFlashDuration: 500 - suppressAutoscroll: false @delegatesMethods 'suggestedIndentForBufferRow', 'autoIndentBufferRow', 'autoIndentBufferRows', 'autoDecreaseIndentForBufferRow', 'toggleLineCommentForBufferRow', 'toggleLineCommentsForBufferRows', @@ -1133,11 +1132,13 @@ class TextEditor extends Model # Essential: Undo the last change. undo: -> - @buffer.undo(this) + @buffer.undo() + @getLastSelection().autoscroll() # Essential: Redo the last change. redo: -> @buffer.redo(this) + @getLastSelection().autoscroll() # Extended: Batch multiple operations as a single undo/redo step. # @@ -1608,9 +1609,8 @@ class TextEditor extends Model # # Returns a {Cursor}. addCursorAtBufferPosition: (bufferPosition, options) -> - @suppressAutoscroll = true if options?.autoscroll is false @markBufferPosition(bufferPosition, @getSelectionMarkerAttributes()) - @suppressAutoscroll = false if options?.autoscroll is false + @getLastSelection().cursor.autoscroll() unless options?.autoscroll is false @getLastSelection().cursor # Essential: Add a cursor at the position in screen coordinates. @@ -1619,9 +1619,8 @@ class TextEditor extends Model # # Returns a {Cursor}. addCursorAtScreenPosition: (screenPosition, options) -> - @suppressAutoscroll = true if options?.autoscroll is false @markScreenPosition(screenPosition, @getSelectionMarkerAttributes()) - @suppressAutoscroll = false if options?.autoscroll is false + @getLastSelection().cursor.autoscroll() unless options?.autoscroll is false @getLastSelection().cursor # Essential: Returns {Boolean} indicating whether or not there are multiple cursors. @@ -1951,9 +1950,8 @@ class TextEditor extends Model # # Returns the added {Selection}. addSelectionForBufferRange: (bufferRange, options={}) -> - @suppressAutoscroll = true if options.autoscroll is false @markBufferRange(bufferRange, _.defaults(@getSelectionMarkerAttributes(), options)) - @suppressAutoscroll = false if options.autoscroll is false + @getLastSelection().autoscroll() unless options.autoscroll is false @getLastSelection() # Essential: Add a selection for the given range in screen coordinates. @@ -1965,9 +1963,8 @@ class TextEditor extends Model # # Returns the added {Selection}. addSelectionForScreenRange: (screenRange, options={}) -> - @suppressAutoscroll = true if options.autoscroll is false @markScreenRange(screenRange, _.defaults(@getSelectionMarkerAttributes(), options)) - @suppressAutoscroll = false if options.autoscroll is false + @getLastSelection().autoscroll() unless options.autoscroll is false @getLastSelection() # Essential: Select from the current cursor position to the given position in @@ -2278,10 +2275,8 @@ class TextEditor extends Model if selection.destroyed for selection in @getSelections() if selection.intersectsBufferRange(selectionBufferRange) - selection.autoscroll() return selection else - selection.autoscroll() unless options.autoscroll is false @emit 'selection-added', selection @emitter.emit 'did-add-selection', selection selection From 477a9d7002603ca297efd3e07e3af0300b5d7597 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 16:25:12 -0700 Subject: [PATCH 200/521] :arrow_up: apm@0.152 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index f43d9e024..e10632417 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.151.0" + "atom-package-manager": "0.152.0" } } From c12f94907dc009395bcdafc746ec8fb689813830 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 10:01:09 -0700 Subject: [PATCH 201/521] Remove grim.deprecate override --- src/atom.coffee | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 188d0b3a6..707500479 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -207,12 +207,6 @@ class Atom extends Model # # Call after this instance has been assigned to the `atom` global. initialize: -> - # Disable deprecations unless in dev mode or spec mode so that regular - # editor performance isn't impacted by generating stack traces for - # deprecated calls. - unless @inDevMode() or @inSpecMode() - require('grim').deprecate = -> - sourceMapCache = {} window.onerror = => From c2fecacdbed55e4886b6986c8794aa194b48de93 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 10:47:06 -0700 Subject: [PATCH 202/521] Fail CI build when deprecations exist --- spec/jasmine-helper.coffee | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/jasmine-helper.coffee b/spec/jasmine-helper.coffee index 7642de7d7..1efb6ce19 100644 --- a/spec/jasmine-helper.coffee +++ b/spec/jasmine-helper.coffee @@ -27,8 +27,15 @@ module.exports.runSpecSuite = (specSuite, logFile, logErrors=true) -> fs.closeSync(logStream) if logStream? if process.env.JANKY_SHA1 grim = require 'grim' - grim.logDeprecations() if grim.getDeprecationsLength() > 0 - atom.exit(runner.results().failedCount > 0 ? 1 : 0) + + if grim.getDeprecationsLength() > 0 + grim.logDeprecations() + return atom.exit(1) if runner.results().failedCount is 0 + + if runner.results().failedCount > 0 + atom.exit(1) + else + atom.exit(0) else AtomReporter = require './atom-reporter' reporter = new AtomReporter() From ffdf7ac55840c40bd25b79e2bea9998d48c46878 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:31:08 -0700 Subject: [PATCH 203/521] Remove unneeded failed count check --- spec/jasmine-helper.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/jasmine-helper.coffee b/spec/jasmine-helper.coffee index 1efb6ce19..1e099d897 100644 --- a/spec/jasmine-helper.coffee +++ b/spec/jasmine-helper.coffee @@ -30,7 +30,7 @@ module.exports.runSpecSuite = (specSuite, logFile, logErrors=true) -> if grim.getDeprecationsLength() > 0 grim.logDeprecations() - return atom.exit(1) if runner.results().failedCount is 0 + return atom.exit(1) if runner.results().failedCount > 0 atom.exit(1) From 52e94637a316845dcdf3b8bf2bf27adcd62866fa Mon Sep 17 00:00:00 2001 From: "L. Caputo" Date: Thu, 26 Mar 2015 21:48:07 -0400 Subject: [PATCH 204/521] Update CONTRIBUTING.md change spelling: "judgement" to "judgment". --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2cf02bef..e6073b3ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ The following is a set of guidelines for contributing to Atom and its packages, which are hosted in the [Atom Organization](https://github.com/atom) on GitHub. If you're unsure which package is causing your problem or if you're having an issue with Atom core, please open an issue on the [main atom repository](https://github.com/atom/atom/issues). -These are just guidelines, not rules, use your best judgement and feel free to +These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request. ## Submitting Issues From 230eb12a8a4b4fab76bab3ee0ea09aeadfd2288e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 27 Mar 2015 10:27:24 -0700 Subject: [PATCH 205/521] Fix double autoscroll when moving cursor --- spec/text-editor-spec.coffee | 7 +++++++ src/cursor.coffee | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index d87952e85..bdb6b38fc 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -992,6 +992,13 @@ describe "TextEditor", -> editor.undo() expect(editor.getScrollTop()).toBe 0 + it "doesn't scroll when the cursor moves into the visible area", -> + editor.setCursorBufferPosition([0, 0]) + editor.setScrollTop(40) + expect(editor.getVisibleRowRange()).toEqual([4, 9]) + editor.setCursorBufferPosition([6, 0]) + expect(editor.getScrollTop()).toBe 40 + it "honors the autoscroll option on cursor and selection manipulation methods", -> expect(editor.getScrollTop()).toBe 0 editor.addCursorAtScreenPosition([11, 11], autoscroll: false) diff --git a/src/cursor.coffee b/src/cursor.coffee index c96f2eff5..de311358b 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -648,7 +648,7 @@ class Cursor extends Model ### changePosition: (options, fn) -> - @clearSelection(options) + @clearSelection(autoscroll: false) fn() @autoscroll() if options.autoscroll ? @isLastCursor() From ba867a14f0ded2f93c7056ae8cf99c8434a44661 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 27 Mar 2015 12:35:49 -0700 Subject: [PATCH 206/521] :arrow_up: settings-view@0.186.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 82b404f89..ad9fc3c80 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.185.0", + "settings-view": "0.186.0", "snippets": "0.86.0", "spell-check": "0.55.0", "status-bar": "0.64.0", From 14cfefba46781442b178d65846bd6f14fccaae9c Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 27 Mar 2015 13:37:55 -0700 Subject: [PATCH 207/521] :arrow_up: deprecation-cop@0.38.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad9fc3c80..b37ab89b2 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "bookmarks": "0.35.0", "bracket-matcher": "0.73.0", "command-palette": "0.34.0", - "deprecation-cop": "0.37.0", + "deprecation-cop": "0.38.0", "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", From 51a7630f7637aa215e41e02ac6b47a32f5a238af Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 27 Mar 2015 15:36:40 -0700 Subject: [PATCH 208/521] :arrow_up: feedback@0.36.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b37ab89b2..f2cda4431 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", - "feedback": "0.35.0", + "feedback": "0.36.0", "find-and-replace": "0.159.0", "fuzzy-finder": "0.72.0", "git-diff": "0.54.0", From 167d9b01525505ca6e8f222c605d63e6435bdb2b Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 27 Mar 2015 15:55:33 -0700 Subject: [PATCH 209/521] :arrow_up: image-view@0.53.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f2cda4431..b74797ebf 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", - "image-view": "0.52.0", + "image-view": "0.53.0", "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", From 3551780cdf953a0f275858663761bc9973015321 Mon Sep 17 00:00:00 2001 From: Nikolaus Wittenstein Date: Tue, 27 Jan 2015 10:34:06 -0500 Subject: [PATCH 210/521] Marker::setHead/TailScreenPosition no longer clip unnecessarily DisplayBuffer::bufferPositionForScreenPosition calls clipScreenPosition first thing, meaning that Marker::setHead/TailScreenPosition don't need to call clipScreenPosition before calling bufferPositionForScreenPosition. --- src/marker.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/marker.coffee b/src/marker.coffee index 22460c1f8..962ebb7e7 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -286,7 +286,6 @@ class Marker # * `screenPosition` The new {Point} to use # * `properties` (optional) {Object} properties to associate with the marker. setHeadScreenPosition: (screenPosition, properties) -> - screenPosition = @displayBuffer.clipScreenPosition(screenPosition, properties) @setHeadBufferPosition(@displayBuffer.bufferPositionForScreenPosition(screenPosition, properties)) # Extended: Retrieves the buffer position of the marker's tail. @@ -313,7 +312,6 @@ class Marker # * `screenPosition` The new {Point} to use # * `properties` (optional) {Object} properties to associate with the marker. setTailScreenPosition: (screenPosition, options) -> - screenPosition = @displayBuffer.clipScreenPosition(screenPosition, options) @setTailBufferPosition(@displayBuffer.bufferPositionForScreenPosition(screenPosition, options)) # Extended: Returns a {Boolean} indicating whether the marker has a tail. From 372fb49c88599ccf4e28bb821fa8dd9e2b7f94af Mon Sep 17 00:00:00 2001 From: Nikolaus Wittenstein Date: Tue, 27 Jan 2015 14:42:00 -0500 Subject: [PATCH 211/521] TokenizedLine::screenColumnForBufferColumn calculates more accurately screenColumnForBufferColumn used to break only if the current column was strictly greater than the target column. This commit changes it so it breaks when greater or equal, which is how bufferColumnForScreenColumn works. This also adds some unit tests for screenColumnForBufferColumn's interactions with hard tab characters. --- spec/display-buffer-spec.coffee | 8 ++++++++ src/tokenized-line.coffee | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 2893fd5a4..7635f5074 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -719,6 +719,14 @@ describe "DisplayBuffer", -> expect(displayBuffer.screenPositionForBufferPosition([100000, 0])).toEqual [12, 2] expect(displayBuffer.screenPositionForBufferPosition([100000, 100000])).toEqual [12, 2] + it "clips to the (left or right) edge of an atomic token without simply rounding up", -> + tabLength = 4 + displayBuffer.setTabLength(tabLength) + + buffer.insert([0, 0], '\t') + expect(displayBuffer.screenPositionForBufferPosition([0, 0])).toEqual [0, 0] + expect(displayBuffer.screenPositionForBufferPosition([0, 1])).toEqual [0, tabLength] + describe "position translation in the presence of hard tabs", -> it "correctly translates positions on either side of a tab", -> buffer.setText('\t') diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 11badc859..a6209e210 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -67,7 +67,7 @@ class TokenizedLine screenColumn = 0 currentBufferColumn = 0 for token in @tokens - break if currentBufferColumn > bufferColumn + break if currentBufferColumn + token.bufferDelta > bufferColumn screenColumn += token.screenDelta currentBufferColumn += token.bufferDelta @clipScreenColumn(screenColumn + (bufferColumn - currentBufferColumn)) From 5a3f2035a1f7a7820eb01dc569a5d0ec5fcbcb8f Mon Sep 17 00:00:00 2001 From: Nikolaus Wittenstein Date: Tue, 27 Jan 2015 15:14:15 -0500 Subject: [PATCH 212/521] Replace skipAtomicTokens with clip When clipping a screen position, callers used to have to pick between clipping to the left edge or the right edge when the position was in the middle of an atomic token. This change allows them to choose the closest edge, and makes this the default. This makes selecting hard tabs (or any other atomic tokens) work in a similar manner as in other text editors; that is, when clicking near the middle of a tab, the insertion point will move to the closest edge rather than the left edge. --- spec/display-buffer-spec.coffee | 26 +++++++++++++++++++------- src/cursor.coffee | 4 ++-- src/selection.coffee | 2 +- src/tokenized-line.coffee | 21 ++++++++++++++++++--- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 7635f5074..4d46f3da7 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -638,8 +638,11 @@ describe "DisplayBuffer", -> expect(displayBuffer.outermostFoldsInBufferRowRange(3, 18)).toEqual [fold1, fold3, fold5] expect(displayBuffer.outermostFoldsInBufferRowRange(5, 16)).toEqual [fold3] - describe "::clipScreenPosition(screenPosition, wrapBeyondNewlines: false, wrapAtSoftNewlines: false, skipAtomicTokens: false)", -> + describe "::clipScreenPosition(screenPosition, wrapBeyondNewlines: false, wrapAtSoftNewlines: false, clip: 'closest')", -> beforeEach -> + tabLength = 4 + + displayBuffer.setTabLength(tabLength) displayBuffer.setSoftWrapped(true) displayBuffer.setEditorWidthInChars(50) @@ -698,19 +701,28 @@ describe "DisplayBuffer", -> expect(displayBuffer.clipScreenPosition([3, 58], wrapAtSoftNewlines: true)).toEqual [4, 4] expect(displayBuffer.clipScreenPosition([3, 1000], wrapAtSoftNewlines: true)).toEqual [4, 4] - describe "when skipAtomicTokens is false (the default)", -> - it "clips screen positions in the middle of atomic tab characters to the beginning of the character", -> + describe "when clip is 'closest' (the default)", -> + it "clips screen positions in the middle of atomic tab characters to the closest edge of the character", -> buffer.insert([0, 0], '\t') expect(displayBuffer.clipScreenPosition([0, 0])).toEqual [0, 0] expect(displayBuffer.clipScreenPosition([0, 1])).toEqual [0, 0] + expect(displayBuffer.clipScreenPosition([0, 2])).toEqual [0, 0] + expect(displayBuffer.clipScreenPosition([0, tabLength-1])).toEqual [0, tabLength] expect(displayBuffer.clipScreenPosition([0, tabLength])).toEqual [0, tabLength] - describe "when skipAtomicTokens is true", -> + describe "when clip is 'backward'", -> + it "clips screen positions in the middle of atomic tab characters to the beginning of the character", -> + buffer.insert([0, 0], '\t') + expect(displayBuffer.clipScreenPosition([0, 0], clip: 'backward')).toEqual [0, 0] + expect(displayBuffer.clipScreenPosition([0, tabLength-1], clip: 'backward')).toEqual [0, 0] + expect(displayBuffer.clipScreenPosition([0, tabLength], clip: 'backward')).toEqual [0, tabLength] + + describe "when clip is 'forward'", -> it "clips screen positions in the middle of atomic tab characters to the end of the character", -> buffer.insert([0, 0], '\t') - expect(displayBuffer.clipScreenPosition([0, 0], skipAtomicTokens: true)).toEqual [0, 0] - expect(displayBuffer.clipScreenPosition([0, 1], skipAtomicTokens: true)).toEqual [0, tabLength] - expect(displayBuffer.clipScreenPosition([0, tabLength], skipAtomicTokens: true)).toEqual [0, tabLength] + expect(displayBuffer.clipScreenPosition([0, 0], clip: 'forward')).toEqual [0, 0] + expect(displayBuffer.clipScreenPosition([0, 1], clip: 'forward')).toEqual [0, tabLength] + expect(displayBuffer.clipScreenPosition([0, tabLength], clip: 'forward')).toEqual [0, tabLength] describe "::screenPositionForBufferPosition(bufferPosition, options)", -> it "clips the specified buffer position", -> diff --git a/src/cursor.coffee b/src/cursor.coffee index de311358b..c7db4b04a 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -305,7 +305,7 @@ class Cursor extends Model columnCount-- # subtract 1 for the row move column = column - columnCount - @setScreenPosition({row, column}) + @setScreenPosition({row, column}, clip: 'backward') # Public: Moves the cursor right one screen column. # @@ -332,7 +332,7 @@ class Cursor extends Model columnsRemainingInLine = rowLength column = column + columnCount - @setScreenPosition({row, column}, skipAtomicTokens: true, wrapBeyondNewlines: true, wrapAtSoftNewlines: true) + @setScreenPosition({row, column}, clip: 'forward', wrapBeyondNewlines: true, wrapAtSoftNewlines: true) # Public: Moves the cursor to the top of the buffer. moveToTop: -> diff --git a/src/selection.coffee b/src/selection.coffee index 0bee6f7de..ea4b54034 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -393,7 +393,7 @@ class Selection extends Model if options.select @setBufferRange(newBufferRange, reversed: wasReversed) else - @cursor.setBufferPosition(newBufferRange.end, skipAtomicTokens: true) if wasReversed + @cursor.setBufferPosition(newBufferRange.end, clip: 'forward') if wasReversed if autoIndentFirstLine @editor.setIndentationForBufferRow(oldBufferRange.start.row, desiredIndentLevel) diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index a6209e210..074e7a785 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -41,10 +41,20 @@ class TokenizedLine copy: -> new TokenizedLine({@tokens, @lineEnding, @ruleStack, @startBufferColumn, @fold}) + # This clips a given screen column to a valid column that's within the line + # and not in the middle of any atomic tokens. + # + # column - A {Number} representing the column to clip + # options - A hash with the key clip. Valid values for this key: + # 'closest' (default): clip to the closest edge of an atomic token. + # 'forward': clip to the forward edge. + # 'backward': clip to the backward edge. + # + # Returns a {Number} representing the clipped column. clipScreenColumn: (column, options={}) -> return 0 if @tokens.length == 0 - { skipAtomicTokens } = options + { clip } = options column = Math.min(column, @getMaxScreenColumn()) tokenStartColumn = 0 @@ -55,10 +65,15 @@ class TokenizedLine if @isColumnInsideSoftWrapIndentation(tokenStartColumn) @softWrapIndentationDelta else if token.isAtomic and tokenStartColumn < column - if skipAtomicTokens + if clip == 'forward' tokenStartColumn + token.screenDelta - else + else if clip == 'backward' tokenStartColumn + else #'closest' + if column > tokenStartColumn + (token.screenDelta / 2) + tokenStartColumn + token.screenDelta + else + tokenStartColumn else column From b28ee92896a770504732f3d081e4053e4f93105e Mon Sep 17 00:00:00 2001 From: Nikolaus Wittenstein Date: Mon, 23 Mar 2015 09:42:37 -0400 Subject: [PATCH 213/521] Add tests for DisplayBuffer::screenPositionForBufferPosition around soft tabs This makes sure that a buffer position in the middle of a soft tab will correctly clip to the closest edge by default. --- spec/display-buffer-spec.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 4d46f3da7..93460f173 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -739,6 +739,17 @@ describe "DisplayBuffer", -> expect(displayBuffer.screenPositionForBufferPosition([0, 0])).toEqual [0, 0] expect(displayBuffer.screenPositionForBufferPosition([0, 1])).toEqual [0, tabLength] + it "clips to the edge closest to the given position when it's inside a soft tab", -> + tabLength = 4 + displayBuffer.setTabLength(tabLength) + + buffer.insert([0, 0], ' ') + expect(displayBuffer.screenPositionForBufferPosition([0, 0])).toEqual [0, 0] + expect(displayBuffer.screenPositionForBufferPosition([0, 1])).toEqual [0, 0] + expect(displayBuffer.screenPositionForBufferPosition([0, 2])).toEqual [0, 0] + expect(displayBuffer.screenPositionForBufferPosition([0, 3])).toEqual [0, 4] + expect(displayBuffer.screenPositionForBufferPosition([0, 4])).toEqual [0, 4] + describe "position translation in the presence of hard tabs", -> it "correctly translates positions on either side of a tab", -> buffer.setText('\t') From 2e10517e1cb5f405617fff8ea17d5b28eb0265bf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 29 Jan 2015 11:54:29 -0800 Subject: [PATCH 214/521] :arrow_up: asar@0.2.2 --- build/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/build/package.json b/build/package.json index aa3742e40..cb9954147 100644 --- a/build/package.json +++ b/build/package.json @@ -6,6 +6,7 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { + "asar": "^0.2.2", "async": "~0.2.9", "donna": "1.0.7", "formidable": "~1.0.14", From f9e80439d0c9caa40c2bd2070b236af1a13c20f7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 29 Jan 2015 11:54:46 -0800 Subject: [PATCH 215/521] Add generate-asar task --- build/Gruntfile.coffee | 4 ++-- build/tasks/generate-asar-task.coffee | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 build/tasks/generate-asar-task.coffee diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 05efaeb38..ed4c7b933 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -223,7 +223,7 @@ module.exports = (grunt) -> ciTasks = ['output-disk-space', 'download-atom-shell', 'download-atom-shell-chromedriver', 'build'] ciTasks.push('dump-symbols') if process.platform isnt 'win32' - ciTasks.push('set-version', 'check-licenses', 'lint') + ciTasks.push('set-version', 'check-licenses', 'lint', 'generate-asar') ciTasks.push('mkdeb') if process.platform is 'linux' ciTasks.push('create-windows-installer') if process.platform is 'win32' ciTasks.push('test') if process.platform is 'darwin' @@ -231,6 +231,6 @@ module.exports = (grunt) -> ciTasks.push('publish-build') grunt.registerTask('ci', ciTasks) - defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version'] + defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version', 'generate-asar'] defaultTasks.push 'install' unless process.platform is 'linux' grunt.registerTask('default', defaultTasks) diff --git a/build/tasks/generate-asar-task.coffee b/build/tasks/generate-asar-task.coffee new file mode 100644 index 000000000..266c6bf57 --- /dev/null +++ b/build/tasks/generate-asar-task.coffee @@ -0,0 +1,14 @@ +asar = require 'asar' +path = require 'path' + +module.exports = (grunt) -> + {rm} = require('./task-helpers')(grunt) + + grunt.registerTask 'generate-asar', 'Generate asar archive for the app', -> + done = @async() + + appDir = grunt.config.get('atom.appDir') + asar.createPackage appDir, path.resolve(appDir, '..', 'app.asar'), (err) -> + return done(err) if err? + rm appDir + done() From e79a23f39a4ea47fefcf3a4435f24cdf13ae58e2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 1 Feb 2015 17:52:46 -0800 Subject: [PATCH 216/521] Do not set "cwd" for tasks The task can be inside an asar archive, which is not allowed to be cwd. --- src/task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/task.coffee b/src/task.coffee index 9572494b8..cfea0fae5 100644 --- a/src/task.coffee +++ b/src/task.coffee @@ -83,7 +83,7 @@ class Task taskPath = taskPath.replace(/\\/g, "\\\\") env = _.extend({}, process.env, {taskPath, userAgent: navigator.userAgent}) - @childProcess = fork '--eval', [bootstrap], {env, cwd: __dirname} + @childProcess = fork '--eval', [bootstrap], {env} @on "task:log", -> console.log(arguments...) @on "task:warn", -> console.warn(arguments...) From a8b919f0e045b8e8dcfc1b8ff9137edd8b64401e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 4 Feb 2015 12:17:39 -0800 Subject: [PATCH 217/521] Print errors that happened before task-bootstrap --- src/task.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/task.coffee b/src/task.coffee index cfea0fae5..d752ea11d 100644 --- a/src/task.coffee +++ b/src/task.coffee @@ -83,7 +83,7 @@ class Task taskPath = taskPath.replace(/\\/g, "\\\\") env = _.extend({}, process.env, {taskPath, userAgent: navigator.userAgent}) - @childProcess = fork '--eval', [bootstrap], {env} + @childProcess = fork '--eval', [bootstrap], {env, silent: true} @on "task:log", -> console.log(arguments...) @on "task:warn", -> console.warn(arguments...) @@ -100,6 +100,11 @@ class Task @childProcess.removeAllListeners() @childProcess.on 'message', ({event, args}) => @emit(event, args...) if @childProcess? + # Catch the errors that happened before task-bootstrap. + @childProcess.stdout.on 'data', (data) -> + console.log data.toString() + @childProcess.stderr.on 'data', (data) -> + console.error data.toString() # Public: Starts the task. # From 505754783fbf94d3cfc6c8f882e7721e46571965 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 5 Feb 2015 14:38:25 -0800 Subject: [PATCH 218/521] Warn empty app dir --- build/tasks/generate-asar-task.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/tasks/generate-asar-task.coffee b/build/tasks/generate-asar-task.coffee index 266c6bf57..b6b0064ce 100644 --- a/build/tasks/generate-asar-task.coffee +++ b/build/tasks/generate-asar-task.coffee @@ -1,4 +1,5 @@ asar = require 'asar' +fs = require 'fs' path = require 'path' module.exports = (grunt) -> @@ -8,6 +9,10 @@ module.exports = (grunt) -> done = @async() appDir = grunt.config.get('atom.appDir') + unless fs.existsSync(appDir) + grunt.log.error 'The app has to be built before generating asar archive.' + return done(false) + asar.createPackage appDir, path.resolve(appDir, '..', 'app.asar'), (err) -> return done(err) if err? rm appDir From 01130230e4f6d6bd023e663b9e79ed548987b59e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 25 Mar 2015 10:27:25 +0800 Subject: [PATCH 219/521] Copy LICENSE.md to process.resourcesPath The LICENSE file is needed by mkdeb task, we should move it out of asar archive. --- build/tasks/generate-license-task.coffee | 2 +- script/mkdeb | 2 +- src/browser/atom-application.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/tasks/generate-license-task.coffee b/build/tasks/generate-license-task.coffee index 6b616f5cb..eaf1a9a66 100644 --- a/build/tasks/generate-license-task.coffee +++ b/build/tasks/generate-license-task.coffee @@ -17,7 +17,7 @@ module.exports = (grunt) -> licenseText = getLicenseText(dependencyLicenses) if mode is 'save' - targetPath = path.join(grunt.config.get('atom.appDir'), 'LICENSE.md') + targetPath = path.resolve(grunt.config.get('atom.appDir'), '..', 'LICENSE.md') fs.writeFileSync(targetPath, licenseText) else console.log licenseText diff --git a/script/mkdeb b/script/mkdeb index 272fe23f3..c39b6d649 100755 --- a/script/mkdeb +++ b/script/mkdeb @@ -33,7 +33,7 @@ cp "$ICON_FILE" "$TARGET/usr/share/pixmaps" # Copy generated LICENSE.md to /usr/share/doc/atom/copyright mkdir -m $FILE_MODE -p "$TARGET/usr/share/doc/atom" -cp "$TARGET/usr/share/atom/resources/app/LICENSE.md" "$TARGET/usr/share/doc/atom/copyright" +cp "$TARGET/usr/share/atom/resources/LICENSE.md" "$TARGET/usr/share/doc/atom/copyright" # Add lintian overrides mkdir -m $FILE_MODE -p "$TARGET/usr/share/lintian/overrides" diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index d79b2bf76..7d88858c5 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -190,7 +190,7 @@ class AtomApplication @openPathOnEvent('application:open-your-keymap', 'atom://.atom/keymap') @openPathOnEvent('application:open-your-snippets', 'atom://.atom/snippets') @openPathOnEvent('application:open-your-stylesheet', 'atom://.atom/stylesheet') - @openPathOnEvent('application:open-license', path.join(@resourcePath, 'LICENSE.md')) + @openPathOnEvent('application:open-license', path.join(process.resourcesPath, 'LICENSE.md')) app.on 'window-all-closed', -> app.quit() if process.platform in ['win32', 'linux'] From 3ce12693e6be43f35f8494bb63fcc0bdf06635c3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 25 Mar 2015 13:35:03 +0800 Subject: [PATCH 220/521] Install apm to process.resourcesPath --- build/tasks/build-task.coffee | 6 +++--- src/command-installer.coffee | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index fcb1eb6a8..74e5d8821 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -22,7 +22,7 @@ module.exports = (grunt) -> mkdir appDir if process.platform isnt 'win32' - cp 'atom.sh', path.join(appDir, 'atom.sh') + cp 'atom.sh', path.resolve(appDir, '..', 'atom.sh') cp 'package.json', path.join(appDir, 'package.json') @@ -145,9 +145,9 @@ module.exports = (grunt) -> cp 'src', path.join(appDir, 'src'), filter: /.+\.(cson|coffee)$/ cp 'static', path.join(appDir, 'static') - cp path.join('apm', 'node_modules', 'atom-package-manager'), path.join(appDir, 'apm'), filter: filterNodeModule + cp path.join('apm', 'node_modules', 'atom-package-manager'), path.resolve(appDir, '..', 'apm'), filter: filterNodeModule if process.platform isnt 'win32' - fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(appDir, 'apm', 'node_modules', '.bin', 'apm')) + fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.resolve(appDir, '..', 'apm', 'node_modules', '.bin', 'apm')) if process.platform is 'darwin' grunt.file.recurse path.join('resources', 'mac'), (sourcePath, rootDirectory, subDirectory='', filename) -> diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 1d3a16777..b9d40bce0 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -36,7 +36,7 @@ module.exports = message: "Failed to install shell commands" detailedMessage: error.message - resourcePath = atom.getLoadSettings().resourcePath + resourcePath = process.resourcesPath @installAtomCommand resourcePath, true, (error) => if error? showErrorDialog(error) From 2d9f2091c5631bf43c7932bc92db9820888c80a3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 25 Mar 2015 16:46:36 +0800 Subject: [PATCH 221/521] Unpack native module files It improves performance and makes virus scanners happy --- build/package.json | 2 +- build/tasks/generate-asar-task.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/package.json b/build/package.json index cb9954147..d7323db5c 100644 --- a/build/package.json +++ b/build/package.json @@ -6,7 +6,7 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "asar": "^0.2.2", + "asar": "^0.4.0", "async": "~0.2.9", "donna": "1.0.7", "formidable": "~1.0.14", diff --git a/build/tasks/generate-asar-task.coffee b/build/tasks/generate-asar-task.coffee index b6b0064ce..1f74fbf5d 100644 --- a/build/tasks/generate-asar-task.coffee +++ b/build/tasks/generate-asar-task.coffee @@ -13,7 +13,7 @@ module.exports = (grunt) -> grunt.log.error 'The app has to be built before generating asar archive.' return done(false) - asar.createPackage appDir, path.resolve(appDir, '..', 'app.asar'), (err) -> + asar.createPackageWithOptions appDir, path.resolve(appDir, '..', 'app.asar'), {unpack: '*.node'}, (err) -> return done(err) if err? rm appDir done() From c52058ef12a8b20946ea1be21488d3bedecade6a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 25 Mar 2015 19:04:19 +0800 Subject: [PATCH 222/521] Always install commands from process.resourcesPath --- src/atom.coffee | 4 ++-- src/command-installer.coffee | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 707500479..fc4f59ef2 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -581,9 +581,9 @@ class Atom extends Model {resourcePath, safeMode} = @getLoadSettings() CommandInstaller = require './command-installer' - CommandInstaller.installAtomCommand resourcePath, false, (error) -> + CommandInstaller.installAtomCommand false, (error) -> console.warn error.message if error? - CommandInstaller.installApmCommand resourcePath, false, (error) -> + CommandInstaller.installApmCommand false, (error) -> console.warn error.message if error? dimensions = @restoreWindowDimensions() diff --git a/src/command-installer.coffee b/src/command-installer.coffee index b9d40bce0..c7772b4f5 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -36,12 +36,11 @@ module.exports = message: "Failed to install shell commands" detailedMessage: error.message - resourcePath = process.resourcesPath - @installAtomCommand resourcePath, true, (error) => + @installAtomCommand true, (error) => if error? showErrorDialog(error) else - @installApmCommand resourcePath, true, (error) -> + @installApmCommand true, (error) -> if error? showErrorDialog(error) else @@ -49,12 +48,12 @@ module.exports = message: "Commands installed." detailedMessage: "The shell commands `atom` and `apm` are installed." - installAtomCommand: (resourcePath, askForPrivilege, callback) -> - commandPath = path.join(resourcePath, 'atom.sh') + installAtomCommand: (askForPrivilege, callback) -> + commandPath = path.join(process.resourcesPath, 'atom.sh') @createSymlink commandPath, askForPrivilege, callback - installApmCommand: (resourcePath, askForPrivilege, callback) -> - commandPath = path.join(resourcePath, 'apm', 'node_modules', '.bin', 'apm') + installApmCommand: (askForPrivilege, callback) -> + commandPath = path.join(process.resourcesPath, 'apm', 'node_modules', '.bin', 'apm') @createSymlink commandPath, askForPrivilege, callback createSymlink: (commandPath, askForPrivilege, callback) -> From 685e4ebe960d5cb77bca606fb78fdaa81b96b0ed Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 26 Mar 2015 17:51:26 +0800 Subject: [PATCH 223/521] Update path to apm in squirrel-update and package-manager --- src/browser/squirrel-update.coffee | 2 +- src/package-manager.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 1603a7c0a..3bdd84223 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -142,7 +142,7 @@ addCommandsToPath = (callback) -> atomShCommand = "#!/bin/sh\r\n\"$0/../#{relativeAtomShPath.replace(/\\/g, '/')}\" \"$@\"" apmCommandPath = path.join(binFolder, 'apm.cmd') - relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'app', 'apm', 'bin', 'apm.cmd')) + relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'apm', 'bin', 'apm.cmd')) apmCommand = "@echo off\r\n\"%~dp0\\#{relativeApmPath}\" %*" apmShCommandPath = path.join(binFolder, 'apm') diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 444497c5b..2bbcf7fe7 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -134,7 +134,7 @@ class PackageManager commandName = 'apm' commandName += '.cmd' if process.platform is 'win32' - apmRoot = path.resolve(__dirname, '..', 'apm') + apmRoot = path.resolve(__dirname, '..', '..', 'apm') @apmPath = path.join(apmRoot, 'bin', commandName) unless fs.isFileSync(@apmPath) @apmPath = path.join(apmRoot, 'node_modules', 'atom-package-manager', 'bin', commandName) From e05bb2290296da549582c657a3fb4f8ec6499f0d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 30 Mar 2015 15:02:02 +0800 Subject: [PATCH 224/521] :arrow_up: apm@0.153.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index e10632417..106878360 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.152.0" + "atom-package-manager": "0.153.0" } } From 14ba61f08d1f6ee128c5ae20e31fbec75ba502fc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 30 Mar 2015 19:10:56 +0800 Subject: [PATCH 225/521] :arrow_up: apm@0.154.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 106878360..c43f6e6be 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.153.0" + "atom-package-manager": "0.154.0" } } From 271ad2908badff9eaa74bae9514bd1a8d0402396 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 30 Mar 2015 19:31:38 +0800 Subject: [PATCH 226/521] :arrow_up: apm@0.155.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index c43f6e6be..318047a78 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.154.0" + "atom-package-manager": "0.155.0" } } From f83f37b53df8fa41e8e59d08e6dfff981dc52deb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 09:21:37 -0700 Subject: [PATCH 227/521] :arrow_up: atom-keymap@5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b74797ebf..308c2c662 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.22.2", "dependencies": { "async": "0.2.6", - "atom-keymap": "^4", + "atom-keymap": "^5", "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", From 3b9f829dc6d169c5980bff372ff06db83fe4a5cf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 09:57:38 -0700 Subject: [PATCH 228/521] :arrow_up: language-javascript@0.65 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 308c2c662..73c33cdb7 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.30.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.64.0", + "language-javascript": "0.65.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 5a55c1bba6deb50cf019f1205909f3b65595c188 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Mon, 30 Mar 2015 09:59:33 -0700 Subject: [PATCH 229/521] :arrow_up: feedback@0.37.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 308c2c662..a795fcd4b 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", - "feedback": "0.36.0", + "feedback": "0.37.0", "find-and-replace": "0.159.0", "fuzzy-finder": "0.72.0", "git-diff": "0.54.0", From ed8051cb6140a1982b78ff95eb4a50f273a7e539 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 10:01:49 -0700 Subject: [PATCH 230/521] :arrow_up: language-php@0.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 73c33cdb7..b91f0022c 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "language-mustache": "0.11.0", "language-objective-c": "0.15.0", "language-perl": "0.21.0", - "language-php": "0.21.0", + "language-php": "0.22.0", "language-property-list": "0.8.0", "language-python": "0.32.0", "language-ruby": "0.50.0", From 72dff5b1c10321f7f6cd8554ddb9e11e3e24f0da Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 10:03:41 -0700 Subject: [PATCH 231/521] :arrow_up: language-python@0.33 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b91f0022c..c23261aba 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "language-perl": "0.21.0", "language-php": "0.22.0", "language-property-list": "0.8.0", - "language-python": "0.32.0", + "language-python": "0.33.0", "language-ruby": "0.50.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0", From 4a864e79dca09f911bde74a2daf3bf321cdad0b0 Mon Sep 17 00:00:00 2001 From: Jesse Grosjean Date: Mon, 30 Mar 2015 13:05:45 -0400 Subject: [PATCH 232/521] Fix screenPositionForPixelPosition for case above first row. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently screenPositionForPixelPosition special cases pixel positions below the last row so that the column position is always set to the last column of the last line, even if the pixel 'x' position is less then that column. This patch special cases picks above the first row so that the text column position will be in the first column even if the pixel 'x' position is greater then that column. At a higher level, this patch fixes the problem where you can’t select to the start of a text field by just clicking and dragging up. Instead you have to click and drag back (x axis) beyond the start of the text field. --- src/display-buffer.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index b60113661..d79b1bce7 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -692,6 +692,7 @@ class DisplayBuffer extends Model targetLeft = pixelPosition.left defaultCharWidth = @defaultCharWidth row = Math.floor(targetTop / @getLineHeightInPixels()) + targetLeft = -Infinity if row < 0 targetLeft = Infinity if row > @getLastRow() row = Math.min(row, @getLastRow()) row = Math.max(0, row) From 4a05114b6d24dc0fd0c1a2ec87942b1a905b67be Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 10:11:23 -0700 Subject: [PATCH 233/521] :arrow_up: markdown-preview@0.146 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c23261aba..5dd88b6ba 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", - "markdown-preview": "0.145.0", + "markdown-preview": "0.146.0", "metrics": "0.45.0", "notifications": "0.35.0", "open-on-github": "0.36.0", From b067a6175fe4f854b47499658f2d4cade4fd065f Mon Sep 17 00:00:00 2001 From: Jesse Grosjean Date: Mon, 30 Mar 2015 13:50:25 -0400 Subject: [PATCH 234/521] add screenPositionForPixelPosition spec --- spec/display-buffer-spec.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 93460f173..5ece19692 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -724,6 +724,15 @@ describe "DisplayBuffer", -> expect(displayBuffer.clipScreenPosition([0, 1], clip: 'forward')).toEqual [0, tabLength] expect(displayBuffer.clipScreenPosition([0, tabLength], clip: 'forward')).toEqual [0, tabLength] + describe "::screenPositionForPixelPosition(pixelPosition)", -> + it "pixel positions above buffer to map to start", -> + expect(displayBuffer.screenPositionForPixelPosition(top: -Infinity, left: -Infinity)).toEqual [0, 0] + expect(displayBuffer.screenPositionForPixelPosition(top: -Infinity, left: Infinity)).toEqual [0, 0] + + it "pixel positions below buffer map to end", -> + expect(displayBuffer.screenPositionForPixelPosition(top: Infinity, left: -Infinity)).toEqual [12, 2] + expect(displayBuffer.screenPositionForPixelPosition(top: Infinity, left: Infinity)).toEqual [12, 2] + describe "::screenPositionForBufferPosition(bufferPosition, options)", -> it "clips the specified buffer position", -> expect(displayBuffer.screenPositionForBufferPosition([0, 2])).toEqual [0, 2] From 6ba881b9588ba98498924a412a13bfec4661ad03 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 30 Mar 2015 13:07:55 -0700 Subject: [PATCH 235/521] :arrow_up: feedback@0.38.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 60ebdb94a..c25004c7a 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", - "feedback": "0.37.0", + "feedback": "0.38.0", "find-and-replace": "0.159.0", "fuzzy-finder": "0.72.0", "git-diff": "0.54.0", From 6a9a824eacd29b8249d82120f3d5b3cc11e4c5f5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 13:36:40 -0700 Subject: [PATCH 236/521] :arrow_up: apm@0.156 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index e10632417..28c393ed5 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.152.0" + "atom-package-manager": "0.156.0" } } From 91710894660018988cfa87c5132333129dd1f0c6 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 30 Mar 2015 13:50:08 -0700 Subject: [PATCH 237/521] Add default syntax color vars Will be used by syntax themes, and autocomplete --- static/variables/syntax-variables.less | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/static/variables/syntax-variables.less b/static/variables/syntax-variables.less index 565341f7e..f569773e8 100644 --- a/static/variables/syntax-variables.less +++ b/static/variables/syntax-variables.less @@ -28,3 +28,16 @@ @syntax-color-modified: orange; @syntax-color-removed: red; @syntax-color-renamed: blue; + +// For language entity colors +@syntax-color-variable: #DF6A73; +@syntax-color-constant: #DF6A73; +@syntax-color-property: #DF6A73; +@syntax-color-value: #D29B67; +@syntax-color-function: #61AEEF; +@syntax-color-method: @syntax-color-function; +@syntax-color-class: #E5C17C; +@syntax-color-keyword: #555; +@syntax-color-tag: #555; +@syntax-color-import: #97C378; +@syntax-color-snippet: #97C378; From 2fcfb3416b5f5486b2f6b62fd4e22be3cadb9b59 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Mar 2015 15:24:51 -0700 Subject: [PATCH 238/521] :arrow_up: language-javascript@0.66 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c25004c7a..b5cfa450c 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.30.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.65.0", + "language-javascript": "0.66.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From ba5ab1056d24307b77e78db6460521e27084f832 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Mon, 30 Mar 2015 15:53:12 -0700 Subject: [PATCH 239/521] :arrow_up: status-bar@0.66.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5cfa450c..072bd5f26 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "settings-view": "0.186.0", "snippets": "0.86.0", "spell-check": "0.55.0", - "status-bar": "0.64.0", + "status-bar": "0.66.0", "styleguide": "0.44.0", "symbols-view": "0.93.0", "tabs": "0.67.0", From d38b9a5b75ef3591aa642adba11a65dc0e73459f Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Mon, 30 Mar 2015 16:17:48 -0700 Subject: [PATCH 240/521] :arrow_up: deprecation-cop, image-view --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 072bd5f26..d6a56a02b 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "bookmarks": "0.35.0", "bracket-matcher": "0.73.0", "command-palette": "0.34.0", - "deprecation-cop": "0.38.0", + "deprecation-cop": "0.39.0", "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", @@ -100,7 +100,7 @@ "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", - "image-view": "0.53.0", + "image-view": "0.54.0", "incompatible-packages": "0.24.0", "keybinding-resolver": "0.29.0", "link": "0.30.0", From a06bf8127a4b3e206dd7fd9ad14b4acc227019ed Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 31 Mar 2015 08:55:47 -0700 Subject: [PATCH 241/521] :arrow_up: language-perl@0.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6a56a02b..4315c5077 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "language-make": "0.14.0", "language-mustache": "0.11.0", "language-objective-c": "0.15.0", - "language-perl": "0.21.0", + "language-perl": "0.22.0", "language-php": "0.22.0", "language-property-list": "0.8.0", "language-python": "0.33.0", From 7bd4eebee9effbac2f69261785ca5c33eabe1fcf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 31 Mar 2015 09:09:23 -0700 Subject: [PATCH 242/521] :arrow_up: language-html@0.31 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4315c5077..2d4be5a27 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "language-gfm": "0.67.0", "language-git": "0.10.0", "language-go": "0.22.0", - "language-html": "0.30.0", + "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", "language-javascript": "0.66.0", From ad0fd817fc890cc60391d752ea2964667f3759bf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 31 Mar 2015 09:18:40 -0700 Subject: [PATCH 243/521] :arrow_up: language-javascript@0.67 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d4be5a27..c8daa4a4f 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.66.0", + "language-javascript": "0.67.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 2cc5140e1e024bf120d02b7761f69c6656180119 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 31 Mar 2015 11:06:33 -0700 Subject: [PATCH 244/521] :arrow_up: apm@0.157 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 28c393ed5..84f73451d 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.156.0" + "atom-package-manager": "0.157.0" } } From 4cf34cc1fa96d6ad57edffdd16e8d65cbc830783 Mon Sep 17 00:00:00 2001 From: Vegar Vikan Date: Wed, 1 Apr 2015 00:21:59 +0200 Subject: [PATCH 245/521] Documentation: workspace.open( ) refrasing --- src/workspace.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index c8040f920..6c60cf22a 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -371,8 +371,8 @@ class Workspace extends Model Section: Opening ### - # Essential: Open a given URI in Atom asynchronously. - # If no URI is given, or URI does not resolve to an existing file, + # Essential: Opens the given URI in Atom asynchronously, if it's not already open. + # If no URI is given, or the URI is the path of a file that does not exist, # a new empty text edtior is created. # # * `uri` (optional) A {String} containing a URI. From dc0296851b6a0e6ff66d8576fd546d90ee50b4bb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 31 Mar 2015 16:04:13 -0700 Subject: [PATCH 246/521] :arrow_up: grunt-atom-shell-installer@0.27 --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index aa3742e40..941f711d8 100644 --- a/build/package.json +++ b/build/package.json @@ -12,7 +12,7 @@ "fs-plus": "2.x", "github-releases": "~0.2.0", "grunt": "~0.4.1", - "grunt-atom-shell-installer": "^0.25.0", + "grunt-atom-shell-installer": "^0.27.0", "grunt-cli": "~0.1.9", "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", "grunt-contrib-coffee": "~0.12.0", From e1e34baaea55a687f37e860b80784f1e38bef568 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 31 Mar 2015 16:42:21 -0700 Subject: [PATCH 247/521] :arrow_down: grunt-atom-shell-installer@0.25 --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index 941f711d8..aa3742e40 100644 --- a/build/package.json +++ b/build/package.json @@ -12,7 +12,7 @@ "fs-plus": "2.x", "github-releases": "~0.2.0", "grunt": "~0.4.1", - "grunt-atom-shell-installer": "^0.27.0", + "grunt-atom-shell-installer": "^0.25.0", "grunt-cli": "~0.1.9", "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", "grunt-contrib-coffee": "~0.12.0", From 93e4b061fa63ee8b134f6bebaa3a148a3616c71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Kahyao=C4=9Flu?= Date: Wed, 1 Apr 2015 14:48:23 +0300 Subject: [PATCH 248/521] minor changes in decoration.coffee --- src/decoration.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/decoration.coffee b/src/decoration.coffee index fdaaa285d..cbf649473 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -20,7 +20,7 @@ nextId = -> idCounter++ # decoration = editor.decorateMarker(marker, {type: 'line', class: 'my-line-class'}) # ``` # -# Best practice for destorying the decoration is by destroying the {Marker}. +# Best practice for destroying the decoration is by destroying the {Marker}. # # ```coffee # marker.destroy() @@ -56,7 +56,6 @@ class Decoration @properties.id = @id @flashQueue = null @destroyed = false - @markerDestroyDisposable = @marker.onDidDestroy => @destroy() # Essential: Destroy this marker. From 639fde343cc81a4986246f71d2fa14eb355601bd Mon Sep 17 00:00:00 2001 From: Jesse Grosjean Date: Wed, 11 Feb 2015 10:47:36 -0500 Subject: [PATCH 249/521] Export File and Directory through require('atom') Conflicts: exports/atom.coffee --- exports/atom.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exports/atom.coffee b/exports/atom.coffee index 5afa04022..dab0b007f 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -1,5 +1,6 @@ TextBuffer = require 'text-buffer' {Point, Range} = TextBuffer +{File, Directory} = require 'pathwatcher' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' {deprecate} = require 'grim' @@ -11,6 +12,8 @@ module.exports = TextBuffer: TextBuffer Point: Point Range: Range + File: File + Directory: Directory Emitter: Emitter Disposable: Disposable CompositeDisposable: CompositeDisposable From 4612e023ce9a965ad7f47caf048bb5dae2420a31 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 09:15:39 -0700 Subject: [PATCH 250/521] Delete temp npm folders at beginning of CI build --- script/cibuild | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/script/cibuild b/script/cibuild index c63d5dbf6..e34feacde 100755 --- a/script/cibuild +++ b/script/cibuild @@ -46,8 +46,39 @@ function removeNodeModules() { } } +function removeTempFolders() { + var fsPlus; + try { + fsPlus = require('fs-plus'); + } catch (error) { + return; + } + + var temp = require('os').tmpdir(); + if (!fsPlus.isDirectorySync(temp)) + return; + + var deletedFolders = 0; + + try { + fsPlus.readdirSync(temp).filter(function(folderName) { + return folderName.indexOf('npm-') === 0; + }).forEach(function(folderName) { + fsPlus.removeSync(path.join(temp, folderName)); + deletedFolders++; + }); + + if (deletedFolders > 0) + console.log("Deleted " + deletedFolder + " npm folders from temp directory"); + } catch (error) { + console.error(error.message); + process.exit(1); + } +} + readEnvironmentVariables(); removeNodeModules(); +removeTempFolders(); cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve(__dirname, '..', 'build')}, function() { cp.safeExec.bind(global, 'node script/bootstrap', function(error) { if (error) From fead441acf6afdbe402ff0f00e4246eebf71721d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 09:22:47 -0700 Subject: [PATCH 251/521] deletedFolder -> deletedFolders --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index e34feacde..682568bb5 100755 --- a/script/cibuild +++ b/script/cibuild @@ -69,7 +69,7 @@ function removeTempFolders() { }); if (deletedFolders > 0) - console.log("Deleted " + deletedFolder + " npm folders from temp directory"); + console.log("Deleted " + deletedFolders + " npm folders from temp directory"); } catch (error) { console.error(error.message); process.exit(1); From 409775b53edaa6081b85cbd5c75e66df13566b8e Mon Sep 17 00:00:00 2001 From: Jesse Grosjean Date: Wed, 1 Apr 2015 12:39:22 -0400 Subject: [PATCH 252/521] Improved specs for clipping pixel positions above/below display buffer --- spec/display-buffer-spec.coffee | 10 ++++++++-- spec/text-editor-component-spec.coffee | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 5ece19692..b5858007e 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -725,13 +725,19 @@ describe "DisplayBuffer", -> expect(displayBuffer.clipScreenPosition([0, tabLength], clip: 'forward')).toEqual [0, tabLength] describe "::screenPositionForPixelPosition(pixelPosition)", -> - it "pixel positions above buffer to map to start", -> + it "clips pixel positions above buffer start", -> + displayBuffer.setLineHeightInPixels(20) expect(displayBuffer.screenPositionForPixelPosition(top: -Infinity, left: -Infinity)).toEqual [0, 0] expect(displayBuffer.screenPositionForPixelPosition(top: -Infinity, left: Infinity)).toEqual [0, 0] + expect(displayBuffer.screenPositionForPixelPosition(top: -1, left: Infinity)).toEqual [0, 0] + expect(displayBuffer.screenPositionForPixelPosition(top: 0, left: Infinity)).toEqual [0, 29] - it "pixel positions below buffer map to end", -> + it "clips pixel positions below buffer end", -> + displayBuffer.setLineHeightInPixels(20) expect(displayBuffer.screenPositionForPixelPosition(top: Infinity, left: -Infinity)).toEqual [12, 2] expect(displayBuffer.screenPositionForPixelPosition(top: Infinity, left: Infinity)).toEqual [12, 2] + expect(displayBuffer.screenPositionForPixelPosition(top: displayBuffer.getHeight() + 1, left: 0)).toEqual [12, 2] + expect(displayBuffer.screenPositionForPixelPosition(top: displayBuffer.getHeight() - 1, left: 0)).toEqual [12, 0] describe "::screenPositionForBufferPosition(bufferPosition, options)", -> it "clips the specified buffer position", -> diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 656dca0f0..df1fbcfbf 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1559,6 +1559,22 @@ describe "TextEditorComponent", -> beforeEach -> linesNode = componentNode.querySelector('.lines') + describe "when the mouse is single-clicked above the first line", -> + it "moves the cursor to the start of file buffer position", -> + editor.setText('foo') + editor.setCursorBufferPosition([0, 3]) + height = 4.5 * lineHeightInPixels + wrapperNode.style.height = height + 'px' + wrapperNode.style.width = 10 * charWidth + 'px' + component.measureHeightAndWidth() + nextAnimationFrame() + + coordinates = clientCoordinatesForScreenPosition([0, 2]) + coordinates.clientY = -1 + linesNode.dispatchEvent(buildMouseEvent('mousedown', coordinates)) + nextAnimationFrame() + expect(editor.getCursorScreenPosition()).toEqual [0, 0] + describe "when the mouse is single-clicked below the last line", -> it "moves the cursor to the end of file buffer position", -> editor.setText('foo') From 744bc787ce1fbac4e15a131f1bd464bd9209099e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 10:02:41 -0700 Subject: [PATCH 253/521] Log delete errors but do not fail build --- script/cibuild | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/script/cibuild b/script/cibuild index 682568bb5..08ff65c6e 100755 --- a/script/cibuild +++ b/script/cibuild @@ -60,20 +60,19 @@ function removeTempFolders() { var deletedFolders = 0; - try { - fsPlus.readdirSync(temp).filter(function(folderName) { - return folderName.indexOf('npm-') === 0; - }).forEach(function(folderName) { + fsPlus.readdirSync(temp).filter(function(folderName) { + return folderName.indexOf('npm-') === 0; + }).forEach(function(folderName) { + try { fsPlus.removeSync(path.join(temp, folderName)); deletedFolders++; - }); + } catch (error) { + console.error("Failed to delete npm temp folder: " + error.message); + } + }); - if (deletedFolders > 0) - console.log("Deleted " + deletedFolders + " npm folders from temp directory"); - } catch (error) { - console.error(error.message); - process.exit(1); - } + if (deletedFolders > 0) + console.log("Deleted " + deletedFolders + " npm folders from temp directory"); } readEnvironmentVariables(); From 33faef249924b97f68ec808752931502000fce19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Kahyao=C4=9Flu?= Date: Wed, 1 Apr 2015 20:34:59 +0300 Subject: [PATCH 254/521] remove duplicate switch case --- src/cursor.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/cursor.coffee b/src/cursor.coffee index c7db4b04a..acfc7fc9e 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -94,8 +94,6 @@ class Cursor extends Model Grim.deprecate("Use Cursor::onDidChangePosition instead") when 'destroyed' Grim.deprecate("Use Cursor::onDidDestroy instead") - when 'destroyed' - Grim.deprecate("Use Cursor::onDidDestroy instead") else Grim.deprecate("::on is no longer supported. Use the event subscription methods instead") super From 0f43b246b4ef5c1759c81440e8b0b2abbf9230d3 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 1 Apr 2015 12:04:11 -0700 Subject: [PATCH 255/521] add styleguide for specs --- CONTRIBUTING.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2cf02bef..a6736e11b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ For more information on how to work with Atom's official packages, see [JavaScript](https://github.com/styleguide/javascript), and [CSS](https://github.com/styleguide/css) styleguides. * Include thoughtfully-worded, well-structured - [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. Run them using `apm test`. + [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. Run them using `apm test`. See the [Specs Styleguide](#specs-styleguide) below. * Document new code based on the [Documentation Styleguide](#documentation-styleguide) * End files with a newline. @@ -108,6 +108,24 @@ For more information on how to work with Atom's official packages, see * Add an explicit `return` when your function ends with a `for`/`while` loop and you don't want it to return a collected array. +## Specs Styleguide + +- Include thoughtfully-worded, well-structured + [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. +- treat `describe` as a noun or situation. +- trea `it` as a statement about state or how an operation changes state. + +### Example + +```coffee +describe 'a dog' + it 'barks' + # spec here + describe 'when the dog is happy' + it 'wags its tail' + # spec here +``` + ## Documentation Styleguide * Use [AtomDoc](https://github.com/atom/atomdoc). From 293b34e2a4175f0f964cc796d7259822f97a0dd3 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 1 Apr 2015 12:10:02 -0700 Subject: [PATCH 256/521] typo --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6736e11b..88c0ffa47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,7 +113,7 @@ For more information on how to work with Atom's official packages, see - Include thoughtfully-worded, well-structured [Jasmine](http://jasmine.github.io/) specs in the `./spec` folder. - treat `describe` as a noun or situation. -- trea `it` as a statement about state or how an operation changes state. +- treat `it` as a statement about state or how an operation changes state. ### Example From 10912da5102df4344108eea0cdc7e66b4f4b0ba2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 12:25:55 -0700 Subject: [PATCH 257/521] :arrow_up: settings-view@0.187 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8daa4a4f..3f55fcece 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.186.0", + "settings-view": "0.187.0", "snippets": "0.86.0", "spell-check": "0.55.0", "status-bar": "0.66.0", From 691b1255d8e7b790fc4c422839a93ac032821790 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Apr 2015 10:26:08 +0800 Subject: [PATCH 258/521] :arrow_up: atom-shell@0.22.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3f55fcece..374f70956 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "url": "http://github.com/atom/atom/raw/master/LICENSE.md" } ], - "atomShellVersion": "0.22.2", + "atomShellVersion": "0.22.3", "dependencies": { "async": "0.2.6", "atom-keymap": "^5", From cfca178eef0c08a8bd36618787b96dedcfcaf0e0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 1 Apr 2015 16:45:14 +0800 Subject: [PATCH 259/521] :arrow_up: grunt-atom-shell-installer@0.28 --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index aa3742e40..297ddadfd 100644 --- a/build/package.json +++ b/build/package.json @@ -12,7 +12,7 @@ "fs-plus": "2.x", "github-releases": "~0.2.0", "grunt": "~0.4.1", - "grunt-atom-shell-installer": "^0.25.0", + "grunt-atom-shell-installer": "^0.28.0", "grunt-cli": "~0.1.9", "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", "grunt-contrib-coffee": "~0.12.0", From bec4b34385d0ed44214bffd5e236202fc120e702 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 10:35:19 -0700 Subject: [PATCH 260/521] Log squirrel log on failures --- script/cibuild | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script/cibuild b/script/cibuild index 08ff65c6e..4f2612ed8 100755 --- a/script/cibuild +++ b/script/cibuild @@ -90,6 +90,12 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( cp.safeExec.bind(global, gruntPath + ' ci --gruntfile build/Gruntfile.coffee --stack --no-color'), ] async.series(tasks, function(error) { + if (error && process.platform === 'win32') { + var fs = require('fs'); + var squirrelLog = path.resolve(__dirname, 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); + if (fs.existsSync(squirrelLog)) + console.log(fs.readFileSync(squirrelLog)); + } process.exit(error ? 1 : 0); }); })(); From 3d8c19fc79c7e1091db348dba90c4cf4aeea47b5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 10:35:52 -0700 Subject: [PATCH 261/521] Add missing .. --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 4f2612ed8..41c90f7b3 100755 --- a/script/cibuild +++ b/script/cibuild @@ -92,7 +92,7 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( async.series(tasks, function(error) { if (error && process.platform === 'win32') { var fs = require('fs'); - var squirrelLog = path.resolve(__dirname, 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); + var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); if (fs.existsSync(squirrelLog)) console.log(fs.readFileSync(squirrelLog)); } From d384e0492d89b1d8fedeb633d7c51eed82218573 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 10:40:59 -0700 Subject: [PATCH 262/521] Add charset to read call --- script/cibuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 41c90f7b3..e418d1a15 100755 --- a/script/cibuild +++ b/script/cibuild @@ -94,7 +94,7 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( var fs = require('fs'); var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); if (fs.existsSync(squirrelLog)) - console.log(fs.readFileSync(squirrelLog)); + console.log(fs.readFileSync(squirrelLog, 'utf8')); } process.exit(error ? 1 : 0); }); From 631acbd8d487d19173cc376a3d055a036919b782 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 11:02:12 -0700 Subject: [PATCH 263/521] Log location --- script/cibuild | 1 + 1 file changed, 1 insertion(+) diff --git a/script/cibuild b/script/cibuild index e418d1a15..e9da6232a 100755 --- a/script/cibuild +++ b/script/cibuild @@ -93,6 +93,7 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( if (error && process.platform === 'win32') { var fs = require('fs'); var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); + console.log(squirrelLog, fs.existsSync(squirrelLog)); if (fs.existsSync(squirrelLog)) console.log(fs.readFileSync(squirrelLog, 'utf8')); } From 7027f8619c32a20753fcd15128bb66af3e90083b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 11:18:41 -0700 Subject: [PATCH 264/521] Always log squirrel log --- script/cibuild | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/script/cibuild b/script/cibuild index e9da6232a..1e45aa84e 100755 --- a/script/cibuild +++ b/script/cibuild @@ -90,13 +90,13 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( cp.safeExec.bind(global, gruntPath + ' ci --gruntfile build/Gruntfile.coffee --stack --no-color'), ] async.series(tasks, function(error) { - if (error && process.platform === 'win32') { - var fs = require('fs'); - var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); - console.log(squirrelLog, fs.existsSync(squirrelLog)); - if (fs.existsSync(squirrelLog)) - console.log(fs.readFileSync(squirrelLog, 'utf8')); - } + console.log('DONE-----'); + var fs = require('fs'); + var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); + console.log(squirrelLog, fs.existsSync(squirrelLog)); + if (fs.existsSync(squirrelLog)) + console.log(fs.readFileSync(squirrelLog, 'utf8')); + process.exit(error ? 1 : 0); }); })(); From f24ea101e9ba46206c79ed7529a203c4c0b02599 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 11:21:40 -0700 Subject: [PATCH 265/521] Log squirrel log in exit handler --- script/cibuild | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/script/cibuild b/script/cibuild index 1e45aa84e..bb26b8ac9 100755 --- a/script/cibuild +++ b/script/cibuild @@ -90,14 +90,18 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( cp.safeExec.bind(global, gruntPath + ' ci --gruntfile build/Gruntfile.coffee --stack --no-color'), ] async.series(tasks, function(error) { - console.log('DONE-----'); - var fs = require('fs'); - var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); - console.log(squirrelLog, fs.existsSync(squirrelLog)); - if (fs.existsSync(squirrelLog)) - console.log(fs.readFileSync(squirrelLog, 'utf8')); - process.exit(error ? 1 : 0); }); })(); })(); + + +process.on('exit', function() { + console.log('DONE-----'); + var fs = require('fs'); + var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); + console.log(squirrelLog, fs.existsSync(squirrelLog)); + if (fs.existsSync(squirrelLog)) + console.log(fs.readFileSync(squirrelLog, 'utf8')); + +}); From 4b90926ccf796286d6636950d7335f7cc993ec68 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 11:38:02 -0700 Subject: [PATCH 266/521] Log errors --- script/cibuild | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/script/cibuild b/script/cibuild index bb26b8ac9..9358cc09c 100755 --- a/script/cibuild +++ b/script/cibuild @@ -98,10 +98,14 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( process.on('exit', function() { console.log('DONE-----'); - var fs = require('fs'); - var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); - console.log(squirrelLog, fs.existsSync(squirrelLog)); - if (fs.existsSync(squirrelLog)) - console.log(fs.readFileSync(squirrelLog, 'utf8')); + try { + var fs = require('fs'); + var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); + console.log(squirrelLog, fs.existsSync(squirrelLog)); + if (fs.existsSync(squirrelLog)) + console.log(fs.readFileSync(squirrelLog, 'utf8')); + } catch (error) { + console.error(error.message); + } }); From b44b4a237269e26e73c49522cd8f2d13a310907f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 11:58:22 -0700 Subject: [PATCH 267/521] Remove squirrel log output --- script/cibuild | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/script/cibuild b/script/cibuild index 9358cc09c..08ff65c6e 100755 --- a/script/cibuild +++ b/script/cibuild @@ -94,18 +94,3 @@ cp.safeExec.bind(global, 'npm install npm --loglevel error', {cwd: path.resolve( }); })(); })(); - - -process.on('exit', function() { - console.log('DONE-----'); - try { - var fs = require('fs'); - var squirrelLog = path.resolve(__dirname, '..', 'build', 'node_modules', 'grunt-atom-shell-installer', 'vendor', 'SquirrelSetup.log'); - console.log(squirrelLog, fs.existsSync(squirrelLog)); - if (fs.existsSync(squirrelLog)) - console.log(fs.readFileSync(squirrelLog, 'utf8')); - } catch (error) { - console.error(error.message); - } - -}); From 2bfdb5d7770288a627f0242da24b86a6e40056dd Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Wed, 1 Apr 2015 14:37:42 -0700 Subject: [PATCH 268/521] add syntax --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88c0ffa47..9041b3fcd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,11 +118,11 @@ For more information on how to work with Atom's official packages, see ### Example ```coffee -describe 'a dog' - it 'barks' +describe 'a dog', -> + it 'barks', -> # spec here - describe 'when the dog is happy' - it 'wags its tail' + describe 'when the dog is happy', -> + it 'wags its tail', -> # spec here ``` From 88e65fbbb7e7480fa72158538948128f05304b74 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 1 Apr 2015 14:45:15 -0700 Subject: [PATCH 269/521] Prepare 0.190 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 374f70956..cebd145fe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.189.0", + "version": "0.190.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 53445b0e7d3d6efd19f774e8112bad33c2175497 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 17:39:22 -0700 Subject: [PATCH 270/521] :arrow_up: snippets@0.87.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cebd145fe..75e2a325d 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.187.0", - "snippets": "0.86.0", + "snippets": "0.87.0", "spell-check": "0.55.0", "status-bar": "0.66.0", "styleguide": "0.44.0", From db35022d0e88f64f4e98001f37fc58cbdb5ea4db Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 30 Mar 2015 17:17:21 -0700 Subject: [PATCH 271/521] Remove OverlayManager from the LinesComponent --- src/lines-component.coffee | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 8389a1ae9..5004d4060 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -4,7 +4,6 @@ _ = require 'underscore-plus' CursorsComponent = require './cursors-component' HighlightsComponent = require './highlights-component' -OverlayManager = require './overlay-manager' DummyLineNode = $$(-> @div className: 'line', style: 'position: absolute; visibility: hidden;', => @span 'x')[0] AcceptFilter = {acceptNode: -> NodeFilter.FILTER_ACCEPT} @@ -40,13 +39,6 @@ class LinesComponent insertionPoint.setAttribute('select', '.overlayer') @domNode.appendChild(insertionPoint) - insertionPoint = document.createElement('content') - insertionPoint.setAttribute('select', 'atom-overlay') - @overlayManager = new OverlayManager(@presenter, @hostElement) - @domNode.appendChild(insertionPoint) - else - @overlayManager = new OverlayManager(@presenter, @domNode) - updateSync: (state) -> @newState = state.content @oldState ?= {lines: {}} @@ -82,8 +74,6 @@ class LinesComponent @cursorsComponent.updateSync(state) @highlightsComponent.updateSync(state) - @overlayManager?.render(state) - @oldState.indentGuidesVisible = @newState.indentGuidesVisible @oldState.scrollWidth = @newState.scrollWidth From 2338f8e65b92289b088898118d4266e6f6e21a1c Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 30 Mar 2015 17:19:18 -0700 Subject: [PATCH 272/521] Make atom-pane `overflow: visible` This allows children of the pane-item to make the decision to overflow or not. --- static/panes.less | 2 +- static/text-editor-shadow.less | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/static/panes.less b/static/panes.less index cb8bb6565..bf275e6da 100644 --- a/static/panes.less +++ b/static/panes.less @@ -24,7 +24,7 @@ atom-pane-container { display: -webkit-flex; -webkit-flex: 1; -webkit-flex-direction: column; - overflow: hidden; + overflow: visible; .item-views { -webkit-flex: 1; diff --git a/static/text-editor-shadow.less b/static/text-editor-shadow.less index 63d27de7f..c67637290 100644 --- a/static/text-editor-shadow.less +++ b/static/text-editor-shadow.less @@ -9,7 +9,6 @@ .editor-contents--private { width: 100%; - overflow: hidden; cursor: text; display: -webkit-flex; -webkit-user-select: none; From 8749db30cf8138a2c75393efc835fd5cfe632721 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 30 Mar 2015 17:20:27 -0700 Subject: [PATCH 273/521] Add OverlayManager to the TextEditorComponent --- src/text-editor-component.coffee | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 63a7f9a1c..3bebaea49 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -11,6 +11,7 @@ InputComponent = require './input-component' LinesComponent = require './lines-component' ScrollbarComponent = require './scrollbar-component' ScrollbarCornerComponent = require './scrollbar-corner-component' +OverlayManager = require './overlay-manager' module.exports = class TextEditorComponent @@ -56,8 +57,14 @@ class TextEditorComponent @domNode = document.createElement('div') if @useShadowDOM @domNode.classList.add('editor-contents--private') + + insertionPoint = document.createElement('content') + insertionPoint.setAttribute('select', 'atom-overlay') + @domNode.appendChild(insertionPoint) + @overlayManager = new OverlayManager(@presenter, @hostElement) else @domNode.classList.add('editor-contents') + @overlayManager = new OverlayManager(@presenter, @domNode) @scrollViewNode = document.createElement('div') @scrollViewNode.classList.add('scroll-view') @@ -140,6 +147,8 @@ class TextEditorComponent @verticalScrollbarComponent.updateSync(@newState) @scrollbarCornerComponent.updateSync(@newState) + @overlayManager?.render(@newState) + if @editor.isAlive() @updateParentViewFocusedClassIfNeeded() @updateParentViewMiniClass() From 6b5a74e3b63cfcb0a940c3a03adfbe984d2290b6 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 31 Mar 2015 16:03:05 -0700 Subject: [PATCH 274/521] Update specs for overlay rendering --- spec/spec-helper.coffee | 2 +- spec/text-editor-component-spec.coffee | 167 ++++++++++++++----------- src/text-editor-component.coffee | 20 ++- src/text-editor-presenter.coffee | 18 +++ 4 files changed, 128 insertions(+), 79 deletions(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index d34c72b1a..5406ff33a 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -370,7 +370,7 @@ window.setEditorWidthInChars = (editorView, widthInChars, charWidth=editorView.c window.setEditorHeightInLines = (editorView, heightInLines, lineHeight=editorView.lineHeight) -> editorView.height(editorView.getEditor().getLineHeightInPixels() * heightInLines) - editorView.component?.measureHeightAndWidth() + editorView.component?.measureDimensions() $.fn.resultOfTrigger = (type) -> event = $.Event(type) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 656dca0f0..9859841fe 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -50,7 +50,7 @@ describe "TextEditorComponent", -> verticalScrollbarNode = componentNode.querySelector('.vertical-scrollbar') horizontalScrollbarNode = componentNode.querySelector('.horizontal-scrollbar') - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() afterEach -> @@ -70,7 +70,7 @@ describe "TextEditorComponent", -> describe "line rendering", -> it "renders the currently-visible lines plus the overdraw margin", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() linesNode = componentNode.querySelector('.lines') @@ -113,7 +113,7 @@ describe "TextEditorComponent", -> it "updates the lines when lines are inserted or removed above the rendered row range", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() verticalScrollbarNode.scrollTop = 5 * lineHeightInPixels verticalScrollbarNode.dispatchEvent(new UIEvent('scroll')) @@ -163,7 +163,7 @@ describe "TextEditorComponent", -> it "renders the .lines div at the full height of the editor if there aren't enough lines to scroll vertically", -> editor.setText('') wrapperNode.style.height = '300px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() linesNode = componentNode.querySelector('.lines') @@ -175,7 +175,7 @@ describe "TextEditorComponent", -> lineNodes = componentNode.querySelectorAll('.line') componentNode.style.width = gutterWidth + (30 * charWidth) + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(editor.getScrollWidth()).toBeGreaterThan scrollViewNode.offsetWidth @@ -187,7 +187,7 @@ describe "TextEditorComponent", -> expect(lineNode.style.width).toBe editor.getScrollWidth() + 'px' componentNode.style.width = gutterWidth + editor.getScrollWidth() + 100 + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() scrollViewWidth = scrollViewNode.offsetWidth @@ -339,7 +339,7 @@ describe "TextEditorComponent", -> editor.setSoftWrapped(true) nextAnimationFrame() componentNode.style.width = 16 * charWidth + editor.getVerticalScrollbarWidth() + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() it "doesn't show end of line invisibles at the end of wrapped lines", -> @@ -480,7 +480,7 @@ describe "TextEditorComponent", -> describe "gutter rendering", -> it "renders the currently-visible line numbers", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(componentNode.querySelectorAll('.line-number').length).toBe 6 + 2 + 1 # line overdraw margin below + dummy line number @@ -524,7 +524,7 @@ describe "TextEditorComponent", -> editor.setSoftWrapped(true) wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 30 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(componentNode.querySelectorAll('.line-number').length).toBe 6 + lineOverdrawMargin + 1 # 1 dummy line componentNode @@ -562,7 +562,7 @@ describe "TextEditorComponent", -> it "renders the .line-numbers div at the full height of the editor even if it's taller than its content", -> wrapperNode.style.height = componentNode.offsetHeight + 100 + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(componentNode.querySelector('.line-numbers').offsetHeight).toBe componentNode.offsetHeight @@ -653,7 +653,7 @@ describe "TextEditorComponent", -> editor.setSoftWrapped(true) nextAnimationFrame() componentNode.style.width = 16 * charWidth + editor.getVerticalScrollbarWidth() + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() it "doesn't add the foldable class for soft-wrapped lines", -> @@ -697,7 +697,7 @@ describe "TextEditorComponent", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() cursorNodes = componentNode.querySelectorAll('.cursor') @@ -992,7 +992,7 @@ describe "TextEditorComponent", -> # Shrink editor vertically wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() # Add decorations that are out of range @@ -1016,7 +1016,7 @@ describe "TextEditorComponent", -> editor.setText("a line that wraps, ok") editor.setSoftWrapped(true) componentNode.style.width = 16 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() marker.destroy() @@ -1132,7 +1132,7 @@ describe "TextEditorComponent", -> it "does not render highlights for off-screen lines until they come on-screen", -> wrapperNode.style.height = 2.5 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() marker = editor.displayBuffer.markBufferRange([[9, 2], [9, 4]], invalidate: 'inside') @@ -1279,10 +1279,13 @@ describe "TextEditorComponent", -> expect(componentNode.querySelector('.new-test-highlight')).toBeTruthy() describe "overlay decoration rendering", -> - [item] = [] + [item, gutterWidth] = [] beforeEach -> item = document.createElement('div') item.classList.add 'overlay-test' + item.style.background = 'red' + + gutterWidth = componentNode.querySelector('.gutter').offsetWidth describe "when the marker is empty", -> it "renders an overlay decoration when added and removes the overlay when the decoration is destroyed", -> @@ -1309,7 +1312,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([2, 5]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' editor.moveRight() @@ -1318,7 +1321,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([2, 7]) - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' describe "when the marker is not empty", -> @@ -1330,7 +1333,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([2, 10]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' it "renders at the head of the marker when the marker is reversed", -> @@ -1341,7 +1344,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([2, 5]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' it "renders at the tail of the marker when the 'position' option is 'tail'", -> @@ -1352,18 +1355,19 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([2, 5]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' describe "positioning the overlay when near the edge of the editor", -> - [itemWidth, itemHeight] = [] + [itemWidth, itemHeight, windowWidth, windowHeight] = [] beforeEach -> + atom.storeWindowDimensions() + itemWidth = 4 * editor.getDefaultCharWidth() itemHeight = 4 * editor.getLineHeightInPixels() - gutterWidth = componentNode.querySelector('.gutter').offsetWidth windowWidth = gutterWidth + 30 * editor.getDefaultCharWidth() - windowHeight = 9 * editor.getLineHeightInPixels() + windowHeight = 10 * editor.getLineHeightInPixels() item.style.width = itemWidth + 'px' item.style.height = itemHeight + 'px' @@ -1371,10 +1375,16 @@ describe "TextEditorComponent", -> wrapperNode.style.width = windowWidth + 'px' wrapperNode.style.height = windowHeight + 'px' - component.measureHeightAndWidth() + atom.setWindowDimensions({width: windowWidth, height: windowHeight}) + + component.measureDimensions() + component.measureWindowSize() nextAnimationFrame() - it "flips horizontally when near the right edge", -> + afterEach -> + atom.restoreWindowDimensions() + + it "slides horizontally when near the right edge", -> marker = editor.displayBuffer.markBufferRange([[0, 26], [0, 26]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() @@ -1382,17 +1392,24 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([0, 26]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' editor.insertText('a') nextAnimationFrame() - position = wrapperNode.pixelPositionForBufferPosition([0, 27]) - - expect(overlay.style.left).toBe position.left - itemWidth + 'px' + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + editor.insertText('b') + nextAnimationFrame() + + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + + it "slides horizontally right when near the left edge with margin", -> + # TODO: + it "flips vertically when near the bottom edge", -> marker = editor.displayBuffer.markBufferRange([[4, 0], [4, 0]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) @@ -1401,7 +1418,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([4, 0]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' editor.insertNewline() @@ -1409,7 +1426,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([5, 0]) - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top - itemHeight + 'px' describe "when the editor is very small", -> @@ -1421,7 +1438,7 @@ describe "TextEditorComponent", -> wrapperNode.style.width = windowWidth + 'px' wrapperNode.style.height = windowHeight + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() it "does not flip horizontally and force the overlay to have a negative left", -> @@ -1432,7 +1449,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([0, 2]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' editor.insertText('a') @@ -1440,7 +1457,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([0, 3]) - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' it "does not flip vertically and force the overlay to have a negative top", -> @@ -1451,7 +1468,7 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([1, 0]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' editor.insertNewline() @@ -1459,33 +1476,35 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([2, 0]) - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - describe "when editor scroll position is not 0", -> it "flips horizontally when near the right edge", -> - editor.setScrollLeft(2 * editor.getDefaultCharWidth()) - marker = editor.displayBuffer.markBufferRange([[0, 28], [0, 28]], invalidate: 'never') + scrollLeft = 3 * editor.getDefaultCharWidth() + editor.setScrollLeft(scrollLeft) + editor.setCursorBufferPosition([1, 20]) + marker = editor.displayBuffer.markBufferRange([[1, 29], [1, 29]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() - position = wrapperNode.pixelPositionForBufferPosition([0, 28]) + position = wrapperNode.pixelPositionForBufferPosition([1, 29]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth - scrollLeft + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' editor.insertText('a') nextAnimationFrame() - position = wrapperNode.pixelPositionForBufferPosition([0, 29]) - - expect(overlay.style.left).toBe position.left - itemWidth + 'px' + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' it "flips vertically when near the bottom edge", -> - editor.setScrollTop(2 * editor.getLineHeightInPixels()) + scrollTop = 2 * editor.getLineHeightInPixels() + editor.setScrollTop(scrollTop) + editor.setCursorBufferPosition([5, 0]) + marker = editor.displayBuffer.markBufferRange([[6, 0], [6, 0]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() @@ -1493,16 +1512,16 @@ describe "TextEditorComponent", -> position = wrapperNode.pixelPositionForBufferPosition([6, 0]) overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() - scrollTop + 'px' editor.insertNewline() nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([7, 0]) - expect(overlay.style.left).toBe position.left + 'px' - expect(overlay.style.top).toBe position.top - itemHeight + 'px' + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' + expect(overlay.style.top).toBe position.top - itemHeight - scrollTop + 'px' describe "hidden input field", -> it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", -> @@ -1512,7 +1531,7 @@ describe "TextEditorComponent", -> inputNode = componentNode.querySelector('.hidden-input') wrapperNode.style.height = 5 * lineHeightInPixels + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(editor.getCursorScreenPosition()).toEqual [0, 0] @@ -1566,7 +1585,7 @@ describe "TextEditorComponent", -> height = 4.5 * lineHeightInPixels wrapperNode.style.height = height + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() coordinates = clientCoordinatesForScreenPosition([0, 2]) @@ -1580,7 +1599,7 @@ describe "TextEditorComponent", -> it "moves the cursor to the nearest screen position", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() editor.setScrollTop(3.5 * lineHeightInPixels) editor.setScrollLeft(2 * charWidth) nextAnimationFrame() @@ -1863,7 +1882,7 @@ describe "TextEditorComponent", -> editor.setSoftWrapped(true) nextAnimationFrame() componentNode.style.width = 21 * charWidth + editor.getVerticalScrollbarWidth() + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() describe "when the gutter is clicked", -> @@ -2029,7 +2048,7 @@ describe "TextEditorComponent", -> describe "scrolling", -> it "updates the vertical scrollbar when the scrollTop is changed in the model", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.scrollTop).toBe 0 @@ -2040,7 +2059,7 @@ describe "TextEditorComponent", -> it "updates the horizontal scrollbar and the x transform of the lines based on the scrollLeft of the model", -> componentNode.style.width = 30 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() linesNode = componentNode.querySelector('.lines') @@ -2054,7 +2073,7 @@ describe "TextEditorComponent", -> it "updates the scrollLeft of the model when the scrollLeft of the horizontal scrollbar changes", -> componentNode.style.width = 30 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(editor.getScrollLeft()).toBe 0 @@ -2067,7 +2086,7 @@ describe "TextEditorComponent", -> it "does not obscure the last line with the horizontal scrollbar", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() editor.setScrollBottom(editor.getScrollHeight()) nextAnimationFrame() lastLineNode = component.lineNodeForScreenRow(editor.getLastScreenRow()) @@ -2077,7 +2096,7 @@ describe "TextEditorComponent", -> # Scroll so there's no space below the last line when the horizontal scrollbar disappears wrapperNode.style.width = 100 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() bottomOfLastLine = lastLineNode.getBoundingClientRect().bottom bottomOfEditor = componentNode.getBoundingClientRect().bottom @@ -2086,7 +2105,7 @@ describe "TextEditorComponent", -> it "does not obscure the last character of the longest line with the vertical scrollbar", -> wrapperNode.style.height = 7 * lineHeightInPixels + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() editor.setScrollLeft(Infinity) nextAnimationFrame() @@ -2100,21 +2119,21 @@ describe "TextEditorComponent", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = '1000px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.style.display).toBe '' expect(horizontalScrollbarNode.style.display).toBe 'none' componentNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.style.display).toBe '' expect(horizontalScrollbarNode.style.display).toBe '' wrapperNode.style.height = 20 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.style.display).toBe 'none' @@ -2123,7 +2142,7 @@ describe "TextEditorComponent", -> it "makes the dummy scrollbar divs only as tall/wide as the actual scrollbars", -> wrapperNode.style.height = 4 * lineHeightInPixels + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() atom.styles.addStyleSheet """ @@ -2152,21 +2171,21 @@ describe "TextEditorComponent", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = '1000px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.style.bottom).toBe '0px' expect(horizontalScrollbarNode.style.right).toBe verticalScrollbarNode.offsetWidth + 'px' expect(scrollbarCornerNode.style.display).toBe 'none' componentNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.style.bottom).toBe horizontalScrollbarNode.offsetHeight + 'px' expect(horizontalScrollbarNode.style.right).toBe verticalScrollbarNode.offsetWidth + 'px' expect(scrollbarCornerNode.style.display).toBe '' wrapperNode.style.height = 20 * lineHeightInPixels + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(verticalScrollbarNode.style.bottom).toBe horizontalScrollbarNode.offsetHeight + 'px' expect(horizontalScrollbarNode.style.right).toBe '0px' @@ -2175,7 +2194,7 @@ describe "TextEditorComponent", -> it "accounts for the width of the gutter in the scrollWidth of the horizontal scrollbar", -> gutterNode = componentNode.querySelector('.gutter') componentNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(horizontalScrollbarNode.scrollWidth).toBe editor.getScrollWidth() @@ -2189,7 +2208,7 @@ describe "TextEditorComponent", -> beforeEach -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() it "updates the scrollLeft or scrollTop on mousewheel events depending on which delta is greater (x or y)", -> @@ -2233,7 +2252,7 @@ describe "TextEditorComponent", -> it "keeps the line on the DOM if it is scrolled off-screen", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() lineNode = componentNode.querySelector('.line') wheelEvent = new WheelEvent('mousewheel', wheelDeltaX: 0, wheelDeltaY: -500) @@ -2246,7 +2265,7 @@ describe "TextEditorComponent", -> it "does not set the mouseWheelScreenRow if scrolling horizontally", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() lineNode = componentNode.querySelector('.line') wheelEvent = new WheelEvent('mousewheel', wheelDeltaX: 10, wheelDeltaY: 0) @@ -2289,7 +2308,7 @@ describe "TextEditorComponent", -> it "keeps the line number on the DOM if it is scrolled off-screen", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() lineNumberNode = componentNode.querySelectorAll('.line-number')[1] wheelEvent = new WheelEvent('mousewheel', wheelDeltaX: 0, wheelDeltaY: -500) @@ -2304,7 +2323,7 @@ describe "TextEditorComponent", -> wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px' wrapperNode.style.width = 20 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() # try to scroll past the top, which is impossible @@ -2700,7 +2719,7 @@ describe "TextEditorComponent", -> describe "when the wrapper view has an explicit height", -> it "does not assign a height on the component node", -> wrapperNode.style.height = '200px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() expect(componentNode.style.height).toBe '' diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 3bebaea49..0de081d85 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -168,7 +168,8 @@ class TextEditorComponent @measureScrollbars() if @measureScrollbarsWhenShown @sampleFontStyling() @sampleBackgroundColors() - @measureHeightAndWidth() + @measureWindowSize() + @measureDimensions() @measureLineHeightAndDefaultCharWidth() if @measureLineHeightAndDefaultCharWidthWhenShown @remeasureCharacterWidths() if @remeasureCharacterWidthsWhenShown @editor.setVisible(true) @@ -565,7 +566,7 @@ class TextEditorComponent pollDOM: => unless @checkForVisibilityChange() @sampleBackgroundColors() - @measureHeightAndWidth() + @measureDimensions() @sampleFontStyling() checkForVisibilityChange: -> @@ -584,13 +585,14 @@ class TextEditorComponent @heightAndWidthMeasurementRequested = true requestAnimationFrame => @heightAndWidthMeasurementRequested = false - @measureHeightAndWidth() + @measureDimensions() + @measureWindowSize() # Measure explicitly-styled height and width and relay them to the model. If # these values aren't explicitly styled, we assume the editor is unconstrained # and use the scrollHeight / scrollWidth as its height and width in # calculations. - measureHeightAndWidth: -> + measureDimensions: -> return unless @mounted {position} = getComputedStyle(@hostElement) @@ -611,6 +613,16 @@ class TextEditorComponent if clientWidth > 0 @presenter.setContentFrameWidth(clientWidth) + @presenter.setBoundingClientRect(@hostElement.getBoundingClientRect()) + + measureWindowSize: -> + return unless @mounted + + width = window.innerWidth + height = window.innerHeight + + @presenter.setWindowSize(width, height) + sampleFontStyling: => oldFontSize = @fontSize oldFontFamily = @fontFamily diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index babd7725b..81eb93a5b 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -657,6 +657,24 @@ class TextEditorPresenter @updateLinesState() @updateCursorsState() unless oldContentFrameWidth? + setBoundingClientRect: (boundingClientRect) -> + unless @clientRectsEqual(@boundingClientRect, boundingClientRect) + @boundingClientRect = boundingClientRect + @updateOverlaysState() + + clientRectsEqual: (clientRectA, clientRectB) -> + clientRectA? and clientRectB? and + clientRectA.top is clientRectB.top and + clientRectA.left is clientRectB.left and + clientRectA.width is clientRectB.width and + clientRectA.height is clientRectB.height + + setWindowSize: (width, height) -> + if @windowWidth isnt width or @windowHeight isnt height + @windowWidth = width + @windowHeight = height + @updateOverlaysState() + setBackgroundColor: (backgroundColor) -> unless @backgroundColor is backgroundColor @backgroundColor = backgroundColor From 0fa03f15b6dac00694a80463e7552f4bbf954e41 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 31 Mar 2015 16:04:01 -0700 Subject: [PATCH 275/521] Update overlay rendering --- src/overlay-manager.coffee | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/overlay-manager.coffee b/src/overlay-manager.coffee index c8b5da0e8..0babb45ae 100644 --- a/src/overlay-manager.coffee +++ b/src/overlay-manager.coffee @@ -23,16 +23,23 @@ class OverlayManager itemWidth = item.offsetWidth itemHeight = item.offsetHeight - + contentMargin = parseInt(getComputedStyle(item)['margin-left']) ? 0 {scrollTop, scrollLeft} = state.content - left = pixelPosition.left - if left + itemWidth - scrollLeft > @presenter.contentFrameWidth and left - itemWidth >= scrollLeft - left -= itemWidth + editorBounds = @presenter.boundingClientRect + gutterWidth = editorBounds.width - @presenter.contentFrameWidth - top = pixelPosition.top + @presenter.lineHeight - if top + itemHeight - scrollTop > @presenter.height and top - itemHeight - @presenter.lineHeight >= scrollTop + left = pixelPosition.left - scrollLeft + gutterWidth + top = pixelPosition.top + @presenter.lineHeight - scrollTop + + rightDiff = left + editorBounds.left + itemWidth + contentMargin - @presenter.windowWidth + left -= rightDiff if rightDiff > 0 + + leftDiff = left + editorBounds.left + contentMargin + left -= leftDiff if leftDiff < 0 + + if top + editorBounds.top + itemHeight > @presenter.windowHeight top -= itemHeight + @presenter.lineHeight overlayNode.style.top = top + 'px' From 01905ae55b4ca3b467cd9ecaf5cde95730f51733 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 31 Mar 2015 16:20:58 -0700 Subject: [PATCH 276/521] Add specs for margin handling --- spec/text-editor-component-spec.coffee | 38 +++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 9859841fe..df5b9cd48 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1384,7 +1384,7 @@ describe "TextEditorComponent", -> afterEach -> atom.restoreWindowDimensions() - it "slides horizontally when near the right edge", -> + it "slides horizontally left when near the right edge", -> marker = editor.displayBuffer.markBufferRange([[0, 26], [0, 26]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() @@ -1407,9 +1407,6 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - it "slides horizontally right when near the left edge with margin", -> - # TODO: - it "flips vertically when near the bottom edge", -> marker = editor.displayBuffer.markBufferRange([[4, 0], [4, 0]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) @@ -1429,6 +1426,39 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top - itemHeight + 'px' + describe "when the overlay item has a margin", -> + itemMargin = null + beforeEach -> + itemWidth = 12 * editor.getDefaultCharWidth() + itemMargin = gutterWidth + 2 * editor.getDefaultCharWidth() + item.style.width = itemWidth + 'px' + item.style['margin-left'] = "-#{itemMargin}px" + + it "slides horizontally right when near the left edge with margin", -> + editor.setCursorBufferPosition([0, 3]) + cursor = editor.getLastCursor() + marker = cursor.marker + decoration = editor.decorateMarker(marker, {type: 'overlay', item}) + nextAnimationFrame() + + position = wrapperNode.pixelPositionForBufferPosition([0, 3]) + + overlay = component.getTopmostDOMNode().querySelector('atom-overlay') + expect(overlay.style.left).toBe position.left + gutterWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + + cursor.moveLeft() + nextAnimationFrame() + + expect(overlay.style.left).toBe itemMargin + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + + cursor.moveLeft() + nextAnimationFrame() + + expect(overlay.style.left).toBe itemMargin + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + describe "when the editor is very small", -> beforeEach -> gutterWidth = componentNode.querySelector('.gutter').offsetWidth From c62f06af9d8434904593d2d2c486a14a9b84c19b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 31 Mar 2015 19:11:56 -0700 Subject: [PATCH 277/521] Cache the overlay dimensions in the presenter --- src/overlay-manager.coffee | 80 +++++++++++++++++++++++++++----- src/text-editor-component.coffee | 10 ++-- src/text-editor-presenter.coffee | 14 ++++++ 3 files changed, 87 insertions(+), 17 deletions(-) diff --git a/src/overlay-manager.coffee b/src/overlay-manager.coffee index 0babb45ae..2ab7123ab 100644 --- a/src/overlay-manager.coffee +++ b/src/overlay-manager.coffee @@ -1,30 +1,86 @@ module.exports = class OverlayManager constructor: (@presenter, @container) -> - @overlayNodesById = {} + @overlaysById = {} render: (state) -> - for decorationId, {pixelPosition, item} of state.content.overlays - @renderOverlay(state, decorationId, item, pixelPosition) + editorDimensionsHaveChanged = !@editorDimensionsAreEqual(state) - for id, overlayNode of @overlayNodesById + for decorationId, overlay of state.content.overlays + overlayHasChanged = not @overlayStateIsEqual(decorationId, overlay) + if editorDimensionsHaveChanged or overlayHasChanged + @renderOverlay(state, decorationId, overlay) + @cacheOverlayState(decorationId, overlay) + + for id, {overlayNode} of @overlaysById unless state.content.overlays.hasOwnProperty(id) - delete @overlayNodesById[id] + delete @overlaysById[id] overlayNode.remove() - return + @cacheEditorDimensions(state) - renderOverlay: (state, decorationId, item, pixelPosition) -> + overlayStateIsEqual: (decorationId, overlay) -> + return false unless @overlaysById[decorationId]? + @overlaysById[decorationId].itemWidth is overlay.itemWidth and + @overlaysById[decorationId].itemHeight is overlay.itemHeight and + @overlaysById[decorationId].contentMargin is overlay.contentMargin and + @overlaysById[decorationId].pixelPosition?.top is overlay.pixelPosition?.top and + @overlaysById[decorationId].pixelPosition?.left is overlay.pixelPosition?.left + + cacheOverlayState: (decorationId, overlay) -> + return unless @overlaysById[decorationId]? + @overlaysById[decorationId].itemWidth = overlay.itemWidth + @overlaysById[decorationId].itemHeight = overlay.itemHeight + @overlaysById[decorationId].contentMargin = overlay.contentMargin + @overlaysById[decorationId].pixelPosition = overlay.pixelPosition + + cacheEditorDimensions: (state) -> + @cachedEditorDimensions = + lineHeight: @presenter.lineHeight + contentFrameWidth: @presenter.contentFrameWidth + editorTop: @presenter.boundingClientRect?.top + editorLeft: @presenter.boundingClientRect?.left + editorWidth: @presenter.boundingClientRect?.width + windowWidth: @presenter.windowWidth + windowHeight: @presenter.windowHeight + scrollTop: state.content.scrollTop + scrollLeft: state.content.scrollLeft + + editorDimensionsAreEqual: (state) -> + return false unless @cachedEditorDimensions? + @cachedEditorDimensions.lineHeight is @presenter.lineHeight and + @cachedEditorDimensions.contentFrameWidth is @presenter.contentFrameWidth and + @cachedEditorDimensions.editorTop is @presenter.boundingClientRect?.top and + @cachedEditorDimensions.editorLeft is @presenter.boundingClientRect?.left and + @cachedEditorDimensions.editorWidth is @presenter.boundingClientRect?.width and + @cachedEditorDimensions.windowWidth is @presenter.windowWidth and + @cachedEditorDimensions.windowHeight is @presenter.windowHeight and + @cachedEditorDimensions.scrollTop is state.content.scrollTop and + @cachedEditorDimensions.scrollLeft is state.content.scrollLeft + + measureOverlays: -> + for decorationId, {item} of @overlaysById + @measureOverlay(decorationId, item) + + measureOverlay: (decorationId, item) -> + contentMargin = parseInt(getComputedStyle(item)['margin-left']) ? 0 + @presenter.setOverlayDimensions(decorationId, item.offsetWidth, item.offsetHeight, contentMargin) + + renderOverlay: (state, decorationId, {item, pixelPosition}) -> item = atom.views.getView(item) - unless overlayNode = @overlayNodesById[decorationId] - overlayNode = @overlayNodesById[decorationId] = document.createElement('atom-overlay') + overlay = @overlaysById[decorationId] + unless overlayNode = overlay?.overlayNode + overlayNode = document.createElement('atom-overlay') overlayNode.appendChild(item) @container.appendChild(overlayNode) + @overlaysById[decorationId] = overlay = {overlayNode, item} - itemWidth = item.offsetWidth - itemHeight = item.offsetHeight - contentMargin = parseInt(getComputedStyle(item)['margin-left']) ? 0 + overlayDimensions = @presenter.getOverlayDimensions(decorationId) + unless overlayDimensions?.itemWidth? + @measureOverlay(decorationId, item) + overlayDimensions = @presenter.getOverlayDimensions(decorationId) + {itemWidth, itemHeight, contentMargin} = overlayDimensions {scrollTop, scrollLeft} = state.content editorBounds = @presenter.boundingClientRect diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 0de081d85..459d4368b 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -158,6 +158,7 @@ class TextEditorComponent readAfterUpdateSync: => @linesComponent.measureCharactersInNewLines() if @isVisible() and not @newState.content.scrollingVertically + @overlayManager?.measureOverlays() mountGutterComponent: -> @gutterComponent = new GutterComponent({@editor, onMouseDown: @onGutterMouseDown}) @@ -189,6 +190,8 @@ class TextEditorComponent else unless @updateRequested @updateRequested = true atom.views.updateDocument => + @editor.horribleUpdateMethod?() + @editor.horribleUpdateMethod = null @updateRequested = false @updateSync() if @editor.isAlive() atom.views.readDocument(@readAfterUpdateSync) @@ -568,6 +571,7 @@ class TextEditorComponent @sampleBackgroundColors() @measureDimensions() @sampleFontStyling() + @overlayManager?.measureOverlays() checkForVisibilityChange: -> if @isVisible() @@ -617,11 +621,7 @@ class TextEditorComponent measureWindowSize: -> return unless @mounted - - width = window.innerWidth - height = window.innerHeight - - @presenter.setWindowSize(width, height) + @presenter.setWindowSize(window.innerWidth, window.innerHeight) sampleFontStyling: => oldFontSize = @fontSize diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 81eb93a5b..649e8f290 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -1012,6 +1012,20 @@ class TextEditorPresenter regions + setOverlayDimensions: (decorationId, itemWidth, itemHeight, contentMargin) -> + if overlayState = @state.content.overlays[decorationId] + dimensionsAreEqual = overlayState.itemWidth is itemWidth and + overlayState.itemHeight is itemHeight and + overlayState.contentMargin is contentMargin + unless dimensionsAreEqual + overlayState.itemWidth = itemWidth + overlayState.itemHeight = itemHeight + overlayState.contentMargin = contentMargin + @updateOverlaysState() + + getOverlayDimensions: (decorationId) -> + @state.content.overlays[decorationId] + observeCursor: (cursor) -> didChangePositionDisposable = cursor.onDidChangePosition => @updateHiddenInputState() if cursor.isLastCursor() From b0794bbb681b66e8e837ad599198cbe6d1ff2931 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 13:05:52 -0700 Subject: [PATCH 278/521] Move the overlay calculation into the presenter. --- spec/text-editor-component-spec.coffee | 11 +++ src/overlay-manager.coffee | 99 +++++--------------------- src/text-editor-presenter.coffee | 52 +++++++++++--- 3 files changed, 71 insertions(+), 91 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index df5b9cd48..3f5d4f7fd 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1308,6 +1308,7 @@ describe "TextEditorComponent", -> marker = editor.getLastCursor().getMarker() decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([2, 5]) @@ -1329,6 +1330,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([2, 10]) @@ -1340,6 +1342,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never', reversed: true) decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([2, 5]) @@ -1351,6 +1354,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([2, 5]) @@ -1388,6 +1392,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[0, 26], [0, 26]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([0, 26]) @@ -1411,6 +1416,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[4, 0], [4, 0]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([4, 0]) @@ -1440,6 +1446,7 @@ describe "TextEditorComponent", -> marker = cursor.marker decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([0, 3]) @@ -1475,6 +1482,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[0, 2], [0, 2]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([0, 2]) @@ -1494,6 +1502,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[1, 0], [1, 0]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([1, 0]) @@ -1517,6 +1526,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[1, 29], [1, 29]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([1, 29]) @@ -1538,6 +1548,7 @@ describe "TextEditorComponent", -> marker = editor.displayBuffer.markBufferRange([[6, 0], [6, 0]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() + nextAnimationFrame() position = wrapperNode.pixelPositionForBufferPosition([6, 0]) diff --git a/src/overlay-manager.coffee b/src/overlay-manager.coffee index 2ab7123ab..8d0db365d 100644 --- a/src/overlay-manager.coffee +++ b/src/overlay-manager.coffee @@ -4,99 +4,38 @@ class OverlayManager @overlaysById = {} render: (state) -> - editorDimensionsHaveChanged = !@editorDimensionsAreEqual(state) - for decorationId, overlay of state.content.overlays - overlayHasChanged = not @overlayStateIsEqual(decorationId, overlay) - if editorDimensionsHaveChanged or overlayHasChanged + if @shouldUpdateOverlay(decorationId, overlay) @renderOverlay(state, decorationId, overlay) - @cacheOverlayState(decorationId, overlay) for id, {overlayNode} of @overlaysById unless state.content.overlays.hasOwnProperty(id) delete @overlaysById[id] overlayNode.remove() - @cacheEditorDimensions(state) - - overlayStateIsEqual: (decorationId, overlay) -> - return false unless @overlaysById[decorationId]? - @overlaysById[decorationId].itemWidth is overlay.itemWidth and - @overlaysById[decorationId].itemHeight is overlay.itemHeight and - @overlaysById[decorationId].contentMargin is overlay.contentMargin and - @overlaysById[decorationId].pixelPosition?.top is overlay.pixelPosition?.top and - @overlaysById[decorationId].pixelPosition?.left is overlay.pixelPosition?.left - - cacheOverlayState: (decorationId, overlay) -> - return unless @overlaysById[decorationId]? - @overlaysById[decorationId].itemWidth = overlay.itemWidth - @overlaysById[decorationId].itemHeight = overlay.itemHeight - @overlaysById[decorationId].contentMargin = overlay.contentMargin - @overlaysById[decorationId].pixelPosition = overlay.pixelPosition - - cacheEditorDimensions: (state) -> - @cachedEditorDimensions = - lineHeight: @presenter.lineHeight - contentFrameWidth: @presenter.contentFrameWidth - editorTop: @presenter.boundingClientRect?.top - editorLeft: @presenter.boundingClientRect?.left - editorWidth: @presenter.boundingClientRect?.width - windowWidth: @presenter.windowWidth - windowHeight: @presenter.windowHeight - scrollTop: state.content.scrollTop - scrollLeft: state.content.scrollLeft - - editorDimensionsAreEqual: (state) -> - return false unless @cachedEditorDimensions? - @cachedEditorDimensions.lineHeight is @presenter.lineHeight and - @cachedEditorDimensions.contentFrameWidth is @presenter.contentFrameWidth and - @cachedEditorDimensions.editorTop is @presenter.boundingClientRect?.top and - @cachedEditorDimensions.editorLeft is @presenter.boundingClientRect?.left and - @cachedEditorDimensions.editorWidth is @presenter.boundingClientRect?.width and - @cachedEditorDimensions.windowWidth is @presenter.windowWidth and - @cachedEditorDimensions.windowHeight is @presenter.windowHeight and - @cachedEditorDimensions.scrollTop is state.content.scrollTop and - @cachedEditorDimensions.scrollLeft is state.content.scrollLeft + shouldUpdateOverlay: (decorationId, overlay) -> + cachedOverlay = @overlaysById[decorationId] + return true unless cachedOverlay? + cachedOverlay.pixelPosition?.top isnt overlay.pixelPosition?.top or + cachedOverlay.pixelPosition?.left isnt overlay.pixelPosition?.left measureOverlays: -> - for decorationId, {item} of @overlaysById - @measureOverlay(decorationId, item) + for decorationId, {itemView} of @overlaysById + @measureOverlay(decorationId, itemView) - measureOverlay: (decorationId, item) -> - contentMargin = parseInt(getComputedStyle(item)['margin-left']) ? 0 - @presenter.setOverlayDimensions(decorationId, item.offsetWidth, item.offsetHeight, contentMargin) + measureOverlay: (decorationId, itemView) -> + contentMargin = parseInt(getComputedStyle(itemView)['margin-left']) ? 0 + @presenter.setOverlayDimensions(decorationId, itemView.offsetWidth, itemView.offsetHeight, contentMargin) renderOverlay: (state, decorationId, {item, pixelPosition}) -> - item = atom.views.getView(item) - overlay = @overlaysById[decorationId] - unless overlayNode = overlay?.overlayNode + itemView = atom.views.getView(item) + cachedOverlay = @overlaysById[decorationId] + unless overlayNode = cachedOverlay?.overlayNode overlayNode = document.createElement('atom-overlay') - overlayNode.appendChild(item) + overlayNode.appendChild(itemView) @container.appendChild(overlayNode) - @overlaysById[decorationId] = overlay = {overlayNode, item} + @overlaysById[decorationId] = cachedOverlay = {overlayNode, itemView} - overlayDimensions = @presenter.getOverlayDimensions(decorationId) - unless overlayDimensions?.itemWidth? - @measureOverlay(decorationId, item) - overlayDimensions = @presenter.getOverlayDimensions(decorationId) - - {itemWidth, itemHeight, contentMargin} = overlayDimensions - {scrollTop, scrollLeft} = state.content - - editorBounds = @presenter.boundingClientRect - gutterWidth = editorBounds.width - @presenter.contentFrameWidth - - left = pixelPosition.left - scrollLeft + gutterWidth - top = pixelPosition.top + @presenter.lineHeight - scrollTop - - rightDiff = left + editorBounds.left + itemWidth + contentMargin - @presenter.windowWidth - left -= rightDiff if rightDiff > 0 - - leftDiff = left + editorBounds.left + contentMargin - left -= leftDiff if leftDiff < 0 - - if top + editorBounds.top + itemHeight > @presenter.windowHeight - top -= itemHeight + @presenter.lineHeight - - overlayNode.style.top = top + 'px' - overlayNode.style.left = left + 'px' + cachedOverlay.pixelPosition = pixelPosition + overlayNode.style.top = pixelPosition.top + 'px' + overlayNode.style.left = pixelPosition.left + 'px' diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 649e8f290..c35032e72 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -9,6 +9,7 @@ class TextEditorPresenter stoppedScrollingTimeoutId: null mouseWheelScreenRow: null scopedCharacterWidthsChangeCount: 0 + overlayDimensions: {} constructor: (params) -> {@model, @autoHeight, @explicitHeight, @contentFrameWidth, @scrollTop, @scrollLeft} = params @@ -327,13 +328,39 @@ class TextEditorPresenter else screenPosition = decoration.getMarker().getHeadScreenPosition() + pixelPosition = @pixelPositionForScreenPosition(screenPosition) + + if overlayDimensions = @overlayDimensions[decoration.id] + {itemWidth, itemHeight, contentMargin} = overlayDimensions + {scrollTop, scrollLeft} = @state.content + + gutterWidth = @boundingClientRect.width - @contentFrameWidth + + left = pixelPosition.left - scrollLeft + gutterWidth + top = pixelPosition.top + @lineHeight - scrollTop + + rightDiff = left + @boundingClientRect.left + itemWidth + contentMargin - @windowWidth + left -= rightDiff if rightDiff > 0 + + leftDiff = left + @boundingClientRect.left + contentMargin + left -= leftDiff if leftDiff < 0 + + if top + @boundingClientRect.top + itemHeight > @windowHeight + top -= itemHeight + @lineHeight + + pixelPosition.top = top + pixelPosition.left = left + @state.content.overlays[decoration.id] ?= {item} - @state.content.overlays[decoration.id].pixelPosition = @pixelPositionForScreenPosition(screenPosition) + @state.content.overlays[decoration.id].pixelPosition = pixelPosition visibleDecorationIds[decoration.id] = true for id of @state.content.overlays delete @state.content.overlays[id] unless visibleDecorationIds[id] + for id of @overlayDimensions + delete @overlayDimensions[id] unless visibleDecorationIds[id] + return updateGutterState: -> @batch "shouldUpdateGutterState", -> @@ -566,6 +593,7 @@ class TextEditorPresenter @updateLinesState() @updateCursorsState() @updateLineNumbersState() + @updateOverlaysState() didStartScrolling: -> if @stoppedScrollingTimeoutId? @@ -593,6 +621,7 @@ class TextEditorPresenter @updateHorizontalScrollState() @updateHiddenInputState() @updateCursorsState() unless oldScrollLeft? + @updateOverlaysState() setHorizontalScrollbarHeight: (horizontalScrollbarHeight) -> unless @measuredHorizontalScrollbarHeight is horizontalScrollbarHeight @@ -1013,18 +1042,19 @@ class TextEditorPresenter regions setOverlayDimensions: (decorationId, itemWidth, itemHeight, contentMargin) -> - if overlayState = @state.content.overlays[decorationId] - dimensionsAreEqual = overlayState.itemWidth is itemWidth and - overlayState.itemHeight is itemHeight and - overlayState.contentMargin is contentMargin - unless dimensionsAreEqual - overlayState.itemWidth = itemWidth - overlayState.itemHeight = itemHeight - overlayState.contentMargin = contentMargin - @updateOverlaysState() + @overlayDimensions[decorationId] ?= {} + overlayState = @overlayDimensions[decorationId] + dimensionsAreEqual = overlayState.itemWidth is itemWidth and + overlayState.itemHeight is itemHeight and + overlayState.contentMargin is contentMargin + unless dimensionsAreEqual + overlayState.itemWidth = itemWidth + overlayState.itemHeight = itemHeight + overlayState.contentMargin = contentMargin + @updateOverlaysState() getOverlayDimensions: (decorationId) -> - @state.content.overlays[decorationId] + @overlayDimensions[decorationId] observeCursor: (cursor) -> didChangePositionDisposable = cursor.onDidChangePosition => From 32572c010670529d73d3dcca0f54bab287e8c0bc Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 14:01:00 -0700 Subject: [PATCH 279/521] Add ViewRegistry::pollAfterNextUpdate Closes #6196 --- spec/view-registry-spec.coffee | 15 +++++++++++++++ src/view-registry.coffee | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/view-registry-spec.coffee b/spec/view-registry-spec.coffee index 4d0d72abc..239f2e878 100644 --- a/spec/view-registry-spec.coffee +++ b/spec/view-registry-spec.coffee @@ -137,6 +137,21 @@ describe "ViewRegistry", -> advanceClock(registry.documentPollingInterval) expect(events).toEqual ['write', 'read', 'poll', 'poll'] + it "polls the document after updating when ::pollAfterNextUpdate() has been called", -> + events = [] + registry.pollDocument -> events.push('poll') + registry.updateDocument -> events.push('write') + registry.readDocument -> events.push('read') + frameRequests.shift()() + expect(events).toEqual ['write', 'read'] + + events = [] + registry.pollAfterNextUpdate() + registry.updateDocument -> events.push('write') + registry.readDocument -> events.push('read') + frameRequests.shift()() + expect(events).toEqual ['write', 'read', 'poll'] + describe "::pollDocument(fn)", -> it "calls all registered reader functions on an interval until they are disabled via a returned disposable", -> spyOn(window, 'setInterval').andCallFake(fakeSetInterval) diff --git a/src/view-registry.coffee b/src/view-registry.coffee index 4dbb5594e..050444ff0 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -178,6 +178,9 @@ class ViewRegistry @documentPollers = @documentPollers.filter (poller) -> poller isnt fn @stopPollingDocument() if @documentPollers.length is 0 + pollAfterNextUpdate: -> + @performDocumentPollAfterUpdate = true + clearDocumentRequests: -> @documentReaders = [] @documentWriters = [] @@ -194,6 +197,7 @@ class ViewRegistry writer() while writer = @documentWriters.shift() reader() while reader = @documentReaders.shift() @performDocumentPoll() if @performDocumentPollAfterUpdate + @performDocumentPollAfterUpdate = false startPollingDocument: -> @pollIntervalHandle = window.setInterval(@performDocumentPoll, @documentPollingInterval) @@ -205,6 +209,5 @@ class ViewRegistry if @documentUpdateRequested @performDocumentPollAfterUpdate = true else - @performDocumentPollAfterUpdate = false poller() for poller in @documentPollers return From 3adc646a7902acab1bf7590819d4f0bdcddd3df7 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 14:01:24 -0700 Subject: [PATCH 280/521] Remove the horribleUpdateMethod --- src/text-editor-component.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 459d4368b..43f8184db 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -190,8 +190,6 @@ class TextEditorComponent else unless @updateRequested @updateRequested = true atom.views.updateDocument => - @editor.horribleUpdateMethod?() - @editor.horribleUpdateMethod = null @updateRequested = false @updateSync() if @editor.isAlive() atom.views.readDocument(@readAfterUpdateSync) From 77139104fd6e8062aa62a351c905610c37f943cd Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 14:02:05 -0700 Subject: [PATCH 281/521] Remove getOverlayDimensions No longer needed --- src/text-editor-presenter.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index c35032e72..4546c7893 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -1053,9 +1053,6 @@ class TextEditorPresenter overlayState.contentMargin = contentMargin @updateOverlaysState() - getOverlayDimensions: (decorationId) -> - @overlayDimensions[decorationId] - observeCursor: (cursor) -> didChangePositionDisposable = cursor.onDidChangePosition => @updateHiddenInputState() if cursor.isLastCursor() From bed09cf0efb3afc65f2ce05f5332fe1da82b0fd4 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 14:44:38 -0700 Subject: [PATCH 282/521] =?UTF-8?q?Presenter=20positions=20overlays=20when?= =?UTF-8?q?=20the=20overlay=20doesn=E2=80=99t=20have=20a=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix presenter specs --- spec/text-editor-presenter-spec.coffee | 40 +++++++++++++++++--------- src/text-editor-presenter.coffee | 23 ++++++++------- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index b62391db8..445ec6bf1 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -29,6 +29,9 @@ describe "TextEditorPresenter", -> model: editor explicitHeight: 130 contentFrameWidth: 500 + windowWidth: 500 + windowHeight: 130 + boundingClientRect: {left: 0, top: 0, width: 500, height: 130} lineHeight: 10 baseCharacterWidth: 10 horizontalScrollbarHeight: 10 @@ -1497,14 +1500,14 @@ describe "TextEditorPresenter", -> # Initial state expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 10} + pixelPosition: {top: 3 * 10 - presenter.state.content.scrollTop, left: 13 * 10} } # Change range expectStateUpdate presenter, -> marker.setBufferRange([[2, 13], [4, 6]]) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 4 * 10, left: 6 * 10} + pixelPosition: {top: 5 * 10 - presenter.state.content.scrollTop, left: 6 * 10} } # Valid -> invalid @@ -1515,14 +1518,14 @@ describe "TextEditorPresenter", -> expectStateUpdate presenter, -> editor.undo() expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 4 * 10, left: 6 * 10} + pixelPosition: {top: 5 * 10 - presenter.state.content.scrollTop, left: 6 * 10} } # Reverse direction expectStateUpdate presenter, -> marker.setBufferRange([[2, 13], [4, 6]], reversed: true) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 10} + pixelPosition: {top: 3 * 10 - presenter.state.content.scrollTop, left: 13 * 10} } # Destroy @@ -1533,53 +1536,56 @@ describe "TextEditorPresenter", -> decoration2 = editor.decorateMarker(marker, {type: 'overlay', item}) expectValues stateForOverlay(presenter, decoration2), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 10} + pixelPosition: {top: 3 * 10 - presenter.state.content.scrollTop, left: 13 * 10} } it "updates when ::baseCharacterWidth changes", -> item = {} + scrollTop = 20 marker = editor.markBufferPosition([2, 13], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - presenter = buildPresenter(explicitHeight: 30, scrollTop: 20) + presenter = buildPresenter({explicitHeight: 30, scrollTop}) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 10} + pixelPosition: {top: 3 * 10 - scrollTop, left: 13 * 10} } expectStateUpdate presenter, -> presenter.setBaseCharacterWidth(5) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 5} + pixelPosition: {top: 3 * 10 - scrollTop, left: 13 * 5} } it "updates when ::lineHeight changes", -> item = {} + scrollTop = 20 marker = editor.markBufferPosition([2, 13], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - presenter = buildPresenter(explicitHeight: 30, scrollTop: 20) + presenter = buildPresenter({explicitHeight: 30, scrollTop}) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 10} + pixelPosition: {top: 3 * 10 - scrollTop, left: 13 * 10} } expectStateUpdate presenter, -> presenter.setLineHeight(5) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 5, left: 13 * 10} + pixelPosition: {top: 3 * 5 - scrollTop, left: 13 * 10} } it "honors the 'position' option on overlay decorations", -> item = {} + scrollTop = 20 marker = editor.markBufferRange([[2, 13], [4, 14]], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item}) - presenter = buildPresenter(explicitHeight: 30, scrollTop: 20) + presenter = buildPresenter({explicitHeight: 30, scrollTop}) expectValues stateForOverlay(presenter, decoration), { item: item - pixelPosition: {top: 2 * 10, left: 13 * 10} + pixelPosition: {top: 3 * 10 - scrollTop, left: 13 * 10} } it "is empty until all of the required measurements are assigned", -> @@ -1587,13 +1593,19 @@ describe "TextEditorPresenter", -> marker = editor.markBufferRange([[2, 13], [4, 14]], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item}) - presenter = buildPresenter(baseCharacterWidth: null, lineHeight: null) + presenter = buildPresenter(baseCharacterWidth: null, lineHeight: null, windowWidth: null, windowHeight: null, boundingClientRect: null) expect(presenter.getState().content.overlays).toEqual({}) presenter.setBaseCharacterWidth(10) expect(presenter.getState().content.overlays).toEqual({}) presenter.setLineHeight(10) + expect(presenter.getState().content.overlays).toEqual({}) + + presenter.setWindowSize(500, 100) + expect(presenter.getState().content.overlays).toEqual({}) + + presenter.setBoundingClientRect({top: 0, left: 0, height: 100, width: 500}) expect(presenter.getState().content.overlays).not.toEqual({}) describe ".gutter", -> diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 4546c7893..f8703c085 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -12,7 +12,7 @@ class TextEditorPresenter overlayDimensions: {} constructor: (params) -> - {@model, @autoHeight, @explicitHeight, @contentFrameWidth, @scrollTop, @scrollLeft} = params + {@model, @autoHeight, @explicitHeight, @contentFrameWidth, @scrollTop, @scrollLeft, @boundingClientRect, @windowWidth, @windowHeight} = params {horizontalScrollbarHeight, verticalScrollbarWidth} = params {@lineHeight, @baseCharacterWidth, @lineOverdrawMargin, @backgroundColor, @gutterBackgroundColor} = params {@cursorBlinkPeriod, @cursorBlinkResumeDelay, @stoppedScrollingDelay, @focused} = params @@ -315,7 +315,7 @@ class TextEditorPresenter @emitDidUpdateState() updateOverlaysState: -> @batch "shouldUpdateOverlaysState", -> - return unless @hasPixelRectRequirements() + return unless @hasOverlayPositionRequirements() visibleDecorationIds = {} @@ -330,14 +330,14 @@ class TextEditorPresenter pixelPosition = @pixelPositionForScreenPosition(screenPosition) + {scrollTop, scrollLeft} = @state.content + gutterWidth = @boundingClientRect.width - @contentFrameWidth + + left = pixelPosition.left - scrollLeft + gutterWidth + top = pixelPosition.top + @lineHeight - scrollTop + if overlayDimensions = @overlayDimensions[decoration.id] {itemWidth, itemHeight, contentMargin} = overlayDimensions - {scrollTop, scrollLeft} = @state.content - - gutterWidth = @boundingClientRect.width - @contentFrameWidth - - left = pixelPosition.left - scrollLeft + gutterWidth - top = pixelPosition.top + @lineHeight - scrollTop rightDiff = left + @boundingClientRect.left + itemWidth + contentMargin - @windowWidth left -= rightDiff if rightDiff > 0 @@ -348,8 +348,8 @@ class TextEditorPresenter if top + @boundingClientRect.top + itemHeight > @windowHeight top -= itemHeight + @lineHeight - pixelPosition.top = top - pixelPosition.left = left + pixelPosition.top = top + pixelPosition.left = left @state.content.overlays[decoration.id] ?= {item} @state.content.overlays[decoration.id].pixelPosition = pixelPosition @@ -824,6 +824,9 @@ class TextEditorPresenter hasPixelRectRequirements: -> @hasPixelPositionRequirements() and @scrollWidth? + hasOverlayPositionRequirements: -> + @hasPixelRectRequirements() and @boundingClientRect? and @windowWidth and @windowHeight + pixelRectForScreenRange: (screenRange) -> if screenRange.end.row > screenRange.start.row top = @pixelPositionForScreenPosition(screenRange.start).top From 48a06868c89e491641ba73e68bc69cad27a4cd6c Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 16:17:22 -0700 Subject: [PATCH 283/521] Add specs from the text-editor-component --- spec/text-editor-presenter-spec.coffee | 169 ++++++++++++++++++++++++- 1 file changed, 164 insertions(+), 5 deletions(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 445ec6bf1..577c87401 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -1488,11 +1488,11 @@ describe "TextEditorPresenter", -> } describe ".overlays", -> + [item] = [] stateForOverlay = (presenter, decoration) -> presenter.getState().content.overlays[decoration.id] it "contains state for overlay decorations both initially and when their markers move", -> - item = {} marker = editor.markBufferPosition([2, 13], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) presenter = buildPresenter(explicitHeight: 30, scrollTop: 20) @@ -1540,7 +1540,6 @@ describe "TextEditorPresenter", -> } it "updates when ::baseCharacterWidth changes", -> - item = {} scrollTop = 20 marker = editor.markBufferPosition([2, 13], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) @@ -1559,7 +1558,6 @@ describe "TextEditorPresenter", -> } it "updates when ::lineHeight changes", -> - item = {} scrollTop = 20 marker = editor.markBufferPosition([2, 13], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) @@ -1578,7 +1576,6 @@ describe "TextEditorPresenter", -> } it "honors the 'position' option on overlay decorations", -> - item = {} scrollTop = 20 marker = editor.markBufferRange([[2, 13], [4, 14]], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item}) @@ -1589,7 +1586,6 @@ describe "TextEditorPresenter", -> } it "is empty until all of the required measurements are assigned", -> - item = {} marker = editor.markBufferRange([[2, 13], [4, 14]], invalidate: 'touch') decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item}) @@ -1608,6 +1604,169 @@ describe "TextEditorPresenter", -> presenter.setBoundingClientRect({top: 0, left: 0, height: 100, width: 500}) expect(presenter.getState().content.overlays).not.toEqual({}) + describe "when the overlay has been measured", -> + [gutterWidth, windowWidth, windowHeight, itemWidth, itemHeight, contentMargin, boundingClientRect, contentFrameWidth] = [] + beforeEach -> + item = {} + gutterWidth = 5 * 10 # 5 chars wide + contentFrameWidth = 30 * 10 + windowWidth = gutterWidth + contentFrameWidth + windowHeight = 9 * 10 + + itemWidth = 4 * 10 + itemHeight = 4 * 10 + contentMargin = 0 + + boundingClientRect = + top: 0 + left: 0, + width: windowWidth + height: windowHeight + + it "slides horizontally left when near the right edge", -> + scrollLeft = 20 + marker = editor.markBufferPosition([0, 26], invalidate: 'never') + decoration = editor.decorateMarker(marker, {type: 'overlay', item}) + + presenter = buildPresenter({scrollLeft, windowWidth, windowHeight, contentFrameWidth, boundingClientRect}) + expectStateUpdate presenter, -> + presenter.setOverlayDimensions(decoration.id, itemWidth, itemHeight, contentMargin) + + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 1 * 10, left: 26 * 10 + gutterWidth - scrollLeft} + } + + expectStateUpdate presenter, -> editor.insertText('a') + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 1 * 10, left: windowWidth - itemWidth} + } + + expectStateUpdate presenter, -> editor.insertText('b') + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 1 * 10, left: windowWidth - itemWidth} + } + + it "flips vertically when near the bottom edge", -> + scrollTop = 10 + marker = editor.markBufferPosition([5, 0], invalidate: 'never') + decoration = editor.decorateMarker(marker, {type: 'overlay', item}) + + presenter = buildPresenter({scrollTop, windowWidth, windowHeight, contentFrameWidth, boundingClientRect}) + expectStateUpdate presenter, -> + presenter.setOverlayDimensions(decoration.id, itemWidth, itemHeight, contentMargin) + + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 6 * 10 - scrollTop, left: gutterWidth} + } + + expectStateUpdate presenter, -> + editor.insertNewline() + editor.setScrollTop(scrollTop) # I'm fighting the editor + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 6 * 10 - scrollTop - itemHeight, left: gutterWidth} + } + + describe "when the overlay item has a margin", -> + beforeEach -> + itemWidth = 12 * 10 + contentMargin = -(gutterWidth + 2 * 10) + + it "slides horizontally right when near the left edge with margin", -> + editor.setCursorBufferPosition([0, 3]) + cursor = editor.getLastCursor() + marker = cursor.marker + decoration = editor.decorateMarker(marker, {type: 'overlay', item}) + + presenter = buildPresenter({windowWidth, windowHeight, contentFrameWidth, boundingClientRect}) + expectStateUpdate presenter, -> + presenter.setOverlayDimensions(decoration.id, itemWidth, itemHeight, contentMargin) + + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 1 * 10, left: 3 * 10 + gutterWidth} + } + + expectStateUpdate presenter, -> cursor.moveLeft() + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 1 * 10, left: -contentMargin} + } + + expectStateUpdate presenter, -> cursor.moveLeft() + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 1 * 10, left: -contentMargin} + } + + describe "when the editor is very small", -> + beforeEach -> + windowWidth = gutterWidth + 6 * 10 + windowHeight = 6 * 10 + contentFrameWidth = windowWidth - gutterWidth + boundingClientRect.width = windowWidth + boundingClientRect.height = windowHeight + + it "does not flip vertically and force the overlay to have a negative top", -> + marker = editor.markBufferPosition([1, 0], invalidate: 'never') + decoration = editor.decorateMarker(marker, {type: 'overlay', item}) + + presenter = buildPresenter({windowWidth, windowHeight, contentFrameWidth, boundingClientRect}) + expectStateUpdate presenter, -> + presenter.setOverlayDimensions(decoration.id, itemWidth, itemHeight, contentMargin) + + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 2 * 10, left: 0 * 10 + gutterWidth} + } + + expectStateUpdate presenter, -> editor.insertNewline() + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 3 * 10, left: gutterWidth} + } + + it "does not adjust horizontally and force the overlay to have a negative left", -> + itemWidth = 6 * 10 + + marker = editor.markBufferPosition([0, 0], invalidate: 'never') + decoration = editor.decorateMarker(marker, {type: 'overlay', item}) + + presenter = buildPresenter({windowWidth, windowHeight, contentFrameWidth, boundingClientRect}) + expectStateUpdate presenter, -> + presenter.setOverlayDimensions(decoration.id, itemWidth, itemHeight, contentMargin) + + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 10, left: gutterWidth} + } + + windowWidth = gutterWidth + 5 * 10 + expectStateUpdate presenter, -> presenter.setWindowSize(windowWidth, windowHeight) + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 10, left: windowWidth - itemWidth} + } + + windowWidth = gutterWidth + 1 * 10 + expectStateUpdate presenter, -> presenter.setWindowSize(windowWidth, windowHeight) + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 10, left: 0} + } + + windowWidth = gutterWidth + expectStateUpdate presenter, -> presenter.setWindowSize(windowWidth, windowHeight) + expectValues stateForOverlay(presenter, decoration), { + item: item + pixelPosition: {top: 10, left: 0} + } + + describe ".gutter", -> describe ".scrollHeight", -> it "is initialized based on ::lineHeight, the number of lines, and ::explicitHeight", -> From 48c05210fa636627f2d931a6e970a545aa2b6785 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 16:19:36 -0700 Subject: [PATCH 284/521] Remove specs from text-editor-component --- spec/text-editor-component-spec.coffee | 168 ------------------------- src/text-editor-presenter.coffee | 4 +- 2 files changed, 2 insertions(+), 170 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 3f5d4f7fd..cc4d8e37d 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1338,30 +1338,6 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - it "renders at the head of the marker when the marker is reversed", -> - marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never', reversed: true) - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([2, 5]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - it "renders at the tail of the marker when the 'position' option is 'tail'", -> - marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never') - decoration = editor.decorateMarker(marker, {type: 'overlay', position: 'tail', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([2, 5]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - describe "positioning the overlay when near the edge of the editor", -> [itemWidth, itemHeight, windowWidth, windowHeight] = [] beforeEach -> @@ -1411,19 +1387,6 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - it "flips vertically when near the bottom edge", -> - marker = editor.displayBuffer.markBufferRange([[4, 0], [4, 0]], invalidate: 'never') - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([4, 0]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - editor.insertNewline() nextAnimationFrame() @@ -1432,137 +1395,6 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top - itemHeight + 'px' - describe "when the overlay item has a margin", -> - itemMargin = null - beforeEach -> - itemWidth = 12 * editor.getDefaultCharWidth() - itemMargin = gutterWidth + 2 * editor.getDefaultCharWidth() - item.style.width = itemWidth + 'px' - item.style['margin-left'] = "-#{itemMargin}px" - - it "slides horizontally right when near the left edge with margin", -> - editor.setCursorBufferPosition([0, 3]) - cursor = editor.getLastCursor() - marker = cursor.marker - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([0, 3]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - cursor.moveLeft() - nextAnimationFrame() - - expect(overlay.style.left).toBe itemMargin + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - cursor.moveLeft() - nextAnimationFrame() - - expect(overlay.style.left).toBe itemMargin + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - describe "when the editor is very small", -> - beforeEach -> - gutterWidth = componentNode.querySelector('.gutter').offsetWidth - windowWidth = gutterWidth + 6 * editor.getDefaultCharWidth() - windowHeight = 6 * editor.getLineHeightInPixels() - - wrapperNode.style.width = windowWidth + 'px' - wrapperNode.style.height = windowHeight + 'px' - - component.measureDimensions() - nextAnimationFrame() - - it "does not flip horizontally and force the overlay to have a negative left", -> - marker = editor.displayBuffer.markBufferRange([[0, 2], [0, 2]], invalidate: 'never') - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([0, 2]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - editor.insertText('a') - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([0, 3]) - - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - it "does not flip vertically and force the overlay to have a negative top", -> - marker = editor.displayBuffer.markBufferRange([[1, 0], [1, 0]], invalidate: 'never') - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([1, 0]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - editor.insertNewline() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([2, 0]) - - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - describe "when editor scroll position is not 0", -> - it "flips horizontally when near the right edge", -> - scrollLeft = 3 * editor.getDefaultCharWidth() - editor.setScrollLeft(scrollLeft) - editor.setCursorBufferPosition([1, 20]) - marker = editor.displayBuffer.markBufferRange([[1, 29], [1, 29]], invalidate: 'never') - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([1, 29]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth - scrollLeft + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - editor.insertText('a') - nextAnimationFrame() - - expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - it "flips vertically when near the bottom edge", -> - scrollTop = 2 * editor.getLineHeightInPixels() - editor.setScrollTop(scrollTop) - editor.setCursorBufferPosition([5, 0]) - - marker = editor.displayBuffer.markBufferRange([[6, 0], [6, 0]], invalidate: 'never') - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([6, 0]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() - scrollTop + 'px' - - editor.insertNewline() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([7, 0]) - - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top - itemHeight - scrollTop + 'px' describe "hidden input field", -> it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", -> diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index f8703c085..5b30178d6 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -333,8 +333,8 @@ class TextEditorPresenter {scrollTop, scrollLeft} = @state.content gutterWidth = @boundingClientRect.width - @contentFrameWidth - left = pixelPosition.left - scrollLeft + gutterWidth top = pixelPosition.top + @lineHeight - scrollTop + left = pixelPosition.left + gutterWidth - scrollLeft if overlayDimensions = @overlayDimensions[decoration.id] {itemWidth, itemHeight, contentMargin} = overlayDimensions @@ -345,7 +345,7 @@ class TextEditorPresenter leftDiff = left + @boundingClientRect.left + contentMargin left -= leftDiff if leftDiff < 0 - if top + @boundingClientRect.top + itemHeight > @windowHeight + if top + @boundingClientRect.top + itemHeight > @windowHeight and top - (itemHeight + @lineHeight) >= 0 top -= itemHeight + @lineHeight pixelPosition.top = top From 44d130240248dbc1530518a6ff425ffe38c0b15a Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 16:22:24 -0700 Subject: [PATCH 285/521] Fix text-editor-component spec --- spec/text-editor-component-spec.coffee | 32 -------------------------- 1 file changed, 32 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index cc4d8e37d..1699a0f9b 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1284,7 +1284,6 @@ describe "TextEditorComponent", -> item = document.createElement('div') item.classList.add 'overlay-test' item.style.background = 'red' - gutterWidth = componentNode.querySelector('.gutter').offsetWidth describe "when the marker is empty", -> @@ -1302,29 +1301,6 @@ describe "TextEditorComponent", -> overlay = component.getTopmostDOMNode().querySelector('atom-overlay .overlay-test') expect(overlay).toBe null - it "renders in the correct position on initial display and when the marker moves", -> - editor.setCursorBufferPosition([2, 5]) - - marker = editor.getLastCursor().getMarker() - decoration = editor.decorateMarker(marker, {type: 'overlay', item}) - nextAnimationFrame() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([2, 5]) - - overlay = component.getTopmostDOMNode().querySelector('atom-overlay') - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - - editor.moveRight() - editor.moveRight() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([2, 7]) - - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - describe "when the marker is not empty", -> it "renders at the head of the marker by default", -> marker = editor.displayBuffer.markBufferRange([[2, 5], [2, 10]], invalidate: 'never') @@ -1387,14 +1363,6 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - editor.insertNewline() - nextAnimationFrame() - - position = wrapperNode.pixelPositionForBufferPosition([5, 0]) - - expect(overlay.style.left).toBe position.left + gutterWidth + 'px' - expect(overlay.style.top).toBe position.top - itemHeight + 'px' - describe "hidden input field", -> it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", -> From e29b8416a1c6bd7cbccf94790a915bac2aba5788 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 17:36:13 -0700 Subject: [PATCH 286/521] Always add the item to the parent. --- src/overlay-manager.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlay-manager.coffee b/src/overlay-manager.coffee index 8d0db365d..6dc36b998 100644 --- a/src/overlay-manager.coffee +++ b/src/overlay-manager.coffee @@ -32,10 +32,13 @@ class OverlayManager cachedOverlay = @overlaysById[decorationId] unless overlayNode = cachedOverlay?.overlayNode overlayNode = document.createElement('atom-overlay') - overlayNode.appendChild(itemView) @container.appendChild(overlayNode) @overlaysById[decorationId] = cachedOverlay = {overlayNode, itemView} + # The same node may be used in more than one overlay. This steals the node + # back if it has been displayed in another overlay. + overlayNode.appendChild(itemView) if overlayNode.childNodes.length == 0 + cachedOverlay.pixelPosition = pixelPosition overlayNode.style.top = pixelPosition.top + 'px' overlayNode.style.left = pixelPosition.left + 'px' From dff2453b65a28e362a1902e6aab13b5c55190b93 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 1 Apr 2015 18:05:17 -0700 Subject: [PATCH 287/521] Attempt to fix spec --- spec/text-editor-component-spec.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 1699a0f9b..5f9d2af2f 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -2234,6 +2234,7 @@ describe "TextEditorComponent", -> expect(editor.lineTextForBufferRow(0)).toBe 'üvar quicksort = function () {' it "does not handle input events when input is disabled", -> + nextAnimationFrame = noAnimationFrame # This spec is flaky on the build machine, so this. component.setInputEnabled(false) componentNode.dispatchEvent(buildTextInputEvent(data: 'x', target: inputNode)) expect(nextAnimationFrame).toBe noAnimationFrame From 89d1bc9a716009791d186f21251b0c8573002733 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Apr 2015 10:08:55 +0800 Subject: [PATCH 288/521] :arrow_up: apm@0.158.0 --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 84f73451d..e7a0c8fdc 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.157.0" + "atom-package-manager": "0.158.0" } } From 44d88e082c6771f68804cf9e762b46664877b0e0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 2 Apr 2015 16:28:22 +0200 Subject: [PATCH 289/521] :bug: Always copy selections in order --- spec/text-editor-spec.coffee | 14 ++++++++++++++ src/text-editor.coffee | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index bdb6b38fc..0caf62ada 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -2792,6 +2792,20 @@ describe "TextEditor", -> [[5, 8], [5, 8]] ]) + describe "when many selections get added in shuffle order", -> + it "copies them in order", -> + editor.setSelectedBufferRanges([ + [[2,8], [2, 13]] + [[0,4], [0,13]], + [[1,6], [1, 10]], + ]) + editor.copySelectedText() + expect(atom.clipboard.read()).toEqual """ + quicksort + sort + items + """ + describe ".pasteText()", -> copyText = (text, {startColumn, textEditor}={}) -> startColumn ?= 0 diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 355a644b8..d3b8200ab 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2621,7 +2621,7 @@ class TextEditor extends Model # Essential: For each selection, copy the selected text. copySelectedText: -> maintainClipboard = false - for selection in @getSelections() + for selection in @getSelectionsOrderedByBufferPosition() if selection.isEmpty() previousRange = selection.getBufferRange() selection.selectLine() From b3bdad084f400eb4ab010b7e138c417e9b57e705 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 2 Apr 2015 16:35:26 +0200 Subject: [PATCH 290/521] Always mutate selections in order --- spec/text-editor-spec.coffee | 22 ++++++++++++++++++++-- src/text-editor.coffee | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 0caf62ada..51226a22b 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -2730,6 +2730,20 @@ describe "TextEditor", -> """ + describe "when many selections get added in shuffle order", -> + it "cuts them in order", -> + editor.setSelectedBufferRanges([ + [[2,8], [2, 13]] + [[0,4], [0,13]], + [[1,6], [1, 10]], + ]) + editor.cutSelectedText() + expect(atom.clipboard.read()).toEqual """ + quicksort + sort + items + """ + describe ".cutToEndOfLine()", -> describe "when soft wrap is on", -> it "cuts up to the end of the line", -> @@ -2900,8 +2914,12 @@ describe "TextEditor", -> editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]]) editor.copySelectedText() - it "pastes each selection separately into the buffer", -> - editor.copySelectedText() + it "pastes each selection in order separately into the buffer", -> + editor.setSelectedBufferRanges([ + [[1, 6], [1, 10]] + [[0, 4], [0, 13]], + ]) + editor.moveRight() editor.insertText("_") editor.pasteText() diff --git a/src/text-editor.coffee b/src/text-editor.coffee index d3b8200ab..548725cf6 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -843,7 +843,7 @@ class TextEditor extends Model mutateSelectedText: (fn) -> @mergeIntersectingSelections => @transact => - fn(selection, index) for selection, index in @getSelections() + fn(selection, index) for selection, index in @getSelectionsOrderedByBufferPosition() # Move lines intersection the most recent selection up by one row in screen # coordinates. From 0fe1ea1af3c93a19affc9a35ad2a169849d72fd8 Mon Sep 17 00:00:00 2001 From: Jesse Grosjean Date: Thu, 2 Apr 2015 12:25:16 -0400 Subject: [PATCH 291/521] Target 0 instead of -Infinity to make the code a bit clearer. --- src/display-buffer.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index d79b1bce7..6ec4ce859 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -692,7 +692,7 @@ class DisplayBuffer extends Model targetLeft = pixelPosition.left defaultCharWidth = @defaultCharWidth row = Math.floor(targetTop / @getLineHeightInPixels()) - targetLeft = -Infinity if row < 0 + targetLeft = 0 if row < 0 targetLeft = Infinity if row > @getLastRow() row = Math.min(row, @getLastRow()) row = Math.max(0, row) From cd8536d8a0d44df4574bad8ed5c3e2d99f9f5513 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 09:42:49 -0700 Subject: [PATCH 292/521] Listen for error event before any other calls --- src/browser/auto-update-manager.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/browser/auto-update-manager.coffee b/src/browser/auto-update-manager.coffee index 3ee0fce3d..358390889 100644 --- a/src/browser/auto-update-manager.coffee +++ b/src/browser/auto-update-manager.coffee @@ -33,6 +33,10 @@ class AutoUpdateManager else autoUpdater = require 'auto-updater' + autoUpdater.on 'error', (event, message) => + @setState(ErrorState) + console.error "Error Downloading Update: #{message}" + autoUpdater.setFeedUrl @feedUrl autoUpdater.on 'checking-for-update', => @@ -44,10 +48,6 @@ class AutoUpdateManager autoUpdater.on 'update-available', => @setState(DownladingState) - autoUpdater.on 'error', (event, message) => - @setState(ErrorState) - console.error "Error Downloading Update: #{message}" - autoUpdater.on 'update-downloaded', (event, releaseNotes, @releaseVersion) => @setState(UpdateAvailableState) @emitUpdateAvailableEvent(@getWindows()...) From 1b8337e79f3cf9837f401209b648b6f702963177 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 09:47:20 -0700 Subject: [PATCH 293/521] Project::getPath -> Project::getPaths Closes atom/autocomplete-css#4 --- src/atom.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom.coffee b/src/atom.coffee index 707500479..a71adeeeb 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -768,7 +768,7 @@ class Atom extends Model callback(showSaveDialogSync()) showSaveDialogSync: (defaultPath) -> - defaultPath ?= @project?.getPath() + defaultPath ?= @project?.getPaths()[0] currentWindow = @getCurrentWindow() dialog = remote.require('dialog') dialog.showSaveDialog currentWindow, {title: 'Save File', defaultPath} From bc4ed8a874e160e3691a63296152ad34203cbe3e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 10:01:49 -0700 Subject: [PATCH 294/521] :arrow_up: first-mate@3.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 75e2a325d..e53f93ea6 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "delegato": "^1", "emissary": "^1.3.3", "event-kit": "^1.0.3", - "first-mate": "^3.0.0", + "first-mate": "^3.0.1", "fs-plus": "^2.6", "fstream": "0.1.24", "fuzzaldrin": "^2.1", From 21df0d0401a33a3589ddacd4c2d6c2f067315ef0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 2 Apr 2015 19:06:41 +0200 Subject: [PATCH 295/521] :white_check_mark: Use component.measureDimensions() --- spec/text-editor-component-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 4b5a503bc..a5ca4c309 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1426,7 +1426,7 @@ describe "TextEditorComponent", -> height = 4.5 * lineHeightInPixels wrapperNode.style.height = height + 'px' wrapperNode.style.width = 10 * charWidth + 'px' - component.measureHeightAndWidth() + component.measureDimensions() nextAnimationFrame() coordinates = clientCoordinatesForScreenPosition([0, 2]) From 15091c716db2e279e8b6434d799556f69de9cd87 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 10:16:18 -0700 Subject: [PATCH 296/521] Pin to typescript-simple@1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e53f93ea6..2b15919e9 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "temp": "0.8.1", "text-buffer": "^5.1.0", "theorist": "^1.0.2", - "typescript-simple": "^1.0.0", + "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6" }, "packageDependencies": { From ede6dbb581044e5e6e53ec9eedd912c6ec80ea0b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 2 Apr 2015 13:56:45 -0600 Subject: [PATCH 297/521] :arrow_up: text-buffer to fix marker restoration (fixes #6223) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b15919e9..371720500 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^5.1.0", + "text-buffer": "^5.1.1", "theorist": "^1.0.2", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6" From 89f082602b5b17c8b7a60a0573d8038358087f4b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 14:44:40 -0700 Subject: [PATCH 298/521] :arrow_up: grim@1.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 371720500..4b130c3a2 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "fstream": "0.1.24", "fuzzaldrin": "^2.1", "git-utils": "^3.0.0", - "grim": "1.2", + "grim": "1.2.1", "jasmine-json": "~0.0", "jasmine-tagged": "^1.1.4", "jquery": "^2.1.1", From 14e75aacf921cd32d9b58263e4131ed8659d852a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:17:16 -0700 Subject: [PATCH 299/521] :arrow_up: archive-view@0.55 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b130c3a2..311d1c8f1 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "one-light-ui": "0.4.0", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", - "archive-view": "0.53.0", + "archive-view": "0.55.0", "autocomplete": "0.44.0", "autoflow": "0.22.0", "autosave": "0.20.0", From 4c7fe0414b6f5784a83162c30fa76d7ff7418ece Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:18:19 -0700 Subject: [PATCH 300/521] :arrow_up: language-c@0.43 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 311d1c8f1..683d0badc 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "welcome": "0.26.0", "whitespace": "0.29.0", "wrap-guide": "0.31.0", - "language-c": "0.42.0", + "language-c": "0.43.0", "language-clojure": "0.13.0", "language-coffee-script": "0.39.0", "language-csharp": "0.5.0", From aa4d294c19c4fcdcd30a95d94cdb525684d318d2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 17:19:20 -0700 Subject: [PATCH 301/521] Implement clearObservers in GrammarRegistry --- src/grammar-registry.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee index acdc863bc..911ffafbe 100644 --- a/src/grammar-registry.coffee +++ b/src/grammar-registry.coffee @@ -2,6 +2,7 @@ _ = require 'underscore-plus' {deprecate} = require 'grim' {specificity} = require 'clear-cut' {Subscriber} = require 'emissary' +{Emitter} = require 'event-kit' FirstMate = require 'first-mate' {ScopeSelector} = FirstMate ScopedPropertyStore = require 'scoped-property-store' @@ -69,3 +70,7 @@ class GrammarRegistry extends FirstMate.GrammarRegistry propertiesForScope: (scope, keyPath) -> deprecate 'Use atom.config.getAll instead.' atom.config.settingsForScopeDescriptor(scope, keyPath) + + clearObservers: -> + @off() + @emitter = new Emitter From 2d5f848b4f49ebd507b3a8b18831aba682f0db7e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 17:29:03 -0700 Subject: [PATCH 302/521] :arrow_up: keybinding-resolver@0.30 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 683d0badc..795ee2bc6 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "grammar-selector": "0.46.0", "image-view": "0.54.0", "incompatible-packages": "0.24.0", - "keybinding-resolver": "0.29.0", + "keybinding-resolver": "0.30.0", "link": "0.30.0", "markdown-preview": "0.146.0", "metrics": "0.45.0", From 33d5a2b3fc3e493773d8f1bfc078a7f13533b637 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Apr 2015 18:21:39 +0800 Subject: [PATCH 303/521] InspectorFrontendAPI changed to DevToolsAPI --- src/atom.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom.coffee b/src/atom.coffee index fc4f59ef2..95ed0d4c9 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -226,7 +226,7 @@ class Atom extends Model if openDevTools @openDevTools() - @executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()') + @executeJavaScriptInDevTools('DevToolsAPI.showConsole()') @emit 'uncaught-error', arguments... @emitter.emit 'did-throw-error', {message, url, line, column, originalError} From 6910c81b4636bc16f0cdbc47875fe92d21e7a97c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 3 Apr 2015 18:25:45 +0800 Subject: [PATCH 304/521] Fix error when running apm in packages --- src/package-manager.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 2bbcf7fe7..c00087084 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -134,7 +134,7 @@ class PackageManager commandName = 'apm' commandName += '.cmd' if process.platform is 'win32' - apmRoot = path.resolve(__dirname, '..', '..', 'apm') + apmRoot = path.join(process.resourcesPath, 'apm') @apmPath = path.join(apmRoot, 'bin', commandName) unless fs.isFileSync(@apmPath) @apmPath = path.join(apmRoot, 'node_modules', 'atom-package-manager', 'bin', commandName) From 1cf5822d20ffef09d2b446e79b75ef59c64b6c6e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 3 Apr 2015 18:06:28 +0200 Subject: [PATCH 305/521] Merge intersecting selections by row before deleting lines --- spec/text-editor-spec.coffee | 15 +++++++++++++++ src/selection.coffee | 7 +++++++ src/text-editor.coffee | 17 +++++++++++++---- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 51226a22b..f2945977a 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -3376,6 +3376,21 @@ describe "TextEditor", -> expect(buffer.lineForRow(0)).toBe(line2) expect(buffer.getLineCount()).toBe(count - 2) + it "deletes only the first line when it has multiple selections", -> + line1 = buffer.lineForRow(1) + count = buffer.getLineCount() + editor.getLastCursor().moveToTop() + editor.setSelectedBufferRanges([ + [[0, 1], [0, 2]], + [[0, 4], [0, 5]] + ]) + expect(buffer.lineForRow(0)).not.toBe(line1) + + editor.deleteLine() + + expect(buffer.lineForRow(0)).toBe(line1) + expect(buffer.getLineCount()).toBe(count - 1) + it "only deletes first line if only newline is selected on second line", -> editor.setSelectedBufferRange([[0, 2], [1, 0]]) line1 = buffer.lineForRow(1) diff --git a/src/selection.coffee b/src/selection.coffee index ea4b54034..971ddbdd9 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -174,6 +174,13 @@ class Selection extends Model intersectsScreenRow: (screenRow) -> @getScreenRange().intersectsRow(screenRow) + intersectsByRowWith: (otherSelection) -> + otherScreenRange = otherSelection.getScreenRange() + + @getScreenRange().intersectsRowRange( + otherScreenRange.start.row, otherScreenRange.end.row + ) + # Public: Identifies if a selection intersects with another selection. # # * `otherSelection` A {Selection} to check against. diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 548725cf6..23a612ee4 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -1114,6 +1114,7 @@ class TextEditor extends Model # Extended: Delete all lines intersecting selections. deleteLine: -> + @mergeIntersectingSelectionsByRow() @mutateSelectedText (selection) -> selection.deleteLine() # Deprecated: Use {::deleteToBeginningOfWord} instead. @@ -2232,6 +2233,17 @@ class TextEditor extends Model # the function with merging suppressed, then merges intersecting selections # afterward. mergeIntersectingSelections: (args...) -> + @mergeSelections args..., (previousSelection, currentSelection) -> + exclusive = not currentSelection.isEmpty() and not previousSelection.isEmpty() + + previousSelection.intersectsWith(currentSelection, exclusive) + + mergeIntersectingSelectionsByRow: (args...) -> + @mergeSelections args..., (previousSelection, currentSelection) -> + previousSelection.intersectsByRowWith(currentSelection) + + mergeSelections: (args...) -> + mergePredicate = args.pop() fn = args.pop() if _.isFunction(_.last(args)) options = args.pop() ? {} @@ -2244,10 +2256,7 @@ class TextEditor extends Model reducer = (disjointSelections, selection) -> adjacentSelection = _.last(disjointSelections) - exclusive = not selection.isEmpty() and not adjacentSelection.isEmpty() - intersects = adjacentSelection.intersectsWith(selection, exclusive) - - if intersects + if mergePredicate(adjacentSelection, selection) adjacentSelection.merge(selection, options) disjointSelections else From 42521900e8248ab95bd8a986e91934d01ecae822 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 3 Apr 2015 18:10:43 +0200 Subject: [PATCH 306/521] :memo: Improve naming --- spec/text-editor-spec.coffee | 2 +- src/selection.coffee | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index f2945977a..3be0c8b0e 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -3376,7 +3376,7 @@ describe "TextEditor", -> expect(buffer.lineForRow(0)).toBe(line2) expect(buffer.getLineCount()).toBe(count - 2) - it "deletes only the first line when it has multiple selections", -> + it "deletes a line only once when multiple selections are on the same line", -> line1 = buffer.lineForRow(1) count = buffer.getLineCount() editor.getLastCursor().moveToTop() diff --git a/src/selection.coffee b/src/selection.coffee index 971ddbdd9..c6d6933c0 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -174,6 +174,11 @@ class Selection extends Model intersectsScreenRow: (screenRow) -> @getScreenRange().intersectsRow(screenRow) + # Public: Identifies if this selection's rows intersects with another selection's rows. + # + # * `otherSelection` A {Selection} to check against. + # + # Returns a {Boolean} intersectsByRowWith: (otherSelection) -> otherScreenRange = otherSelection.getScreenRange() From decab183b7ddef217ed0ecd58875915f81c31c79 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 3 Apr 2015 10:34:21 -0700 Subject: [PATCH 307/521] Fix screen/buffer range error in paragraph cursor motions --- spec/text-editor-spec.coffee | 26 ++++++++++---------------- src/cursor.coffee | 4 ++-- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 51226a22b..439a1ddb6 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -831,35 +831,29 @@ describe "TextEditor", -> describe ".moveToBeginningOfNextParagraph()", -> it "moves the cursor before the first line of the next paragraph", -> - editor.setCursorBufferPosition [0,6] - cursor = editor.getLastCursor() + editor.setCursorBufferPosition [0, 6] + editor.foldBufferRow(4) editor.moveToBeginningOfNextParagraph() - - expect(cursor.getBufferPosition()).toEqual { row : 10, column : 0 } + expect(editor.getCursorBufferPosition()).toEqual [10, 0] editor.setText("") - editor.setCursorBufferPosition [0,0] - cursor = editor.getLastCursor() + editor.setCursorBufferPosition [0, 0] editor.moveToBeginningOfNextParagraph() - - expect(cursor.getBufferPosition()).toEqual [0, 0] + expect(editor.getCursorBufferPosition()).toEqual [0, 0] describe ".moveToBeginningOfPreviousParagraph()", -> it "moves the cursor before the first line of the pevious paragraph", -> - editor.setCursorBufferPosition [10,0] - cursor = editor.getLastCursor() + editor.setCursorBufferPosition [10, 0] + editor.foldBufferRow(4) editor.moveToBeginningOfPreviousParagraph() - - expect(cursor.getBufferPosition()).toEqual { row : 0, column : 0 } + expect(editor.getCursorBufferPosition()).toEqual [0, 0] editor.setText("") - editor.setCursorBufferPosition [0,0] - cursor = editor.getLastCursor() + editor.setCursorBufferPosition [0, 0] editor.moveToBeginningOfPreviousParagraph() - - expect(cursor.getBufferPosition()).toEqual [0, 0] + expect(editor.getCursorBufferPosition()).toEqual [0, 0] describe ".getCurrentParagraphBufferRange()", -> it "returns the buffer range of the current paragraph, delimited by blank lines or the beginning / end of the file", -> diff --git a/src/cursor.coffee b/src/cursor.coffee index acfc7fc9e..1656b9dc2 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -672,7 +672,7 @@ class Cursor extends Model if !range.start.isEqual(start) position = range.start stop() - @editor.screenPositionForBufferPosition(position) + position getBeginningOfPreviousParagraphBufferPosition: -> start = @getBufferPosition() @@ -685,4 +685,4 @@ class Cursor extends Model if !range.start.isEqual(zero) position = range.start stop() - @editor.screenPositionForBufferPosition(position) + position From 3de83f6860d9086d5366a80ce8f5516851d3865c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:03:43 -0700 Subject: [PATCH 308/521] Revert "Add asar support in Atom" --- apm/package.json | 2 +- build/Gruntfile.coffee | 4 ++-- build/package.json | 1 - build/tasks/build-task.coffee | 6 +++--- build/tasks/generate-asar-task.coffee | 19 ------------------- build/tasks/generate-license-task.coffee | 2 +- script/mkdeb | 2 +- src/atom.coffee | 6 +++--- src/browser/atom-application.coffee | 2 +- src/browser/squirrel-update.coffee | 2 +- src/command-installer.coffee | 13 +++++++------ src/package-manager.coffee | 2 +- src/task.coffee | 7 +------ 13 files changed, 22 insertions(+), 46 deletions(-) delete mode 100644 build/tasks/generate-asar-task.coffee diff --git a/apm/package.json b/apm/package.json index e7a0c8fdc..84f73451d 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "0.158.0" + "atom-package-manager": "0.157.0" } } diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index ed4c7b933..05efaeb38 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -223,7 +223,7 @@ module.exports = (grunt) -> ciTasks = ['output-disk-space', 'download-atom-shell', 'download-atom-shell-chromedriver', 'build'] ciTasks.push('dump-symbols') if process.platform isnt 'win32' - ciTasks.push('set-version', 'check-licenses', 'lint', 'generate-asar') + ciTasks.push('set-version', 'check-licenses', 'lint') ciTasks.push('mkdeb') if process.platform is 'linux' ciTasks.push('create-windows-installer') if process.platform is 'win32' ciTasks.push('test') if process.platform is 'darwin' @@ -231,6 +231,6 @@ module.exports = (grunt) -> ciTasks.push('publish-build') grunt.registerTask('ci', ciTasks) - defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version', 'generate-asar'] + defaultTasks = ['download-atom-shell', 'download-atom-shell-chromedriver', 'build', 'set-version'] defaultTasks.push 'install' unless process.platform is 'linux' grunt.registerTask('default', defaultTasks) diff --git a/build/package.json b/build/package.json index ef5b314a0..297ddadfd 100644 --- a/build/package.json +++ b/build/package.json @@ -6,7 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "asar": "^0.4.0", "async": "~0.2.9", "donna": "1.0.7", "formidable": "~1.0.14", diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index 74e5d8821..fcb1eb6a8 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -22,7 +22,7 @@ module.exports = (grunt) -> mkdir appDir if process.platform isnt 'win32' - cp 'atom.sh', path.resolve(appDir, '..', 'atom.sh') + cp 'atom.sh', path.join(appDir, 'atom.sh') cp 'package.json', path.join(appDir, 'package.json') @@ -145,9 +145,9 @@ module.exports = (grunt) -> cp 'src', path.join(appDir, 'src'), filter: /.+\.(cson|coffee)$/ cp 'static', path.join(appDir, 'static') - cp path.join('apm', 'node_modules', 'atom-package-manager'), path.resolve(appDir, '..', 'apm'), filter: filterNodeModule + cp path.join('apm', 'node_modules', 'atom-package-manager'), path.join(appDir, 'apm'), filter: filterNodeModule if process.platform isnt 'win32' - fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.resolve(appDir, '..', 'apm', 'node_modules', '.bin', 'apm')) + fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.join(appDir, 'apm', 'node_modules', '.bin', 'apm')) if process.platform is 'darwin' grunt.file.recurse path.join('resources', 'mac'), (sourcePath, rootDirectory, subDirectory='', filename) -> diff --git a/build/tasks/generate-asar-task.coffee b/build/tasks/generate-asar-task.coffee deleted file mode 100644 index 1f74fbf5d..000000000 --- a/build/tasks/generate-asar-task.coffee +++ /dev/null @@ -1,19 +0,0 @@ -asar = require 'asar' -fs = require 'fs' -path = require 'path' - -module.exports = (grunt) -> - {rm} = require('./task-helpers')(grunt) - - grunt.registerTask 'generate-asar', 'Generate asar archive for the app', -> - done = @async() - - appDir = grunt.config.get('atom.appDir') - unless fs.existsSync(appDir) - grunt.log.error 'The app has to be built before generating asar archive.' - return done(false) - - asar.createPackageWithOptions appDir, path.resolve(appDir, '..', 'app.asar'), {unpack: '*.node'}, (err) -> - return done(err) if err? - rm appDir - done() diff --git a/build/tasks/generate-license-task.coffee b/build/tasks/generate-license-task.coffee index eaf1a9a66..6b616f5cb 100644 --- a/build/tasks/generate-license-task.coffee +++ b/build/tasks/generate-license-task.coffee @@ -17,7 +17,7 @@ module.exports = (grunt) -> licenseText = getLicenseText(dependencyLicenses) if mode is 'save' - targetPath = path.resolve(grunt.config.get('atom.appDir'), '..', 'LICENSE.md') + targetPath = path.join(grunt.config.get('atom.appDir'), 'LICENSE.md') fs.writeFileSync(targetPath, licenseText) else console.log licenseText diff --git a/script/mkdeb b/script/mkdeb index c39b6d649..272fe23f3 100755 --- a/script/mkdeb +++ b/script/mkdeb @@ -33,7 +33,7 @@ cp "$ICON_FILE" "$TARGET/usr/share/pixmaps" # Copy generated LICENSE.md to /usr/share/doc/atom/copyright mkdir -m $FILE_MODE -p "$TARGET/usr/share/doc/atom" -cp "$TARGET/usr/share/atom/resources/LICENSE.md" "$TARGET/usr/share/doc/atom/copyright" +cp "$TARGET/usr/share/atom/resources/app/LICENSE.md" "$TARGET/usr/share/doc/atom/copyright" # Add lintian overrides mkdir -m $FILE_MODE -p "$TARGET/usr/share/lintian/overrides" diff --git a/src/atom.coffee b/src/atom.coffee index f05ce11f6..a71adeeeb 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -226,7 +226,7 @@ class Atom extends Model if openDevTools @openDevTools() - @executeJavaScriptInDevTools('DevToolsAPI.showConsole()') + @executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()') @emit 'uncaught-error', arguments... @emitter.emit 'did-throw-error', {message, url, line, column, originalError} @@ -581,9 +581,9 @@ class Atom extends Model {resourcePath, safeMode} = @getLoadSettings() CommandInstaller = require './command-installer' - CommandInstaller.installAtomCommand false, (error) -> + CommandInstaller.installAtomCommand resourcePath, false, (error) -> console.warn error.message if error? - CommandInstaller.installApmCommand false, (error) -> + CommandInstaller.installApmCommand resourcePath, false, (error) -> console.warn error.message if error? dimensions = @restoreWindowDimensions() diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 7d88858c5..d79b2bf76 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -190,7 +190,7 @@ class AtomApplication @openPathOnEvent('application:open-your-keymap', 'atom://.atom/keymap') @openPathOnEvent('application:open-your-snippets', 'atom://.atom/snippets') @openPathOnEvent('application:open-your-stylesheet', 'atom://.atom/stylesheet') - @openPathOnEvent('application:open-license', path.join(process.resourcesPath, 'LICENSE.md')) + @openPathOnEvent('application:open-license', path.join(@resourcePath, 'LICENSE.md')) app.on 'window-all-closed', -> app.quit() if process.platform in ['win32', 'linux'] diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 3bdd84223..1603a7c0a 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -142,7 +142,7 @@ addCommandsToPath = (callback) -> atomShCommand = "#!/bin/sh\r\n\"$0/../#{relativeAtomShPath.replace(/\\/g, '/')}\" \"$@\"" apmCommandPath = path.join(binFolder, 'apm.cmd') - relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'apm', 'bin', 'apm.cmd')) + relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'app', 'apm', 'bin', 'apm.cmd')) apmCommand = "@echo off\r\n\"%~dp0\\#{relativeApmPath}\" %*" apmShCommandPath = path.join(binFolder, 'apm') diff --git a/src/command-installer.coffee b/src/command-installer.coffee index c7772b4f5..1d3a16777 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -36,11 +36,12 @@ module.exports = message: "Failed to install shell commands" detailedMessage: error.message - @installAtomCommand true, (error) => + resourcePath = atom.getLoadSettings().resourcePath + @installAtomCommand resourcePath, true, (error) => if error? showErrorDialog(error) else - @installApmCommand true, (error) -> + @installApmCommand resourcePath, true, (error) -> if error? showErrorDialog(error) else @@ -48,12 +49,12 @@ module.exports = message: "Commands installed." detailedMessage: "The shell commands `atom` and `apm` are installed." - installAtomCommand: (askForPrivilege, callback) -> - commandPath = path.join(process.resourcesPath, 'atom.sh') + installAtomCommand: (resourcePath, askForPrivilege, callback) -> + commandPath = path.join(resourcePath, 'atom.sh') @createSymlink commandPath, askForPrivilege, callback - installApmCommand: (askForPrivilege, callback) -> - commandPath = path.join(process.resourcesPath, 'apm', 'node_modules', '.bin', 'apm') + installApmCommand: (resourcePath, askForPrivilege, callback) -> + commandPath = path.join(resourcePath, 'apm', 'node_modules', '.bin', 'apm') @createSymlink commandPath, askForPrivilege, callback createSymlink: (commandPath, askForPrivilege, callback) -> diff --git a/src/package-manager.coffee b/src/package-manager.coffee index c00087084..444497c5b 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -134,7 +134,7 @@ class PackageManager commandName = 'apm' commandName += '.cmd' if process.platform is 'win32' - apmRoot = path.join(process.resourcesPath, 'apm') + apmRoot = path.resolve(__dirname, '..', 'apm') @apmPath = path.join(apmRoot, 'bin', commandName) unless fs.isFileSync(@apmPath) @apmPath = path.join(apmRoot, 'node_modules', 'atom-package-manager', 'bin', commandName) diff --git a/src/task.coffee b/src/task.coffee index d752ea11d..9572494b8 100644 --- a/src/task.coffee +++ b/src/task.coffee @@ -83,7 +83,7 @@ class Task taskPath = taskPath.replace(/\\/g, "\\\\") env = _.extend({}, process.env, {taskPath, userAgent: navigator.userAgent}) - @childProcess = fork '--eval', [bootstrap], {env, silent: true} + @childProcess = fork '--eval', [bootstrap], {env, cwd: __dirname} @on "task:log", -> console.log(arguments...) @on "task:warn", -> console.warn(arguments...) @@ -100,11 +100,6 @@ class Task @childProcess.removeAllListeners() @childProcess.on 'message', ({event, args}) => @emit(event, args...) if @childProcess? - # Catch the errors that happened before task-bootstrap. - @childProcess.stdout.on 'data', (data) -> - console.log data.toString() - @childProcess.stderr.on 'data', (data) -> - console.error data.toString() # Public: Starts the task. # From f79c2669fc95992499858592bbee9910345b14c6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 09:46:23 -0700 Subject: [PATCH 309/521] Add 1.0 API preview command line option --- src/atom.coffee | 10 +++++++--- src/browser/atom-application.coffee | 24 ++++++++++++++---------- src/browser/atom-window.coffee | 3 ++- src/browser/main.coffee | 5 ++++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index a71adeeeb..c45744408 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -342,15 +342,19 @@ class Atom extends Model # Public: Is the current window in development mode? inDevMode: -> - @getLoadSettings().devMode + @devMode ?= @getLoadSettings().devMode # Public: Is the current window in safe mode? inSafeMode: -> - @getLoadSettings().safeMode + @safeMode ?= @getLoadSettings().safeMode # Public: Is the current window running specs? inSpecMode: -> - @getLoadSettings().isSpec + @specMode ?= @getLoadSettings().isSpec + + # Is the current window in 1.0 API preview mode? + inApiPreviewMode: -> + @apiPreviewMode ?= @getLoadSettings().apiPreviewMode # Public: Get the version of the Atom application. # diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index d79b2bf76..fb9085416 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -60,7 +60,7 @@ class AtomApplication exit: (status) -> app.exit(status) constructor: (options) -> - {@resourcePath, @version, @devMode, @safeMode, @socketPath} = options + {@resourcePath, @version, @devMode, @safeMode, @apiPreviewMode, @socketPath} = options # Normalize to make sure drive letter case is consistent on Windows @resourcePath = path.normalize(@resourcePath) if @resourcePath @@ -82,15 +82,15 @@ class AtomApplication @openWithOptions(options) # Opens a new window based on the options provided. - openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile}) -> + openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, apiPreviewMode, newWindow, specDirectory, logFile}) -> if test @runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile}) else if pathsToOpen.length > 0 - @openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode}) + @openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode}) else if urlsToOpen.length > 0 - @openUrl({urlToOpen, devMode, safeMode}) for urlToOpen in urlsToOpen + @openUrl({urlToOpen, devMode, safeMode, apiPreviewMode}) for urlToOpen in urlsToOpen else - @openPath({pidToKillWhenClosed, newWindow, devMode, safeMode}) # Always open a editor window if this is the first instance of Atom. + @openPath({pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode}) # Always open a editor window if this is the first instance of Atom. # Public: Removes the {AtomWindow} from the global window list. removeWindow: (window) -> @@ -146,6 +146,7 @@ class AtomApplication getLoadSettings = => devMode: @focusedWindow()?.devMode safeMode: @focusedWindow()?.safeMode + apiPreviewMode: @focusedWindow()?.apiPreviewMode @on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: global.devResourcePath, safeMode: @focusedWindow()?.safeMode) @on 'application:run-benchmarks', -> @runBenchmarks() @@ -157,6 +158,7 @@ class AtomApplication @on 'application:open-folder', -> @promptForPathToOpen('folder', getLoadSettings()) @on 'application:open-dev', -> @promptForPathToOpen('all', devMode: true) @on 'application:open-safe', -> @promptForPathToOpen('all', safeMode: true) + @on 'application:open-api-preview', -> @promptForPathToOpen('all', apiPreviewMode: true) @on 'application:inspect', ({x,y, atomWindow}) -> atomWindow ?= @focusedWindow() atomWindow?.browserWindow.inspectElement(x, y) @@ -209,7 +211,7 @@ class AtomApplication app.on 'open-url', (event, urlToOpen) => event.preventDefault() - @openUrl({urlToOpen, @devMode, @safeMode}) + @openUrl({urlToOpen, @devMode, @safeMode, @apiPreviewMode}) app.on 'activate-with-no-open-windows', (event) => event.preventDefault() @@ -333,9 +335,10 @@ class AtomApplication # :newWindow - Boolean of whether this should be opened in a new window. # :devMode - Boolean to control the opened window's dev mode. # :safeMode - Boolean to control the opened window's safe mode. + # :apiPreviewMode - Boolean to control the opened window's 1.0 API preview mode. # :window - {AtomWindow} to open file paths in. - openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, window}) -> - @openPaths({pathsToOpen: [pathToOpen], pidToKillWhenClosed, newWindow, devMode, safeMode, window}) + openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, window}) -> + @openPaths({pathsToOpen: [pathToOpen], pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, window}) # Public: Opens a single path, in an existing window if possible. # @@ -345,9 +348,10 @@ class AtomApplication # :newWindow - Boolean of whether this should be opened in a new window. # :devMode - Boolean to control the opened window's dev mode. # :safeMode - Boolean to control the opened window's safe mode. + # :apiPreviewMode - Boolean to control the opened window's 1.0 API preview mode. # :windowDimensions - Object with height and width keys. # :window - {AtomWindow} to open file paths in. - openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, window}={}) -> + openPaths: ({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, windowDimensions, window}={}) -> pathsToOpen = (fs.normalize(pathToOpen) for pathToOpen in pathsToOpen) locationsToOpen = (@locationForPathToOpen(pathToOpen) for pathToOpen in pathsToOpen) @@ -377,7 +381,7 @@ class AtomApplication bootstrapScript ?= require.resolve('../window-bootstrap') resourcePath ?= @resourcePath - openedWindow = new AtomWindow({locationsToOpen, bootstrapScript, resourcePath, devMode, safeMode, windowDimensions}) + openedWindow = new AtomWindow({locationsToOpen, bootstrapScript, resourcePath, devMode, safeMode, apiPreviewMode, windowDimensions}) if pidToKillWhenClosed? @pidsToOpenWindows[pidToKillWhenClosed] = openedWindow diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index 66fad179e..fff98799c 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -18,7 +18,7 @@ class AtomWindow isSpec: null constructor: (settings={}) -> - {@resourcePath, pathToOpen, locationsToOpen, @isSpec, @exitWhenDone, @safeMode, @devMode} = settings + {@resourcePath, pathToOpen, locationsToOpen, @isSpec, @exitWhenDone, @safeMode, @devMode, @apiPreviewMode} = settings locationsToOpen ?= [{pathToOpen}] if pathToOpen locationsToOpen ?= [] @@ -47,6 +47,7 @@ class AtomWindow loadSettings.resourcePath = @resourcePath loadSettings.devMode ?= false loadSettings.safeMode ?= false + loadSettings.apiPreviewMode ?= false # Only send to the first non-spec window created if @constructor.includeShellLoadTime and not @isSpec diff --git a/src/browser/main.coffee b/src/browser/main.coffee index 09db16357..812771e9a 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -106,6 +106,7 @@ parseCommandLine = -> ATOM_HOME The root path for all configuration files and folders. Defaults to `~/.atom`. """ + options.alias('1', 'one').boolean('1').describe('1', 'Run in 1.0 API preview mode.') options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.') options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.') options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.') @@ -131,6 +132,7 @@ parseCommandLine = -> executedFrom = args['executed-from'] devMode = args['dev'] safeMode = args['safe'] + apiPreviewMode = args['one'] pathsToOpen = args._ pathsToOpen = [executedFrom] if executedFrom and pathsToOpen.length is 0 test = args['test'] @@ -164,6 +166,7 @@ parseCommandLine = -> process.env.PATH = args['path-environment'] if args['path-environment'] {resourcePath, pathsToOpen, executedFrom, test, version, pidToKillWhenClosed, - devMode, safeMode, newWindow, specDirectory, logFile, socketPath} + devMode, apiPreviewMode, safeMode, newWindow, specDirectory, logFile, + socketPath} start() From 80cb757cfec8f2da6385fb7be6a9d6e390c131d5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 09:47:44 -0700 Subject: [PATCH 310/521] Add api preview open ipc event proxy --- src/workspace-element.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 425d920d8..5afe2cf0e 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -136,6 +136,7 @@ atom.commands.add 'atom-workspace', 'application:open-folder': -> ipc.send('command', 'application:open-folder') 'application:open-dev': -> ipc.send('command', 'application:open-dev') 'application:open-safe': -> ipc.send('command', 'application:open-safe') + 'application:open-api-preview': -> ipc.send('command', 'application:open-api-preview') 'application:minimize': -> ipc.send('command', 'application:minimize') 'application:zoom': -> ipc.send('command', 'application:zoom') 'application:bring-all-windows-to-front': -> ipc.send('command', 'application:bring-all-windows-to-front') From 5a7d746eaeec84d4bea4304808f295676304809b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:18:11 -0700 Subject: [PATCH 311/521] Conditionally include deprecations in Atom --- src/atom.coffee | 88 +++++++++++++++++++++++++------------------------ static/index.js | 2 ++ 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index c45744408..49a76481b 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -6,7 +6,7 @@ remote = require 'remote' shell = require 'shell' _ = require 'underscore-plus' -{deprecate} = require 'grim' +{deprecate, includeDeprecations} = require 'grim' {Emitter} = require 'event-kit' {Model} = require 'theorist' fs = require 'fs-plus' @@ -34,35 +34,36 @@ class Atom extends Model atom = @deserialize(@loadState(mode)) ? new this({mode, @version}) atom.deserializeTimings.atom = Date.now() - startTime - workspaceViewDeprecationMessage = """ - atom.workspaceView is no longer available. - In most cases you will not need the view. See the Workspace docs for - alternatives: https://atom.io/docs/api/latest/Workspace. - If you do need the view, please use `atom.views.getView(atom.workspace)`, - which returns an HTMLElement. - """ + if includeDeprecations + workspaceViewDeprecationMessage = """ + atom.workspaceView is no longer available. + In most cases you will not need the view. See the Workspace docs for + alternatives: https://atom.io/docs/api/latest/Workspace. + If you do need the view, please use `atom.views.getView(atom.workspace)`, + which returns an HTMLElement. + """ - serviceHubDeprecationMessage = """ - atom.services is no longer available. To register service providers and - consumers, use the `providedServices` and `consumedServices` fields in - your package's package.json. - """ + serviceHubDeprecationMessage = """ + atom.services is no longer available. To register service providers and + consumers, use the `providedServices` and `consumedServices` fields in + your package's package.json. + """ - Object.defineProperty atom, 'workspaceView', - get: -> - deprecate(workspaceViewDeprecationMessage) - atom.__workspaceView - set: (newValue) -> - deprecate(workspaceViewDeprecationMessage) - atom.__workspaceView = newValue + Object.defineProperty atom, 'workspaceView', + get: -> + deprecate(workspaceViewDeprecationMessage) + atom.__workspaceView + set: (newValue) -> + deprecate(workspaceViewDeprecationMessage) + atom.__workspaceView = newValue - Object.defineProperty atom, 'services', - get: -> - deprecate(serviceHubDeprecationMessage) - atom.packages.serviceHub - set: (newValue) -> - deprecate(serviceHubDeprecationMessage) - atom.packages.serviceHub = newValue + Object.defineProperty atom, 'services', + get: -> + deprecate(serviceHubDeprecationMessage) + atom.packages.serviceHub + set: (newValue) -> + deprecate(serviceHubDeprecationMessage) + atom.packages.serviceHub = newValue atom @@ -263,7 +264,10 @@ class Atom extends Model @config = new Config({configDirPath, resourcePath}) @keymaps = new KeymapManager({configDirPath, resourcePath}) - @keymap = @keymaps # Deprecated + + if includeDeprecations + @keymap = @keymaps # Deprecated + @keymaps.subscribeToFileReadFailure() @tooltips = new TooltipManager @notifications = new NotificationManager @@ -279,9 +283,10 @@ class Atom extends Model @grammars = @deserializers.deserialize(@state.grammars ? @state.syntax) ? new GrammarRegistry() - Object.defineProperty this, 'syntax', get: -> - deprecate "The atom.syntax global is deprecated. Use atom.grammars instead." - @grammars + if includeDeprecations + Object.defineProperty this, 'syntax', get: -> + deprecate "The atom.syntax global is deprecated. Use atom.grammars instead." + @grammars @subscribe @packages.onDidActivateInitialPackages => @watchThemes() @@ -352,10 +357,6 @@ class Atom extends Model inSpecMode: -> @specMode ?= @getLoadSettings().isSpec - # Is the current window in 1.0 API preview mode? - inApiPreviewMode: -> - @apiPreviewMode ?= @getLoadSettings().apiPreviewMode - # Public: Get the version of the Atom application. # # Returns the version text {String}. @@ -831,17 +832,18 @@ class Atom extends Model updateAvailable: (details) -> @emitter.emit 'update-available', details - # Deprecated: Callers should be converted to use atom.deserializers - registerRepresentationClass: -> - deprecate("Callers should be converted to use atom.deserializers") - - # Deprecated: Callers should be converted to use atom.deserializers - registerRepresentationClasses: -> - deprecate("Callers should be converted to use atom.deserializers") - setBodyPlatformClass: -> document.body.classList.add("platform-#{process.platform}") setAutoHideMenuBar: (autoHide) -> ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide) + +if includeDeprecations + # Deprecated: Callers should be converted to use atom.deserializers + Atom::registerRepresentationClass = -> + deprecate("Callers should be converted to use atom.deserializers") + + # Deprecated: Callers should be converted to use atom.deserializers + Atom::registerRepresentationClasses = -> + deprecate("Callers should be converted to use atom.deserializers") diff --git a/static/index.js b/static/index.js index d99a9e9e7..7c8e92571 100644 --- a/static/index.js +++ b/static/index.js @@ -34,6 +34,8 @@ window.onload = function() { ModuleCache.register(loadSettings); ModuleCache.add(loadSettings.resourcePath); + require('grim').includeDeprecations = !loadSettings.apiPreviewMode; + // Start the crash reporter before anything else. require('crash-reporter').start({ productName: 'Atom', From 69b0d90e6449842ef3eec8da6324bb37019f3379 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:23:41 -0700 Subject: [PATCH 312/521] Remove unused require --- src/token.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/token.coffee b/src/token.coffee index 778ea16e6..941daf032 100644 --- a/src/token.coffee +++ b/src/token.coffee @@ -1,5 +1,4 @@ _ = require 'underscore-plus' -{deprecate} = require 'grim' textUtils = require './text-utils' WhitespaceRegexesByTabLength = {} From 87fca98bab08173dda5f360442f45a618a16e02c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:24:48 -0700 Subject: [PATCH 313/521] Deprecate TextEditorComponent::setShowInvisibles --- src/text-editor-component.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 43f8184db..071d39271 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -754,6 +754,7 @@ class TextEditorComponent # Deprecated setShowInvisibles: (showInvisibles) -> + grim.deprecate "Use config.set('editor.showInvisibles', showInvisibles) instead" atom.config.set('editor.showInvisibles', showInvisibles) setScrollSensitivity: (scrollSensitivity) => From 94d42197eb32702ba4b067b50fe36a3420c224f0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:29:13 -0700 Subject: [PATCH 314/521] Conditionally include deprecations --- exports/atom.coffee | 190 +++++++++++++++++++------------------- src/styles-element.coffee | 5 +- 2 files changed, 99 insertions(+), 96 deletions(-) diff --git a/exports/atom.coffee b/exports/atom.coffee index 5afa04022..6b9243098 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -1,7 +1,7 @@ TextBuffer = require 'text-buffer' {Point, Range} = TextBuffer {Emitter, Disposable, CompositeDisposable} = require 'event-kit' -{deprecate} = require 'grim' +{includeDeprecations, deprecate} = require 'grim' module.exports = BufferedNodeProcess: require '../src/buffered-node-process' @@ -21,109 +21,111 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE module.exports.Task = require '../src/task' module.exports.TextEditor = require '../src/text-editor' - {$, $$, $$$, View} = require '../src/space-pen-extensions' + if includeDeprecations + {$, $$, $$$, View} = require '../src/space-pen-extensions' - Object.defineProperty module.exports, 'Workspace', get: -> - deprecate """ - Requiring `Workspace` from `atom` is no longer supported. - If you need this, please open an issue on - https://github.com/atom/atom/issues/new - And let us know what you are using it for. - """ - require '../src/workspace' + Object.defineProperty module.exports, 'Workspace', get: -> + deprecate """ + Requiring `Workspace` from `atom` is no longer supported. + If you need this, please open an issue on + https://github.com/atom/atom/issues/new + And let us know what you are using it for. + """ + require '../src/workspace' - Object.defineProperty module.exports, 'WorkspaceView', get: -> - deprecate """ - Requiring `WorkspaceView` from `atom` is no longer supported. - Use `atom.views.getView(atom.workspace)` instead. - """ - require '../src/workspace-view' + Object.defineProperty module.exports, 'WorkspaceView', get: -> + deprecate """ + Requiring `WorkspaceView` from `atom` is no longer supported. + Use `atom.views.getView(atom.workspace)` instead. + """ + require '../src/workspace-view' - Object.defineProperty module.exports, '$', get: -> - deprecate """ - Requiring `$` from `atom` is no longer supported. - If you are using `space-pen`, please require `$` from `atom-space-pen-views`. Otherwise require `jquery` instead: - `{$} = require 'atom-space-pen-views'` - or - `$ = require 'jquery'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - Or add `"jquery": "^2"` to your package dependencies. - """ - $ + Object.defineProperty module.exports, '$', get: -> + deprecate """ + Requiring `$` from `atom` is no longer supported. + If you are using `space-pen`, please require `$` from `atom-space-pen-views`. Otherwise require `jquery` instead: + `{$} = require 'atom-space-pen-views'` + or + `$ = require 'jquery'` + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + Or add `"jquery": "^2"` to your package dependencies. + """ + $ - Object.defineProperty module.exports, '$$', get: -> - deprecate """ - Requiring `$$` from `atom` is no longer supported. - Please require `atom-space-pen-views` instead: - `{$$} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - $$ + Object.defineProperty module.exports, '$$', get: -> + deprecate """ + Requiring `$$` from `atom` is no longer supported. + Please require `atom-space-pen-views` instead: + `{$$} = require 'atom-space-pen-views'` + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + $$ - Object.defineProperty module.exports, '$$$', get: -> - deprecate """ - Requiring `$$$` from `atom` is no longer supported. - Please require `atom-space-pen-views` instead: - `{$$$} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - $$$ + Object.defineProperty module.exports, '$$$', get: -> + deprecate """ + Requiring `$$$` from `atom` is no longer supported. + Please require `atom-space-pen-views` instead: + `{$$$} = require 'atom-space-pen-views'` + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + $$$ - Object.defineProperty module.exports, 'View', get: -> - deprecate """ - Requiring `View` from `atom` is no longer supported. - Please require `atom-space-pen-views` instead: - `{View} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - View + Object.defineProperty module.exports, 'View', get: -> + deprecate """ + Requiring `View` from `atom` is no longer supported. + Please require `atom-space-pen-views` instead: + `{View} = require 'atom-space-pen-views'` + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + View - Object.defineProperty module.exports, 'EditorView', get: -> - deprecate """ - Requiring `EditorView` from `atom` is no longer supported. - Please require `TextEditorView` from `atom-space-pen-view` instead: - `{TextEditorView} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - require '../src/text-editor-view' + Object.defineProperty module.exports, 'EditorView', get: -> + deprecate """ + Requiring `EditorView` from `atom` is no longer supported. + Please require `TextEditorView` from `atom-space-pen-view` instead: + `{TextEditorView} = require 'atom-space-pen-views'` + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + require '../src/text-editor-view' - Object.defineProperty module.exports, 'TextEditorView', get: -> - deprecate """ - Requiring `TextEditorView` from `atom` is no longer supported. - Please require `TextEditorView` from `atom-space-pen-view` instead: - `{TextEditorView} = require 'atom-space-pen-views'` - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - require '../src/text-editor-view' + Object.defineProperty module.exports, 'TextEditorView', get: -> + deprecate """ + Requiring `TextEditorView` from `atom` is no longer supported. + Please require `TextEditorView` from `atom-space-pen-view` instead: + `{TextEditorView} = require 'atom-space-pen-views'` + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + require '../src/text-editor-view' - Object.defineProperty module.exports, 'ScrollView', get: -> - deprecate """ - Requiring `ScrollView` from `atom` is no longer supported. - Please require `ScrollView` from `atom-space-pen-view` instead: - `{ScrollView} = require 'atom-space-pen-views'` - Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - require '../src/scroll-view' + Object.defineProperty module.exports, 'ScrollView', get: -> + deprecate """ + Requiring `ScrollView` from `atom` is no longer supported. + Please require `ScrollView` from `atom-space-pen-view` instead: + `{ScrollView} = require 'atom-space-pen-views'` + Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + require '../src/scroll-view' - Object.defineProperty module.exports, 'SelectListView', get: -> - deprecate """ - Requiring `SelectListView` from `atom` is no longer supported. - Please require `SelectListView` from `atom-space-pen-view` instead: - `{SelectListView} = require 'atom-space-pen-views'` - Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views - Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. - """ - require '../src/select-list-view' + Object.defineProperty module.exports, 'SelectListView', get: -> + deprecate """ + Requiring `SelectListView` from `atom` is no longer supported. + Please require `SelectListView` from `atom-space-pen-view` instead: + `{SelectListView} = require 'atom-space-pen-views'` + Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views + Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies. + """ + require '../src/select-list-view' - Object.defineProperty module.exports, 'React', get: -> - deprecate "Please require `react-atom-fork` instead: `React = require 'react-atom-fork'`. Add `\"react-atom-fork\": \"^0.11\"` to your package dependencies." - require 'react-atom-fork' + Object.defineProperty module.exports, 'React', get: -> + deprecate "Please require `react-atom-fork` instead: `React = require 'react-atom-fork'`. Add `\"react-atom-fork\": \"^0.11\"` to your package dependencies." + require 'react-atom-fork' - Object.defineProperty module.exports, 'Reactionary', get: -> - deprecate "Please require `reactionary-atom-fork` instead: `Reactionary = require 'reactionary-atom-fork'`. Add `\"reactionary-atom-fork\": \"^0.9\"` to your package dependencies." - require 'reactionary-atom-fork' + Object.defineProperty module.exports, 'Reactionary', get: -> + deprecate "Please require `reactionary-atom-fork` instead: `Reactionary = require 'reactionary-atom-fork'`. Add `\"reactionary-atom-fork\": \"^0.9\"` to your package dependencies." + require 'reactionary-atom-fork' -Object.defineProperty module.exports, 'Git', get: -> - deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`" - module.exports.GitRepository +if includeDeprecations + Object.defineProperty module.exports, 'Git', get: -> + deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`" + module.exports.GitRepository diff --git a/src/styles-element.coffee b/src/styles-element.coffee index fc3b888cf..eaf7c53c8 100644 --- a/src/styles-element.coffee +++ b/src/styles-element.coffee @@ -1,4 +1,5 @@ {Emitter, CompositeDisposable} = require 'event-kit' +{includeDeprecations} = require 'grim' class StylesElement extends HTMLElement subscriptions: null @@ -18,7 +19,7 @@ class StylesElement extends HTMLElement @styleElementClonesByOriginalElement = new WeakMap attachedCallback: -> - if @context is 'atom-text-editor' + if includeDeprecations and @context is 'atom-text-editor' for styleElement in @children @upgradeDeprecatedSelectors(styleElement) @initialize() @@ -66,7 +67,7 @@ class StylesElement extends HTMLElement @insertBefore(styleElementClone, insertBefore) - if @context is 'atom-text-editor' + if includeDeprecations and @context is 'atom-text-editor' @upgradeDeprecatedSelectors(styleElementClone) @emitter.emit 'did-add-style-element', styleElementClone From bc58574238a377493fa9ebe2c7456d7f388dbeb6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:41:27 -0700 Subject: [PATCH 315/521] Conditionally include deprecations in Cursor --- src/cursor.coffee | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/cursor.coffee b/src/cursor.coffee index 1656b9dc2..a930666c3 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -39,13 +39,13 @@ class Cursor extends Model textChanged: textChanged cursor: this - @emit 'moved', movedEvent + @emit 'moved', movedEvent if Grim.includeDeprecations @emitter.emit 'did-change-position', movedEvent @editor.cursorMoved(movedEvent) @marker.onDidDestroy => @destroyed = true @editor.removeCursor(this) - @emit 'destroyed' + @emit 'destroyed' if Grim.includeDeprecations @emitter.emit 'did-destroy' @emitter.dispose() @@ -89,6 +89,8 @@ class Cursor extends Model @emitter.on 'did-change-visibility', callback on: (eventName) -> + return unless Grim.includeDeprecations + switch eventName when 'moved' Grim.deprecate("Use Cursor::onDidChangePosition instead") @@ -222,9 +224,6 @@ class Cursor extends Model # Returns a {ScopeDescriptor} getScopeDescriptor: -> @editor.scopeDescriptorForBufferPosition(@getBufferPosition()) - getScopes: -> - Grim.deprecate 'Use Cursor::getScopeDescriptor() instead' - @getScopeDescriptor().getScopesArray() # Public: Returns true if this cursor has no non-whitespace characters before # its current position. @@ -476,10 +475,6 @@ class Cursor extends Model endOfWordPosition or currentBufferPosition - getMoveNextWordBoundaryBufferPosition: (options) -> - Grim.deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead' - @getNextWordBoundaryBufferPosition(options) - # Public: Retrieves the buffer position of where the current word starts. # # * `options` (optional) An {Object} with the following keys: @@ -593,7 +588,7 @@ class Cursor extends Model setVisible: (visible) -> if @visible != visible @visible = visible - @emit 'visibility-changed', @visible + @emit 'visibility-changed', @visible if Grim.includeDeprecations @emitter.emit 'did-change-visibility', @visible # Public: Returns the visibility of the cursor. @@ -686,3 +681,12 @@ class Cursor extends Model position = range.start stop() position + +if Grim.includeDeprecations + Cursor::getScopes = -> + Grim.deprecate 'Use Cursor::getScopeDescriptor() instead' + @getScopeDescriptor().getScopesArray() + + Cursor::getMoveNextWordBoundaryBufferPosition = (options) -> + Grim.deprecate 'Use `::getNextWordBoundaryBufferPosition(options)` instead' + @getNextWordBoundaryBufferPosition(options) From 4884e32a3df1261296aa276ac12764e530628664 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:41:40 -0700 Subject: [PATCH 316/521] Conditionally include deprecations in ContextMenuManager --- src/context-menu-manager.coffee | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index ed91f5e6c..69caa5d6d 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -101,25 +101,26 @@ class ContextMenuManager # with the following argument: # * `event` The click event that deployed the context menu. add: (itemsBySelector) -> - # Detect deprecated file path as first argument - if itemsBySelector? and typeof itemsBySelector isnt 'object' - Grim.deprecate """ - ContextMenuManager::add has changed to take a single object as its - argument. Please see - https://atom.io/docs/api/latest/ContextMenuManager for more info. - """ - itemsBySelector = arguments[1] - devMode = arguments[2]?.devMode - - # Detect deprecated format for items object - for key, value of itemsBySelector - unless _.isArray(value) + if Grim.includeDeprecations + # Detect deprecated file path as first argument + if itemsBySelector? and typeof itemsBySelector isnt 'object' Grim.deprecate """ ContextMenuManager::add has changed to take a single object as its argument. Please see https://atom.io/docs/api/latest/ContextMenuManager for more info. """ - itemsBySelector = @convertLegacyItemsBySelector(itemsBySelector, devMode) + itemsBySelector = arguments[1] + devMode = arguments[2]?.devMode + + # Detect deprecated format for items object + for key, value of itemsBySelector + unless _.isArray(value) + Grim.deprecate """ + ContextMenuManager::add has changed to take a single object as its + argument. Please see + https://atom.io/docs/api/latest/ContextMenuManager for more info. + """ + itemsBySelector = @convertLegacyItemsBySelector(itemsBySelector, devMode) addedItemSets = [] From 2d9eaa5c7529210c575189421e15621d961b2fe0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:45:18 -0700 Subject: [PATCH 317/521] Conditionally include deprecations in Decoration --- src/decoration.coffee | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/decoration.coffee b/src/decoration.coffee index cbf649473..92316042c 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -30,7 +30,6 @@ nextId = -> idCounter++ # the marker. module.exports = class Decoration - EmitterMixin.includeInto(this) # Private: Check if the `decorationProperties.type` matches `type` # @@ -123,9 +122,6 @@ class Decoration # Essential: Returns the {Decoration}'s properties. getProperties: -> @properties - getParams: -> - Grim.deprecate 'Use Decoration::getProperties instead' - @getProperties() # Essential: Update the marker with new Properties. Allows you to change the decoration's class. # @@ -143,9 +139,6 @@ class Decoration @properties.id = @id @emit 'updated', {oldParams: oldProperties, newParams: newProperties} @emitter.emit 'did-change-properties', {oldProperties, newProperties} - update: (newProperties) -> - Grim.deprecate 'Use Decoration::setProperties instead' - @setProperties(newProperties) ### Section: Private methods @@ -171,7 +164,10 @@ class Decoration return @flashQueue.shift() if @flashQueue?.length > 0 null - on: (eventName) -> +if Grim.includeDeprecations + EmitterMixin.includeInto(Decoration) + + Decoration::on = (eventName) -> switch eventName when 'updated' Grim.deprecate 'Use Decoration::onDidChangeProperties instead' @@ -183,3 +179,11 @@ class Decoration Grim.deprecate 'Decoration::on is deprecated. Use event subscription methods instead.' EmitterMixin::on.apply(this, arguments) + + Decoration::getParams = -> + Grim.deprecate 'Use Decoration::getProperties instead' + @getProperties() + + Decoration::update = -> (newProperties) -> + Grim.deprecate 'Use Decoration::setProperties instead' + @setProperties(newProperties) From 1fdbd4db3fc9788466d844432958beb50c8018c3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:46:00 -0700 Subject: [PATCH 318/521] Conditionally include deprecations in DeserializerManager --- src/deserializer-manager.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/deserializer-manager.coffee b/src/deserializer-manager.coffee index 40c5ea7f3..4efc71ec5 100644 --- a/src/deserializer-manager.coffee +++ b/src/deserializer-manager.coffee @@ -37,11 +37,6 @@ class DeserializerManager delete @deserializers[deserializer.name] for deserializer in deserializers return - remove: (classes...) -> - Grim.deprecate("Call .dispose() on the Disposable return from ::add instead") - delete @deserializers[name] for {name} in classes - return - # Public: Deserialize the state and params. # # * `state` The state {Object} to deserialize. @@ -65,3 +60,9 @@ class DeserializerManager name = state.get?('deserializer') ? state.deserializer @deserializers[name] + +if Grim.includeDeprecations + DeserializerManager::remove = (classes...) -> + Grim.deprecate("Call .dispose() on the Disposable return from ::add instead") + delete @deserializers[name] for {name} in classes + return From 15c48c5388a5e7ecfb0ed6a40693873d3a88eb67 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:49:44 -0700 Subject: [PATCH 319/521] Conditionally include deprecations in DisplayBuffer --- src/display-buffer.coffee | 69 ++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 6ec4ce859..aef36fc99 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -151,38 +151,11 @@ class DisplayBuffer extends Model onDidUpdateMarkers: (callback) -> @emitter.on 'did-update-markers', callback - on: (eventName) -> - switch eventName - when 'changed' - Grim.deprecate("Use DisplayBuffer::onDidChange instead") - when 'grammar-changed' - Grim.deprecate("Use DisplayBuffer::onDidChangeGrammar instead") - when 'soft-wrap-changed' - Grim.deprecate("Use DisplayBuffer::onDidChangeSoftWrap instead") - when 'character-widths-changed' - Grim.deprecate("Use DisplayBuffer::onDidChangeCharacterWidths instead") - when 'decoration-added' - Grim.deprecate("Use DisplayBuffer::onDidAddDecoration instead") - when 'decoration-removed' - Grim.deprecate("Use DisplayBuffer::onDidRemoveDecoration instead") - when 'decoration-changed' - Grim.deprecate("Use decoration.getMarker().onDidChange() instead") - when 'decoration-updated' - Grim.deprecate("Use Decoration::onDidChangeProperties instead") - when 'marker-created' - Grim.deprecate("Use Decoration::onDidCreateMarker instead") - when 'markers-updated' - Grim.deprecate("Use Decoration::onDidUpdateMarkers instead") - else - Grim.deprecate("DisplayBuffer::on is deprecated. Use event subscription methods instead.") - - EmitterMixin::on.apply(this, arguments) - emitDidChange: (eventProperties, refreshMarkers=true) -> if refreshMarkers @pauseMarkerChangeEvents() @refreshMarkerScreenPositions() - @emit 'changed', eventProperties + @emit 'changed', eventProperties if Grim.includeDeprecations @emitter.emit 'did-change', eventProperties @resumeMarkerChangeEvents() @@ -336,7 +309,7 @@ class DisplayBuffer extends Model characterWidthsChanged: -> @computeScrollWidth() - @emit 'character-widths-changed', @scopedCharacterWidthsChangeCount + @emit 'character-widths-changed', @scopedCharacterWidthsChangeCount if Grim.includeDeprecations @emitter.emit 'did-change-character-widths', @scopedCharacterWidthsChangeCount clearScopedCharWidths: -> @@ -454,7 +427,7 @@ class DisplayBuffer extends Model @softWrapped = softWrapped @updateWrappedScreenLines() softWrapped = @isSoftWrapped() - @emit 'soft-wrap-changed', softWrapped + @emit 'soft-wrap-changed', softWrapped if Grim.includeDeprecations @emitter.emit 'did-change-soft-wrapped', softWrapped softWrapped else @@ -938,7 +911,7 @@ class DisplayBuffer extends Model @decorationsByMarkerId[marker.id] ?= [] @decorationsByMarkerId[marker.id].push(decoration) @decorationsById[decoration.id] = decoration - @emit 'decoration-added', decoration + @emit 'decoration-added', decoration if Grim.includeDeprecations @emitter.emit 'did-add-decoration', decoration decoration @@ -950,7 +923,7 @@ class DisplayBuffer extends Model if index > -1 decorations.splice(index, 1) delete @decorationsById[decoration.id] - @emit 'decoration-removed', decoration + @emit 'decoration-removed', decoration if Grim.includeDeprecations @emitter.emit 'did-remove-decoration', decoration delete @decorationsByMarkerId[marker.id] if decorations.length is 0 @@ -1102,7 +1075,7 @@ class DisplayBuffer extends Model resumeMarkerChangeEvents: -> marker.resumeChangeEvents() for marker in @getMarkers() - @emit 'markers-updated' + @emit 'markers-updated' if Grim.includeDeprecations @emitter.emit 'did-update-markers' refreshMarkerScreenPositions: -> @@ -1244,7 +1217,7 @@ class DisplayBuffer extends Model if marker = @getMarker(textBufferMarker.id) # The marker might have been removed in some other handler called before # this one. Only emit when the marker still exists. - @emit 'marker-created', marker + @emit 'marker-created', marker if Grim.includeDeprecations @emitter.emit 'did-create-marker', marker createFoldForMarker: (marker) -> @@ -1253,3 +1226,31 @@ class DisplayBuffer extends Model foldForMarker: (marker) -> @foldsByMarkerId[marker.id] + +if Grim.includeDeprecations + DisplayBuffer::on = (eventName) -> + switch eventName + when 'changed' + Grim.deprecate("Use DisplayBuffer::onDidChange instead") + when 'grammar-changed' + Grim.deprecate("Use DisplayBuffer::onDidChangeGrammar instead") + when 'soft-wrap-changed' + Grim.deprecate("Use DisplayBuffer::onDidChangeSoftWrap instead") + when 'character-widths-changed' + Grim.deprecate("Use DisplayBuffer::onDidChangeCharacterWidths instead") + when 'decoration-added' + Grim.deprecate("Use DisplayBuffer::onDidAddDecoration instead") + when 'decoration-removed' + Grim.deprecate("Use DisplayBuffer::onDidRemoveDecoration instead") + when 'decoration-changed' + Grim.deprecate("Use decoration.getMarker().onDidChange() instead") + when 'decoration-updated' + Grim.deprecate("Use Decoration::onDidChangeProperties instead") + when 'marker-created' + Grim.deprecate("Use Decoration::onDidCreateMarker instead") + when 'markers-updated' + Grim.deprecate("Use Decoration::onDidUpdateMarkers instead") + else + Grim.deprecate("DisplayBuffer::on is deprecated. Use event subscription methods instead.") + + EmitterMixin::on.apply(this, arguments) From efcfcc73a4c414ad899ec2d621604aceb8c27702 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:54:13 -0700 Subject: [PATCH 320/521] Conditionally include deprecations in GitRepository --- src/git-repository.coffee | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index ae10e7459..2fb61bdff 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -5,7 +5,7 @@ EmitterMixin = require('emissary').Emitter {Emitter, Disposable, CompositeDisposable} = require 'event-kit' fs = require 'fs-plus' GitUtils = require 'git-utils' -{deprecate} = require 'grim' +{includeDeprecations, deprecate} = require 'grim' Task = require './task' @@ -155,16 +155,6 @@ class GitRepository onDidChangeStatuses: (callback) -> @emitter.on 'did-change-statuses', callback - on: (eventName) -> - switch eventName - when 'status-changed' - deprecate 'Use GitRepository::onDidChangeStatus instead' - when 'statuses-changed' - deprecate 'Use GitRepository::onDidChangeStatuses instead' - else - deprecate 'GitRepository::on is deprecated. Use event subscription methods instead.' - EmitterMixin::on.apply(this, arguments) - ### Section: Repository Details ### @@ -252,9 +242,6 @@ class GitRepository # * `path` (optional) {String} path in the repository to get this information # for, only needed if the repository has submodules. getOriginURL: (path) -> @getConfigValue('remote.origin.url', path) - getOriginUrl: (path) -> - deprecate 'Use ::getOriginURL instead.' - @getOriginURL(path) # Public: Returns the upstream branch for the current HEAD, or null if there # is no upstream branch for the current HEAD. @@ -492,3 +479,18 @@ class GitRepository unless statusesUnchanged @emit 'statuses-changed' @emitter.emit 'did-change-statuses' + +if includeDeprecations + GitRepository::on = (eventName) -> + switch eventName + when 'status-changed' + deprecate 'Use GitRepository::onDidChangeStatus instead' + when 'statuses-changed' + deprecate 'Use GitRepository::onDidChangeStatuses instead' + else + deprecate 'GitRepository::on is deprecated. Use event subscription methods instead.' + EmitterMixin::on.apply(this, arguments) + + GitRepository::getOriginUrl = (path) -> + deprecate 'Use ::getOriginURL instead.' + @getOriginURL(path) From 00b31c5c6e1cab3ae55fd7c21a325cc3c320712a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:54:54 -0700 Subject: [PATCH 321/521] Conditionally include Emitter mixin --- src/git-repository.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 2fb61bdff..a14869655 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -1,7 +1,6 @@ {basename, join} = require 'path' _ = require 'underscore-plus' -EmitterMixin = require('emissary').Emitter {Emitter, Disposable, CompositeDisposable} = require 'event-kit' fs = require 'fs-plus' GitUtils = require 'git-utils' @@ -43,8 +42,6 @@ Task = require './task' # ``` module.exports = class GitRepository - EmitterMixin.includeInto(this) - @exists: (path) -> if git = @open(path) git.destroy() @@ -481,6 +478,9 @@ class GitRepository @emitter.emit 'did-change-statuses' if includeDeprecations + EmitterMixin = require('emissary').Emitter + EmitterMixin.includeInto(GitRepository) + GitRepository::on = (eventName) -> switch eventName when 'status-changed' From d799254cbbfee658d842a0d560d7c42e5692e231 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 12:59:27 -0700 Subject: [PATCH 322/521] Conditionally include deprecations in Marker --- src/marker.coffee | 60 +++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/src/marker.coffee b/src/marker.coffee index 962ebb7e7..798dcc12d 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -1,7 +1,5 @@ {Range} = require 'text-buffer' _ = require 'underscore-plus' -{Subscriber} = require 'emissary' -EmitterMixin = require('emissary').Emitter {Emitter} = require 'event-kit' Grim = require 'grim' @@ -45,9 +43,6 @@ Grim = require 'grim' # See {TextEditor::markBufferRange} for usage. module.exports = class Marker - EmitterMixin.includeInto(this) - Subscriber.includeInto(this) - bufferMarkerSubscription: null oldHeadBufferPosition: null oldHeadScreenPosition: null @@ -118,17 +113,6 @@ class Marker onDidDestroy: (callback) -> @emitter.on 'did-destroy', callback - on: (eventName) -> - switch eventName - when 'changed' - Grim.deprecate("Use Marker::onDidChange instead") - when 'destroyed' - Grim.deprecate("Use Marker::onDidDestroy instead") - else - Grim.deprecate("Marker::on is deprecated. Use documented event subscription methods instead.") - - EmitterMixin::on.apply(this, arguments) - ### Section: Marker Details ### @@ -161,9 +145,6 @@ class Marker # the marker. getProperties: -> @bufferMarker.getProperties() - getAttributes: -> - Grim.deprecate 'Use Marker::getProperties instead' - @getProperties() # Essential: Merges an {Object} containing new properties into the marker's # existing properties. @@ -171,16 +152,10 @@ class Marker # * `properties` {Object} setProperties: (properties) -> @bufferMarker.setProperties(properties) - setAttributes: (properties) -> - Grim.deprecate 'Use Marker::getProperties instead' - @setProperties(properties) matchesProperties: (attributes) -> attributes = @displayBuffer.translateToBufferMarkerParams(attributes) @bufferMarker.matchesParams(attributes) - matchesAttributes: (attributes) -> - Grim.deprecate 'Use Marker::matchesProperties instead' - @matchesProperties(attributes) ### Section: Comparing to other markers @@ -344,7 +319,7 @@ class Marker destroyed: -> delete @displayBuffer.markers[@id] - @emit 'destroyed' + @emit 'destroyed' if Grim.includeDeprecations @emitter.emit 'did-destroy' @emitter.dispose() @@ -375,7 +350,7 @@ class Marker if @deferredChangeEvents? @deferredChangeEvents.push(changeEvent) else - @emit 'changed', changeEvent + @emit 'changed', changeEvent if Grim.includeDeprecations @emitter.emit 'did-change', changeEvent @oldHeadBufferPosition = newHeadBufferPosition @@ -392,9 +367,38 @@ class Marker @deferredChangeEvents = null for event in deferredChangeEvents - @emit 'changed', event + @emit 'changed', event if Grim.includeDeprecations @emitter.emit 'did-change', event return getPixelRange: -> @displayBuffer.pixelRangeForScreenRange(@getScreenRange(), false) + +if Grim.includeDeprecations + {Subscriber} = require 'emissary' + EmitterMixin = require('emissary').Emitter + EmitterMixin.includeInto(Marker) + Subscriber.includeInto(Marker) + + Marker::on = (eventName) -> + switch eventName + when 'changed' + Grim.deprecate("Use Marker::onDidChange instead") + when 'destroyed' + Grim.deprecate("Use Marker::onDidDestroy instead") + else + Grim.deprecate("Marker::on is deprecated. Use documented event subscription methods instead.") + + EmitterMixin::on.apply(this, arguments) + + Marker::getAttributes = -> + Grim.deprecate 'Use Marker::getProperties instead' + @getProperties() + + Marker::setAttributes = (properties) -> + Grim.deprecate 'Use Marker::setProperties instead' + @setProperties(properties) + + Marker::matchesAttributes = (attributes) -> + Grim.deprecate 'Use Marker::matchesProperties instead' + @matchesProperties(attributes) From 729fe91e36837c228fa104a5aec9a6e8d5afeca1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:02:11 -0700 Subject: [PATCH 323/521] Conditionally include deprecations in Selection --- src/selection.coffee | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/selection.coffee b/src/selection.coffee index ea4b54034..2a2d1c98c 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -63,18 +63,6 @@ class Selection extends Model onDidDestroy: (callback) -> @emitter.on 'did-destroy', callback - on: (eventName) -> - switch eventName - when 'screen-range-changed' - Grim.deprecate("Use Selection::onDidChangeRange instead. Call ::getScreenRange() yourself in your callback if you need the range.") - when 'destroyed' - Grim.deprecate("Use Selection::onDidDestroy instead.") - else - Grim.deprecate("Selection::on is deprecated. Use documented event subscription methods instead.") - - super - - ### Section: Managing the selection range ### @@ -416,16 +404,6 @@ class Selection extends Model @selectLeft() if @isEmpty() and not @editor.isFoldedAtScreenRow(@cursor.getScreenRow()) @deleteSelectedText() - # Deprecated: Use {::deleteToBeginningOfWord} instead. - backspaceToBeginningOfWord: -> - deprecate("Use Selection::deleteToBeginningOfWord() instead") - @deleteToBeginningOfWord() - - # Deprecated: Use {::deleteToBeginningOfLine} instead. - backspaceToBeginningOfLine: -> - deprecate("Use Selection::deleteToBeginningOfLine() instead") - @deleteToBeginningOfLine() - # Public: Removes from the start of the selection to the beginning of the # current word if the selection is empty otherwise it deletes the selection. deleteToBeginningOfWord: -> @@ -789,3 +767,25 @@ class Selection extends Model getGoalScreenRange: -> if goalScreenRange = @marker.getProperties().goalScreenRange Range.fromObject(goalScreenRange) + +if Grim.includeDeprecations + Selection::on = (eventName) -> + switch eventName + when 'screen-range-changed' + Grim.deprecate("Use Selection::onDidChangeRange instead. Call ::getScreenRange() yourself in your callback if you need the range.") + when 'destroyed' + Grim.deprecate("Use Selection::onDidDestroy instead.") + else + Grim.deprecate("Selection::on is deprecated. Use documented event subscription methods instead.") + + super + + # Deprecated: Use {::deleteToBeginningOfWord} instead. + Selection::backspaceToBeginningOfWord = -> + deprecate("Use Selection::deleteToBeginningOfWord() instead") + @deleteToBeginningOfWord() + + # Deprecated: Use {::deleteToBeginningOfLine} instead. + Selection::backspaceToBeginningOfLine = -> + deprecate("Use Selection::deleteToBeginningOfLine() instead") + @deleteToBeginningOfLine() From baca3284f4be42cead249ba381bfa4118baa830f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:03:10 -0700 Subject: [PATCH 324/521] Conditionally include deprecations in TextEditorComponent --- src/text-editor-component.coffee | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 071d39271..c2babdca4 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -747,16 +747,6 @@ class TextEditorComponent setShowIndentGuide: (showIndentGuide) -> atom.config.set("editor.showIndentGuide", showIndentGuide) - # Deprecated - setInvisibles: (invisibles={}) -> - grim.deprecate "Use config.set('editor.invisibles', invisibles) instead" - atom.config.set('editor.invisibles', invisibles) - - # Deprecated - setShowInvisibles: (showInvisibles) -> - grim.deprecate "Use config.set('editor.showInvisibles', showInvisibles) instead" - atom.config.set('editor.showInvisibles', showInvisibles) - setScrollSensitivity: (scrollSensitivity) => if scrollSensitivity = parseInt(scrollSensitivity) @scrollSensitivity = Math.abs(scrollSensitivity) / 100 @@ -789,3 +779,14 @@ class TextEditorComponent updateParentViewMiniClass: -> @hostElement.classList.toggle('mini', @editor.isMini()) @rootElement.classList.toggle('mini', @editor.isMini()) + +if grim.includeDeprecations + # Deprecated + TextEditorComponent::setInvisibles = (invisibles={}) -> + grim.deprecate "Use config.set('editor.invisibles', invisibles) instead" + atom.config.set('editor.invisibles', invisibles) + + # Deprecated + TextEditorComponent::setShowInvisibles = (showInvisibles) -> + grim.deprecate "Use config.set('editor.showInvisibles', showInvisibles) instead" + atom.config.set('editor.showInvisibles', showInvisibles) From f91630553870b576ddf261217d29a95dada0ee0f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:06:54 -0700 Subject: [PATCH 325/521] Conditionally include deprecations in TokenizedBuffer --- src/tokenized-buffer.coffee | 40 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index cf7d15c28..303906ada 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -1,6 +1,5 @@ _ = require 'underscore-plus' {Model} = require 'theorist' -EmitterMixin = require('emissary').Emitter {Emitter} = require 'event-kit' {Point, Range} = require 'text-buffer' Serializable = require 'serializable' @@ -56,19 +55,6 @@ class TokenizedBuffer extends Model onDidTokenize: (callback) -> @emitter.on 'did-tokenize', callback - on: (eventName) -> - switch eventName - when 'changed' - Grim.deprecate("Use TokenizedBuffer::onDidChange instead") - when 'grammar-changed' - Grim.deprecate("Use TokenizedBuffer::onDidChangeGrammar instead") - when 'tokenized' - Grim.deprecate("Use TokenizedBuffer::onDidTokenize instead") - else - Grim.deprecate("TokenizedBuffer::on is deprecated. Use event subscription methods instead.") - - EmitterMixin::on.apply(this, arguments) - grammarAddedOrUpdated: (grammar) => if grammar.injectionSelector? @retokenizeLines() if @hasTokenForSelector(grammar.injectionSelector) @@ -94,7 +80,7 @@ class TokenizedBuffer extends Model @retokenizeLines() - @emit 'grammar-changed', grammar + @emit 'grammar-changed', grammar if Grim.includeDeprecations @emitter.emit 'did-change-grammar', grammar reloadGrammar: -> @@ -116,7 +102,7 @@ class TokenizedBuffer extends Model @invalidateRow(0) @fullyTokenized = false event = {start: 0, end: lastRow, delta: 0} - @emit 'changed', event + @emit 'changed', event if Grim.includeDeprecations @emitter.emit 'did-change', event setVisible: (@visible) -> @@ -178,7 +164,7 @@ class TokenizedBuffer extends Model [startRow, endRow] = @updateFoldableStatus(startRow, endRow) event = {start: startRow, end: endRow, delta: 0} - @emit 'changed', event + @emit 'changed', event if Grim.includeDeprecations @emitter.emit 'did-change', event if @firstInvalidRow()? @@ -188,7 +174,7 @@ class TokenizedBuffer extends Model markTokenizationComplete: -> unless @fullyTokenized - @emit 'tokenized' + @emit 'tokenized' if Grim.includeDeprecations @emitter.emit 'did-tokenize' @fullyTokenized = true @@ -235,7 +221,7 @@ class TokenizedBuffer extends Model end -= delta event = { start, end, delta, bufferChange: e } - @emit 'changed', event + @emit 'changed', event if Grim.includeDeprecations @emitter.emit 'did-change', event retokenizeWhitespaceRowsIfIndentLevelChanged: (row, increment) -> @@ -470,3 +456,19 @@ class TokenizedBuffer extends Model line = @tokenizedLineForRow(row).text console.log row, line, line.length return + +if Grim.includeDeprecations + EmitterMixin = require('emissary').Emitter + + TokenizedBuffer::on = (eventName) -> + switch eventName + when 'changed' + Grim.deprecate("Use TokenizedBuffer::onDidChange instead") + when 'grammar-changed' + Grim.deprecate("Use TokenizedBuffer::onDidChangeGrammar instead") + when 'tokenized' + Grim.deprecate("Use TokenizedBuffer::onDidTokenize instead") + else + Grim.deprecate("TokenizedBuffer::on is deprecated. Use event subscription methods instead.") + + EmitterMixin::on.apply(this, arguments) From 8375526ca658aa76e58f522c5cd91fac0b062760 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:23:08 -0700 Subject: [PATCH 326/521] Use CompositeDisposable instead of Subscriber mixin --- src/marker.coffee | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/marker.coffee b/src/marker.coffee index 798dcc12d..bd48eb48c 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -1,6 +1,6 @@ {Range} = require 'text-buffer' _ = require 'underscore-plus' -{Emitter} = require 'event-kit' +{CompositeDisposable, Emitter} = require 'event-kit' Grim = require 'grim' # Essential: Represents a buffer annotation that remains logically stationary @@ -57,6 +57,7 @@ class Marker constructor: ({@bufferMarker, @displayBuffer}) -> @emitter = new Emitter + @disposables = new CompositeDisposable @id = @bufferMarker.id @oldHeadBufferPosition = @getHeadBufferPosition() @oldHeadScreenPosition = @getHeadScreenPosition() @@ -64,14 +65,14 @@ class Marker @oldTailScreenPosition = @getTailScreenPosition() @wasValid = @isValid() - @subscribe @bufferMarker.onDidDestroy => @destroyed() - @subscribe @bufferMarker.onDidChange (event) => @notifyObservers(event) + @disposables.add @bufferMarker.onDidDestroy => @destroyed() + @disposables.add @bufferMarker.onDidChange (event) => @notifyObservers(event) # Essential: Destroys the marker, causing it to emit the 'destroyed' event. Once # destroyed, a marker cannot be restored by undo/redo operations. destroy: -> @bufferMarker.destroy() - @unsubscribe() + @disposables.dispose() # Essential: Creates and returns a new {Marker} with the same properties as this # marker. @@ -375,10 +376,8 @@ class Marker @displayBuffer.pixelRangeForScreenRange(@getScreenRange(), false) if Grim.includeDeprecations - {Subscriber} = require 'emissary' EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(Marker) - Subscriber.includeInto(Marker) Marker::on = (eventName) -> switch eventName From f7c4fa4bccdc5ae1f9d67de5d31f240591b14243 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:24:28 -0700 Subject: [PATCH 327/521] Only do legacy emits when deprecations are included --- src/git-repository.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index a14869655..0ae4abf3a 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -313,7 +313,7 @@ class GitRepository else delete @statuses[relativePath] if currentPathStatus isnt pathStatus - @emit 'status-changed', path, pathStatus + @emit 'status-changed', path, pathStatus if includeDeprecations @emitter.emit 'did-change-status', {path, pathStatus} pathStatus @@ -474,7 +474,7 @@ class GitRepository submoduleRepo.upstream = submodules[submodulePath]?.upstream ? {ahead: 0, behind: 0} unless statusesUnchanged - @emit 'statuses-changed' + @emit 'statuses-changed' if includeDeprecations @emitter.emit 'did-change-statuses' if includeDeprecations From 6a6036db580722b24faf437ff7b785035121f801 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:25:51 -0700 Subject: [PATCH 328/521] Add command for open dev and api preview modes --- src/browser/atom-application.coffee | 1 + src/workspace-element.coffee | 1 + 2 files changed, 2 insertions(+) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index fb9085416..ec4fe650a 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -159,6 +159,7 @@ class AtomApplication @on 'application:open-dev', -> @promptForPathToOpen('all', devMode: true) @on 'application:open-safe', -> @promptForPathToOpen('all', safeMode: true) @on 'application:open-api-preview', -> @promptForPathToOpen('all', apiPreviewMode: true) + @on 'application:open-dev-api-preview', -> @promptForPathToOpen('all', {apiPreviewMode: true, devMode: true}) @on 'application:inspect', ({x,y, atomWindow}) -> atomWindow ?= @focusedWindow() atomWindow?.browserWindow.inspectElement(x, y) diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 5afe2cf0e..f2805ff08 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -137,6 +137,7 @@ atom.commands.add 'atom-workspace', 'application:open-dev': -> ipc.send('command', 'application:open-dev') 'application:open-safe': -> ipc.send('command', 'application:open-safe') 'application:open-api-preview': -> ipc.send('command', 'application:open-api-preview') + 'application:open-dev-api-preview': -> ipc.send('command', 'application:open-dev-api-preview') 'application:minimize': -> ipc.send('command', 'application:minimize') 'application:zoom': -> ipc.send('command', 'application:zoom') 'application:bring-all-windows-to-front': -> ipc.send('command', 'application:bring-all-windows-to-front') From 914c1b55e51d8b411b86a06a85d15b953eecb520 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 13:28:56 -0700 Subject: [PATCH 329/521] Pass through apiPreviewMode flag --- src/browser/atom-application.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index ec4fe650a..45c0c8b5c 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -503,9 +503,9 @@ class AtomApplication # :safeMode - A Boolean which controls whether any newly opened windows # should be in safe mode or not. # :window - An {AtomWindow} to use for opening a selected file path. - promptForPathToOpen: (type, {devMode, safeMode, window}) -> + promptForPathToOpen: (type, {devMode, safeMode, apiPreviewMode, window}) -> @promptForPath type, (pathsToOpen) => - @openPaths({pathsToOpen, devMode, safeMode, window}) + @openPaths({pathsToOpen, devMode, safeMode, apiPreviewMode, window}) promptForPath: (type, callback) -> properties = From f34b6c9e95f8d778dc7b2f1258293ff8831da200 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 14:25:37 -0700 Subject: [PATCH 330/521] Conditionally include deprecations in GrammarRegistry --- src/grammar-registry.coffee | 42 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee index 911ffafbe..b95b561da 100644 --- a/src/grammar-registry.coffee +++ b/src/grammar-registry.coffee @@ -1,14 +1,6 @@ -_ = require 'underscore-plus' -{deprecate} = require 'grim' -{specificity} = require 'clear-cut' -{Subscriber} = require 'emissary' {Emitter} = require 'event-kit' +{includeDeprecations, deprecate} = require 'grim' FirstMate = require 'first-mate' -{ScopeSelector} = FirstMate -ScopedPropertyStore = require 'scoped-property-store' -PropertyAccessors = require 'property-accessors' - -{$, $$} = require './space-pen-extensions' Token = require './token' # Extended: Syntax class holding the grammars used for tokenizing. @@ -19,16 +11,12 @@ Token = require './token' # language-specific comment regexes. See {::getProperty} for more details. module.exports = class GrammarRegistry extends FirstMate.GrammarRegistry - PropertyAccessors.includeInto(this) - Subscriber.includeInto(this) - @deserialize: ({grammarOverridesByPath}) -> grammarRegistry = new GrammarRegistry() grammarRegistry.grammarOverridesByPath = grammarOverridesByPath grammarRegistry atom.deserializers.add(this) - atom.deserializers.add(name: 'Syntax', deserialize: @deserialize) # Support old serialization constructor: -> super(maxTokensPerLine: 100) @@ -49,28 +37,38 @@ class GrammarRegistry extends FirstMate.GrammarRegistry # Returns a {Grammar}, never null. selectGrammar: (filePath, fileContents) -> super + clearObservers: -> + @off() if includeDeprecations + @emitter = new Emitter + +if includeDeprecations + PropertyAccessors = require 'property-accessors' + PropertyAccessors.includeInto(GrammarRegistry) + + {Subscriber} = require 'emissary' + Subscriber.includeInto(GrammarRegistry) + + # Support old serialization + atom.deserializers.add(name: 'Syntax', deserialize: GrammarRegistry.deserialize) + # Deprecated: Used by settings-view to display snippets for packages - @::accessor 'propertyStore', -> + GrammarRegistry::accessor 'propertyStore', -> deprecate("Do not use this. Use a public method on Config") atom.config.scopedSettingsStore - addProperties: (args...) -> + GrammarRegistry::addProperties = (args...) -> args.unshift(null) if args.length == 2 deprecate 'Consider using atom.config.set() instead. A direct (but private) replacement is available at atom.config.addScopedSettings().' atom.config.addScopedSettings(args...) - removeProperties: (name) -> + GrammarRegistry::removeProperties = (name) -> deprecate 'atom.config.addScopedSettings() now returns a disposable you can call .dispose() on' atom.config.scopedSettingsStore.removeProperties(name) - getProperty: (scope, keyPath) -> + GrammarRegistry::getProperty = (scope, keyPath) -> deprecate 'A direct (but private) replacement is available at atom.config.getRawScopedValue().' atom.config.getRawScopedValue(scope, keyPath) - propertiesForScope: (scope, keyPath) -> + GrammarRegistry::propertiesForScope = (scope, keyPath) -> deprecate 'Use atom.config.getAll instead.' atom.config.settingsForScopeDescriptor(scope, keyPath) - - clearObservers: -> - @off() - @emitter = new Emitter From b9570be338eda576cede3b1d1987b3d5b58e74c3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 14:36:12 -0700 Subject: [PATCH 331/521] Conditionally include deprecations in PackageManager --- src/package-manager.coffee | 48 ++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 444497c5b..7399eaab1 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -1,7 +1,6 @@ path = require 'path' _ = require 'underscore-plus' -EmitterMixin = require('emissary').Emitter {Emitter} = require 'event-kit' fs = require 'fs-plus' Q = require 'q' @@ -28,8 +27,6 @@ ThemePackage = require './theme-package' # settings and also by calling `enablePackage()/disablePackage()`. module.exports = class PackageManager - EmitterMixin.includeInto(this) - constructor: ({configDirPath, @devMode, safeMode, @resourcePath}) -> @emitter = new Emitter @packageDirPaths = [] @@ -57,11 +54,6 @@ class PackageManager # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidLoadInitialPackages: (callback) -> @emitter.on 'did-load-initial-packages', callback - @emitter.on 'did-load-all', callback # TODO: Remove once deprecated pre-1.0 APIs are gone - - onDidLoadAll: (callback) -> - Grim.deprecate("Use `::onDidLoadInitialPackages` instead.") - @onDidLoadInitialPackages(callback) # Public: Invoke the given callback when all packages have been activated. # @@ -70,11 +62,6 @@ class PackageManager # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidActivateInitialPackages: (callback) -> @emitter.on 'did-activate-initial-packages', callback - @emitter.on 'did-activate-all', callback # TODO: Remove once deprecated pre-1.0 APIs are gone - - onDidActivateAll: (callback) -> - Grim.deprecate("Use `::onDidActivateInitialPackages` instead.") - @onDidActivateInitialPackages(callback) # Public: Invoke the given callback when a package is activated. # @@ -112,16 +99,6 @@ class PackageManager onDidUnloadPackage: (callback) -> @emitter.on 'did-unload-package', callback - on: (eventName) -> - switch eventName - when 'loaded' - Grim.deprecate 'Use PackageManager::onDidLoadInitialPackages instead' - when 'activated' - Grim.deprecate 'Use PackageManager::onDidActivateInitialPackages instead' - else - Grim.deprecate 'PackageManager::on is deprecated. Use event subscription methods instead.' - EmitterMixin::on.apply(this, arguments) - ### Section: Package system data ### @@ -331,7 +308,7 @@ class PackageManager packagePaths = packagePaths.filter (packagePath) => not @isPackageDisabled(path.basename(packagePath)) packagePaths = _.uniq packagePaths, (packagePath) -> path.basename(packagePath) @loadPackage(packagePath) for packagePath in packagePaths - @emit 'loaded' + @emit 'loaded' if Grim.includeDeprecations @emitter.emit 'did-load-initial-packages' loadPackage: (nameOrPath) -> @@ -380,7 +357,7 @@ class PackageManager packages = @getLoadedPackagesForTypes(types) promises = promises.concat(activator.activatePackages(packages)) Q.all(promises).then => - @emit 'activated' + @emit 'activated' if Grim.includeDeprecations @emitter.emit 'did-activate-initial-packages' # another type of package manager can handle other package types. @@ -432,3 +409,24 @@ class PackageManager stack = "#{error.stack}\n at #{metadataPath}:1:1" message = "Failed to load the #{path.basename(packagePath)} package" atom.notifications.addError(message, {stack, detail, dismissable: true}) + +if Grim.includeDeprecations + PackageManager::onDidLoadAll = (callback) -> + Grim.deprecate("Use `::onDidLoadInitialPackages` instead.") + @onDidLoadInitialPackages(callback) + + PackageManager::onDidActivateAll = (callback) -> + Grim.deprecate("Use `::onDidActivateInitialPackages` instead.") + @onDidActivateInitialPackages(callback) + + EmitterMixin = require('emissary').Emitter + EmitterMixin.includeInto(PackageManager) + PackageManager::on = (eventName) -> + switch eventName + when 'loaded' + Grim.deprecate 'Use PackageManager::onDidLoadInitialPackages instead' + when 'activated' + Grim.deprecate 'Use PackageManager::onDidActivateInitialPackages instead' + else + Grim.deprecate 'PackageManager::on is deprecated. Use event subscription methods instead.' + EmitterMixin::on.apply(this, arguments) From 484e78f09605c161c5f756fe66c460afcf0dec50 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 14:39:26 -0700 Subject: [PATCH 332/521] Conditionally include deprecations in Package --- src/package.coffee | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index ebc771123..7b590aab4 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -4,10 +4,9 @@ _ = require 'underscore-plus' async = require 'async' CSON = require 'season' fs = require 'fs-plus' -EmitterMixin = require('emissary').Emitter {Emitter, CompositeDisposable} = require 'event-kit' Q = require 'q' -{deprecate} = require 'grim' +{includeDeprecations, deprecate} = require 'grim' ModuleCache = require './module-cache' ScopedProperties = require './scoped-properties' @@ -21,8 +20,6 @@ catch error # stylesheets, keymaps, grammar, editor properties, and menus. module.exports = class Package - EmitterMixin.includeInto(this) - @isBundledPackagePath: (packagePath) -> if atom.packages.devMode return false unless atom.packages.resourcePath.startsWith("#{process.resourcesPath}#{path.sep}") @@ -43,11 +40,11 @@ class Package metadata ?= {} metadata.name = packageName - if metadata.stylesheetMain? + if includeDeprecations and metadata.stylesheetMain? deprecate("Use the `mainStyleSheet` key instead of `stylesheetMain` in the `package.json` of `#{packageName}`", {packageName}) metadata.mainStyleSheet = metadata.stylesheetMain - if metadata.stylesheets? + if includeDeprecations and metadata.stylesheets? deprecate("Use the `styleSheets` key instead of `stylesheets` in the `package.json` of `#{packageName}`", {packageName}) metadata.styleSheets = metadata.stylesheets @@ -87,14 +84,6 @@ class Package onDidDeactivate: (callback) -> @emitter.on 'did-deactivate', callback - on: (eventName) -> - switch eventName - when 'deactivated' - deprecate 'Use Package::onDidDeactivate instead' - else - deprecate 'Package::on is deprecated. Use event subscription methods instead.' - EmitterMixin::on.apply(this, arguments) - ### Section: Instance Methods ### @@ -174,7 +163,7 @@ class Package if @mainModule? if @mainModule.config? and typeof @mainModule.config is 'object' atom.config.setSchema @name, {type: 'object', properties: @mainModule.config} - else if @mainModule.configDefaults? and typeof @mainModule.configDefaults is 'object' + else if includeDeprecations and @mainModule.configDefaults? and typeof @mainModule.configDefaults is 'object' deprecate """Use a config schema instead. See the configuration section of https://atom.io/docs/latest/hacking-atom-package-word-count and https://atom.io/docs/api/latest/Config for more details""" @@ -268,7 +257,7 @@ class Package [stylesheetPath, atom.themes.loadStylesheet(stylesheetPath, true)] getStylesheetsPath: -> - if fs.isDirectorySync(path.join(@path, 'stylesheets')) + if includeDeprecations and fs.isDirectorySync(path.join(@path, 'stylesheets')) deprecate("Store package style sheets in the `styles/` directory instead of `stylesheets/` in the `#{@name}` package", packageName: @name) path.join(@path, 'stylesheets') else @@ -339,7 +328,7 @@ class Package deferred = Q.defer() - if fs.isDirectorySync(path.join(@path, 'scoped-properties')) + if includeDeprecations and fs.isDirectorySync(path.join(@path, 'scoped-properties')) settingsDirPath = path.join(@path, 'scoped-properties') deprecate("Store package settings files in the `settings/` directory instead of `scoped-properties/`", packageName: @name) else @@ -467,7 +456,7 @@ class Package else if _.isArray(commands) @activationCommands[selector].push(commands...) - if @metadata.activationEvents? + if includeDeprecations and @metadata.activationEvents? deprecate """ Use `activationCommands` instead of `activationEvents` in your package.json Commands should be grouped by selector as follows: @@ -585,3 +574,15 @@ class Package stack = error.stack ? error atom.notifications.addFatalError(message, {stack, detail, dismissable: true}) + +if includeDeprecations + EmitterMixin = require('emissary').Emitter + EmitterMixin.includeInto(Package) + + Package::on = (eventName) -> + switch eventName + when 'deactivated' + deprecate 'Use Package::onDidDeactivate instead' + else + deprecate 'Package::on is deprecated. Use event subscription methods instead.' + EmitterMixin::on.apply(this, arguments) From 193ab71aca7ad131e00ba6d47640c48140502315 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 14:43:15 -0700 Subject: [PATCH 333/521] Call dispose instead of unsubscribe on marker --- src/display-buffer.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index aef36fc99..27e2ae936 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -1084,7 +1084,7 @@ class DisplayBuffer extends Model return destroyed: -> - marker.unsubscribe() for id, marker of @markers + marker.disposables.dispose() for id, marker of @markers @scopedConfigSubscriptions.dispose() @unsubscribe() @tokenizedBuffer.destroy() From 7a52ef7d0a0a5f5fa9f17e8f2329654398fdc899 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 14:50:55 -0700 Subject: [PATCH 334/521] Use disposables in Atom --- src/atom.coffee | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 49a76481b..ace3245ef 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -7,7 +7,7 @@ shell = require 'shell' _ = require 'underscore-plus' {deprecate, includeDeprecations} = require 'grim' -{Emitter} = require 'event-kit' +{CompositeDisposable, Emitter} = require 'event-kit' {Model} = require 'theorist' fs = require 'fs-plus' {convertStackTrace, convertLine} = require 'coffeestack' @@ -198,6 +198,7 @@ class Atom extends Model # Call .loadOrCreate instead constructor: (@state) -> @emitter = new Emitter + @disposables = new CompositeDisposable {@mode} = @state DeserializerManager = require './deserializer-manager' @deserializers = new DeserializerManager() @@ -232,7 +233,9 @@ class Atom extends Model @emit 'uncaught-error', arguments... @emitter.emit 'did-throw-error', {message, url, line, column, originalError} - @unsubscribe() + @disposables?.dispose() + @disposables = new CompositeDisposable + @setBodyPlatformClass() @loadTime = null @@ -288,7 +291,7 @@ class Atom extends Model deprecate "The atom.syntax global is deprecated. Use atom.grammars instead." @grammars - @subscribe @packages.onDidActivateInitialPackages => @watchThemes() + @disposables.add @packages.onDidActivateInitialPackages => @watchThemes() Project = require './project' TextBuffer = require 'text-buffer' @@ -605,7 +608,7 @@ class Atom extends Model @requireUserInitScript() unless safeMode @menu.update() - @subscribe @config.onDidChange 'core.autoHideMenuBar', ({newValue}) => + @disposables.add @config.onDidChange 'core.autoHideMenuBar', ({newValue}) => @setAutoHideMenuBar(newValue) @setAutoHideMenuBar(true) if @config.get('core.autoHideMenuBar') @@ -755,7 +758,7 @@ class Atom extends Model # Notify the browser project of the window's current project path watchProjectPath: -> - @subscribe @project.onDidChangePaths => + @disposables.add @project.onDidChangePaths => @constructor.updateLoadSetting('initialPaths', @project.getPaths()) exit: (status) -> From 8eded9f9bdf5c3ae753cb3e62fc97e1943c781eb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 14:52:12 -0700 Subject: [PATCH 335/521] Use disposables in DisplayBuffer --- src/display-buffer.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 27e2ae936..277a79200 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -42,6 +42,7 @@ class DisplayBuffer extends Model super @emitter = new Emitter + @disposables = new CompositeDisposable @tokenizedBuffer ?= new TokenizedBuffer({tabLength, buffer, @invisibles}) @buffer = @tokenizedBuffer.buffer @@ -50,10 +51,10 @@ class DisplayBuffer extends Model @foldsByMarkerId = {} @decorationsById = {} @decorationsByMarkerId = {} - @subscribe @tokenizedBuffer.observeGrammar @subscribeToScopedConfigSettings - @subscribe @tokenizedBuffer.onDidChange @handleTokenizedBufferChange - @subscribe @buffer.onDidUpdateMarkers @handleBufferMarkersUpdated - @subscribe @buffer.onDidCreateMarker @handleBufferMarkerCreated + @disposables.add @tokenizedBuffer.observeGrammar @subscribeToScopedConfigSettings + @disposables.add @tokenizedBuffer.onDidChange @handleTokenizedBufferChange + @disposables.add @buffer.onDidUpdateMarkers @handleBufferMarkersUpdated + @disposables.add @buffer.onDidCreateMarker @handleBufferMarkerCreated @updateAllScreenLines() @createFoldForMarker(marker) for marker in @buffer.findMarkers(@getFoldMarkerAttributes()) @@ -907,7 +908,7 @@ class DisplayBuffer extends Model decorateMarker: (marker, decorationParams) -> marker = @getMarker(marker.id) decoration = new Decoration(marker, this, decorationParams) - @subscribe decoration.onDidDestroy => @removeDecoration(decoration) + @disposables.add decoration.onDidDestroy => @removeDecoration(decoration) @decorationsByMarkerId[marker.id] ?= [] @decorationsByMarkerId[marker.id].push(decoration) @decorationsById[decoration.id] = decoration @@ -1086,7 +1087,7 @@ class DisplayBuffer extends Model destroyed: -> marker.disposables.dispose() for id, marker of @markers @scopedConfigSubscriptions.dispose() - @unsubscribe() + @disposables.dispose() @tokenizedBuffer.destroy() logLines: (start=0, end=@getLastRow()) -> From 382974412fa4151a5e7ea9e900d1363cd4884a21 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 15:01:53 -0700 Subject: [PATCH 336/521] Conditionally include deprecations in Workspace --- src/workspace.coffee | 143 ++++++++++++++++++++++--------------------- 1 file changed, 73 insertions(+), 70 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 4afce1f37..a5a4e5e30 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -1,4 +1,4 @@ -{deprecate} = require 'grim' +{includeDeprecations, deprecate} = require 'grim' _ = require 'underscore-plus' path = require 'path' {join} = path @@ -33,16 +33,6 @@ class Workspace extends Model atom.deserializers.add(this) Serializable.includeInto(this) - Object.defineProperty @::, 'activePaneItem', - get: -> - Grim.deprecate "Use ::getActivePaneItem() instead of the ::activePaneItem property" - @getActivePaneItem() - - Object.defineProperty @::, 'activePane', - get: -> - Grim.deprecate "Use ::getActivePane() instead of the ::activePane property" - @getActivePane() - @properties paneContainer: null fullScreen: false @@ -342,32 +332,6 @@ class Workspace extends Model @onDidAddPaneItem ({item, pane, index}) -> callback({textEditor: item, pane, index}) if item instanceof TextEditor - eachEditor: (callback) -> - deprecate("Use Workspace::observeTextEditors instead") - - callback(editor) for editor in @getEditors() - @subscribe this, 'editor-created', (editor) -> callback(editor) - - getEditors: -> - deprecate("Use Workspace::getTextEditors instead") - - editors = [] - for pane in @paneContainer.getPanes() - editors.push(item) for item in pane.getItems() when item instanceof TextEditor - - editors - - on: (eventName) -> - switch eventName - when 'editor-created' - deprecate("Use Workspace::onDidAddTextEditor or Workspace::observeTextEditors instead.") - when 'uri-opened' - deprecate("Use Workspace::onDidOpen or Workspace::onDidAddPaneItem instead. https://atom.io/docs/api/latest/Workspace#instance-onDidOpen") - else - deprecate("Subscribing via ::on is deprecated. Use documented event subscription methods instead.") - - super - ### Section: Opening ### @@ -425,7 +389,7 @@ class Workspace extends Model # the containing pane. Defaults to `true`. openSync: (uri='', options={}) -> # TODO: Remove deprecated changeFocus option - if options.changeFocus? + if includeDeprecations and options.changeFocus? deprecate("The `changeFocus` option has been renamed to `activatePane`") options.activatePane = options.changeFocus delete options.changeFocus @@ -446,7 +410,7 @@ class Workspace extends Model openURIInPane: (uri, pane, options={}) -> # TODO: Remove deprecated changeFocus option - if options.changeFocus? + if includeDeprecations and options.changeFocus? deprecate("The `changeFocus` option has been renamed to `activatePane`") options.activatePane = options.changeFocus delete options.changeFocus @@ -496,12 +460,6 @@ class Workspace extends Model else Q() - # Deprecated - reopenItemSync: -> - deprecate("Use Workspace::reopenItem instead") - if uri = @destroyedItemURIs.pop() - @openSync(uri) - # Public: Register an opener for a uri. # # An {TextEditor} will be used if no openers return a value. @@ -519,24 +477,20 @@ class Workspace extends Model # Returns a {Disposable} on which `.dispose()` can be called to remove the # opener. addOpener: (opener) -> - packageName = @getCallingPackageName() + if includeDeprecations + packageName = @getCallingPackageName() - wrappedOpener = (uri, options) -> - item = opener(uri, options) - if item? and typeof item.getUri is 'function' and typeof item.getURI isnt 'function' - Grim.deprecate("Pane item with class `#{item.constructor.name}` should implement `::getURI` instead of `::getUri`.", {packageName}) - item + wrappedOpener = (uri, options) -> + item = opener(uri, options) + if item? and typeof item.getUri is 'function' and typeof item.getURI isnt 'function' + Grim.deprecate("Pane item with class `#{item.constructor.name}` should implement `::getURI` instead of `::getUri`.", {packageName}) + item - @openers.push(wrappedOpener) - new Disposable => _.remove(@openers, wrappedOpener) - - registerOpener: (opener) -> - Grim.deprecate("Call Workspace::addOpener instead") - @addOpener(opener) - - unregisterOpener: (opener) -> - Grim.deprecate("Call .dispose() on the Disposable returned from ::addOpener instead") - _.remove(@openers, opener) + @openers.push(wrappedOpener) + new Disposable => _.remove(@openers, wrappedOpener) + else + @openers.push(opener) + new Disposable => _.remove(@openers, opener) getOpeners: -> @openers @@ -599,11 +553,6 @@ class Workspace extends Model activeItem = @getActivePaneItem() activeItem if activeItem instanceof TextEditor - # Deprecated - getActiveEditor: -> - Grim.deprecate "Call ::getActiveTextEditor instead" - @getActivePane()?.getActiveEditor() - # Save all pane items. saveAll: -> @paneContainer.saveAll() @@ -667,10 +616,6 @@ class Workspace extends Model paneForURI: (uri) -> @paneContainer.paneForURI(uri) - paneForUri: (uri) -> - deprecate("Use ::paneForURI instead.") - @paneForURI(uri) - # Extended: Get the {Pane} containing the given item. # # * `item` Item the returned pane contains. @@ -945,3 +890,61 @@ class Workspace extends Model checkFinished() deferred.promise + +if includeDeprecations + Object.defineProperty Workspace::, 'activePaneItem', + get: -> + Grim.deprecate "Use ::getActivePaneItem() instead of the ::activePaneItem property" + @getActivePaneItem() + + Object.defineProperty Workspace::, 'activePane', + get: -> + Grim.deprecate "Use ::getActivePane() instead of the ::activePane property" + @getActivePane() + + Workspace::eachEditor = (callback) -> + deprecate("Use Workspace::observeTextEditors instead") + + callback(editor) for editor in @getEditors() + @subscribe this, 'editor-created', (editor) -> callback(editor) + + Workspace::getEditors = -> + deprecate("Use Workspace::getTextEditors instead") + + editors = [] + for pane in @paneContainer.getPanes() + editors.push(item) for item in pane.getItems() when item instanceof TextEditor + + editors + + Workspace::on = (eventName) -> + switch eventName + when 'editor-created' + deprecate("Use Workspace::onDidAddTextEditor or Workspace::observeTextEditors instead.") + when 'uri-opened' + deprecate("Use Workspace::onDidOpen or Workspace::onDidAddPaneItem instead. https://atom.io/docs/api/latest/Workspace#instance-onDidOpen") + else + deprecate("Subscribing via ::on is deprecated. Use documented event subscription methods instead.") + + super + + Workspace::reopenItemSync = -> + deprecate("Use Workspace::reopenItem instead") + if uri = @destroyedItemURIs.pop() + @openSync(uri) + + Workspace::registerOpener = (opener) -> + Grim.deprecate("Call Workspace::addOpener instead") + @addOpener(opener) + + Workspace::unregisterOpener = (opener) -> + Grim.deprecate("Call .dispose() on the Disposable returned from ::addOpener instead") + _.remove(@openers, opener) + + Workspace::getActiveEditor = -> + Grim.deprecate "Call ::getActiveTextEditor instead" + @getActivePane()?.getActiveEditor() + + Workspace::paneForUri = (uri) -> + deprecate("Use ::paneForURI instead.") + @paneForURI(uri) From 8e56a252e014121a147e6386635547d8a99f4447 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 15:02:56 -0700 Subject: [PATCH 337/521] Only call emit when deprecations are included --- src/decoration.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/decoration.coffee b/src/decoration.coffee index 92316042c..b3ad4b7ff 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -66,7 +66,7 @@ class Decoration @markerDestroyDisposable.dispose() @markerDestroyDisposable = null @destroyed = true - @emit 'destroyed' + @emit 'destroyed' if Grim.includeDeprecations @emitter.emit 'did-destroy' @emitter.dispose() @@ -137,7 +137,7 @@ class Decoration oldProperties = @properties @properties = newProperties @properties.id = @id - @emit 'updated', {oldParams: oldProperties, newParams: newProperties} + @emit 'updated', {oldParams: oldProperties, newParams: newProperties} if Grim.includeDeprecations @emitter.emit 'did-change-properties', {oldProperties, newProperties} ### @@ -157,7 +157,7 @@ class Decoration flashObject = {class: klass, duration} @flashQueue ?= [] @flashQueue.push(flashObject) - @emit 'flash' + @emit 'flash' if Grim.includeDeprecations @emitter.emit 'did-flash' consumeNextFlash: -> From b0b9172154d523f9a1e04af62f65138a27401f4d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 15:24:40 -0700 Subject: [PATCH 338/521] Conditionally include deprecations in TextEditor --- src/text-editor.coffee | 437 +++++++++++++++++++++-------------------- 1 file changed, 226 insertions(+), 211 deletions(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 548725cf6..1821a8a52 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2,7 +2,7 @@ _ = require 'underscore-plus' path = require 'path' Serializable = require 'serializable' Delegator = require 'delegato' -{deprecate} = require 'grim' +{includeDeprecations, deprecate} = require 'grim' {Model} = require 'theorist' EmitterMixin = require('emissary').Emitter {CompositeDisposable, Emitter} = require 'event-kit' @@ -174,9 +174,6 @@ class TextEditor extends Model subscriptions.add atom.config.onDidChange 'editor.showInvisibles', scope: scopeDescriptor, => @updateInvisibles() subscriptions.add atom.config.onDidChange 'editor.invisibles', scope: scopeDescriptor, => @updateInvisibles() - getViewClass: -> - require './text-editor-view' - destroyed: -> @unsubscribe() @scopedConfigSubscriptions.dispose() @@ -461,76 +458,12 @@ class TextEditor extends Model onDidChangeIcon: (callback) -> @emitter.on 'did-change-icon', callback - on: (eventName) -> - switch eventName - when 'title-changed' - deprecate("Use TextEditor::onDidChangeTitle instead") - when 'path-changed' - deprecate("Use TextEditor::onDidChangePath instead") - when 'modified-status-changed' - deprecate("Use TextEditor::onDidChangeModified instead") - when 'soft-wrap-changed' - deprecate("Use TextEditor::onDidChangeSoftWrapped instead") - when 'grammar-changed' - deprecate("Use TextEditor::onDidChangeGrammar instead") - when 'character-widths-changed' - deprecate("Use TextEditor::onDidChangeCharacterWidths instead") - when 'contents-modified' - deprecate("Use TextEditor::onDidStopChanging instead") - when 'contents-conflicted' - deprecate("Use TextEditor::onDidConflict instead") - - when 'will-insert-text' - deprecate("Use TextEditor::onWillInsertText instead") - when 'did-insert-text' - deprecate("Use TextEditor::onDidInsertText instead") - - when 'cursor-added' - deprecate("Use TextEditor::onDidAddCursor instead") - when 'cursor-removed' - deprecate("Use TextEditor::onDidRemoveCursor instead") - when 'cursor-moved' - deprecate("Use TextEditor::onDidChangeCursorPosition instead") - - when 'selection-added' - deprecate("Use TextEditor::onDidAddSelection instead") - when 'selection-removed' - deprecate("Use TextEditor::onDidRemoveSelection instead") - when 'selection-screen-range-changed' - deprecate("Use TextEditor::onDidChangeSelectionRange instead") - - when 'decoration-added' - deprecate("Use TextEditor::onDidAddDecoration instead") - when 'decoration-removed' - deprecate("Use TextEditor::onDidRemoveDecoration instead") - when 'decoration-updated' - deprecate("Use Decoration::onDidChangeProperties instead. You will get the decoration back from `TextEditor::decorateMarker()`") - when 'decoration-changed' - deprecate("Use Marker::onDidChange instead. e.g. `editor::decorateMarker(...).getMarker().onDidChange()`") - - when 'screen-lines-changed' - deprecate("Use TextEditor::onDidChange instead") - - when 'scroll-top-changed' - deprecate("Use TextEditor::onDidChangeScrollTop instead") - when 'scroll-left-changed' - deprecate("Use TextEditor::onDidChangeScrollLeft instead") - - else - deprecate("TextEditor::on is deprecated. Use documented event subscription methods instead.") - - EmitterMixin::on.apply(this, arguments) - # Retrieves the current {TextBuffer}. getBuffer: -> @buffer # Retrieves the current buffer's URI. getURI: -> @buffer.getUri() - getUri: -> - deprecate("Use `::getURI` instead") - @getURI() - # Create an {TextEditor} with its initial state based on this object copy: -> displayBuffer = @displayBuffer.copy() @@ -698,9 +631,6 @@ class TextEditor extends Model # # * `bufferRow` A {Number} representing a zero-indexed buffer row. lineTextForBufferRow: (bufferRow) -> @buffer.lineForRow(bufferRow) - lineForBufferRow: (bufferRow) -> - deprecate 'Use TextEditor::lineTextForBufferRow(bufferRow) instead' - @lineTextForBufferRow(bufferRow) # Essential: Returns a {String} representing the contents of the line at the # given screen row. @@ -714,23 +644,9 @@ class TextEditor extends Model # # Returns {TokenizedLine} tokenizedLineForScreenRow: (screenRow) -> @displayBuffer.tokenizedLineForScreenRow(screenRow) - lineForScreenRow: (screenRow) -> - deprecate "TextEditor::tokenizedLineForScreenRow(bufferRow) is the new name. But it's private. Try to use TextEditor::lineTextForScreenRow instead" - @tokenizedLineForScreenRow(screenRow) # {Delegates to: DisplayBuffer.tokenizedLinesForScreenRows} tokenizedLinesForScreenRows: (start, end) -> @displayBuffer.tokenizedLinesForScreenRows(start, end) - linesForScreenRows: (start, end) -> - deprecate "Use TextEditor::tokenizedLinesForScreenRows instead" - @tokenizedLinesForScreenRows(start, end) - - # Returns a {Number} representing the line length for the given - # buffer row, exclusive of its line-ending character(s). - # - # * `row` A {Number} indicating the buffer row. - lineLengthForBufferRow: (row) -> - deprecate "Use editor.lineTextForBufferRow(row).length instead" - @lineTextForBufferRow(row).length bufferRowForScreenRow: (row) -> @displayBuffer.bufferRowForScreenRow(row) @@ -981,11 +897,6 @@ class TextEditor extends Model @createFold(foldStartRow + delta, foldEndRow + delta) return - # Deprecated: Use {::duplicateLines} instead. - duplicateLine: -> - deprecate("Use TextEditor::duplicateLines() instead") - @duplicateLines() - replaceSelectedText: (options={}, fn) -> {selectWordIfEmpty} = options @mutateSelectedText (selection) -> @@ -1116,16 +1027,6 @@ class TextEditor extends Model deleteLine: -> @mutateSelectedText (selection) -> selection.deleteLine() - # Deprecated: Use {::deleteToBeginningOfWord} instead. - backspaceToBeginningOfWord: -> - deprecate("Use TextEditor::deleteToBeginningOfWord() instead") - @deleteToBeginningOfWord() - - # Deprecated: Use {::deleteToBeginningOfLine} instead. - backspaceToBeginningOfLine: -> - deprecate("Use TextEditor::deleteToBeginningOfLine() instead") - @deleteToBeginningOfLine() - ### Section: History ### @@ -1351,7 +1252,7 @@ class TextEditor extends Model # # Returns a {Decoration} object decorateMarker: (marker, decorationParams) -> - if decorationParams.type is 'gutter' + if includeDeprecations and decorationParams.type is 'gutter' deprecate("Decorations of `type: 'gutter'` have been renamed to `type: 'line-number'`.") decorationParams.type = 'line-number' @displayBuffer.decorateMarker(marker, decorationParams) @@ -1387,11 +1288,6 @@ class TextEditor extends Model getLineDecorations: (propertyFilter) -> @displayBuffer.getLineDecorations(propertyFilter) - # Soft-deprecated (forgot to deprecated this pre 1.0) - getGutterDecorations: (propertyFilter) -> - deprecate("Use ::getLineNumberDecorations instead") - @getLineNumberDecorations(propertyFilter) - # Extended: Get all decorations of type 'line-number'. # # * `propertyFilter` (optional) An {Object} containing key value pairs that @@ -1585,13 +1481,6 @@ class TextEditor extends Model getCursorScreenPositions: -> cursor.getScreenPosition() for cursor in @getCursors() - # Get the row of the most recently added cursor in screen coordinates. - # - # Returns the screen row {Number}. - getCursorScreenRow: -> - deprecate('Use `editor.getCursorScreenPosition().row` instead') - @getCursorScreenPosition().row - # Essential: Move the cursor to the given position in screen coordinates. # # If there are multiple cursors, they will be consolidated to a single cursor. @@ -1632,85 +1521,52 @@ class TextEditor extends Model # * `lineCount` (optional) {Number} number of lines to move moveUp: (lineCount) -> @moveCursors (cursor) -> cursor.moveUp(lineCount, moveToEndOfSelection: true) - moveCursorUp: (lineCount) -> - deprecate("Use TextEditor::moveUp() instead") - @moveUp(lineCount) # Essential: Move every cursor down one row in screen coordinates. # # * `lineCount` (optional) {Number} number of lines to move moveDown: (lineCount) -> @moveCursors (cursor) -> cursor.moveDown(lineCount, moveToEndOfSelection: true) - moveCursorDown: (lineCount) -> - deprecate("Use TextEditor::moveDown() instead") - @moveDown(lineCount) # Essential: Move every cursor left one column. # # * `columnCount` (optional) {Number} number of columns to move (default: 1) moveLeft: (columnCount) -> @moveCursors (cursor) -> cursor.moveLeft(columnCount, moveToEndOfSelection: true) - moveCursorLeft: -> - deprecate("Use TextEditor::moveLeft() instead") - @moveLeft() # Essential: Move every cursor right one column. # # * `columnCount` (optional) {Number} number of columns to move (default: 1) moveRight: (columnCount) -> @moveCursors (cursor) -> cursor.moveRight(columnCount, moveToEndOfSelection: true) - moveCursorRight: -> - deprecate("Use TextEditor::moveRight() instead") - @moveRight() # Essential: Move every cursor to the beginning of its line in buffer coordinates. moveToBeginningOfLine: -> @moveCursors (cursor) -> cursor.moveToBeginningOfLine() - moveCursorToBeginningOfLine: -> - deprecate("Use TextEditor::moveToBeginningOfLine() instead") - @moveToBeginningOfLine() # Essential: Move every cursor to the beginning of its line in screen coordinates. moveToBeginningOfScreenLine: -> @moveCursors (cursor) -> cursor.moveToBeginningOfScreenLine() - moveCursorToBeginningOfScreenLine: -> - deprecate("Use TextEditor::moveToBeginningOfScreenLine() instead") - @moveToBeginningOfScreenLine() # Essential: Move every cursor to the first non-whitespace character of its line. moveToFirstCharacterOfLine: -> @moveCursors (cursor) -> cursor.moveToFirstCharacterOfLine() - moveCursorToFirstCharacterOfLine: -> - deprecate("Use TextEditor::moveToFirstCharacterOfLine() instead") - @moveToFirstCharacterOfLine() # Essential: Move every cursor to the end of its line in buffer coordinates. moveToEndOfLine: -> @moveCursors (cursor) -> cursor.moveToEndOfLine() - moveCursorToEndOfLine: -> - deprecate("Use TextEditor::moveToEndOfLine() instead") - @moveToEndOfLine() # Essential: Move every cursor to the end of its line in screen coordinates. moveToEndOfScreenLine: -> @moveCursors (cursor) -> cursor.moveToEndOfScreenLine() - moveCursorToEndOfScreenLine: -> - deprecate("Use TextEditor::moveToEndOfScreenLine() instead") - @moveToEndOfScreenLine() # Essential: Move every cursor to the beginning of its surrounding word. moveToBeginningOfWord: -> @moveCursors (cursor) -> cursor.moveToBeginningOfWord() - moveCursorToBeginningOfWord: -> - deprecate("Use TextEditor::moveToBeginningOfWord() instead") - @moveToBeginningOfWord() # Essential: Move every cursor to the end of its surrounding word. moveToEndOfWord: -> @moveCursors (cursor) -> cursor.moveToEndOfWord() - moveCursorToEndOfWord: -> - deprecate("Use TextEditor::moveToEndOfWord() instead") - @moveToEndOfWord() # Cursor Extended @@ -1719,63 +1575,37 @@ class TextEditor extends Model # If there are multiple cursors, they will be merged into a single cursor. moveToTop: -> @moveCursors (cursor) -> cursor.moveToTop() - moveCursorToTop: -> - deprecate("Use TextEditor::moveToTop() instead") - @moveToTop() # Extended: Move every cursor to the bottom of the buffer. # # If there are multiple cursors, they will be merged into a single cursor. moveToBottom: -> @moveCursors (cursor) -> cursor.moveToBottom() - moveCursorToBottom: -> - deprecate("Use TextEditor::moveToBottom() instead") - @moveToBottom() # Extended: Move every cursor to the beginning of the next word. moveToBeginningOfNextWord: -> @moveCursors (cursor) -> cursor.moveToBeginningOfNextWord() - moveCursorToBeginningOfNextWord: -> - deprecate("Use TextEditor::moveToBeginningOfNextWord() instead") - @moveToBeginningOfNextWord() # Extended: Move every cursor to the previous word boundary. moveToPreviousWordBoundary: -> @moveCursors (cursor) -> cursor.moveToPreviousWordBoundary() - moveCursorToPreviousWordBoundary: -> - deprecate("Use TextEditor::moveToPreviousWordBoundary() instead") - @moveToPreviousWordBoundary() # Extended: Move every cursor to the next word boundary. moveToNextWordBoundary: -> @moveCursors (cursor) -> cursor.moveToNextWordBoundary() - moveCursorToNextWordBoundary: -> - deprecate("Use TextEditor::moveToNextWordBoundary() instead") - @moveToNextWordBoundary() # Extended: Move every cursor to the beginning of the next paragraph. moveToBeginningOfNextParagraph: -> @moveCursors (cursor) -> cursor.moveToBeginningOfNextParagraph() - moveCursorToBeginningOfNextParagraph: -> - deprecate("Use TextEditor::moveToBeginningOfNextParagraph() instead") - @moveToBeginningOfNextParagraph() # Extended: Move every cursor to the beginning of the previous paragraph. moveToBeginningOfPreviousParagraph: -> @moveCursors (cursor) -> cursor.moveToBeginningOfPreviousParagraph() - moveCursorToBeginningOfPreviousParagraph: -> - deprecate("Use TextEditor::moveToBeginningOfPreviousParagraph() instead") - @moveToBeginningOfPreviousParagraph() # Extended: Returns the most recently added {Cursor} getLastCursor: -> _.last(@cursors) - # Deprecated: - getCursor: -> - deprecate("Use TextEditor::getLastCursor() instead") - @getLastCursor() - # Extended: Returns the word surrounding the most recently added cursor. # # * `options` (optional) See {Cursor::getBeginningOfCurrentWordBufferPosition}. @@ -2087,16 +1917,10 @@ class TextEditor extends Model # This method merges selections on successive lines. selectLinesContainingCursors: -> @expandSelectionsForward (selection) -> selection.selectLine() - selectLine: -> - deprecate('Use TextEditor::selectLinesContainingCursors instead') - @selectLinesContainingCursors() # Essential: Select the word surrounding each cursor. selectWordsContainingCursors: -> @expandSelectionsForward (selection) -> selection.selectWord() - selectWord: -> - deprecate('Use TextEditor::selectWordsContainingCursors instead') - @selectWordsContainingCursors() # Selection Extended @@ -2152,15 +1976,6 @@ class TextEditor extends Model getLastSelection: -> _.last(@selections) - # Deprecated: - getSelection: (index) -> - if index? - deprecate("Use TextEditor::getSelections()[index] instead when getting a specific selection") - @getSelections()[index] - else - deprecate("Use TextEditor::getLastSelection() instead") - @getLastSelection() - # Extended: Get current {Selection}s. # # Returns: An {Array} of {Selection}s. @@ -2428,9 +2243,6 @@ class TextEditor extends Model # # Returns a {Boolean}. isSoftWrapped: (softWrapped) -> @displayBuffer.isSoftWrapped() - getSoftWrapped: -> - deprecate("Use TextEditor::isSoftWrapped instead") - @displayBuffer.isSoftWrapped() # Essential: Enable or disable soft wrapping for this editor. # @@ -2438,17 +2250,11 @@ class TextEditor extends Model # # Returns a {Boolean}. setSoftWrapped: (softWrapped) -> @displayBuffer.setSoftWrapped(softWrapped) - setSoftWrap: (softWrapped) -> - deprecate("Use TextEditor::setSoftWrapped instead") - @setSoftWrapped(softWrapped) # Essential: Toggle soft wrapping for this editor # # Returns a {Boolean}. toggleSoftWrapped: -> @setSoftWrapped(not @isSoftWrapped()) - toggleSoftWrap: -> - deprecate("Use TextEditor::toggleSoftWrapped instead") - @toggleSoftWrapped() # Public: Gets the column at which column will soft wrap getSoftWrapColumn: -> @displayBuffer.getSoftWrapColumn() @@ -2573,9 +2379,6 @@ class TextEditor extends Model # Returns a {ScopeDescriptor}. scopeDescriptorForBufferPosition: (bufferPosition) -> @displayBuffer.scopeDescriptorForBufferPosition(bufferPosition) - scopesForBufferPosition: (bufferPosition) -> - deprecate 'Use ::scopeDescriptorForBufferPosition instead. The return value has changed! It now returns a `ScopeDescriptor`' - @scopeDescriptorForBufferPosition(bufferPosition).getScopesArray() # Extended: Get the range in buffer coordinates of all tokens surrounding the # cursor that match the given scope selector. @@ -2607,13 +2410,6 @@ class TextEditor extends Model # {Delegates to: DisplayBuffer.tokenForBufferPosition} tokenForBufferPosition: (bufferPosition) -> @displayBuffer.tokenForBufferPosition(bufferPosition) - scopesAtCursor: -> - deprecate 'Use editor.getLastCursor().getScopeDescriptor() instead' - @getLastCursor().getScopeDescriptor().getScopesArray() - getCursorScopes: -> - deprecate 'Use editor.getLastCursor().getScopeDescriptor() instead' - @scopesAtCursor() - ### Section: Clipboard Operations ### @@ -3030,11 +2826,6 @@ class TextEditor extends Model pixelRectForScreenRange: (screenRange) -> @displayBuffer.pixelRectForScreenRange(screenRange) - # Deprecated: Call {::joinLines} instead. - joinLine: -> - deprecate("Use TextEditor::joinLines() instead") - @joinLines() - ### Section: Utility ### @@ -3043,3 +2834,227 @@ class TextEditor extends Model "" logScreenLines: (start, end) -> @displayBuffer.logLines(start, end) + +if includeDeprecations + TextEditor::getViewClass = -> + require './text-editor-view' + + TextEditor::joinLine = -> + deprecate("Use TextEditor::joinLines() instead") + @joinLines() + + TextEditor::scopesAtCursor = -> + deprecate 'Use editor.getLastCursor().getScopeDescriptor() instead' + @getLastCursor().getScopeDescriptor().getScopesArray() + + TextEditor::getCursorScopes = -> + deprecate 'Use editor.getLastCursor().getScopeDescriptor() instead' + @scopesAtCursor() + + TextEditor::getUri = -> + deprecate("Use `::getURI` instead") + @getURI() + + TextEditor::lineForBufferRow = (bufferRow) -> + deprecate 'Use TextEditor::lineTextForBufferRow(bufferRow) instead' + @lineTextForBufferRow(bufferRow) + + TextEditor::lineForScreenRow = (screenRow) -> + deprecate "TextEditor::tokenizedLineForScreenRow(bufferRow) is the new name. But it's private. Try to use TextEditor::lineTextForScreenRow instead" + @tokenizedLineForScreenRow(screenRow) + + TextEditor::linesForScreenRows = (start, end) -> + deprecate "Use TextEditor::tokenizedLinesForScreenRows instead" + @tokenizedLinesForScreenRows(start, end) + + TextEditor::lineLengthForBufferRow = (row) -> + deprecate "Use editor.lineTextForBufferRow(row).length instead" + @lineTextForBufferRow(row).length + + TextEditor::duplicateLine = -> + deprecate("Use TextEditor::duplicateLines() instead") + @duplicateLines() + + TextEditor::scopesForBufferPosition = (bufferPosition) -> + deprecate 'Use ::scopeDescriptorForBufferPosition instead. The return value has changed! It now returns a `ScopeDescriptor`' + @scopeDescriptorForBufferPosition(bufferPosition).getScopesArray() + + TextEditor::toggleSoftWrap = -> + deprecate("Use TextEditor::toggleSoftWrapped instead") + @toggleSoftWrapped() + + TextEditor::setSoftWrap = (softWrapped) -> + deprecate("Use TextEditor::setSoftWrapped instead") + @setSoftWrapped(softWrapped) + + TextEditor::backspaceToBeginningOfWord = -> + deprecate("Use TextEditor::deleteToBeginningOfWord() instead") + @deleteToBeginningOfWord() + + TextEditor::backspaceToBeginningOfLine = -> + deprecate("Use TextEditor::deleteToBeginningOfLine() instead") + @deleteToBeginningOfLine() + + TextEditor::getGutterDecorations = (propertyFilter) -> + deprecate("Use ::getLineNumberDecorations instead") + @getLineNumberDecorations(propertyFilter) + + TextEditor::getCursorScreenRow = -> + deprecate('Use `editor.getCursorScreenPosition().row` instead') + @getCursorScreenPosition().row + + TextEditor::moveCursorUp = (lineCount) -> + deprecate("Use TextEditor::moveUp() instead") + @moveUp(lineCount) + + TextEditor::moveCursorDown = (lineCount) -> + deprecate("Use TextEditor::moveDown() instead") + @moveDown(lineCount) + + TextEditor::moveCursorLeft = -> + deprecate("Use TextEditor::moveLeft() instead") + @moveLeft() + + TextEditor::moveCursorRight = -> + deprecate("Use TextEditor::moveRight() instead") + @moveRight() + + TextEditor::moveCursorToBeginningOfLine = -> + deprecate("Use TextEditor::moveToBeginningOfLine() instead") + @moveToBeginningOfLine() + + TextEditor::moveCursorToBeginningOfScreenLine = -> + deprecate("Use TextEditor::moveToBeginningOfScreenLine() instead") + @moveToBeginningOfScreenLine() + + TextEditor::moveCursorToFirstCharacterOfLine = -> + deprecate("Use TextEditor::moveToFirstCharacterOfLine() instead") + @moveToFirstCharacterOfLine() + + TextEditor::moveCursorToEndOfLine = -> + deprecate("Use TextEditor::moveToEndOfLine() instead") + @moveToEndOfLine() + + TextEditor::moveCursorToEndOfScreenLine = -> + deprecate("Use TextEditor::moveToEndOfScreenLine() instead") + @moveToEndOfScreenLine() + + TextEditor::moveCursorToBeginningOfWord = -> + deprecate("Use TextEditor::moveToBeginningOfWord() instead") + @moveToBeginningOfWord() + + TextEditor::moveCursorToEndOfWord = -> + deprecate("Use TextEditor::moveToEndOfWord() instead") + @moveToEndOfWord() + + TextEditor::moveCursorToTop = -> + deprecate("Use TextEditor::moveToTop() instead") + @moveToTop() + + TextEditor::moveCursorToBottom = -> + deprecate("Use TextEditor::moveToBottom() instead") + @moveToBottom() + + TextEditor::moveCursorToBeginningOfNextWord = -> + deprecate("Use TextEditor::moveToBeginningOfNextWord() instead") + @moveToBeginningOfNextWord() + + TextEditor::moveCursorToPreviousWordBoundary = -> + deprecate("Use TextEditor::moveToPreviousWordBoundary() instead") + @moveToPreviousWordBoundary() + + TextEditor::moveCursorToNextWordBoundary = -> + deprecate("Use TextEditor::moveToNextWordBoundary() instead") + @moveToNextWordBoundary() + + TextEditor::moveCursorToBeginningOfNextParagraph = -> + deprecate("Use TextEditor::moveToBeginningOfNextParagraph() instead") + @moveToBeginningOfNextParagraph() + + TextEditor::moveCursorToBeginningOfPreviousParagraph = -> + deprecate("Use TextEditor::moveToBeginningOfPreviousParagraph() instead") + @moveToBeginningOfPreviousParagraph() + + TextEditor::getCursor = -> + deprecate("Use TextEditor::getLastCursor() instead") + @getLastCursor() + + TextEditor::selectLine = -> + deprecate('Use TextEditor::selectLinesContainingCursors instead') + @selectLinesContainingCursors() + + TextEditor::selectWord = -> + deprecate('Use TextEditor::selectWordsContainingCursors instead') + @selectWordsContainingCursors() + + TextEditor::getSelection = (index) -> + if index? + deprecate("Use TextEditor::getSelections()[index] instead when getting a specific selection") + @getSelections()[index] + else + deprecate("Use TextEditor::getLastSelection() instead") + @getLastSelection() + + TextEditor::getSoftWrapped = -> + deprecate("Use TextEditor::isSoftWrapped instead") + @displayBuffer.isSoftWrapped() + + TextEditor::on = (eventName) -> + switch eventName + when 'title-changed' + deprecate("Use TextEditor::onDidChangeTitle instead") + when 'path-changed' + deprecate("Use TextEditor::onDidChangePath instead") + when 'modified-status-changed' + deprecate("Use TextEditor::onDidChangeModified instead") + when 'soft-wrap-changed' + deprecate("Use TextEditor::onDidChangeSoftWrapped instead") + when 'grammar-changed' + deprecate("Use TextEditor::onDidChangeGrammar instead") + when 'character-widths-changed' + deprecate("Use TextEditor::onDidChangeCharacterWidths instead") + when 'contents-modified' + deprecate("Use TextEditor::onDidStopChanging instead") + when 'contents-conflicted' + deprecate("Use TextEditor::onDidConflict instead") + + when 'will-insert-text' + deprecate("Use TextEditor::onWillInsertText instead") + when 'did-insert-text' + deprecate("Use TextEditor::onDidInsertText instead") + + when 'cursor-added' + deprecate("Use TextEditor::onDidAddCursor instead") + when 'cursor-removed' + deprecate("Use TextEditor::onDidRemoveCursor instead") + when 'cursor-moved' + deprecate("Use TextEditor::onDidChangeCursorPosition instead") + + when 'selection-added' + deprecate("Use TextEditor::onDidAddSelection instead") + when 'selection-removed' + deprecate("Use TextEditor::onDidRemoveSelection instead") + when 'selection-screen-range-changed' + deprecate("Use TextEditor::onDidChangeSelectionRange instead") + + when 'decoration-added' + deprecate("Use TextEditor::onDidAddDecoration instead") + when 'decoration-removed' + deprecate("Use TextEditor::onDidRemoveDecoration instead") + when 'decoration-updated' + deprecate("Use Decoration::onDidChangeProperties instead. You will get the decoration back from `TextEditor::decorateMarker()`") + when 'decoration-changed' + deprecate("Use Marker::onDidChange instead. e.g. `editor::decorateMarker(...).getMarker().onDidChange()`") + + when 'screen-lines-changed' + deprecate("Use TextEditor::onDidChange instead") + + when 'scroll-top-changed' + deprecate("Use TextEditor::onDidChangeScrollTop instead") + when 'scroll-left-changed' + deprecate("Use TextEditor::onDidChangeScrollLeft instead") + + else + deprecate("TextEditor::on is deprecated. Use documented event subscription methods instead.") + + EmitterMixin::on.apply(this, arguments) From 164d5e46b0552cf5012bce20958f61e3d9467ac3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 15:29:58 -0700 Subject: [PATCH 339/521] Only call emit when including deprecations --- src/package.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.coffee b/src/package.coffee index 7b590aab4..f9d3ac576 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -356,7 +356,7 @@ class Package @mainModule?.deactivate?() catch e console.error "Error deactivating package '#{@name}'", e.stack - @emit 'deactivated' + @emit 'deactivated' if includeDeprecations @emitter.emit 'did-deactivate' deactivateConfig: -> From 97bf4fb4d18f739cd385f6e3678f11ce3ae028de Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 15:56:29 -0700 Subject: [PATCH 340/521] :arrow_up: command-palette@0.35 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 795ee2bc6..02b3c9669 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "background-tips": "0.23.0", "bookmarks": "0.35.0", "bracket-matcher": "0.73.0", - "command-palette": "0.34.0", + "command-palette": "0.35.0", "deprecation-cop": "0.39.0", "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", From c24948ebccb2c510d3963ec0c624052f8d201ff5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 16:15:09 -0700 Subject: [PATCH 341/521] Conditionally include deprecations in Pane --- src/pane.coffee | 85 +++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index a6e456d6a..d1e83c609 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -42,7 +42,7 @@ class Pane extends Model # Called by the Serializable mixin during serialization. serializeParams: -> - if typeof @activeItem?.getURI is 'function' + if Grim.includeDeprecations and typeof @activeItem?.getURI is 'function' activeItemURI = @activeItem.getURI() else if typeof @activeItem?.getUri is 'function' activeItemURI = @activeItem.getUri() @@ -203,39 +203,6 @@ class Pane extends Model onWillDestroyItem: (callback) -> @emitter.on 'will-destroy-item', callback - on: (eventName) -> - switch eventName - when 'activated' - Grim.deprecate("Use Pane::onDidActivate instead") - when 'destroyed' - Grim.deprecate("Use Pane::onDidDestroy instead") - when 'item-added' - Grim.deprecate("Use Pane::onDidAddItem instead") - when 'item-removed' - Grim.deprecate("Use Pane::onDidRemoveItem instead") - when 'item-moved' - Grim.deprecate("Use Pane::onDidMoveItem instead") - when 'before-item-destroyed' - Grim.deprecate("Use Pane::onWillDestroyItem instead") - else - Grim.deprecate("Subscribing via ::on is deprecated. Use documented event subscription methods instead.") - super - - behavior: (behaviorName) -> - switch behaviorName - when 'active' - Grim.deprecate("The $active behavior property is deprecated. Use ::observeActive or ::onDidChangeActive instead.") - when 'container' - Grim.deprecate("The $container behavior property is deprecated.") - when 'activeItem' - Grim.deprecate("The $activeItem behavior property is deprecated. Use ::observeActiveItem or ::onDidChangeActiveItem instead.") - when 'focused' - Grim.deprecate("The $focused behavior property is deprecated.") - else - Grim.deprecate("Pane::behavior is deprecated. Use event subscription methods instead.") - - super - # Called by the view layer to indicate that the pane has gained focus. focus: -> @focused = true @@ -535,10 +502,6 @@ class Pane extends Model itemUri is uri - itemForUri: (uri) -> - Grim.deprecate("Use `::itemForURI` instead.") - @itemForURI(uri) - # Public: Activate the first item that matches the given URI. # # Returns a {Boolean} indicating whether an item matching the URI was found. @@ -549,10 +512,6 @@ class Pane extends Model else false - activateItemForUri: (uri) -> - Grim.deprecate("Use `::activateItemForURI` instead.") - @activateItemForURI(uri) - copyActiveItem: -> if @activeItem? @activeItem.copy?() ? atom.deserializers.deserialize(@activeItem.serialize()) @@ -701,3 +660,45 @@ class Pane extends Model atom.notifications.addWarning("Unable to save file: A directory in the path '#{fileName}' could not be written to") else throw error + +if Grim.includeDeprecations + Pane::on = (eventName) -> + switch eventName + when 'activated' + Grim.deprecate("Use Pane::onDidActivate instead") + when 'destroyed' + Grim.deprecate("Use Pane::onDidDestroy instead") + when 'item-added' + Grim.deprecate("Use Pane::onDidAddItem instead") + when 'item-removed' + Grim.deprecate("Use Pane::onDidRemoveItem instead") + when 'item-moved' + Grim.deprecate("Use Pane::onDidMoveItem instead") + when 'before-item-destroyed' + Grim.deprecate("Use Pane::onWillDestroyItem instead") + else + Grim.deprecate("Subscribing via ::on is deprecated. Use documented event subscription methods instead.") + super + + Pane::behavior = (behaviorName) -> + switch behaviorName + when 'active' + Grim.deprecate("The $active behavior property is deprecated. Use ::observeActive or ::onDidChangeActive instead.") + when 'container' + Grim.deprecate("The $container behavior property is deprecated.") + when 'activeItem' + Grim.deprecate("The $activeItem behavior property is deprecated. Use ::observeActiveItem or ::onDidChangeActiveItem instead.") + when 'focused' + Grim.deprecate("The $focused behavior property is deprecated.") + else + Grim.deprecate("Pane::behavior is deprecated. Use event subscription methods instead.") + + super + + Pane::itemForUri = (uri) -> + Grim.deprecate("Use `::itemForURI` instead.") + @itemForURI(uri) + + Pane::activateItemForUri = (uri) -> + Grim.deprecate("Use `::activateItemForURI` instead.") + @activateItemForURI(uri) From edf17f1fdbaeb4ea1a6a46a2501f8c94e1fc9d81 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 16:19:53 -0700 Subject: [PATCH 342/521] Conditionally include deprecations in Project --- src/project.coffee | 115 ++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index f0d368531..02be678fe 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -4,7 +4,7 @@ url = require 'url' _ = require 'underscore-plus' fs = require 'fs-plus' Q = require 'q' -{deprecate} = require 'grim' +{includeDeprecations, deprecate} = require 'grim' {Model} = require 'theorist' {Subscriber} = require 'emissary' {Emitter} = require 'event-kit' @@ -25,12 +25,6 @@ class Project extends Model atom.deserializers.add(this) Serializable.includeInto(this) - @pathForRepositoryUrl: (repoUrl) -> - deprecate '::pathForRepositoryUrl will be removed. Please remove from your code.' - [repoName] = url.parse(repoUrl).path.split('/')[-1..] - repoName = repoName.replace(/\.git$/, '') - path.join(atom.config.get('core.projectHome'), repoName) - ### Section: Construction and Destruction ### @@ -73,8 +67,10 @@ class Project extends Model @subscribeToBuffer(buffer) for buffer in @buffers - Grim.deprecate("Pass 'paths' array instead of 'path' to project constructor") if path? - paths ?= _.compact([path]) + if Grim.includeDeprecations and path? + Grim.deprecate("Pass 'paths' array instead of 'path' to project constructor") + paths ?= _.compact([path]) + @setPaths(paths) destroyed: -> @@ -122,13 +118,6 @@ class Project extends Model onDidAddBuffer: (callback) -> @emitter.on 'did-add-buffer', callback - on: (eventName) -> - if eventName is 'path-changed' - Grim.deprecate("Use Project::onDidChangePaths instead") - else - Grim.deprecate("Project::on is deprecated. Use documented event subscription methods instead.") - super - ### Section: Accessing the git repository ### @@ -144,9 +133,6 @@ class Project extends Model # project.repositoryForDirectory.bind(project))) # ``` getRepositories: -> @repositories - getRepo: -> - Grim.deprecate("Use ::getRepositories instead") - @getRepositories()[0] # Public: Get the repository for a given directory asynchronously. # @@ -180,9 +166,6 @@ class Project extends Model # Public: Get an {Array} of {String}s containing the paths of the project's # directories. getPaths: -> rootDirectory.getPath() for rootDirectory in @rootDirectories - getPath: -> - Grim.deprecate("Use ::getPaths instead") - @getPaths()[0] # Public: Set the paths of the project's directories. # @@ -198,10 +181,6 @@ class Project extends Model @emit "path-changed" @emitter.emit 'did-change-paths', projectPaths - setPath: (path) -> - Grim.deprecate("Use ::setPaths instead") - @setPaths([path]) - # Public: Add a path to the project's list of root paths # # * `projectPath` {String} The path to the directory to add. @@ -257,13 +236,6 @@ class Project extends Model # Public: Get an {Array} of {Directory}s associated with this project. getDirectories: -> @rootDirectories - getRootDirectory: -> - Grim.deprecate("Use ::getDirectories instead") - @getDirectories()[0] - - resolve: (uri) -> - Grim.deprecate("Use `Project::getDirectories()[0]?.resolve()` instead") - @resolvePath(uri) resolvePath: (uri) -> return unless uri @@ -329,18 +301,6 @@ class Project extends Model contains: (pathToCheck) -> @rootDirectories.some (dir) -> dir.contains(pathToCheck) - ### - Section: Searching and Replacing - ### - - scan: (regex, options={}, iterator) -> - Grim.deprecate("Use atom.workspace.scan instead of atom.project.scan") - atom.workspace.scan(regex, options, iterator) - - replace: (regex, replacementText, filePaths, iterator) -> - Grim.deprecate("Use atom.workspace.replace instead of atom.project.replace") - atom.workspace.replace(regex, replacementText, filePaths, iterator) - ### Section: Private ### @@ -365,12 +325,6 @@ class Project extends Model @bufferForPath(filePath).then (buffer) => @buildEditorForBuffer(buffer, options) - # Deprecated - openSync: (filePath, options={}) -> - deprecate("Use Project::open instead") - filePath = @resolvePath(filePath) - @buildEditorForBuffer(@bufferForPathSync(filePath), options) - # Retrieves all the {TextBuffer}s in the project; that is, the # buffers for all open files. # @@ -479,22 +433,65 @@ class Project extends Model detail: error.message dismissable: true - # Deprecated: delegate - registerOpener: (opener) -> +if includeDeprecations + Project.pathForRepositoryUrl = (repoUrl) -> + deprecate '::pathForRepositoryUrl will be removed. Please remove from your code.' + [repoName] = url.parse(repoUrl).path.split('/')[-1..] + repoName = repoName.replace(/\.git$/, '') + path.join(atom.config.get('core.projectHome'), repoName) + + Project::registerOpener = (opener) -> deprecate("Use Workspace::addOpener instead") atom.workspace.addOpener(opener) - # Deprecated: delegate - unregisterOpener: (opener) -> + Project::unregisterOpener = (opener) -> deprecate("Call .dispose() on the Disposable returned from ::addOpener instead") atom.workspace.unregisterOpener(opener) - # Deprecated: delegate - eachEditor: (callback) -> + Project::eachEditor = (callback) -> deprecate("Use Workspace::observeTextEditors instead") atom.workspace.observeTextEditors(callback) - # Deprecated: delegate - getEditors: -> + Project::getEditors = -> deprecate("Use Workspace::getTextEditors instead") atom.workspace.getTextEditors() + + Project::on = (eventName) -> + if eventName is 'path-changed' + Grim.deprecate("Use Project::onDidChangePaths instead") + else + Grim.deprecate("Project::on is deprecated. Use documented event subscription methods instead.") + super + + Project::getRepo = -> + Grim.deprecate("Use ::getRepositories instead") + @getRepositories()[0] + + Project::getPath = -> + Grim.deprecate("Use ::getPaths instead") + @getPaths()[0] + + Project::setPath = (path) -> + Grim.deprecate("Use ::setPaths instead") + @setPaths([path]) + + Project::getRootDirectory = -> + Grim.deprecate("Use ::getDirectories instead") + @getDirectories()[0] + + Project::resolve = (uri) -> + Grim.deprecate("Use `Project::getDirectories()[0]?.resolve()` instead") + @resolvePath(uri) + + Project::scan = (regex, options={}, iterator) -> + Grim.deprecate("Use atom.workspace.scan instead of atom.project.scan") + atom.workspace.scan(regex, options, iterator) + + Project::replace = (regex, replacementText, filePaths, iterator) -> + Grim.deprecate("Use atom.workspace.replace instead of atom.project.replace") + atom.workspace.replace(regex, replacementText, filePaths, iterator) + + Project::openSync = (filePath, options={}) -> + deprecate("Use Project::open instead") + filePath = @resolvePath(filePath) + @buildEditorForBuffer(@bufferForPathSync(filePath), options) From 9e904268411b0b955823371cee7a79102f01726e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 16:42:20 -0700 Subject: [PATCH 343/521] Only do legacy emit when including deprecations --- src/workspace.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index a5a4e5e30..858ae063f 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -112,7 +112,7 @@ class Workspace extends Model _.uniq(packageNames) editorAdded: (editor) -> - @emit 'editor-created', editor + @emit 'editor-created', editor if includeDeprecations installShellCommands: -> require('./command-installer').installShellCommandsInteractively() @@ -446,7 +446,7 @@ class Workspace extends Model if options.initialLine? or options.initialColumn? item.setCursorBufferPosition?([options.initialLine, options.initialColumn]) index = pane.getActiveItemIndex() - @emit "uri-opened" + @emit "uri-opened" if includeDeprecations @emitter.emit 'did-open', {uri, pane, item, index} item From 23d1c72a5f3945aa1b8f76c884ee95bfe613f05a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 17:06:10 -0700 Subject: [PATCH 344/521] Remove unused imports --- src/context-menu-manager.coffee | 4 +--- src/decoration.coffee | 2 +- src/display-buffer.coffee | 3 ++- src/marker.coffee | 1 - src/pane.coffee | 1 - 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 69caa5d6d..4565c8b55 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -1,6 +1,4 @@ -{$} = require './space-pen-extensions' _ = require 'underscore-plus' -remote = require 'remote' path = require 'path' CSON = require 'season' fs = require 'fs-plus' @@ -189,7 +187,7 @@ class ContextMenuManager menuTemplate = @templateForEvent(event) return unless menuTemplate?.length > 0 - remote.getCurrentWindow().emit('context-menu', menuTemplate) + atom.getCurrentWindow().emit('context-menu', menuTemplate) return clear: -> diff --git a/src/decoration.coffee b/src/decoration.coffee index b3ad4b7ff..a556a3a3c 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -1,5 +1,4 @@ _ = require 'underscore-plus' -EmitterMixin = require('emissary').Emitter {Emitter} = require 'event-kit' Grim = require 'grim' @@ -165,6 +164,7 @@ class Decoration null if Grim.includeDeprecations + EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(Decoration) Decoration::on = (eventName) -> diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 277a79200..12b839143 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -1,5 +1,4 @@ _ = require 'underscore-plus' -EmitterMixin = require('emissary').Emitter Serializable = require 'serializable' {Model} = require 'theorist' {CompositeDisposable, Emitter} = require 'event-kit' @@ -1229,6 +1228,8 @@ class DisplayBuffer extends Model @foldsByMarkerId[marker.id] if Grim.includeDeprecations + EmitterMixin = require('emissary').Emitter + DisplayBuffer::on = (eventName) -> switch eventName when 'changed' diff --git a/src/marker.coffee b/src/marker.coffee index bd48eb48c..c177b792e 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -1,4 +1,3 @@ -{Range} = require 'text-buffer' _ = require 'underscore-plus' {CompositeDisposable, Emitter} = require 'event-kit' Grim = require 'grim' diff --git a/src/pane.coffee b/src/pane.coffee index d1e83c609..07e621e46 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -5,7 +5,6 @@ Serializable = require 'serializable' Grim = require 'grim' PaneAxis = require './pane-axis' TextEditor = require './text-editor' -PaneView = null # Extended: A container for presenting content in the center of the workspace. # Panes can contain multiple items, one of which is *active* at a given time. From 63072bf8aee0909ab69585f4e5109d649855a3e2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 17:11:42 -0700 Subject: [PATCH 345/521] Check deprecations flag for space pen shim inclusion --- src/atom.coffee | 4 +++- src/text-editor-component.coffee | 7 ++++--- src/text-editor-element.coffee | 5 +++-- src/workspace-element.coffee | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index ace3245ef..b787764be 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -721,7 +721,9 @@ class Atom extends Model deserializeWorkspaceView: -> Workspace = require './workspace' - WorkspaceView = require './workspace-view' + + if includeDeprecations + WorkspaceView = require './workspace-view' startTime = Date.now() @workspace = Workspace.deserialize(@state.workspace) ? new Workspace diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index c2babdca4..b57920952 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -152,9 +152,10 @@ class TextEditorComponent if @editor.isAlive() @updateParentViewFocusedClassIfNeeded() @updateParentViewMiniClass() - @hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved - @hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged - @hostElement.__spacePenView.trigger 'editor:display-updated' + if grim.includeDeprecations + @hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved + @hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged + @hostElement.__spacePenView.trigger 'editor:display-updated' readAfterUpdateSync: => @linesComponent.measureCharactersInNewLines() if @isVisible() and not @newState.content.scrollingVertically diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index ccd69dca8..5822f533c 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -3,6 +3,7 @@ Path = require 'path' {defaults} = require 'underscore-plus' TextBuffer = require 'text-buffer' +Grim = require 'grim' TextEditor = require './text-editor' TextEditorComponent = require './text-editor-component' TextEditorView = null @@ -20,7 +21,7 @@ class TextEditorElement extends HTMLElement createdCallback: -> @emitter = new Emitter @initializeContent() - @createSpacePenShim() + @createSpacePenShim() if Grim.includeDeprecations @addEventListener 'focus', @focused.bind(this) @addEventListener 'blur', @blurred.bind(this) @@ -86,7 +87,7 @@ class TextEditorElement extends HTMLElement @model.onDidChangeGrammar => @addGrammarScopeAttribute() @model.onDidChangeEncoding => @addEncodingAttribute() @model.onDidDestroy => @unmountComponent() - @__spacePenView.setModel(@model) + @__spacePenView.setModel(@model) if Grim.includeDeprecations @model getModel: -> diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index f2805ff08..66ded0084 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -16,10 +16,10 @@ class WorkspaceElement extends HTMLElement @initializeContent() @observeScrollbarStyle() @observeTextEditorFontConfig() - @createSpacePenShim() + @createSpacePenShim() if Grim.includeDeprecations attachedCallback: -> - callAttachHooks(this) + callAttachHooks(this) if Grim.includeDeprecations @focus() detachedCallback: -> @@ -82,7 +82,7 @@ class WorkspaceElement extends HTMLElement @appendChild(@panelContainers.modal) - @__spacePenView.setModel(@model) + @__spacePenView.setModel(@model) if Grim.includeDeprecations this getModel: -> @model From dd72bbe0ef1eae13eff908f006ae4181aae3756f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 17:19:44 -0700 Subject: [PATCH 346/521] Conditionally include deprecations in Config --- src/config.coffee | 163 ++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 93 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 4901f21dc..b48d69ca0 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -371,13 +371,13 @@ class Config observe: -> if arguments.length is 2 [keyPath, callback] = arguments - else if arguments.length is 3 and (_.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor) + else if Grim.includeDeprecations and arguments.length is 3 and (_.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor) Grim.deprecate """ Passing a scope descriptor as the first argument to Config::observe is deprecated. Pass a `scope` in an options hash as the third argument instead. """ [scopeDescriptor, keyPath, callback] = arguments - else if arguments.length is 3 and (_.isString(arguments[0]) and _.isObject(arguments[1])) + else if Grim.includeDeprecations and arguments.length is 3 and (_.isString(arguments[0]) and _.isObject(arguments[1])) [keyPath, options, callback] = arguments scopeDescriptor = options.scope if options.callNow? @@ -419,7 +419,7 @@ class Config [callback] = arguments else if arguments.length is 2 [keyPath, callback] = arguments - else if _.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor + else if Grim.includeDeprecations and _.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor Grim.deprecate """ Passing a scope descriptor as the first argument to Config::onDidChange is deprecated. Pass a `scope` in an options hash as the third argument instead. @@ -498,7 +498,7 @@ class Config if typeof arguments[0] is 'string' or not arguments[0]? [keyPath, options] = arguments {scope} = options - else + else if Grim.includeDeprecations Grim.deprecate """ Passing a scope descriptor as the first argument to Config::get is deprecated. Pass a `scope` in an options hash as the final argument instead. @@ -578,7 +578,7 @@ class Config # * `true` if the value was set. # * `false` if the value was not able to be coerced to the type specified in the setting's schema. set: -> - if arguments[0]?[0] is '.' + if Grim.includeDeprecations and arguments[0]?[0] is '.' Grim.deprecate """ Passing a scope selector as the first argument to Config::set is deprecated. Pass a `scopeSelector` in an options hash as the final argument instead. @@ -617,7 +617,7 @@ class Config # * `scopeSelector` (optional) {String}. See {::set} # * `source` (optional) {String}. See {::set} unset: (keyPath, options) -> - if typeof options is 'string' + if Grim.includeDeprecations and typeof options is 'string' Grim.deprecate """ Passing a scope selector as the first argument to Config::unset is deprecated. Pass a `scopeSelector` in an options hash as the second argument instead. @@ -652,47 +652,6 @@ class Config getSources: -> _.uniq(_.pluck(@scopedSettingsStore.propertySets, 'source')).sort() - # Deprecated: Restore the global setting at `keyPath` to its default value. - # - # Returns the new value. - restoreDefault: (scopeSelector, keyPath) -> - Grim.deprecate("Use ::unset instead.") - @unset(scopeSelector, keyPath) - @get(keyPath) - - # Deprecated: Get the global default value of the key path. _Please note_ that in most - # cases calling this is not necessary! {::get} returns the default value when - # a custom value is not specified. - # - # * `scopeSelector` (optional) {String}. eg. '.source.ruby' - # * `keyPath` The {String} name of the key. - # - # Returns the default value. - getDefault: -> - Grim.deprecate("Use `::get(keyPath, {scope, excludeSources: [atom.config.getUserConfigPath()]})` instead") - if arguments.length is 1 - [keyPath] = arguments - else - [scopeSelector, keyPath] = arguments - scope = [scopeSelector] - @get(keyPath, {scope, excludeSources: [@getUserConfigPath()]}) - - # Deprecated: Is the value at `keyPath` its default value? - # - # * `scopeSelector` (optional) {String}. eg. '.source.ruby' - # * `keyPath` The {String} name of the key. - # - # Returns a {Boolean}, `true` if the current value is the default, `false` - # otherwise. - isDefault: -> - Grim.deprecate("Use `not ::get(keyPath, {scope, sources: [atom.config.getUserConfigPath()]})?` instead") - if arguments.length is 1 - [keyPath] = arguments - else - [scopeSelector, keyPath] = arguments - scope = [scopeSelector] - not @get(keyPath, {scope, sources: [@getUserConfigPath()]})? - # Extended: Retrieve the schema for a specific key path. The schema will tell # you what type the keyPath expects, and other metadata about the config # option. @@ -709,12 +668,6 @@ class Config schema = schema.properties?[key] schema - # Deprecated: Returns a new {Object} containing all of the global settings and - # defaults. Returns the scoped settings when a `scopeSelector` is specified. - getSettings: -> - Grim.deprecate "Use ::get(keyPath) instead" - _.deepExtend({}, @settings, @defaultSettings) - # Extended: Get the {String} path to the config file being used. getUserConfigPath: -> @configFilePath @@ -732,31 +685,6 @@ class Config @transactDepth-- @emitChangeEvent() - ### - Section: Deprecated - ### - - getInt: (keyPath) -> - Grim.deprecate '''Config::getInt is no longer necessary. Use ::get instead. - Make sure the config option you are accessing has specified an `integer` - schema. See the schema section of - https://atom.io/docs/api/latest/Config for more info.''' - parseInt(@get(keyPath)) - - getPositiveInt: (keyPath, defaultValue=0) -> - Grim.deprecate '''Config::getPositiveInt is no longer necessary. Use ::get instead. - Make sure the config option you are accessing has specified an `integer` - schema with `minimum: 1`. See the schema section of - https://atom.io/docs/api/latest/Config for more info.''' - Math.max(@getInt(keyPath), 0) or defaultValue - - toggle: (keyPath) -> - Grim.deprecate 'Config::toggle is no longer supported. Please remove from your code.' - @set(keyPath, !@get(keyPath)) - - unobserve: (keyPath) -> - Grim.deprecate 'Config::unobserve no longer does anything. Call `.dispose()` on the object returned by Config::observe instead.' - ### Section: Internal methods used by core ### @@ -1056,16 +984,6 @@ class Config @emitChangeEvent() - addScopedSettings: (source, selector, value, options) -> - Grim.deprecate("Use ::set instead") - settingsBySelector = {} - settingsBySelector[selector] = value - disposable = @scopedSettingsStore.addProperties(source, settingsBySelector, options) - @emitChangeEvent() - new Disposable => - disposable.dispose() - @emitChangeEvent() - setRawScopedValue: (keyPath, value, source, selector, options) -> if keyPath? newValue = {} @@ -1094,11 +1012,6 @@ class Config oldValue = newValue callback(event) - settingsForScopeDescriptor: (scopeDescriptor, keyPath) -> - Grim.deprecate("Use Config::getAll instead") - entries = @getAll(null, scope: scopeDescriptor) - value for {value} in entries when _.valueForKeyPath(value, keyPath)? - # Base schema enforcers. These will coerce raw input into the specified type, # and will throw an error when the value cannot be coerced. Throwing the error # will indicate that the value should not be set. @@ -1232,3 +1145,67 @@ withoutEmptyObjects = (object) -> else resultObject = object resultObject + +if Grim.includeDeprecations + Config::restoreDefault = (scopeSelector, keyPath) -> + Grim.deprecate("Use ::unset instead.") + @unset(scopeSelector, keyPath) + @get(keyPath) + + Config::getDefault = -> + Grim.deprecate("Use `::get(keyPath, {scope, excludeSources: [atom.config.getUserConfigPath()]})` instead") + if arguments.length is 1 + [keyPath] = arguments + else + [scopeSelector, keyPath] = arguments + scope = [scopeSelector] + @get(keyPath, {scope, excludeSources: [@getUserConfigPath()]}) + + Config::isDefault = -> + Grim.deprecate("Use `not ::get(keyPath, {scope, sources: [atom.config.getUserConfigPath()]})?` instead") + if arguments.length is 1 + [keyPath] = arguments + else + [scopeSelector, keyPath] = arguments + scope = [scopeSelector] + not @get(keyPath, {scope, sources: [@getUserConfigPath()]})? + + Config::getSettings = -> + Grim.deprecate "Use ::get(keyPath) instead" + _.deepExtend({}, @settings, @defaultSettings) + + Config::getInt = (keyPath) -> + Grim.deprecate '''Config::getInt is no longer necessary. Use ::get instead. + Make sure the config option you are accessing has specified an `integer` + schema. See the schema section of + https://atom.io/docs/api/latest/Config for more info.''' + parseInt(@get(keyPath)) + + Config::getPositiveInt = (keyPath, defaultValue=0) -> + Grim.deprecate '''Config::getPositiveInt is no longer necessary. Use ::get instead. + Make sure the config option you are accessing has specified an `integer` + schema with `minimum: 1`. See the schema section of + https://atom.io/docs/api/latest/Config for more info.''' + Math.max(@getInt(keyPath), 0) or defaultValue + + Config::toggle = (keyPath) -> + Grim.deprecate 'Config::toggle is no longer supported. Please remove from your code.' + @set(keyPath, !@get(keyPath)) + + Config::unobserve = (keyPath) -> + Grim.deprecate 'Config::unobserve no longer does anything. Call `.dispose()` on the object returned by Config::observe instead.' + + Config::addScopedSettings = (source, selector, value, options) -> + Grim.deprecate("Use ::set instead") + settingsBySelector = {} + settingsBySelector[selector] = value + disposable = @scopedSettingsStore.addProperties(source, settingsBySelector, options) + @emitChangeEvent() + new Disposable => + disposable.dispose() + @emitChangeEvent() + + Config::settingsForScopeDescriptor = (scopeDescriptor, keyPath) -> + Grim.deprecate("Use Config::getAll instead") + entries = @getAll(null, scope: scopeDescriptor) + value for {value} in entries when _.valueForKeyPath(value, keyPath)? From 0c06c69cd91c0bca31c547893b2b4c272fa2fc55 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 17:31:28 -0700 Subject: [PATCH 347/521] Check deprecations flag for space pen shim inclusion --- src/pane-container-element.coffee | 9 ++++++--- src/pane-element.coffee | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/pane-container-element.coffee b/src/pane-container-element.coffee index 65ee9ecea..55d527971 100644 --- a/src/pane-container-element.coffee +++ b/src/pane-container-element.coffee @@ -1,4 +1,5 @@ {CompositeDisposable} = require 'event-kit' +Grim = require 'grim' {callAttachHooks} = require './space-pen-extensions' PaneContainerView = null _ = require 'underscore-plus' @@ -8,12 +9,14 @@ class PaneContainerElement extends HTMLElement createdCallback: -> @subscriptions = new CompositeDisposable @classList.add 'panes' - PaneContainerView ?= require './pane-container-view' - @__spacePenView = new PaneContainerView(this) + + if Grim.includeDeprecations + PaneContainerView ?= require './pane-container-view' + @__spacePenView = new PaneContainerView(this) initialize: (@model) -> @subscriptions.add @model.observeRoot(@rootChanged.bind(this)) - @__spacePenView.setModel(@model) + @__spacePenView.setModel(@model) if Grim.includeDeprecations this rootChanged: (root) -> diff --git a/src/pane-element.coffee b/src/pane-element.coffee index f626e9fad..f050567b2 100644 --- a/src/pane-element.coffee +++ b/src/pane-element.coffee @@ -1,6 +1,7 @@ {CompositeDisposable} = require 'event-kit' +Grim = require 'grim' {$, callAttachHooks, callRemoveHooks} = require './space-pen-extensions' -PaneView = require './pane-view' +PaneView = null class PaneElement extends HTMLElement attached: false @@ -12,7 +13,7 @@ class PaneElement extends HTMLElement @initializeContent() @subscribeToDOMEvents() - @createSpacePenShim() + @createSpacePenShim() if Grim.includeDeprecations attachedCallback: -> @attached = true @@ -41,6 +42,7 @@ class PaneElement extends HTMLElement @addEventListener 'blur', handleBlur, true createSpacePenShim: -> + PaneView ?= require './pane-view' @__spacePenView = new PaneView(this) initialize: (@model) -> @@ -49,7 +51,7 @@ class PaneElement extends HTMLElement @subscriptions.add @model.observeActiveItem(@activeItemChanged.bind(this)) @subscriptions.add @model.onDidRemoveItem(@itemRemoved.bind(this)) @subscriptions.add @model.onDidDestroy(@paneDestroyed.bind(this)) - @__spacePenView.setModel(@model) + @__spacePenView.setModel(@model) if Grim.includeDeprecations this getModel: -> @model From bb53548ba02b96cf45cbe7d1caa5766e65ec96de Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 17:35:29 -0700 Subject: [PATCH 348/521] Only check deprecation flag for callNow usage --- src/config.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index b48d69ca0..3d0e363ad 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -377,10 +377,10 @@ class Config Pass a `scope` in an options hash as the third argument instead. """ [scopeDescriptor, keyPath, callback] = arguments - else if Grim.includeDeprecations and arguments.length is 3 and (_.isString(arguments[0]) and _.isObject(arguments[1])) + else if arguments.length is 3 and (_.isString(arguments[0]) and _.isObject(arguments[1])) [keyPath, options, callback] = arguments scopeDescriptor = options.scope - if options.callNow? + if Grim.includeDeprecations and options.callNow? Grim.deprecate """ Config::observe no longer takes a `callNow` option. Use ::onDidChange instead. Note that ::onDidChange passes its callback different arguments. From 8ceb2e2028edddb84017479371ee80bd64f85e2f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 18:09:00 -0700 Subject: [PATCH 349/521] Don't extend Model in 1.0 mode --- src/atom.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index b787764be..463f5a7bf 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -16,11 +16,13 @@ fs = require 'fs-plus' WindowEventHandler = require './window-event-handler' StylesElement = require './styles-element' +SuperClass = if includeDeprecations then Model else Object + # Essential: Atom global for dealing with packages, themes, menus, and the window. # # An instance of this class is always available as the `atom` global. module.exports = -class Atom extends Model +class Atom extends SuperClass @version: 1 # Increment this when the serialization format changes # Load or create the Atom environment in the given mode. @@ -230,7 +232,7 @@ class Atom extends Model @openDevTools() @executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()') - @emit 'uncaught-error', arguments... + @emit 'uncaught-error', arguments... if includeDeprecations @emitter.emit 'did-throw-error', {message, url, line, column, originalError} @disposables?.dispose() From 488e40e635fc7b86946c518d4b97ea278c196a83 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 18:17:03 -0700 Subject: [PATCH 350/521] Add 1.0 preview mode bridge Model class --- src/atom.coffee | 8 +++++--- src/model.coffee | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/model.coffee diff --git a/src/atom.coffee b/src/atom.coffee index 463f5a7bf..427811162 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -8,7 +8,6 @@ shell = require 'shell' _ = require 'underscore-plus' {deprecate, includeDeprecations} = require 'grim' {CompositeDisposable, Emitter} = require 'event-kit' -{Model} = require 'theorist' fs = require 'fs-plus' {convertStackTrace, convertLine} = require 'coffeestack' @@ -16,13 +15,16 @@ fs = require 'fs-plus' WindowEventHandler = require './window-event-handler' StylesElement = require './styles-element' -SuperClass = if includeDeprecations then Model else Object +if includeDeprecations + {Model} = require 'theorist' +else + Model = require './model' # Essential: Atom global for dealing with packages, themes, menus, and the window. # # An instance of this class is always available as the `atom` global. module.exports = -class Atom extends SuperClass +class Atom extends Model @version: 1 # Increment this when the serialization format changes # Load or create the Atom environment in the given mode. diff --git a/src/model.coffee b/src/model.coffee new file mode 100644 index 000000000..b590082a5 --- /dev/null +++ b/src/model.coffee @@ -0,0 +1,27 @@ +PropertyAccessors = require 'property-accessors' + +nextInstanceId = 1 + +module.exports = +class Model + PropertyAccessors.includeInto(this) + + @resetNextInstanceId: -> nextInstanceId = 1 + + constructor: (params) -> + @assignId(params?.id) + + assignId: (id) -> + @id ?= id ? nextInstanceId++ + + @::advisedAccessor 'id', + set: (id) -> nextInstanceId = id + 1 if id >= nextInstanceId + + destroy: -> + return unless @isAlive() + @alive = false + @destroyed?() + + isAlive: -> @alive + + isDestroyed: -> not @isAlive() From e41a366e081f4db1fac881137207e12aa8d36d2e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 18:19:41 -0700 Subject: [PATCH 351/521] Using single Model class require --- src/atom.coffee | 7 +------ src/model.coffee | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 427811162..55cb7ee59 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -10,16 +10,11 @@ _ = require 'underscore-plus' {CompositeDisposable, Emitter} = require 'event-kit' fs = require 'fs-plus' {convertStackTrace, convertLine} = require 'coffeestack' - +Model = require './model' {$} = require './space-pen-extensions' WindowEventHandler = require './window-event-handler' StylesElement = require './styles-element' -if includeDeprecations - {Model} = require 'theorist' -else - Model = require './model' - # Essential: Atom global for dealing with packages, themes, menus, and the window. # # An instance of this class is always available as the `atom` global. diff --git a/src/model.coffee b/src/model.coffee index b590082a5..20128b0d2 100644 --- a/src/model.coffee +++ b/src/model.coffee @@ -1,3 +1,8 @@ +Grim = require 'grim' +if Grim.includeDeprecations + module.exports = require('theorist').Model + return + PropertyAccessors = require 'property-accessors' nextInstanceId = 1 From 82c39a5af9e0e6371ba3c8c0e499ecb518d540c9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 18:28:51 -0700 Subject: [PATCH 352/521] Use lighter Model in cursor, selection, and project --- src/cursor.coffee | 2 +- src/project.coffee | 10 +++++----- src/selection.coffee | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cursor.coffee b/src/cursor.coffee index a930666c3..6bb3f4bae 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -1,8 +1,8 @@ {Point, Range} = require 'text-buffer' -{Model} = require 'theorist' {Emitter} = require 'event-kit' _ = require 'underscore-plus' Grim = require 'grim' +Model = require './model' # Extended: The `Cursor` class represents the little blinking line identifying # where text can be inserted. diff --git a/src/project.coffee b/src/project.coffee index 02be678fe..0392bd7ce 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -5,7 +5,6 @@ _ = require 'underscore-plus' fs = require 'fs-plus' Q = require 'q' {includeDeprecations, deprecate} = require 'grim' -{Model} = require 'theorist' {Subscriber} = require 'emissary' {Emitter} = require 'event-kit' DefaultDirectoryProvider = require './default-directory-provider' @@ -13,6 +12,7 @@ Serializable = require 'serializable' TextBuffer = require 'text-buffer' Grim = require 'grim' +Model = require './model' TextEditor = require './text-editor' Task = require './task' GitRepositoryProvider = require './git-repository-provider' @@ -178,7 +178,7 @@ class Project extends Model @addPath(projectPath, emitEvent: false) for projectPath in projectPaths - @emit "path-changed" + @emit "path-changed" if includeDeprecations @emitter.emit 'did-change-paths', projectPaths # Public: Add a path to the project's list of root paths @@ -205,7 +205,7 @@ class Project extends Model @repositories.push(repo ? null) unless options?.emitEvent is false - @emit "path-changed" + @emit "path-changed" if includeDeprecations @emitter.emit 'did-change-paths', @getPaths() # Public: remove a path from the project's list of root paths. @@ -227,7 +227,7 @@ class Project extends Model [removedRepository] = @repositories.splice(indexToRemove, 1) removedDirectory.off() removedRepository?.destroy() unless removedRepository in @repositories - @emit "path-changed" + @emit "path-changed" if includeDeprecations @emitter.emit "did-change-paths", @getPaths() true else @@ -393,7 +393,7 @@ class Project extends Model addBufferAtIndex: (buffer, index, options={}) -> @buffers.splice(index, 0, buffer) @subscribeToBuffer(buffer) - @emit 'buffer-created', buffer + @emit 'buffer-created', buffer if includeDeprecations @emitter.emit 'did-add-buffer', buffer buffer diff --git a/src/selection.coffee b/src/selection.coffee index 2a2d1c98c..af70e234c 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -1,8 +1,8 @@ {Point, Range} = require 'text-buffer' -{Model} = require 'theorist' {pick} = _ = require 'underscore-plus' {Emitter} = require 'event-kit' Grim = require 'grim' +Model = require './model' NonWhitespaceRegExp = /\S/ @@ -27,7 +27,7 @@ class Selection extends Model unless @editor.isDestroyed() @destroyed = true @editor.removeSelection(this) - @emit 'destroyed' + @emit 'destroyed' if Grim.includeDeprecations @emitter.emit 'did-destroy' @emitter.dispose() @@ -732,7 +732,7 @@ class Selection extends Model newScreenRange: @getScreenRange() selection: this - @emit 'screen-range-changed', @getScreenRange() # old event + @emit 'screen-range-changed', @getScreenRange() if Grim.includeDeprecations @emitter.emit 'did-change-range' @editor.selectionRangeChanged(eventObject) From 578bce1aaf8a98ca3121b37c68ecd388c23ce797 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 25 Mar 2015 18:30:36 -0700 Subject: [PATCH 353/521] :art: --- src/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index 0392bd7ce..63e5576de 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -7,11 +7,11 @@ Q = require 'q' {includeDeprecations, deprecate} = require 'grim' {Subscriber} = require 'emissary' {Emitter} = require 'event-kit' -DefaultDirectoryProvider = require './default-directory-provider' Serializable = require 'serializable' TextBuffer = require 'text-buffer' Grim = require 'grim' +DefaultDirectoryProvider = require './default-directory-provider' Model = require './model' TextEditor = require './text-editor' Task = require './task' From 83b679dcc2f273fba146ecd6990be1fd5e00aff1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 15:58:38 -0700 Subject: [PATCH 354/521] ::subscribe -> CompositeDisposable --- src/tokenized-buffer.coffee | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 303906ada..ff06c66e6 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -1,6 +1,6 @@ _ = require 'underscore-plus' {Model} = require 'theorist' -{Emitter} = require 'event-kit' +{CompositeDisposable, Emitter} = require 'event-kit' {Point, Range} = require 'text-buffer' Serializable = require 'serializable' TokenizedLine = require './tokenized-line' @@ -24,15 +24,19 @@ class TokenizedBuffer extends Model constructor: ({@buffer, @tabLength, @invisibles}) -> @emitter = new Emitter + @disposables = new CompositeDisposable - @subscribe atom.grammars.onDidAddGrammar(@grammarAddedOrUpdated) - @subscribe atom.grammars.onDidUpdateGrammar(@grammarAddedOrUpdated) + @disposables.add atom.grammars.onDidAddGrammar(@grammarAddedOrUpdated) + @disposables.add atom.grammars.onDidUpdateGrammar(@grammarAddedOrUpdated) - @subscribe @buffer.preemptDidChange (e) => @handleBufferChange(e) - @subscribe @buffer.onDidChangePath (@bufferPath) => @reloadGrammar() + @disposables.add @buffer.preemptDidChange (e) => @handleBufferChange(e) + @disposables.add @buffer.onDidChangePath (@bufferPath) => @reloadGrammar() @reloadGrammar() + destroyed: -> + @disposables.dispose() + serializeParams: -> bufferPath: @buffer.getPath() tabLength: @tabLength @@ -64,11 +68,14 @@ class TokenizedBuffer extends Model setGrammar: (grammar, score) -> return if grammar is @grammar - @unsubscribe(@grammar) if @grammar + @grammar = grammar @rootScopeDescriptor = new ScopeDescriptor(scopes: [@grammar.scopeName]) @currentGrammarScore = score ? grammar.getScore(@buffer.getPath(), @buffer.getText()) - @subscribe @grammar.onDidUpdate => @retokenizeLines() + + @grammarUpdateDisposable?.dispose() + @grammarUpdateDisposable = @grammar.onDidUpdate => @retokenizeLines() + @disposables.add(@grammarUpdateDisposable) @configSettings = tabLength: atom.config.get('editor.tabLength', scope: @rootScopeDescriptor) @@ -76,7 +83,7 @@ class TokenizedBuffer extends Model @grammarTabLengthSubscription = atom.config.onDidChange 'editor.tabLength', scope: @rootScopeDescriptor, ({newValue}) => @configSettings.tabLength = newValue @retokenizeLines() - @subscribe @grammarTabLengthSubscription + @disposables.add(@grammarTabLengthSubscription) @retokenizeLines() From 7861e462bece67e4965c996b65d8b879ebd34f70 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 26 Mar 2015 15:59:24 -0700 Subject: [PATCH 355/521] Add alive ivar to light Model --- src/model.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/model.coffee b/src/model.coffee index 20128b0d2..bfb854320 100644 --- a/src/model.coffee +++ b/src/model.coffee @@ -13,6 +13,8 @@ class Model @resetNextInstanceId: -> nextInstanceId = 1 + alive: true + constructor: (params) -> @assignId(params?.id) From 3a94376c46706187b90505d7b065d15e32881611 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:00:43 -0700 Subject: [PATCH 356/521] :arrow_up: event-kit@1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 02b3c9669..b36c35b0a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "color": "^0.7.3", "delegato": "^1", "emissary": "^1.3.3", - "event-kit": "^1.0.3", + "event-kit": "^1.1", "first-mate": "^3.0.1", "fs-plus": "^2.6", "fstream": "0.1.24", From fe1bb240753cee00acb7fa792f115b2747eb206f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:31:31 -0700 Subject: [PATCH 357/521] :arrow_up: pathwatcher@4.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b36c35b0a..b6abacc20 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "nslog": "^2.0.0", "oniguruma": "^4.1", "optimist": "0.4.0", - "pathwatcher": "^4.3.1", + "pathwatcher": "^4.4", "property-accessors": "^1.1.3", "q": "^1.1.2", "random-words": "0.0.1", From ccd57bd66689db897a97353bf1b220f5aa78f1fb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:35:40 -0700 Subject: [PATCH 358/521] :arrow_up: atom-keymap@5.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6abacc20..2e4b6c9d2 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.22.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^5", + "atom-keymap": "^5.1", "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", From 5e090669f91d4617e08dd55bcb86e7b3777a3e46 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:38:49 -0700 Subject: [PATCH 359/521] :arrow_up: scoped-property-store@0.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e4b6c9d2..0e700271c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "reactionary-atom-fork": "^1.0.0", "runas": "2.0.0", "scandal": "2.0.0", - "scoped-property-store": "^0.16.2", + "scoped-property-store": "^0.17.0", "scrollbar-style": "^2.0.0", "season": "^5.1.4", "semver": "~4.2", From 1f8d7a05af90668d097bd245e05cb11820f4a054 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 15:50:48 -0700 Subject: [PATCH 360/521] :arrow_up: first-mate@3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e700271c..093afa9a5 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "delegato": "^1", "emissary": "^1.3.3", "event-kit": "^1.1", - "first-mate": "^3.0.1", + "first-mate": "^3.1", "fs-plus": "^2.6", "fstream": "0.1.24", "fuzzaldrin": "^2.1", From 2a2cf17fc1ac81c95d8a44651135c32c87099c8c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 17:04:16 -0700 Subject: [PATCH 361/521] :arrow_up: text-buffer@5.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 093afa9a5..8b575680c 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "space-pen": "3.8.2", "stacktrace-parser": "0.1.1", "temp": "0.8.1", - "text-buffer": "^5.1.1", + "text-buffer": "^5.2", "theorist": "^1.0.2", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6" From 7d592c8b7851b4e94a79d941b37e893a494d1161 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 2 Apr 2015 17:08:28 -0700 Subject: [PATCH 362/521] includeDeprecations -> includeDeprecatedAPIs --- exports/atom.coffee | 6 +++--- src/atom.coffee | 14 +++++++------- src/config.coffee | 14 +++++++------- src/context-menu-manager.coffee | 2 +- src/cursor.coffee | 10 +++++----- src/decoration.coffee | 8 ++++---- src/deserializer-manager.coffee | 2 +- src/display-buffer.coffee | 16 ++++++++-------- src/git-repository.coffee | 8 ++++---- src/grammar-registry.coffee | 4 ++-- src/marker.coffee | 8 ++++---- src/model.coffee | 2 +- src/package-manager.coffee | 6 +++--- src/package.coffee | 18 +++++++++--------- src/pane-container-element.coffee | 4 ++-- src/pane-element.coffee | 4 ++-- src/pane.coffee | 4 ++-- src/project.coffee | 14 +++++++------- src/selection.coffee | 6 +++--- src/styles-element.coffee | 6 +++--- src/text-editor-component.coffee | 4 ++-- src/text-editor-element.coffee | 4 ++-- src/text-editor.coffee | 6 +++--- src/tokenized-buffer.coffee | 12 ++++++------ src/workspace-element.coffee | 6 +++--- src/workspace.coffee | 14 +++++++------- static/index.js | 2 +- 27 files changed, 102 insertions(+), 102 deletions(-) diff --git a/exports/atom.coffee b/exports/atom.coffee index 6b9243098..0d4583c5d 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -1,7 +1,7 @@ TextBuffer = require 'text-buffer' {Point, Range} = TextBuffer {Emitter, Disposable, CompositeDisposable} = require 'event-kit' -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' module.exports = BufferedNodeProcess: require '../src/buffered-node-process' @@ -21,7 +21,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE module.exports.Task = require '../src/task' module.exports.TextEditor = require '../src/text-editor' - if includeDeprecations + if includeDeprecatedAPIs {$, $$, $$$, View} = require '../src/space-pen-extensions' Object.defineProperty module.exports, 'Workspace', get: -> @@ -125,7 +125,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE deprecate "Please require `reactionary-atom-fork` instead: `Reactionary = require 'reactionary-atom-fork'`. Add `\"reactionary-atom-fork\": \"^0.9\"` to your package dependencies." require 'reactionary-atom-fork' -if includeDeprecations +if includeDeprecatedAPIs Object.defineProperty module.exports, 'Git', get: -> deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`" module.exports.GitRepository diff --git a/src/atom.coffee b/src/atom.coffee index 55cb7ee59..1710edd98 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -6,7 +6,7 @@ remote = require 'remote' shell = require 'shell' _ = require 'underscore-plus' -{deprecate, includeDeprecations} = require 'grim' +{deprecate, includeDeprecatedAPIs} = require 'grim' {CompositeDisposable, Emitter} = require 'event-kit' fs = require 'fs-plus' {convertStackTrace, convertLine} = require 'coffeestack' @@ -33,7 +33,7 @@ class Atom extends Model atom = @deserialize(@loadState(mode)) ? new this({mode, @version}) atom.deserializeTimings.atom = Date.now() - startTime - if includeDeprecations + if includeDeprecatedAPIs workspaceViewDeprecationMessage = """ atom.workspaceView is no longer available. In most cases you will not need the view. See the Workspace docs for @@ -229,7 +229,7 @@ class Atom extends Model @openDevTools() @executeJavaScriptInDevTools('InspectorFrontendAPI.showConsole()') - @emit 'uncaught-error', arguments... if includeDeprecations + @emit 'uncaught-error', arguments... if includeDeprecatedAPIs @emitter.emit 'did-throw-error', {message, url, line, column, originalError} @disposables?.dispose() @@ -267,7 +267,7 @@ class Atom extends Model @config = new Config({configDirPath, resourcePath}) @keymaps = new KeymapManager({configDirPath, resourcePath}) - if includeDeprecations + if includeDeprecatedAPIs @keymap = @keymaps # Deprecated @keymaps.subscribeToFileReadFailure() @@ -285,7 +285,7 @@ class Atom extends Model @grammars = @deserializers.deserialize(@state.grammars ? @state.syntax) ? new GrammarRegistry() - if includeDeprecations + if includeDeprecatedAPIs Object.defineProperty this, 'syntax', get: -> deprecate "The atom.syntax global is deprecated. Use atom.grammars instead." @grammars @@ -721,7 +721,7 @@ class Atom extends Model deserializeWorkspaceView: -> Workspace = require './workspace' - if includeDeprecations + if includeDeprecatedAPIs WorkspaceView = require './workspace-view' startTime = Date.now() @@ -843,7 +843,7 @@ class Atom extends Model ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide) -if includeDeprecations +if includeDeprecatedAPIs # Deprecated: Callers should be converted to use atom.deserializers Atom::registerRepresentationClass = -> deprecate("Callers should be converted to use atom.deserializers") diff --git a/src/config.coffee b/src/config.coffee index 3d0e363ad..f7db867ed 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -371,7 +371,7 @@ class Config observe: -> if arguments.length is 2 [keyPath, callback] = arguments - else if Grim.includeDeprecations and arguments.length is 3 and (_.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor) + else if Grim.includeDeprecatedAPIs and arguments.length is 3 and (_.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor) Grim.deprecate """ Passing a scope descriptor as the first argument to Config::observe is deprecated. Pass a `scope` in an options hash as the third argument instead. @@ -380,7 +380,7 @@ class Config else if arguments.length is 3 and (_.isString(arguments[0]) and _.isObject(arguments[1])) [keyPath, options, callback] = arguments scopeDescriptor = options.scope - if Grim.includeDeprecations and options.callNow? + if Grim.includeDeprecatedAPIs and options.callNow? Grim.deprecate """ Config::observe no longer takes a `callNow` option. Use ::onDidChange instead. Note that ::onDidChange passes its callback different arguments. @@ -419,7 +419,7 @@ class Config [callback] = arguments else if arguments.length is 2 [keyPath, callback] = arguments - else if Grim.includeDeprecations and _.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor + else if Grim.includeDeprecatedAPIs and _.isArray(arguments[0]) or arguments[0] instanceof ScopeDescriptor Grim.deprecate """ Passing a scope descriptor as the first argument to Config::onDidChange is deprecated. Pass a `scope` in an options hash as the third argument instead. @@ -498,7 +498,7 @@ class Config if typeof arguments[0] is 'string' or not arguments[0]? [keyPath, options] = arguments {scope} = options - else if Grim.includeDeprecations + else if Grim.includeDeprecatedAPIs Grim.deprecate """ Passing a scope descriptor as the first argument to Config::get is deprecated. Pass a `scope` in an options hash as the final argument instead. @@ -578,7 +578,7 @@ class Config # * `true` if the value was set. # * `false` if the value was not able to be coerced to the type specified in the setting's schema. set: -> - if Grim.includeDeprecations and arguments[0]?[0] is '.' + if Grim.includeDeprecatedAPIs and arguments[0]?[0] is '.' Grim.deprecate """ Passing a scope selector as the first argument to Config::set is deprecated. Pass a `scopeSelector` in an options hash as the final argument instead. @@ -617,7 +617,7 @@ class Config # * `scopeSelector` (optional) {String}. See {::set} # * `source` (optional) {String}. See {::set} unset: (keyPath, options) -> - if Grim.includeDeprecations and typeof options is 'string' + if Grim.includeDeprecatedAPIs and typeof options is 'string' Grim.deprecate """ Passing a scope selector as the first argument to Config::unset is deprecated. Pass a `scopeSelector` in an options hash as the second argument instead. @@ -1146,7 +1146,7 @@ withoutEmptyObjects = (object) -> resultObject = object resultObject -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs Config::restoreDefault = (scopeSelector, keyPath) -> Grim.deprecate("Use ::unset instead.") @unset(scopeSelector, keyPath) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 4565c8b55..00b635251 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -99,7 +99,7 @@ class ContextMenuManager # with the following argument: # * `event` The click event that deployed the context menu. add: (itemsBySelector) -> - if Grim.includeDeprecations + if Grim.includeDeprecatedAPIs # Detect deprecated file path as first argument if itemsBySelector? and typeof itemsBySelector isnt 'object' Grim.deprecate """ diff --git a/src/cursor.coffee b/src/cursor.coffee index 6bb3f4bae..3ed9939ad 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -39,13 +39,13 @@ class Cursor extends Model textChanged: textChanged cursor: this - @emit 'moved', movedEvent if Grim.includeDeprecations + @emit 'moved', movedEvent if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-position', movedEvent @editor.cursorMoved(movedEvent) @marker.onDidDestroy => @destroyed = true @editor.removeCursor(this) - @emit 'destroyed' if Grim.includeDeprecations + @emit 'destroyed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-destroy' @emitter.dispose() @@ -89,7 +89,7 @@ class Cursor extends Model @emitter.on 'did-change-visibility', callback on: (eventName) -> - return unless Grim.includeDeprecations + return unless Grim.includeDeprecatedAPIs switch eventName when 'moved' @@ -588,7 +588,7 @@ class Cursor extends Model setVisible: (visible) -> if @visible != visible @visible = visible - @emit 'visibility-changed', @visible if Grim.includeDeprecations + @emit 'visibility-changed', @visible if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-visibility', @visible # Public: Returns the visibility of the cursor. @@ -682,7 +682,7 @@ class Cursor extends Model stop() position -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs Cursor::getScopes = -> Grim.deprecate 'Use Cursor::getScopeDescriptor() instead' @getScopeDescriptor().getScopesArray() diff --git a/src/decoration.coffee b/src/decoration.coffee index a556a3a3c..8654cf39a 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -65,7 +65,7 @@ class Decoration @markerDestroyDisposable.dispose() @markerDestroyDisposable = null @destroyed = true - @emit 'destroyed' if Grim.includeDeprecations + @emit 'destroyed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-destroy' @emitter.dispose() @@ -136,7 +136,7 @@ class Decoration oldProperties = @properties @properties = newProperties @properties.id = @id - @emit 'updated', {oldParams: oldProperties, newParams: newProperties} if Grim.includeDeprecations + @emit 'updated', {oldParams: oldProperties, newParams: newProperties} if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-properties', {oldProperties, newProperties} ### @@ -156,14 +156,14 @@ class Decoration flashObject = {class: klass, duration} @flashQueue ?= [] @flashQueue.push(flashObject) - @emit 'flash' if Grim.includeDeprecations + @emit 'flash' if Grim.includeDeprecatedAPIs @emitter.emit 'did-flash' consumeNextFlash: -> return @flashQueue.shift() if @flashQueue?.length > 0 null -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(Decoration) diff --git a/src/deserializer-manager.coffee b/src/deserializer-manager.coffee index 4efc71ec5..fab84539c 100644 --- a/src/deserializer-manager.coffee +++ b/src/deserializer-manager.coffee @@ -61,7 +61,7 @@ class DeserializerManager name = state.get?('deserializer') ? state.deserializer @deserializers[name] -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs DeserializerManager::remove = (classes...) -> Grim.deprecate("Call .dispose() on the Disposable return from ::add instead") delete @deserializers[name] for {name} in classes diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 12b839143..a8b24086a 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -155,7 +155,7 @@ class DisplayBuffer extends Model if refreshMarkers @pauseMarkerChangeEvents() @refreshMarkerScreenPositions() - @emit 'changed', eventProperties if Grim.includeDeprecations + @emit 'changed', eventProperties if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', eventProperties @resumeMarkerChangeEvents() @@ -309,7 +309,7 @@ class DisplayBuffer extends Model characterWidthsChanged: -> @computeScrollWidth() - @emit 'character-widths-changed', @scopedCharacterWidthsChangeCount if Grim.includeDeprecations + @emit 'character-widths-changed', @scopedCharacterWidthsChangeCount if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-character-widths', @scopedCharacterWidthsChangeCount clearScopedCharWidths: -> @@ -427,7 +427,7 @@ class DisplayBuffer extends Model @softWrapped = softWrapped @updateWrappedScreenLines() softWrapped = @isSoftWrapped() - @emit 'soft-wrap-changed', softWrapped if Grim.includeDeprecations + @emit 'soft-wrap-changed', softWrapped if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-soft-wrapped', softWrapped softWrapped else @@ -911,7 +911,7 @@ class DisplayBuffer extends Model @decorationsByMarkerId[marker.id] ?= [] @decorationsByMarkerId[marker.id].push(decoration) @decorationsById[decoration.id] = decoration - @emit 'decoration-added', decoration if Grim.includeDeprecations + @emit 'decoration-added', decoration if Grim.includeDeprecatedAPIs @emitter.emit 'did-add-decoration', decoration decoration @@ -923,7 +923,7 @@ class DisplayBuffer extends Model if index > -1 decorations.splice(index, 1) delete @decorationsById[decoration.id] - @emit 'decoration-removed', decoration if Grim.includeDeprecations + @emit 'decoration-removed', decoration if Grim.includeDeprecatedAPIs @emitter.emit 'did-remove-decoration', decoration delete @decorationsByMarkerId[marker.id] if decorations.length is 0 @@ -1075,7 +1075,7 @@ class DisplayBuffer extends Model resumeMarkerChangeEvents: -> marker.resumeChangeEvents() for marker in @getMarkers() - @emit 'markers-updated' if Grim.includeDeprecations + @emit 'markers-updated' if Grim.includeDeprecatedAPIs @emitter.emit 'did-update-markers' refreshMarkerScreenPositions: -> @@ -1217,7 +1217,7 @@ class DisplayBuffer extends Model if marker = @getMarker(textBufferMarker.id) # The marker might have been removed in some other handler called before # this one. Only emit when the marker still exists. - @emit 'marker-created', marker if Grim.includeDeprecations + @emit 'marker-created', marker if Grim.includeDeprecatedAPIs @emitter.emit 'did-create-marker', marker createFoldForMarker: (marker) -> @@ -1227,7 +1227,7 @@ class DisplayBuffer extends Model foldForMarker: (marker) -> @foldsByMarkerId[marker.id] -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs EmitterMixin = require('emissary').Emitter DisplayBuffer::on = (eventName) -> diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 0ae4abf3a..145b2bf96 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -4,7 +4,7 @@ _ = require 'underscore-plus' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' fs = require 'fs-plus' GitUtils = require 'git-utils' -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' Task = require './task' @@ -313,7 +313,7 @@ class GitRepository else delete @statuses[relativePath] if currentPathStatus isnt pathStatus - @emit 'status-changed', path, pathStatus if includeDeprecations + @emit 'status-changed', path, pathStatus if includeDeprecatedAPIs @emitter.emit 'did-change-status', {path, pathStatus} pathStatus @@ -474,10 +474,10 @@ class GitRepository submoduleRepo.upstream = submodules[submodulePath]?.upstream ? {ahead: 0, behind: 0} unless statusesUnchanged - @emit 'statuses-changed' if includeDeprecations + @emit 'statuses-changed' if includeDeprecatedAPIs @emitter.emit 'did-change-statuses' -if includeDeprecations +if includeDeprecatedAPIs EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(GitRepository) diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee index b95b561da..b43e095d9 100644 --- a/src/grammar-registry.coffee +++ b/src/grammar-registry.coffee @@ -1,5 +1,5 @@ {Emitter} = require 'event-kit' -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' FirstMate = require 'first-mate' Token = require './token' @@ -41,7 +41,7 @@ class GrammarRegistry extends FirstMate.GrammarRegistry @off() if includeDeprecations @emitter = new Emitter -if includeDeprecations +if includeDeprecatedAPIs PropertyAccessors = require 'property-accessors' PropertyAccessors.includeInto(GrammarRegistry) diff --git a/src/marker.coffee b/src/marker.coffee index c177b792e..5d1e35570 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -319,7 +319,7 @@ class Marker destroyed: -> delete @displayBuffer.markers[@id] - @emit 'destroyed' if Grim.includeDeprecations + @emit 'destroyed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-destroy' @emitter.dispose() @@ -350,7 +350,7 @@ class Marker if @deferredChangeEvents? @deferredChangeEvents.push(changeEvent) else - @emit 'changed', changeEvent if Grim.includeDeprecations + @emit 'changed', changeEvent if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', changeEvent @oldHeadBufferPosition = newHeadBufferPosition @@ -367,14 +367,14 @@ class Marker @deferredChangeEvents = null for event in deferredChangeEvents - @emit 'changed', event if Grim.includeDeprecations + @emit 'changed', event if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', event return getPixelRange: -> @displayBuffer.pixelRangeForScreenRange(@getScreenRange(), false) -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(Marker) diff --git a/src/model.coffee b/src/model.coffee index bfb854320..7b38c0eef 100644 --- a/src/model.coffee +++ b/src/model.coffee @@ -1,5 +1,5 @@ Grim = require 'grim' -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs module.exports = require('theorist').Model return diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 7399eaab1..bc4443418 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -308,7 +308,7 @@ class PackageManager packagePaths = packagePaths.filter (packagePath) => not @isPackageDisabled(path.basename(packagePath)) packagePaths = _.uniq packagePaths, (packagePath) -> path.basename(packagePath) @loadPackage(packagePath) for packagePath in packagePaths - @emit 'loaded' if Grim.includeDeprecations + @emit 'loaded' if Grim.includeDeprecatedAPIs @emitter.emit 'did-load-initial-packages' loadPackage: (nameOrPath) -> @@ -357,7 +357,7 @@ class PackageManager packages = @getLoadedPackagesForTypes(types) promises = promises.concat(activator.activatePackages(packages)) Q.all(promises).then => - @emit 'activated' if Grim.includeDeprecations + @emit 'activated' if Grim.includeDeprecatedAPIs @emitter.emit 'did-activate-initial-packages' # another type of package manager can handle other package types. @@ -410,7 +410,7 @@ class PackageManager message = "Failed to load the #{path.basename(packagePath)} package" atom.notifications.addError(message, {stack, detail, dismissable: true}) -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs PackageManager::onDidLoadAll = (callback) -> Grim.deprecate("Use `::onDidLoadInitialPackages` instead.") @onDidLoadInitialPackages(callback) diff --git a/src/package.coffee b/src/package.coffee index f9d3ac576..dd6701527 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -6,7 +6,7 @@ CSON = require 'season' fs = require 'fs-plus' {Emitter, CompositeDisposable} = require 'event-kit' Q = require 'q' -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' ModuleCache = require './module-cache' ScopedProperties = require './scoped-properties' @@ -40,11 +40,11 @@ class Package metadata ?= {} metadata.name = packageName - if includeDeprecations and metadata.stylesheetMain? + if includeDeprecatedAPIs and metadata.stylesheetMain? deprecate("Use the `mainStyleSheet` key instead of `stylesheetMain` in the `package.json` of `#{packageName}`", {packageName}) metadata.mainStyleSheet = metadata.stylesheetMain - if includeDeprecations and metadata.stylesheets? + if includeDeprecatedAPIs and metadata.stylesheets? deprecate("Use the `styleSheets` key instead of `stylesheets` in the `package.json` of `#{packageName}`", {packageName}) metadata.styleSheets = metadata.stylesheets @@ -163,7 +163,7 @@ class Package if @mainModule? if @mainModule.config? and typeof @mainModule.config is 'object' atom.config.setSchema @name, {type: 'object', properties: @mainModule.config} - else if includeDeprecations and @mainModule.configDefaults? and typeof @mainModule.configDefaults is 'object' + else if includeDeprecatedAPIs and @mainModule.configDefaults? and typeof @mainModule.configDefaults is 'object' deprecate """Use a config schema instead. See the configuration section of https://atom.io/docs/latest/hacking-atom-package-word-count and https://atom.io/docs/api/latest/Config for more details""" @@ -257,7 +257,7 @@ class Package [stylesheetPath, atom.themes.loadStylesheet(stylesheetPath, true)] getStylesheetsPath: -> - if includeDeprecations and fs.isDirectorySync(path.join(@path, 'stylesheets')) + if includeDeprecatedAPIs and fs.isDirectorySync(path.join(@path, 'stylesheets')) deprecate("Store package style sheets in the `styles/` directory instead of `stylesheets/` in the `#{@name}` package", packageName: @name) path.join(@path, 'stylesheets') else @@ -328,7 +328,7 @@ class Package deferred = Q.defer() - if includeDeprecations and fs.isDirectorySync(path.join(@path, 'scoped-properties')) + if includeDeprecatedAPIs and fs.isDirectorySync(path.join(@path, 'scoped-properties')) settingsDirPath = path.join(@path, 'scoped-properties') deprecate("Store package settings files in the `settings/` directory instead of `scoped-properties/`", packageName: @name) else @@ -356,7 +356,7 @@ class Package @mainModule?.deactivate?() catch e console.error "Error deactivating package '#{@name}'", e.stack - @emit 'deactivated' if includeDeprecations + @emit 'deactivated' if includeDeprecatedAPIs @emitter.emit 'did-deactivate' deactivateConfig: -> @@ -456,7 +456,7 @@ class Package else if _.isArray(commands) @activationCommands[selector].push(commands...) - if includeDeprecations and @metadata.activationEvents? + if includeDeprecatedAPIs and @metadata.activationEvents? deprecate """ Use `activationCommands` instead of `activationEvents` in your package.json Commands should be grouped by selector as follows: @@ -575,7 +575,7 @@ class Package atom.notifications.addFatalError(message, {stack, detail, dismissable: true}) -if includeDeprecations +if includeDeprecatedAPIs EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(Package) diff --git a/src/pane-container-element.coffee b/src/pane-container-element.coffee index 55d527971..94b008255 100644 --- a/src/pane-container-element.coffee +++ b/src/pane-container-element.coffee @@ -10,13 +10,13 @@ class PaneContainerElement extends HTMLElement @subscriptions = new CompositeDisposable @classList.add 'panes' - if Grim.includeDeprecations + if Grim.includeDeprecatedAPIs PaneContainerView ?= require './pane-container-view' @__spacePenView = new PaneContainerView(this) initialize: (@model) -> @subscriptions.add @model.observeRoot(@rootChanged.bind(this)) - @__spacePenView.setModel(@model) if Grim.includeDeprecations + @__spacePenView.setModel(@model) if Grim.includeDeprecatedAPIs this rootChanged: (root) -> diff --git a/src/pane-element.coffee b/src/pane-element.coffee index f050567b2..f5bfc18bd 100644 --- a/src/pane-element.coffee +++ b/src/pane-element.coffee @@ -13,7 +13,7 @@ class PaneElement extends HTMLElement @initializeContent() @subscribeToDOMEvents() - @createSpacePenShim() if Grim.includeDeprecations + @createSpacePenShim() if Grim.includeDeprecatedAPIs attachedCallback: -> @attached = true @@ -51,7 +51,7 @@ class PaneElement extends HTMLElement @subscriptions.add @model.observeActiveItem(@activeItemChanged.bind(this)) @subscriptions.add @model.onDidRemoveItem(@itemRemoved.bind(this)) @subscriptions.add @model.onDidDestroy(@paneDestroyed.bind(this)) - @__spacePenView.setModel(@model) if Grim.includeDeprecations + @__spacePenView.setModel(@model) if Grim.includeDeprecatedAPIs this getModel: -> @model diff --git a/src/pane.coffee b/src/pane.coffee index 07e621e46..6d2aa5154 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -41,7 +41,7 @@ class Pane extends Model # Called by the Serializable mixin during serialization. serializeParams: -> - if Grim.includeDeprecations and typeof @activeItem?.getURI is 'function' + if Grim.includeDeprecatedAPIs and typeof @activeItem?.getURI is 'function' activeItemURI = @activeItem.getURI() else if typeof @activeItem?.getUri is 'function' activeItemURI = @activeItem.getUri() @@ -660,7 +660,7 @@ class Pane extends Model else throw error -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs Pane::on = (eventName) -> switch eventName when 'activated' diff --git a/src/project.coffee b/src/project.coffee index 63e5576de..b34d301b6 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -4,7 +4,7 @@ url = require 'url' _ = require 'underscore-plus' fs = require 'fs-plus' Q = require 'q' -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' {Subscriber} = require 'emissary' {Emitter} = require 'event-kit' Serializable = require 'serializable' @@ -67,7 +67,7 @@ class Project extends Model @subscribeToBuffer(buffer) for buffer in @buffers - if Grim.includeDeprecations and path? + if Grim.includeDeprecatedAPIs and path? Grim.deprecate("Pass 'paths' array instead of 'path' to project constructor") paths ?= _.compact([path]) @@ -178,7 +178,7 @@ class Project extends Model @addPath(projectPath, emitEvent: false) for projectPath in projectPaths - @emit "path-changed" if includeDeprecations + @emit "path-changed" if includeDeprecatedAPIs @emitter.emit 'did-change-paths', projectPaths # Public: Add a path to the project's list of root paths @@ -205,7 +205,7 @@ class Project extends Model @repositories.push(repo ? null) unless options?.emitEvent is false - @emit "path-changed" if includeDeprecations + @emit "path-changed" if includeDeprecatedAPIs @emitter.emit 'did-change-paths', @getPaths() # Public: remove a path from the project's list of root paths. @@ -227,7 +227,7 @@ class Project extends Model [removedRepository] = @repositories.splice(indexToRemove, 1) removedDirectory.off() removedRepository?.destroy() unless removedRepository in @repositories - @emit "path-changed" if includeDeprecations + @emit "path-changed" if includeDeprecatedAPIs @emitter.emit "did-change-paths", @getPaths() true else @@ -393,7 +393,7 @@ class Project extends Model addBufferAtIndex: (buffer, index, options={}) -> @buffers.splice(index, 0, buffer) @subscribeToBuffer(buffer) - @emit 'buffer-created', buffer if includeDeprecations + @emit 'buffer-created', buffer if includeDeprecatedAPIs @emitter.emit 'did-add-buffer', buffer buffer @@ -433,7 +433,7 @@ class Project extends Model detail: error.message dismissable: true -if includeDeprecations +if includeDeprecatedAPIs Project.pathForRepositoryUrl = (repoUrl) -> deprecate '::pathForRepositoryUrl will be removed. Please remove from your code.' [repoName] = url.parse(repoUrl).path.split('/')[-1..] diff --git a/src/selection.coffee b/src/selection.coffee index af70e234c..91f942524 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -27,7 +27,7 @@ class Selection extends Model unless @editor.isDestroyed() @destroyed = true @editor.removeSelection(this) - @emit 'destroyed' if Grim.includeDeprecations + @emit 'destroyed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-destroy' @emitter.dispose() @@ -732,7 +732,7 @@ class Selection extends Model newScreenRange: @getScreenRange() selection: this - @emit 'screen-range-changed', @getScreenRange() if Grim.includeDeprecations + @emit 'screen-range-changed', @getScreenRange() if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-range' @editor.selectionRangeChanged(eventObject) @@ -768,7 +768,7 @@ class Selection extends Model if goalScreenRange = @marker.getProperties().goalScreenRange Range.fromObject(goalScreenRange) -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs Selection::on = (eventName) -> switch eventName when 'screen-range-changed' diff --git a/src/styles-element.coffee b/src/styles-element.coffee index eaf7c53c8..74ebd23ba 100644 --- a/src/styles-element.coffee +++ b/src/styles-element.coffee @@ -1,5 +1,5 @@ {Emitter, CompositeDisposable} = require 'event-kit' -{includeDeprecations} = require 'grim' +{includeDeprecatedAPIs} = require 'grim' class StylesElement extends HTMLElement subscriptions: null @@ -19,7 +19,7 @@ class StylesElement extends HTMLElement @styleElementClonesByOriginalElement = new WeakMap attachedCallback: -> - if includeDeprecations and @context is 'atom-text-editor' + if includeDeprecatedAPIs and @context is 'atom-text-editor' for styleElement in @children @upgradeDeprecatedSelectors(styleElement) @initialize() @@ -67,7 +67,7 @@ class StylesElement extends HTMLElement @insertBefore(styleElementClone, insertBefore) - if includeDeprecations and @context is 'atom-text-editor' + if includeDeprecatedAPIs and @context is 'atom-text-editor' @upgradeDeprecatedSelectors(styleElementClone) @emitter.emit 'did-add-style-element', styleElementClone diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index b57920952..c001c2252 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -152,7 +152,7 @@ class TextEditorComponent if @editor.isAlive() @updateParentViewFocusedClassIfNeeded() @updateParentViewMiniClass() - if grim.includeDeprecations + if grim.includeDeprecatedAPIs @hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved @hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged @hostElement.__spacePenView.trigger 'editor:display-updated' @@ -781,7 +781,7 @@ class TextEditorComponent @hostElement.classList.toggle('mini', @editor.isMini()) @rootElement.classList.toggle('mini', @editor.isMini()) -if grim.includeDeprecations +if grim.includeDeprecatedAPIs # Deprecated TextEditorComponent::setInvisibles = (invisibles={}) -> grim.deprecate "Use config.set('editor.invisibles', invisibles) instead" diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index 5822f533c..4a7a11147 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -21,7 +21,7 @@ class TextEditorElement extends HTMLElement createdCallback: -> @emitter = new Emitter @initializeContent() - @createSpacePenShim() if Grim.includeDeprecations + @createSpacePenShim() if Grim.includeDeprecatedAPIs @addEventListener 'focus', @focused.bind(this) @addEventListener 'blur', @blurred.bind(this) @@ -87,7 +87,7 @@ class TextEditorElement extends HTMLElement @model.onDidChangeGrammar => @addGrammarScopeAttribute() @model.onDidChangeEncoding => @addEncodingAttribute() @model.onDidDestroy => @unmountComponent() - @__spacePenView.setModel(@model) if Grim.includeDeprecations + @__spacePenView.setModel(@model) if Grim.includeDeprecatedAPIs @model getModel: -> diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 1821a8a52..1f917b6a2 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2,7 +2,7 @@ _ = require 'underscore-plus' path = require 'path' Serializable = require 'serializable' Delegator = require 'delegato' -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' {Model} = require 'theorist' EmitterMixin = require('emissary').Emitter {CompositeDisposable, Emitter} = require 'event-kit' @@ -1252,7 +1252,7 @@ class TextEditor extends Model # # Returns a {Decoration} object decorateMarker: (marker, decorationParams) -> - if includeDeprecations and decorationParams.type is 'gutter' + if includeDeprecatedAPIs and decorationParams.type is 'gutter' deprecate("Decorations of `type: 'gutter'` have been renamed to `type: 'line-number'`.") decorationParams.type = 'line-number' @displayBuffer.decorateMarker(marker, decorationParams) @@ -2835,7 +2835,7 @@ class TextEditor extends Model logScreenLines: (start, end) -> @displayBuffer.logLines(start, end) -if includeDeprecations +if includeDeprecatedAPIs TextEditor::getViewClass = -> require './text-editor-view' diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index ff06c66e6..bfc563d93 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -87,7 +87,7 @@ class TokenizedBuffer extends Model @retokenizeLines() - @emit 'grammar-changed', grammar if Grim.includeDeprecations + @emit 'grammar-changed', grammar if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-grammar', grammar reloadGrammar: -> @@ -109,7 +109,7 @@ class TokenizedBuffer extends Model @invalidateRow(0) @fullyTokenized = false event = {start: 0, end: lastRow, delta: 0} - @emit 'changed', event if Grim.includeDeprecations + @emit 'changed', event if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', event setVisible: (@visible) -> @@ -171,7 +171,7 @@ class TokenizedBuffer extends Model [startRow, endRow] = @updateFoldableStatus(startRow, endRow) event = {start: startRow, end: endRow, delta: 0} - @emit 'changed', event if Grim.includeDeprecations + @emit 'changed', event if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', event if @firstInvalidRow()? @@ -181,7 +181,7 @@ class TokenizedBuffer extends Model markTokenizationComplete: -> unless @fullyTokenized - @emit 'tokenized' if Grim.includeDeprecations + @emit 'tokenized' if Grim.includeDeprecatedAPIs @emitter.emit 'did-tokenize' @fullyTokenized = true @@ -228,7 +228,7 @@ class TokenizedBuffer extends Model end -= delta event = { start, end, delta, bufferChange: e } - @emit 'changed', event if Grim.includeDeprecations + @emit 'changed', event if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', event retokenizeWhitespaceRowsIfIndentLevelChanged: (row, increment) -> @@ -464,7 +464,7 @@ class TokenizedBuffer extends Model console.log row, line, line.length return -if Grim.includeDeprecations +if Grim.includeDeprecatedAPIs EmitterMixin = require('emissary').Emitter TokenizedBuffer::on = (eventName) -> diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 66ded0084..33ea14093 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -16,10 +16,10 @@ class WorkspaceElement extends HTMLElement @initializeContent() @observeScrollbarStyle() @observeTextEditorFontConfig() - @createSpacePenShim() if Grim.includeDeprecations + @createSpacePenShim() if Grim.includeDeprecatedAPIs attachedCallback: -> - callAttachHooks(this) if Grim.includeDeprecations + callAttachHooks(this) if Grim.includeDeprecatedAPIs @focus() detachedCallback: -> @@ -82,7 +82,7 @@ class WorkspaceElement extends HTMLElement @appendChild(@panelContainers.modal) - @__spacePenView.setModel(@model) if Grim.includeDeprecations + @__spacePenView.setModel(@model) if Grim.includeDeprecatedAPIs this getModel: -> @model diff --git a/src/workspace.coffee b/src/workspace.coffee index 858ae063f..722a45f21 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -1,4 +1,4 @@ -{includeDeprecations, deprecate} = require 'grim' +{includeDeprecatedAPIs, deprecate} = require 'grim' _ = require 'underscore-plus' path = require 'path' {join} = path @@ -112,7 +112,7 @@ class Workspace extends Model _.uniq(packageNames) editorAdded: (editor) -> - @emit 'editor-created', editor if includeDeprecations + @emit 'editor-created', editor if includeDeprecatedAPIs installShellCommands: -> require('./command-installer').installShellCommandsInteractively() @@ -389,7 +389,7 @@ class Workspace extends Model # the containing pane. Defaults to `true`. openSync: (uri='', options={}) -> # TODO: Remove deprecated changeFocus option - if includeDeprecations and options.changeFocus? + if includeDeprecatedAPIs and options.changeFocus? deprecate("The `changeFocus` option has been renamed to `activatePane`") options.activatePane = options.changeFocus delete options.changeFocus @@ -410,7 +410,7 @@ class Workspace extends Model openURIInPane: (uri, pane, options={}) -> # TODO: Remove deprecated changeFocus option - if includeDeprecations and options.changeFocus? + if includeDeprecatedAPIs and options.changeFocus? deprecate("The `changeFocus` option has been renamed to `activatePane`") options.activatePane = options.changeFocus delete options.changeFocus @@ -446,7 +446,7 @@ class Workspace extends Model if options.initialLine? or options.initialColumn? item.setCursorBufferPosition?([options.initialLine, options.initialColumn]) index = pane.getActiveItemIndex() - @emit "uri-opened" if includeDeprecations + @emit "uri-opened" if includeDeprecatedAPIs @emitter.emit 'did-open', {uri, pane, item, index} item @@ -477,7 +477,7 @@ class Workspace extends Model # Returns a {Disposable} on which `.dispose()` can be called to remove the # opener. addOpener: (opener) -> - if includeDeprecations + if includeDeprecatedAPIs packageName = @getCallingPackageName() wrappedOpener = (uri, options) -> @@ -891,7 +891,7 @@ class Workspace extends Model deferred.promise -if includeDeprecations +if includeDeprecatedAPIs Object.defineProperty Workspace::, 'activePaneItem', get: -> Grim.deprecate "Use ::getActivePaneItem() instead of the ::activePaneItem property" diff --git a/static/index.js b/static/index.js index 7c8e92571..aa582f845 100644 --- a/static/index.js +++ b/static/index.js @@ -34,7 +34,7 @@ window.onload = function() { ModuleCache.register(loadSettings); ModuleCache.add(loadSettings.resourcePath); - require('grim').includeDeprecations = !loadSettings.apiPreviewMode; + require('grim').includeDeprecatedAPIs = !loadSettings.apiPreviewMode; // Start the crash reporter before anything else. require('crash-reporter').start({ From 183ac788a1e48e6c50e3f0359e8baae1dee5dbc2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 09:22:36 -0700 Subject: [PATCH 363/521] Check Grim.includeDeprecatedAPIs in keymap-extensions --- src/keymap-extensions.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 821abbc0c..551c6580d 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -3,13 +3,14 @@ path = require 'path' KeymapManager = require 'atom-keymap' CSON = require 'season' {jQuery} = require 'space-pen' +Grim = require 'grim' KeymapManager::onDidLoadBundledKeymaps = (callback) -> @emitter.on 'did-load-bundled-keymaps', callback KeymapManager::loadBundledKeymaps = -> @loadKeymap(path.join(@resourcePath, 'keymaps')) - @emit 'bundled-keymaps-loaded' + @emit 'bundled-keymaps-loaded' if Grim.includeDeprecatedAPIs @emitter.emit 'did-load-bundled-keymaps' KeymapManager::getUserKeymapPath = -> From ec5cd753508a61b2dbaf03425c726492548b19ef Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 09:40:17 -0700 Subject: [PATCH 364/521] includeDeprecations -> includeDeprecatedAPIs --- src/grammar-registry.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee index b43e095d9..8272dce47 100644 --- a/src/grammar-registry.coffee +++ b/src/grammar-registry.coffee @@ -38,7 +38,7 @@ class GrammarRegistry extends FirstMate.GrammarRegistry selectGrammar: (filePath, fileContents) -> super clearObservers: -> - @off() if includeDeprecations + @off() if includeDeprecatedAPIs @emitter = new Emitter if includeDeprecatedAPIs From 50d7825200d9fc0eeb2b7f1568363eacc44bfc98 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 09:45:13 -0700 Subject: [PATCH 365/521] Always assign paths --- src/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index b34d301b6..f7f1eb498 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -69,7 +69,7 @@ class Project extends Model if Grim.includeDeprecatedAPIs and path? Grim.deprecate("Pass 'paths' array instead of 'path' to project constructor") - paths ?= _.compact([path]) + paths ?= _.compact([path]) @setPaths(paths) From d1289be584bb98358414c597c78f5ec0f4958357 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 09:51:11 -0700 Subject: [PATCH 366/521] :arrow_up: markdown-preview@0.147 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b575680c..e1f0b075a 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.30.0", "link": "0.30.0", - "markdown-preview": "0.146.0", + "markdown-preview": "0.147.0", "metrics": "0.45.0", "notifications": "0.35.0", "open-on-github": "0.36.0", From 8be59f7433ecc6b51b3f398742a05673088c51a0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 09:53:18 -0700 Subject: [PATCH 367/521] :arrow_up: wrap-guide@0.32 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e1f0b075a..531f8f093 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "update-package-dependencies": "0.9.0", "welcome": "0.26.0", "whitespace": "0.29.0", - "wrap-guide": "0.31.0", + "wrap-guide": "0.32.0", "language-c": "0.43.0", "language-clojure": "0.13.0", "language-coffee-script": "0.39.0", From 2cf1a926889cee018ace189253370abdbb2ac116 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:11:25 -0700 Subject: [PATCH 368/521] :arrow_up: donna@1.0.9 --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index 297ddadfd..18bef4d1e 100644 --- a/build/package.json +++ b/build/package.json @@ -7,7 +7,7 @@ }, "dependencies": { "async": "~0.2.9", - "donna": "1.0.7", + "donna": "1.0.9", "formidable": "~1.0.14", "fs-plus": "2.x", "github-releases": "~0.2.0", From f5aab3547659759a016f43f8306e76036d2e8864 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:21:54 -0700 Subject: [PATCH 369/521] Check Grim.includeDeprecatedAPIs before emitting --- src/pane.coffee | 10 +++++----- src/text-editor.coffee | 29 +++++++++++++++-------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index 6d2aa5154..c69c74180 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -317,7 +317,7 @@ class Pane extends Model @subscribe item, 'destroyed', => @removeItem(item, true) @items.splice(index, 0, item) - @emit 'item-added', item, index + @emit 'item-added', item, index if Grim.includeDeprecatedAPIs @emitter.emit 'did-add-item', {item, index} @setActiveItem(item) unless @getActiveItem()? item @@ -352,7 +352,7 @@ class Pane extends Model else @activatePreviousItem() @items.splice(index, 1) - @emit 'item-removed', item, index, destroyed + @emit 'item-removed', item, index, destroyed if Grim.includeDeprecatedAPIs @emitter.emit 'did-remove-item', {item, index, destroyed} @container?.didDestroyPaneItem({item, index, pane: this}) if destroyed @destroy() if @items.length is 0 and atom.config.get('core.destroyEmptyPanes') @@ -365,7 +365,7 @@ class Pane extends Model oldIndex = @items.indexOf(item) @items.splice(oldIndex, 1) @items.splice(newIndex, 0, item) - @emit 'item-moved', item, newIndex + @emit 'item-moved', item, newIndex if Grim.includeDeprecatedAPIs @emitter.emit 'did-move-item', {item, oldIndex, newIndex} # Public: Move the given item to the given index on another pane. @@ -393,7 +393,7 @@ class Pane extends Model destroyItem: (item) -> index = @items.indexOf(item) if index isnt -1 - @emit 'before-item-destroyed', item + @emit 'before-item-destroyed', item if Grim.includeDeprecatedAPIs @emitter.emit 'will-destroy-item', {item, index} @container?.willDestroyPaneItem({item, index, pane: this}) if @promptToSaveItem(item) @@ -530,7 +530,7 @@ class Pane extends Model throw new Error("Pane has been destroyed") if @isDestroyed() @container?.setActivePane(this) - @emit 'activated' + @emit 'activated' if Grim.includeDeprecatedAPIs @emitter.emit 'did-activate' # Public: Close the pane and destroy all its items. diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 1f917b6a2..cbf1136a2 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -109,10 +109,10 @@ class TextEditor extends Model @setEncoding(atom.config.get('core.fileEncoding', scope: @getRootScopeDescriptor())) @subscribe @$scrollTop, (scrollTop) => - @emit 'scroll-top-changed', scrollTop + @emit 'scroll-top-changed', scrollTop if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-top', scrollTop @subscribe @$scrollLeft, (scrollLeft) => - @emit 'scroll-left-changed', scrollLeft + @emit 'scroll-left-changed', scrollLeft if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-left', scrollLeft atom.workspace?.editorAdded(this) if registerEditor @@ -134,18 +134,19 @@ class TextEditor extends Model @subscribe @buffer.onDidChangePath => unless atom.project.getPaths().length > 0 atom.project.setPaths([path.dirname(@getPath())]) - @emit "title-changed" + @emit "title-changed" if includeDeprecatedAPIs @emitter.emit 'did-change-title', @getTitle() - @emit "path-changed" + @emit "path-changed" if includeDeprecatedAPIs @emitter.emit 'did-change-path', @getPath() @subscribe @buffer.onDidChangeEncoding => @emitter.emit 'did-change-encoding', @getEncoding() @subscribe @buffer.onDidDestroy => @destroy() # TODO: remove these when we remove the deprecations. They are old events. - @subscribe @buffer.onDidStopChanging => @emit "contents-modified" - @subscribe @buffer.onDidConflict => @emit "contents-conflicted" - @subscribe @buffer.onDidChangeModified => @emit "modified-status-changed" + if includeDeprecatedAPIs + @subscribe @buffer.onDidStopChanging => @emit "contents-modified" + @subscribe @buffer.onDidConflict => @emit "contents-conflicted" + @subscribe @buffer.onDidChangeModified => @emit "modified-status-changed" @preserveCursorPositionOnBufferReload() @@ -1630,14 +1631,14 @@ class TextEditor extends Model @decorateMarker(marker, type: 'line-number', class: 'cursor-line') @decorateMarker(marker, type: 'line-number', class: 'cursor-line-no-selection', onlyHead: true, onlyEmpty: true) @decorateMarker(marker, type: 'line', class: 'cursor-line', onlyEmpty: true) - @emit 'cursor-added', cursor + @emit 'cursor-added', cursor if includeDeprecatedAPIs @emitter.emit 'did-add-cursor', cursor cursor # Remove the given cursor from this editor. removeCursor: (cursor) -> _.remove(@cursors, cursor) - @emit 'cursor-removed', cursor + @emit 'cursor-removed', cursor if includeDeprecatedAPIs @emitter.emit 'did-remove-cursor', cursor moveCursors: (fn) -> @@ -1645,7 +1646,7 @@ class TextEditor extends Model @mergeCursors() cursorMoved: (event) -> - @emit 'cursor-moved', event + @emit 'cursor-moved', event if includeDeprecatedAPIs @emitter.emit 'did-change-cursor-position', event # Merge cursors that have the same screen position @@ -2092,14 +2093,14 @@ class TextEditor extends Model if selection.intersectsBufferRange(selectionBufferRange) return selection else - @emit 'selection-added', selection + @emit 'selection-added', selection if includeDeprecatedAPIs @emitter.emit 'did-add-selection', selection selection # Remove the given selection. removeSelection: (selection) -> _.remove(@selections, selection) - @emit 'selection-removed', selection + @emit 'selection-removed', selection if includeDeprecatedAPIs @emitter.emit 'did-remove-selection', selection # Reduce one or more selections to a single empty selection based on the most @@ -2119,7 +2120,7 @@ class TextEditor extends Model # Called by the selection selectionRangeChanged: (event) -> - @emit 'selection-screen-range-changed', event + @emit 'selection-screen-range-changed', event if includeDeprecatedAPIs @emitter.emit 'did-change-selection-range', event ### @@ -2723,7 +2724,7 @@ class TextEditor extends Model @updateInvisibles() @subscribeToScopedConfigSettings() @unfoldAll() - @emit 'grammar-changed' + @emit 'grammar-changed' if includeDeprecatedAPIs @emitter.emit 'did-change-grammar', @getGrammar() handleMarkerCreated: (marker) => From e39df0e40d44feb0e142e5327af8582dc1de0d92 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:26:36 -0700 Subject: [PATCH 370/521] Conditionally include deprecations in ThemeManager --- src/theme-manager.coffee | 157 ++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 93 deletions(-) diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 0ff42c4d2..01bb9652a 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -1,22 +1,16 @@ path = require 'path' - _ = require 'underscore-plus' -EmitterMixin = require('emissary').Emitter {Emitter, Disposable, CompositeDisposable} = require 'event-kit' {File} = require 'pathwatcher' fs = require 'fs-plus' Q = require 'q' Grim = require 'grim' -Package = require './package' - # Extended: Handles loading and activating available themes. # # An instance of this class is always available as the `atom.themes` global. module.exports = class ThemeManager - EmitterMixin.includeInto(this) - constructor: ({@packageManager, @resourcePath, @configDirPath, @safeMode}) -> @emitter = new Emitter @styleSheetDisposablesBySourcePath = {} @@ -33,24 +27,24 @@ class ThemeManager styleElementAdded: (styleElement) -> {sheet} = styleElement @sheetsByStyleElement.set(styleElement, sheet) - @emit 'stylesheet-added', sheet + @emit 'stylesheet-added', sheet if Grim.includeDeprecatedAPIs @emitter.emit 'did-add-stylesheet', sheet - @emit 'stylesheets-changed' + @emit 'stylesheets-changed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-stylesheets' styleElementRemoved: (styleElement) -> sheet = @sheetsByStyleElement.get(styleElement) - @emit 'stylesheet-removed', sheet + @emit 'stylesheet-removed', sheet if Grim.includeDeprecatedAPIs @emitter.emit 'did-remove-stylesheet', sheet - @emit 'stylesheets-changed' + @emit 'stylesheets-changed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-stylesheets' styleElementUpdated: ({sheet}) -> - @emit 'stylesheet-removed', sheet + @emit 'stylesheet-removed', sheet if Grim.includeDeprecatedAPIs @emitter.emit 'did-remove-stylesheet', sheet - @emit 'stylesheet-added', sheet + @emit 'stylesheet-added', sheet if Grim.includeDeprecatedAPIs @emitter.emit 'did-add-stylesheet', sheet - @emit 'stylesheets-changed' + @emit 'stylesheets-changed' if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-stylesheets' ### @@ -65,65 +59,6 @@ class ThemeManager @emitter.on 'did-change-active-themes', callback @emitter.on 'did-reload-all', callback # TODO: Remove once deprecated pre-1.0 APIs are gone - onDidReloadAll: (callback) -> - Grim.deprecate("Use `::onDidChangeActiveThemes` instead.") - @onDidChangeActiveThemes(callback) - - # Deprecated: Invoke `callback` when a stylesheet has been added to the dom. - # - # * `callback` {Function} - # * `stylesheet` {StyleSheet} the style node - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidAddStylesheet: (callback) -> - Grim.deprecate("Use atom.styles.onDidAddStyleElement instead") - @emitter.on 'did-add-stylesheet', callback - - # Deprecated: Invoke `callback` when a stylesheet has been removed from the dom. - # - # * `callback` {Function} - # * `stylesheet` {StyleSheet} the style node - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidRemoveStylesheet: (callback) -> - Grim.deprecate("Use atom.styles.onDidRemoveStyleElement instead") - @emitter.on 'did-remove-stylesheet', callback - - # Deprecated: Invoke `callback` when a stylesheet has been updated. - # - # * `callback` {Function} - # * `stylesheet` {StyleSheet} the style node - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidUpdateStylesheet: (callback) -> - Grim.deprecate("Use atom.styles.onDidUpdateStyleElement instead") - @emitter.on 'did-update-stylesheet', callback - - # Deprecated: Invoke `callback` when any stylesheet has been updated, added, or removed. - # - # * `callback` {Function} - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidChangeStylesheets: (callback) -> - Grim.deprecate("Use atom.styles.onDidAdd/RemoveStyleElement instead") - @emitter.on 'did-change-stylesheets', callback - - on: (eventName) -> - switch eventName - when 'reloaded' - Grim.deprecate 'Use ThemeManager::onDidChangeActiveThemes instead' - when 'stylesheet-added' - Grim.deprecate 'Use ThemeManager::onDidAddStylesheet instead' - when 'stylesheet-removed' - Grim.deprecate 'Use ThemeManager::onDidRemoveStylesheet instead' - when 'stylesheet-updated' - Grim.deprecate 'Use ThemeManager::onDidUpdateStylesheet instead' - when 'stylesheets-changed' - Grim.deprecate 'Use ThemeManager::onDidChangeStylesheets instead' - else - Grim.deprecate 'ThemeManager::on is deprecated. Use event subscription methods instead.' - EmitterMixin::on.apply(this, arguments) - ### Section: Accessing Available Themes ### @@ -140,10 +75,6 @@ class ThemeManager getLoadedThemeNames: -> theme.name for theme in @getLoadedThemes() - getLoadedNames: -> - Grim.deprecate("Use `::getLoadedThemeNames` instead.") - @getLoadedThemeNames() - # Public: Get an array of all the loaded themes. getLoadedThemes: -> pack for pack in @packageManager.getLoadedPackages() when pack.isTheme() @@ -156,10 +87,6 @@ class ThemeManager getActiveThemeNames: -> theme.name for theme in @getActiveThemes() - getActiveNames: -> - Grim.deprecate("Use `::getActiveThemeNames` instead.") - @getActiveThemeNames() - # Public: Get an array of all the active themes. getActiveThemes: -> pack for pack in @packageManager.getActivePackages() when pack.isTheme() @@ -208,22 +135,10 @@ class ThemeManager # the first/top theme to override later themes in the stack. themeNames.reverse() - # Set the list of enabled themes. - # - # * `enabledThemeNames` An {Array} of {String} theme names. - setEnabledThemes: (enabledThemeNames) -> - Grim.deprecate("Use `atom.config.set('core.themes', arrayOfThemeNames)` instead") - atom.config.set('core.themes', enabledThemeNames) - ### Section: Private ### - # Returns the {String} path to the user's stylesheet under ~/.atom - getUserStylesheetPath: -> - Grim.deprecate("Call atom.styles.getUserStyleSheetPath() instead") - atom.styles.getUserStyleSheetPath() - # Resolve and apply the stylesheet specified by the path. # # This supports both CSS and Less stylsheets. @@ -366,7 +281,7 @@ class ThemeManager @loadUserStylesheet() @reloadBaseStylesheets() @initialLoadComplete = true - @emit 'reloaded' + @emit 'reloaded' if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-active-themes' deferred.resolve() @@ -410,3 +325,59 @@ class ThemeManager themePaths.push(path.join(themePath, 'styles')) themePaths.filter (themePath) -> fs.isDirectorySync(themePath) + +if Grim.includeDeprecatedAPIs + EmitterMixin = require('emissary').Emitter + EmitterMixin.includeInto(ThemeManager) + + ThemeManager::on = (eventName) -> + switch eventName + when 'reloaded' + Grim.deprecate 'Use ThemeManager::onDidChangeActiveThemes instead' + when 'stylesheet-added' + Grim.deprecate 'Use ThemeManager::onDidAddStylesheet instead' + when 'stylesheet-removed' + Grim.deprecate 'Use ThemeManager::onDidRemoveStylesheet instead' + when 'stylesheet-updated' + Grim.deprecate 'Use ThemeManager::onDidUpdateStylesheet instead' + when 'stylesheets-changed' + Grim.deprecate 'Use ThemeManager::onDidChangeStylesheets instead' + else + Grim.deprecate 'ThemeManager::on is deprecated. Use event subscription methods instead.' + EmitterMixin::on.apply(this, arguments) + + ThemeManager::onDidReloadAll = (callback) -> + Grim.deprecate("Use `::onDidChangeActiveThemes` instead.") + @onDidChangeActiveThemes(callback) + + ThemeManager::onDidAddStylesheet = (callback) -> + Grim.deprecate("Use atom.styles.onDidAddStyleElement instead") + @emitter.on 'did-add-stylesheet', callback + + ThemeManager::onDidRemoveStylesheet = (callback) -> + Grim.deprecate("Use atom.styles.onDidRemoveStyleElement instead") + @emitter.on 'did-remove-stylesheet', callback + + ThemeManager::onDidUpdateStylesheet = (callback) -> + Grim.deprecate("Use atom.styles.onDidUpdateStyleElement instead") + @emitter.on 'did-update-stylesheet', callback + + ThemeManager::onDidChangeStylesheets = (callback) -> + Grim.deprecate("Use atom.styles.onDidAdd/RemoveStyleElement instead") + @emitter.on 'did-change-stylesheets', callback + + ThemeManager::getUserStylesheetPath = -> + Grim.deprecate("Call atom.styles.getUserStyleSheetPath() instead") + atom.styles.getUserStyleSheetPath() + + ThemeManager::getLoadedNames = -> + Grim.deprecate("Use `::getLoadedThemeNames` instead.") + @getLoadedThemeNames() + + ThemeManager::getActiveNames = -> + Grim.deprecate("Use `::getActiveThemeNames` instead.") + @getActiveThemeNames() + + ThemeManager::setEnabledThemes = (enabledThemeNames) -> + Grim.deprecate("Use `atom.config.set('core.themes', arrayOfThemeNames)` instead") + atom.config.set('core.themes', enabledThemeNames) From 73707ce57c8a1349ce6e19295dadb5f28b8c5354 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:35:04 -0700 Subject: [PATCH 371/521] :art: --- src/package-manager.coffee | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index bc4443418..16142cda4 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -411,16 +411,9 @@ class PackageManager atom.notifications.addError(message, {stack, detail, dismissable: true}) if Grim.includeDeprecatedAPIs - PackageManager::onDidLoadAll = (callback) -> - Grim.deprecate("Use `::onDidLoadInitialPackages` instead.") - @onDidLoadInitialPackages(callback) - - PackageManager::onDidActivateAll = (callback) -> - Grim.deprecate("Use `::onDidActivateInitialPackages` instead.") - @onDidActivateInitialPackages(callback) - EmitterMixin = require('emissary').Emitter EmitterMixin.includeInto(PackageManager) + PackageManager::on = (eventName) -> switch eventName when 'loaded' @@ -430,3 +423,11 @@ if Grim.includeDeprecatedAPIs else Grim.deprecate 'PackageManager::on is deprecated. Use event subscription methods instead.' EmitterMixin::on.apply(this, arguments) + + PackageManager::onDidLoadAll = (callback) -> + Grim.deprecate("Use `::onDidLoadInitialPackages` instead.") + @onDidLoadInitialPackages(callback) + + PackageManager::onDidActivateAll = (callback) -> + Grim.deprecate("Use `::onDidActivateInitialPackages` instead.") + @onDidActivateInitialPackages(callback) From 5aeffd49ab597a0545de3b5bfe4e508408a4e3e6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:36:10 -0700 Subject: [PATCH 372/521] :art: --- src/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index f7f1eb498..b1c939905 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -69,8 +69,8 @@ class Project extends Model if Grim.includeDeprecatedAPIs and path? Grim.deprecate("Pass 'paths' array instead of 'path' to project constructor") - paths ?= _.compact([path]) + paths ?= _.compact([path]) @setPaths(paths) destroyed: -> From 60913cd9bfa9794a0b4a0f5c659eb8d766824f18 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 3 Apr 2015 11:37:34 -0700 Subject: [PATCH 373/521] :memo: Remove empty deprecated comments --- src/text-editor-component.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index c001c2252..bd0e0ee86 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -782,12 +782,10 @@ class TextEditorComponent @rootElement.classList.toggle('mini', @editor.isMini()) if grim.includeDeprecatedAPIs - # Deprecated TextEditorComponent::setInvisibles = (invisibles={}) -> grim.deprecate "Use config.set('editor.invisibles', invisibles) instead" atom.config.set('editor.invisibles', invisibles) - # Deprecated TextEditorComponent::setShowInvisibles = (showInvisibles) -> grim.deprecate "Use config.set('editor.showInvisibles', showInvisibles) instead" atom.config.set('editor.showInvisibles', showInvisibles) From 4ec5f2b4adc2dac91b942c15b008e0ac8dd4e0ea Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:15:08 -0700 Subject: [PATCH 374/521] :arrow_up: language-c@0.44 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 531f8f093..7fe621085 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "welcome": "0.26.0", "whitespace": "0.29.0", "wrap-guide": "0.32.0", - "language-c": "0.43.0", + "language-c": "0.44.0", "language-clojure": "0.13.0", "language-coffee-script": "0.39.0", "language-csharp": "0.5.0", From a470ab9dd39d1552204d4fb3f478ea800d67ec74 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:20:11 -0700 Subject: [PATCH 375/521] :arrow_up: language-javascript@0.68 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7fe621085..2567e164d 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.67.0", + "language-javascript": "0.68.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From e0f316e53c38a6bfc70bce5d98dd4482e81f3122 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:26:08 -0700 Subject: [PATCH 376/521] :arrow_up: language-clojure@0.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2567e164d..5024e41b2 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "whitespace": "0.29.0", "wrap-guide": "0.32.0", "language-c": "0.44.0", - "language-clojure": "0.13.0", + "language-clojure": "0.14.0", "language-coffee-script": "0.39.0", "language-csharp": "0.5.0", "language-css": "0.28.0", From 4b46a5218e2270965e6cd06160ba68d2e7c82d20 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:33:21 -0700 Subject: [PATCH 377/521] :arrow_up: language-ruby@0.51 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5024e41b2..8ca00c56c 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "language-php": "0.22.0", "language-property-list": "0.8.0", "language-python": "0.33.0", - "language-ruby": "0.50.0", + "language-ruby": "0.51.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0", "language-shellscript": "0.13.0", From af80bc54197e616aab2170eee008bf5fb5ed6abe Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 2 Apr 2015 13:32:39 -0700 Subject: [PATCH 378/521] :memo: Make TextEditor::getBuffer public --- src/text-editor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index cbf1136a2..8d54fadb1 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -459,7 +459,7 @@ class TextEditor extends Model onDidChangeIcon: (callback) -> @emitter.on 'did-change-icon', callback - # Retrieves the current {TextBuffer}. + # Public: Retrieves the current {TextBuffer}. getBuffer: -> @buffer # Retrieves the current buffer's URI. From cf0a18e0f1b9b5e12ecfce47a60c3d61c3dd80b1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:45:31 -0700 Subject: [PATCH 379/521] :arrow_up: markdown-preview@0.148 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ca00c56c..f280f18bc 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "incompatible-packages": "0.24.0", "keybinding-resolver": "0.30.0", "link": "0.30.0", - "markdown-preview": "0.147.0", + "markdown-preview": "0.148.0", "metrics": "0.45.0", "notifications": "0.35.0", "open-on-github": "0.36.0", From 361732ce8119a189a67cca24f8922f85a1a384c2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:50:59 -0700 Subject: [PATCH 380/521] :arrow_up: snippets@0.88 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f280f18bc..55762cec0 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "package-generator": "0.38.0", "release-notes": "0.52.0", "settings-view": "0.187.0", - "snippets": "0.87.0", + "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.66.0", "styleguide": "0.44.0", From 39a1d6b788de9537566dd779f71c465b05c36d6d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 10:59:06 -0700 Subject: [PATCH 381/521] Wrap getUri in deprecated API check --- src/pane.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index c69c74180..b24d5b7e2 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -41,9 +41,9 @@ class Pane extends Model # Called by the Serializable mixin during serialization. serializeParams: -> - if Grim.includeDeprecatedAPIs and typeof @activeItem?.getURI is 'function' + if typeof @activeItem?.getURI is 'function' activeItemURI = @activeItem.getURI() - else if typeof @activeItem?.getUri is 'function' + else if Grim.includeDeprecatedAPIs and typeof @activeItem?.getUri is 'function' activeItemURI = @activeItem.getUri() id: @id From b98c2a8fbb0a100946afae4fd323ae7da895f1f5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 11:02:14 -0700 Subject: [PATCH 382/521] Only call Directory::off when including deprecated APIs --- src/project.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index b1c939905..5094ef8ce 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -171,7 +171,9 @@ class Project extends Model # # * `projectPaths` {Array} of {String} paths. setPaths: (projectPaths) -> - rootDirectory.off() for rootDirectory in @rootDirectories + if includeDeprecatedAPIs + rootDirectory.off() for rootDirectory in @rootDirectories + repository?.destroy() for repository in @repositories @rootDirectories = [] @repositories = [] @@ -225,7 +227,7 @@ class Project extends Model if indexToRemove? [removedDirectory] = @rootDirectories.splice(indexToRemove, 1) [removedRepository] = @repositories.splice(indexToRemove, 1) - removedDirectory.off() + removedDirectory.off() if includeDeprecatedAPIs removedRepository?.destroy() unless removedRepository in @repositories @emit "path-changed" if includeDeprecatedAPIs @emitter.emit "did-change-paths", @getPaths() From 661b2124b2b1a10ce40ef96694dbbcfd4e2a2b64 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 09:56:40 -0700 Subject: [PATCH 383/521] Use new Model in PaneAxis --- src/pane-axis.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pane-axis.coffee b/src/pane-axis.coffee index a9eb0757b..ec77b17d2 100644 --- a/src/pane-axis.coffee +++ b/src/pane-axis.coffee @@ -1,7 +1,7 @@ -{Model} = require 'theorist' {Emitter, CompositeDisposable} = require 'event-kit' {flatten} = require 'underscore-plus' Serializable = require 'serializable' +Model = require './model' module.exports = class PaneAxis extends Model From 312c03e6d20f6cf8aaeb0bc38c3864a3f2bb29a7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 10:02:02 -0700 Subject: [PATCH 384/521] Conditionally include activePane/activePaneItem properties --- src/pane-container.coffee | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/pane-container.coffee b/src/pane-container.coffee index 61ff9f207..7bc7c37e0 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -1,7 +1,8 @@ {find, flatten} = require 'underscore-plus' -{Model} = require 'theorist' +Grim = require 'grim' {Emitter, CompositeDisposable} = require 'event-kit' Serializable = require 'serializable' +Model = require './model' Pane = require './pane' PaneElement = require './pane-element' PaneContainerElement = require './pane-container-element' @@ -18,16 +19,8 @@ class PaneContainer extends Model @version: 1 - @properties - activePane: null - root: null - @behavior 'activePaneItem', -> - @$activePane - .switch((activePane) -> activePane?.$activeItem) - .distinctUntilChanged() - constructor: (params) -> super @@ -236,3 +229,15 @@ class PaneContainer extends Model removedPaneItem: (item) -> @itemRegistry.removeItem(item) + +if Grim.includeDeprecatedAPIs + PaneContainer.properties + activePane: null + + PaneContainer.behavior 'activePaneItem', -> + @$activePane + .switch((activePane) -> activePane?.$activeItem) + .distinctUntilChanged() + +else + PaneContainer::activePane = null From 96b95b74e9efae29781276bfd66718d22526c932 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 10:56:33 -0700 Subject: [PATCH 385/521] Conditionally include Pane model properties and behaviors --- src/pane-container.coffee | 4 +++- src/pane.coffee | 38 ++++++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/pane-container.coffee b/src/pane-container.coffee index 7bc7c37e0..58da39872 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -24,6 +24,9 @@ class PaneContainer extends Model constructor: (params) -> super + unless Grim.includeDeprecatedAPIs + @activePane = params?.activePane + @emitter = new Emitter @subscriptions = new CompositeDisposable @@ -238,6 +241,5 @@ if Grim.includeDeprecatedAPIs @$activePane .switch((activePane) -> activePane?.$activeItem) .distinctUntilChanged() - else PaneContainer::activePane = null diff --git a/src/pane.coffee b/src/pane.coffee index b24d5b7e2..dec0789c5 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -15,23 +15,13 @@ class Pane extends Model atom.deserializers.add(this) Serializable.includeInto(this) - @properties - container: undefined - activeItem: undefined - focused: false - - # Public: Only one pane is considered *active* at a time. A pane is activated - # when it is focused, and when focus returns to the pane container after - # moving to another element such as a panel, it returns to the active pane. - @behavior 'active', -> - @$container - .switch((container) -> container?.$activePane) - .map((activePane) => activePane is this) - .distinctUntilChanged() - constructor: (params) -> super + unless Grim.includeDeprecatedAPIs + @container = params?.container + @activeItem = params?.activeItem + @emitter = new Emitter @itemSubscriptions = new WeakMap @items = [] @@ -313,7 +303,8 @@ class Pane extends Model if typeof item.onDidDestroy is 'function' @itemSubscriptions.set item, item.onDidDestroy => @removeItem(item, true) - else if typeof item.on is 'function' + else if Grim.includeDeprecations and typeof item.on is 'function' + deprecate 'If you would like your pane item to support removal when destroyed behavior, please implement a ::onDidDestroy() method. ::on methods for items are no longer supported. If not, ignore this message.' @subscribe item, 'destroyed', => @removeItem(item, true) @items.splice(index, 0, item) @@ -340,7 +331,7 @@ class Pane extends Model index = @items.indexOf(item) return if index is -1 - if typeof item.on is 'function' + if Grim.includeDeprecations and typeof item.on is 'function' @unsubscribe item @unsubscribeFromItem(item) @@ -661,6 +652,17 @@ class Pane extends Model throw error if Grim.includeDeprecatedAPIs + Pane.properties + container: undefined + activeItem: undefined + focused: false + + Pane.behavior 'active', -> + @$container + .switch((container) -> container?.$activePane) + .map((activePane) => activePane is this) + .distinctUntilChanged() + Pane::on = (eventName) -> switch eventName when 'activated' @@ -701,3 +703,7 @@ if Grim.includeDeprecatedAPIs Pane::activateItemForUri = (uri) -> Grim.deprecate("Use `::activateItemForURI` instead.") @activateItemForURI(uri) +else + Pane::container = undefined + Pane::activeItem = undefined + Pane::focused = undefined From 383523677e41fec017c12c40924fd44a71f1f92f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 11:07:17 -0700 Subject: [PATCH 386/521] Use new Model superclass in Pane --- src/pane.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pane.coffee b/src/pane.coffee index dec0789c5..892a42a0c 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -1,8 +1,8 @@ {find, compact, extend, last} = require 'underscore-plus' -{Model} = require 'theorist' {Emitter} = require 'event-kit' Serializable = require 'serializable' Grim = require 'grim' +Model = require './model' PaneAxis = require './pane-axis' TextEditor = require './text-editor' From fcefe55e0d634d0953f4209d6973da2c03b1091b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 11:08:01 -0700 Subject: [PATCH 387/521] Add deprecated check for item.getUri --- src/pane.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pane.coffee b/src/pane.coffee index 892a42a0c..04dbab1f3 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -49,7 +49,7 @@ class Pane extends Model params.activeItem = find params.items, (item) -> if typeof item.getURI is 'function' itemURI = item.getURI() - else if typeof item.getUri is 'function' + else if Grim.includeDeprecatedAPIs and typeof item.getUri is 'function' itemURI = item.getUri() itemURI is activeItemURI From e8e1500d119f00f67d25ce0ce7c1e26e021ab3b5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 11:22:51 -0700 Subject: [PATCH 388/521] Use new Model superclass in Workspace --- src/workspace.coffee | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 722a45f21..646ab0a98 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -9,6 +9,7 @@ Serializable = require 'serializable' Grim = require 'grim' fs = require 'fs-plus' StackTraceParser = require 'stacktrace-parser' +Model = require './model' TextEditor = require './text-editor' PaneContainer = require './pane-container' Pane = require './pane' @@ -33,14 +34,14 @@ class Workspace extends Model atom.deserializers.add(this) Serializable.includeInto(this) - @properties - paneContainer: null - fullScreen: false - destroyedItemURIs: -> [] - constructor: (params) -> super + unless Grim.includeDeprecatedAPIs + @paneContainer = params?.paneContainer + @fullScreen = params?.fullScreen ? false + @destroyedItemURIs = params?.destroyedItemURIs ? [] + @emitter = new Emitter @openers = [] @@ -892,6 +893,11 @@ class Workspace extends Model deferred.promise if includeDeprecatedAPIs + Workspace.properties + paneContainer: null + fullScreen: false + destroyedItemURIs: -> [] + Object.defineProperty Workspace::, 'activePaneItem', get: -> Grim.deprecate "Use ::getActivePaneItem() instead of the ::activePaneItem property" From 39a7af1f24764feb2b4723c5e6f3f16ab6d38184 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 11:23:09 -0700 Subject: [PATCH 389/521] Remove theorist require --- src/workspace.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 646ab0a98..6a7a40a0c 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -2,7 +2,6 @@ _ = require 'underscore-plus' path = require 'path' {join} = path -{Model} = require 'theorist' Q = require 'q' Serializable = require 'serializable' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' From 0691b837a1ff36de858176264dfc56c5da8595bd Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 11:25:35 -0700 Subject: [PATCH 390/521] Use new Model superclass in TokenizedBuffer --- src/tokenized-buffer.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index bfc563d93..b9d1d01f6 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -1,8 +1,8 @@ _ = require 'underscore-plus' -{Model} = require 'theorist' {CompositeDisposable, Emitter} = require 'event-kit' {Point, Range} = require 'text-buffer' Serializable = require 'serializable' +Model = require './model' TokenizedLine = require './tokenized-line' Token = require './token' ScopeDescriptor = require './scope-descriptor' @@ -12,11 +12,10 @@ module.exports = class TokenizedBuffer extends Model Serializable.includeInto(this) - @property 'tabLength' - grammar: null currentGrammarScore: null buffer: null + tabLength: null tokenizedLines: null chunkSize: 50 invalidRows: null From 265bc94eb3addee3be4e51c410644e56aef3fa6d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 13:10:37 -0700 Subject: [PATCH 391/521] Bind TextEditor behaviors to deprecated API flag --- src/text-editor.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 8d54fadb1..82781c8ec 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -74,10 +74,6 @@ class TextEditor extends Model 'autoDecreaseIndentForBufferRow', 'toggleLineCommentForBufferRow', 'toggleLineCommentsForBufferRows', toProperty: 'languageMode' - @delegatesProperties '$lineHeightInPixels', '$defaultCharWidth', '$height', '$width', - '$verticalScrollbarWidth', '$horizontalScrollbarHeight', '$scrollTop', '$scrollLeft', - toProperty: 'displayBuffer' - constructor: ({@softTabs, initialLine, initialColumn, tabLength, softWrapped, @displayBuffer, buffer, registerEditor, suppressCursorCreation, @mini, @placeholderText, @gutterVisible}) -> super @@ -108,10 +104,10 @@ class TextEditor extends Model @setEncoding(atom.config.get('core.fileEncoding', scope: @getRootScopeDescriptor())) - @subscribe @$scrollTop, (scrollTop) => + @subscribe @displayBuffer.$scrollTop, (scrollTop) => @emit 'scroll-top-changed', scrollTop if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-top', scrollTop - @subscribe @$scrollLeft, (scrollLeft) => + @subscribe @displayBuffer.$scrollLeft, (scrollLeft) => @emit 'scroll-left-changed', scrollLeft if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-left', scrollLeft @@ -2837,6 +2833,10 @@ class TextEditor extends Model logScreenLines: (start, end) -> @displayBuffer.logLines(start, end) if includeDeprecatedAPIs + TextEditor.delegatesProperties '$lineHeightInPixels', '$defaultCharWidth', '$height', '$width', + '$verticalScrollbarWidth', '$horizontalScrollbarHeight', '$scrollTop', '$scrollLeft', + toProperty: 'displayBuffer' + TextEditor::getViewClass = -> require './text-editor-view' From 72678df7fc91912409e7c7fc33c5c2d647b6f592 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 13:25:55 -0700 Subject: [PATCH 392/521] Use new Model superclass in DisplayBuffer --- src/display-buffer.coffee | 66 +++++++++++++++++++++++++++++---------- src/text-editor.coffee | 7 +++-- 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index a8b24086a..e5cba3506 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -1,11 +1,11 @@ _ = require 'underscore-plus' Serializable = require 'serializable' -{Model} = require 'theorist' {CompositeDisposable, Emitter} = require 'event-kit' {Point, Range} = require 'text-buffer' TokenizedBuffer = require './tokenized-buffer' RowMap = require './row-map' Fold = require './fold' +Model = require './model' Token = require './token' Decoration = require './decoration' Marker = require './marker' @@ -20,19 +20,6 @@ module.exports = class DisplayBuffer extends Model Serializable.includeInto(this) - @properties - softWrapped: null - editorWidthInChars: null - lineHeightInPixels: null - defaultCharWidth: null - height: null - width: null - scrollTop: 0 - scrollLeft: 0 - scrollWidth: 0 - verticalScrollbarWidth: 15 - horizontalScrollbarHeight: 15 - verticalScrollMargin: 2 horizontalScrollMargin: 6 scopedCharacterWidthsChangeCount: 0 @@ -135,6 +122,20 @@ class DisplayBuffer extends Model onDidChangeCharacterWidths: (callback) -> @emitter.on 'did-change-character-widths', callback + onDidChangeScrollTop: (callback) -> + @emitter.on 'did-change-scroll-top', callback + + onDidChangeScrollLeft: (callback) -> + @emitter.on 'did-change-scroll-left', callback + + observeScrollTop: (callback) -> + callback(@scrollTop) + @onDidChangeScrollTop(callback) + + observeScrollLeft: (callback) -> + callback(@scrollLeft) + @onDidChangeScrollLeft(callback) + observeDecorations: (callback) -> callback(decoration) for decoration in @getDecorations() @onDidAddDecoration(callback) @@ -250,7 +251,11 @@ class DisplayBuffer extends Model getScrollTop: -> @scrollTop setScrollTop: (scrollTop) -> - @scrollTop = Math.round(Math.max(0, Math.min(@getMaxScrollTop(), scrollTop))) + scrollTop = Math.round(Math.max(0, Math.min(@getMaxScrollTop(), scrollTop))) + return if scrollTop is @scrollTop + + @scrollTop = scrollTop + @emitter.emit 'did-change-scroll-top', @scrollTop getMaxScrollTop: -> @getScrollHeight() - @getClientHeight() @@ -262,7 +267,11 @@ class DisplayBuffer extends Model getScrollLeft: -> @scrollLeft setScrollLeft: (scrollLeft) -> - @scrollLeft = Math.round(Math.max(0, Math.min(@getScrollWidth() - @getClientWidth(), scrollLeft))) + scrollLeft = Math.round(Math.max(0, Math.min(@getScrollWidth() - @getClientWidth(), scrollLeft))) + return if scrollLeft is @scrollLeft + + @scrollLeft = scrollLeft + @emitter.emit 'did-change-scroll-left', @scrollLeft getMaxScrollLeft: -> @getScrollWidth() - @getClientWidth() @@ -1228,6 +1237,19 @@ class DisplayBuffer extends Model @foldsByMarkerId[marker.id] if Grim.includeDeprecatedAPIs + DisplayBuffer.properties + softWrapped: null + editorWidthInChars: null + lineHeightInPixels: null + defaultCharWidth: null + height: null + width: null + scrollTop: 0 + scrollLeft: 0 + scrollWidth: 0 + verticalScrollbarWidth: 15 + horizontalScrollbarHeight: 15 + EmitterMixin = require('emissary').Emitter DisplayBuffer::on = (eventName) -> @@ -1256,3 +1278,15 @@ if Grim.includeDeprecatedAPIs Grim.deprecate("DisplayBuffer::on is deprecated. Use event subscription methods instead.") EmitterMixin::on.apply(this, arguments) +else + DisplayBuffer::softWrapped = null + DisplayBuffer::editorWidthInChars = null + DisplayBuffer::lineHeightInPixels = null + DisplayBuffer::defaultCharWidth = null + DisplayBuffer::height = null + DisplayBuffer::width = null + DisplayBuffer::scrollTop = 0 + DisplayBuffer::scrollLeft = 0 + DisplayBuffer::scrollWidth = 0 + DisplayBuffer::verticalScrollbarWidth = 15 + DisplayBuffer::horizontalScrollbarHeight = 15 diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 82781c8ec..a9bf86b33 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -78,6 +78,7 @@ class TextEditor extends Model super @emitter = new Emitter + @disposables = new CompositeDisposable @cursors = [] @selections = [] @@ -104,10 +105,11 @@ class TextEditor extends Model @setEncoding(atom.config.get('core.fileEncoding', scope: @getRootScopeDescriptor())) - @subscribe @displayBuffer.$scrollTop, (scrollTop) => + @disposables.add @displayBuffer.onDidChangeScrollTop (scrollTop) => @emit 'scroll-top-changed', scrollTop if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-top', scrollTop - @subscribe @displayBuffer.$scrollLeft, (scrollLeft) => + + @disposables.add @displayBuffer.onDidChangeScrollLeft (scrollLeft) => @emit 'scroll-left-changed', scrollLeft if includeDeprecatedAPIs @emitter.emit 'did-change-scroll-left', scrollLeft @@ -173,6 +175,7 @@ class TextEditor extends Model destroyed: -> @unsubscribe() + @disposables.dispose() @scopedConfigSubscriptions.dispose() selection.destroy() for selection in @getSelections() @buffer.release() From f36f8ba5eb2992a748bec6f9d7c0c8b65c9d0e8f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 13:32:22 -0700 Subject: [PATCH 393/521] Use new Model superclass in TextEditor --- src/text-editor.coffee | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index a9bf86b33..2ca7d74bb 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -3,13 +3,13 @@ path = require 'path' Serializable = require 'serializable' Delegator = require 'delegato' {includeDeprecatedAPIs, deprecate} = require 'grim' -{Model} = require 'theorist' EmitterMixin = require('emissary').Emitter {CompositeDisposable, Emitter} = require 'event-kit' {Point, Range} = TextBuffer = require 'text-buffer' LanguageMode = require './language-mode' DisplayBuffer = require './display-buffer' Cursor = require './cursor' +Model = require './model' Selection = require './selection' TextMateScopeSelector = require('first-mate').ScopeSelector {Directory} = require "pathwatcher" @@ -129,16 +129,16 @@ class TextEditor extends Model subscribeToBuffer: -> @buffer.retain() - @subscribe @buffer.onDidChangePath => + @disposables.add @buffer.onDidChangePath => unless atom.project.getPaths().length > 0 atom.project.setPaths([path.dirname(@getPath())]) @emit "title-changed" if includeDeprecatedAPIs @emitter.emit 'did-change-title', @getTitle() @emit "path-changed" if includeDeprecatedAPIs @emitter.emit 'did-change-path', @getPath() - @subscribe @buffer.onDidChangeEncoding => + @disposables.add @buffer.onDidChangeEncoding => @emitter.emit 'did-change-encoding', @getEncoding() - @subscribe @buffer.onDidDestroy => @destroy() + @disposables.add @buffer.onDidDestroy => @destroy() # TODO: remove these when we remove the deprecations. They are old events. if includeDeprecatedAPIs @@ -149,18 +149,19 @@ class TextEditor extends Model @preserveCursorPositionOnBufferReload() subscribeToDisplayBuffer: -> - @subscribe @displayBuffer.onDidCreateMarker @handleMarkerCreated - @subscribe @displayBuffer.onDidUpdateMarkers => @mergeIntersectingSelections() - @subscribe @displayBuffer.onDidChangeGrammar => @handleGrammarChange() - @subscribe @displayBuffer.onDidTokenize => @handleTokenization() - @subscribe @displayBuffer.onDidChange (e) => - @emit 'screen-lines-changed', e + @disposables.add @displayBuffer.onDidCreateMarker @handleMarkerCreated + @disposables.add @displayBuffer.onDidUpdateMarkers => @mergeIntersectingSelections() + @disposables.add @displayBuffer.onDidChangeGrammar => @handleGrammarChange() + @disposables.add @displayBuffer.onDidTokenize => @handleTokenization() + @disposables.add @displayBuffer.onDidChange (e) => + @emit 'screen-lines-changed', e if includeDeprecatedAPIs @emitter.emit 'did-change', e # TODO: remove these when we remove the deprecations. Though, no one is likely using them - @subscribe @displayBuffer.onDidChangeSoftWrapped (softWrapped) => @emit 'soft-wrap-changed', softWrapped - @subscribe @displayBuffer.onDidAddDecoration (decoration) => @emit 'decoration-added', decoration - @subscribe @displayBuffer.onDidRemoveDecoration (decoration) => @emit 'decoration-removed', decoration + if includeDeprecatedAPIs + @subscribe @displayBuffer.onDidChangeSoftWrapped (softWrapped) => @emit 'soft-wrap-changed', softWrapped + @subscribe @displayBuffer.onDidAddDecoration (decoration) => @emit 'decoration-added', decoration + @subscribe @displayBuffer.onDidRemoveDecoration (decoration) => @emit 'decoration-removed', decoration @subscribeToScopedConfigSettings() @@ -174,7 +175,7 @@ class TextEditor extends Model subscriptions.add atom.config.onDidChange 'editor.invisibles', scope: scopeDescriptor, => @updateInvisibles() destroyed: -> - @unsubscribe() + @unsubscribe() if includeDeprecatedAPIs @disposables.dispose() @scopedConfigSubscriptions.dispose() selection.destroy() for selection in @getSelections() @@ -719,7 +720,7 @@ class TextEditor extends Model willInsert = true cancel = -> willInsert = false willInsertEvent = {cancel, text} - @emit('will-insert-text', willInsertEvent) + @emit('will-insert-text', willInsertEvent) if includeDeprecatedAPIs @emitter.emit 'will-insert-text', willInsertEvent if willInsert @@ -728,7 +729,7 @@ class TextEditor extends Model @mutateSelectedText (selection) => range = selection.insertText(text, options) didInsertEvent = {text, range} - @emit('did-insert-text', didInsertEvent) + @emit('did-insert-text', didInsertEvent) if includeDeprecatedAPIs @emitter.emit 'did-insert-text', didInsertEvent range else @@ -1661,9 +1662,9 @@ class TextEditor extends Model preserveCursorPositionOnBufferReload: -> cursorPosition = null - @subscribe @buffer.onWillReload => + @disposables.add @buffer.onWillReload => cursorPosition = @getCursorBufferPosition() - @subscribe @buffer.onDidReload => + @disposables.add @buffer.onDidReload => @setCursorBufferPosition(cursorPosition) if cursorPosition cursorPosition = null From 6e3bdd2daf54b9aab1e23cc7d194289e0ff513c1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 13:38:34 -0700 Subject: [PATCH 394/521] Return value from scroll top/left setters --- src/display-buffer.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index e5cba3506..ec95d0619 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -252,10 +252,10 @@ class DisplayBuffer extends Model getScrollTop: -> @scrollTop setScrollTop: (scrollTop) -> scrollTop = Math.round(Math.max(0, Math.min(@getMaxScrollTop(), scrollTop))) - return if scrollTop is @scrollTop - - @scrollTop = scrollTop - @emitter.emit 'did-change-scroll-top', @scrollTop + unless scrollTop is @scrollTop + @scrollTop = scrollTop + @emitter.emit 'did-change-scroll-top', @scrollTop + @scrollTop getMaxScrollTop: -> @getScrollHeight() - @getClientHeight() @@ -268,10 +268,10 @@ class DisplayBuffer extends Model getScrollLeft: -> @scrollLeft setScrollLeft: (scrollLeft) -> scrollLeft = Math.round(Math.max(0, Math.min(@getScrollWidth() - @getClientWidth(), scrollLeft))) - return if scrollLeft is @scrollLeft - - @scrollLeft = scrollLeft - @emitter.emit 'did-change-scroll-left', @scrollLeft + unless scrollLeft is @scrollLeft + @scrollLeft = scrollLeft + @emitter.emit 'did-change-scroll-left', @scrollLeft + @scrollLeft getMaxScrollLeft: -> @getScrollWidth() - @getClientWidth() From b45aa8c51f7763309d3375767e05d973924f5cbc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 13:44:17 -0700 Subject: [PATCH 395/521] includeDeprecations -> includeDeprecatedAPIs --- src/pane.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pane.coffee b/src/pane.coffee index 04dbab1f3..75daa782c 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -303,8 +303,8 @@ class Pane extends Model if typeof item.onDidDestroy is 'function' @itemSubscriptions.set item, item.onDidDestroy => @removeItem(item, true) - else if Grim.includeDeprecations and typeof item.on is 'function' - deprecate 'If you would like your pane item to support removal when destroyed behavior, please implement a ::onDidDestroy() method. ::on methods for items are no longer supported. If not, ignore this message.' + else if Grim.includeDeprecatedAPIs and typeof item.on is 'function' + Grim.deprecate 'If you would like your pane item to support removal when destroyed behavior, please implement a ::onDidDestroy() method. ::on methods for items are no longer supported. If not, ignore this message.' @subscribe item, 'destroyed', => @removeItem(item, true) @items.splice(index, 0, item) @@ -331,7 +331,7 @@ class Pane extends Model index = @items.indexOf(item) return if index is -1 - if Grim.includeDeprecations and typeof item.on is 'function' + if Grim.includeDeprecatedAPIs and typeof item.on is 'function' @unsubscribe item @unsubscribeFromItem(item) From c4062d8fea0e34341e22acd9b27e4a7d505ecab2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 13:57:52 -0700 Subject: [PATCH 396/521] Remove destroyed event deprecation --- src/pane.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pane.coffee b/src/pane.coffee index 75daa782c..8b12fcf7f 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -304,7 +304,6 @@ class Pane extends Model if typeof item.onDidDestroy is 'function' @itemSubscriptions.set item, item.onDidDestroy => @removeItem(item, true) else if Grim.includeDeprecatedAPIs and typeof item.on is 'function' - Grim.deprecate 'If you would like your pane item to support removal when destroyed behavior, please implement a ::onDidDestroy() method. ::on methods for items are no longer supported. If not, ignore this message.' @subscribe item, 'destroyed', => @removeItem(item, true) @items.splice(index, 0, item) From c7071f15b52123e02d8c082704b9efca53bab3fe Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 14:43:49 -0700 Subject: [PATCH 397/521] :arrow_up: donna@1.0.10 --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index 18bef4d1e..212f9c3ed 100644 --- a/build/package.json +++ b/build/package.json @@ -7,7 +7,7 @@ }, "dependencies": { "async": "~0.2.9", - "donna": "1.0.9", + "donna": "1.0.10", "formidable": "~1.0.14", "fs-plus": "2.x", "github-releases": "~0.2.0", From b54177eb5eb4797f48057f3d7a1057cc6dedc7e0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 15:14:26 -0700 Subject: [PATCH 398/521] Remove property always set in constructor --- src/pane-container.coffee | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pane-container.coffee b/src/pane-container.coffee index 58da39872..e6eb97075 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -241,5 +241,3 @@ if Grim.includeDeprecatedAPIs @$activePane .switch((activePane) -> activePane?.$activeItem) .distinctUntilChanged() -else - PaneContainer::activePane = null From 5df56fc50ae2f5442ad82d1f9bd48ac31762de60 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 6 Apr 2015 12:30:12 -0700 Subject: [PATCH 399/521] Add workspace element command for 'add root folder' --- spec/atom-spec.coffee | 16 ++++++++++++++++ src/atom.coffee | 11 ++++++++--- src/workspace-element.coffee | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index 1fca9cf28..f888c433f 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -180,3 +180,19 @@ describe "the `atom` global", -> it "does not open an empty buffer", -> atom.openInitialEmptyEditorIfNecessary() expect(atom.workspace.open).not.toHaveBeenCalled() + + describe "adding a root folder", -> + it "adds a second path to the project", -> + initialPaths = atom.project.getPaths() + tempDirectory = temp.mkdirSync("a-new-directory") + spyOn(atom, "pickFolder").andCallFake (callback) -> + callback([tempDirectory]) + atom.addRootFolder() + expect(atom.project.getPaths()).toEqual(initialPaths.concat([tempDirectory])) + + it "does nothing if the user dismisses the file picker", -> + initialPaths = atom.project.getPaths() + tempDirectory = temp.mkdirSync("a-new-directory") + spyOn(atom, "pickFolder").andCallFake (callback) -> callback(null) + atom.addRootFolder() + expect(atom.project.getPaths()).toEqual(initialPaths) diff --git a/src/atom.coffee b/src/atom.coffee index 1710edd98..701f2e91e 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -412,10 +412,11 @@ class Atom extends Model open: (options) -> ipc.send('open', options) - # Extended: Show the native dialog to prompt the user to select a folder. + # Extended: Prompt the user to select one or more folders. # - # * `callback` A {Function} to call once the user has selected a folder. - # * `path` {String} the path to the folder the user selected. + # * `callback` A {Function} to call once the user has confirmed the selection. + # * `paths` An {Array} of {String} paths that the user selected, or `null` + # if the user dismissed the dialog. pickFolder: (callback) -> responseChannel = "atom-pick-folder-response" ipc.on responseChannel, (path) -> @@ -773,6 +774,10 @@ class Atom extends Model setRepresentedFilename: (filename) -> ipc.send('call-window-method', 'setRepresentedFilename', filename) + addRootFolder: -> + @pickFolder (selectedPaths = []) => + @project.addPath(selectedPath) for selectedPath in selectedPaths + showSaveDialog: (callback) -> callback(showSaveDialogSync()) diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 33ea14093..ccf165439 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -138,6 +138,7 @@ atom.commands.add 'atom-workspace', 'application:open-safe': -> ipc.send('command', 'application:open-safe') 'application:open-api-preview': -> ipc.send('command', 'application:open-api-preview') 'application:open-dev-api-preview': -> ipc.send('command', 'application:open-dev-api-preview') + 'application:add-root-folder': -> atom.addRootFolder() 'application:minimize': -> ipc.send('command', 'application:minimize') 'application:zoom': -> ipc.send('command', 'application:zoom') 'application:bring-all-windows-to-front': -> ipc.send('command', 'application:bring-all-windows-to-front') From 4560be9eaeddbb2680bef1097a3169e1c574a3ae Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 15:53:25 -0700 Subject: [PATCH 400/521] Don't use deprecated atom.config.toggle --- src/workspace-element.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index ccf165439..5f127d970 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -156,9 +156,9 @@ atom.commands.add 'atom-workspace', 'window:focus-pane-on-left': -> @focusPaneViewOnLeft() 'window:focus-pane-on-right': -> @focusPaneViewOnRight() 'window:save-all': -> @getModel().saveAll() - 'window:toggle-invisibles': -> atom.config.toggle("editor.showInvisibles") + 'window:toggle-invisibles': -> atom.config.set("editor.showInvisibles", !atom.config.get("editor.showInvisibles")) 'window:log-deprecation-warnings': -> Grim.logDeprecations() - 'window:toggle-auto-indent': -> atom.config.toggle("editor.autoIndent") + 'window:toggle-auto-indent': -> atom.config.set("editor.autoIndent", !atom.config.get("editor.autoIndent")) 'pane:reopen-closed-item': -> @getModel().reopenItem() 'core:close': -> @getModel().destroyActivePaneItemOrEmptyPane() 'core:save': -> @getModel().saveActivePaneItem() From 188b2e5a74e87ae98c1ce70986848d74d637ce03 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 15:55:51 -0700 Subject: [PATCH 401/521] Report core deprecations in specs --- spec/spec-helper.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 5406ff33a..70fb4fb58 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -72,7 +72,6 @@ if specDirectory isCoreSpec = specDirectory == fs.realpathSync(__dirname) beforeEach -> - Grim.clearDeprecations() if isCoreSpec $.fx.off = true documentTitle = null projectPath = specProjectPath ? path.join(@specDirectory, 'fixtures') From 50d9fee0d3ce00b6a1bbfe8a2f7a4249956d14f7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 16:21:09 -0700 Subject: [PATCH 402/521] Use Project::onDidAddBuffer --- spec/project-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index a1cdce662..703b3d4f8 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -221,7 +221,7 @@ describe "Project", -> beforeEach -> absolutePath = require.resolve('./fixtures/dir/a') newBufferHandler = jasmine.createSpy('newBufferHandler') - atom.project.on 'buffer-created', newBufferHandler + atom.project.onDidAddBuffer(newBufferHandler) describe "when given an absolute path that isn't currently open", -> it "returns a new edit session for the given path and emits 'buffer-created'", -> From 9b7870d5032607b6bd357c49cdf3feaa5cdb4154 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 16:22:31 -0700 Subject: [PATCH 403/521] Snapshot deprecations around calls to Project::eachBuffer --- spec/project-spec.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 703b3d4f8..d89802243 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -502,8 +502,12 @@ describe "Project", -> describe ".eachBuffer(callback)", -> beforeEach -> + jasmine.snapshotDeprecations() atom.project.bufferForPathSync('a') + afterEach -> + jasmine.restoreDeprecationsSnapshot() + it "invokes the callback for existing buffer", -> count = 0 count = 0 From e02e8c91a6ce97b9a9d348ef297b27256203a700 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 16:29:12 -0700 Subject: [PATCH 404/521] Use TextEditor::onDidChangeCursorPosition in spec --- spec/text-editor-component-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index a5ca4c309..b2ef2ec51 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -728,7 +728,7 @@ describe "TextEditorComponent", -> expect(cursorNodes[0].style['-webkit-transform']).toBe "translate(#{10 * charWidth}px, #{4 * lineHeightInPixels}px)" expect(cursorNodes[1].style['-webkit-transform']).toBe "translate(#{11 * charWidth}px, #{8 * lineHeightInPixels}px)" - wrapperView.on 'cursor:moved', cursorMovedListener = jasmine.createSpy('cursorMovedListener') + editor.onDidChangeCursorPosition cursorMovedListener = jasmine.createSpy('cursorMovedListener') cursor3.setScreenPosition([4, 11], autoscroll: false) nextAnimationFrame() expect(cursorNodes[0].style['-webkit-transform']).toBe "translate(#{11 * charWidth}px, #{4 * lineHeightInPixels}px)" From fdba094aa6b1bd987e6085989367a18c69eae68b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 6 Apr 2015 17:12:50 -0700 Subject: [PATCH 405/521] :arrow_up: tree-view --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 55762cec0..ce1d886c4 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "symbols-view": "0.93.0", "tabs": "0.67.0", "timecop": "0.31.0", - "tree-view": "0.168.0", + "tree-view": "0.169.0", "update-package-dependencies": "0.9.0", "welcome": "0.26.0", "whitespace": "0.29.0", From a80256155344a7d175d14b80afddf258fbedafb3 Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 7 Apr 2015 09:20:27 +0900 Subject: [PATCH 406/521] :arrow_up: one-dark-ui@0.6.0 one-light-ui@0.5.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ce1d886c4..48f8a591c 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.25.0", "base16-tomorrow-light-theme": "0.8.0", - "one-dark-ui": "0.5.0", + "one-dark-ui": "0.6.0", "one-dark-syntax": "0.3.0", "one-light-syntax": "0.4.0", - "one-light-ui": "0.4.0", + "one-light-ui": "0.5.0", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", "archive-view": "0.55.0", From aed17cda9b43e96c6b31dd1f70199d3742b904ff Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Apr 2015 17:51:18 -0700 Subject: [PATCH 407/521] :arrow_up: language-javascript@0.69 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48f8a591c..d6abef9c6 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.68.0", + "language-javascript": "0.69.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From a6d47d403fc68ef9e0c29635a5427dff4d5ecfe9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 7 Apr 2015 11:01:54 +0800 Subject: [PATCH 408/521] :penguin: Don't use clipboard in renderer process, fixes #6221 --- src/clipboard.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/clipboard.coffee b/src/clipboard.coffee index 3fba6f4e8..bc0926521 100644 --- a/src/clipboard.coffee +++ b/src/clipboard.coffee @@ -1,6 +1,12 @@ -clipboard = require 'clipboard' crypto = require 'crypto' +# Using clipboard in renderer process is not safe on Linux. +clipboard = + if process.platform is 'linux' + require('remote').require 'clipboard' + else + require 'clipboard' + # Extended: Represents the clipboard used for copying and pasting in Atom. # # An instance of this class is always available as the `atom.clipboard` global. From 099c8eda77763d0c38b0c67ef947c7a228e0a1f7 Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 7 Apr 2015 12:33:44 +0900 Subject: [PATCH 409/521] :arrow_up: status-bar@v0.67.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6abef9c6..f8ebc304d 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "settings-view": "0.187.0", "snippets": "0.88.0", "spell-check": "0.55.0", - "status-bar": "0.66.0", + "status-bar": "0.67.0", "styleguide": "0.44.0", "symbols-view": "0.93.0", "tabs": "0.67.0", From 9b8d7d46fe8e72f7fe6e31b419de7407f50f6ca2 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Thu, 2 Apr 2015 23:03:29 -0400 Subject: [PATCH 410/521] Lint for more styleguide errors - Add more coffeelint rules to cover code style requirements from CONTRIBUTING.md --- coffeelint.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/coffeelint.json b/coffeelint.json index d8e19fc46..f3caf09cc 100644 --- a/coffeelint.json +++ b/coffeelint.json @@ -13,5 +13,19 @@ }, "no_debugger": { "level": "error" + }, + "prefer_english_operator": { + "level": "error" + }, + "colon_assignment_spacing": { + "spacing": { + "left": 0, + "right": 1 + }, + "level": "error" + }, + "braces_spacing": { + "spaces": 0, + "level": "error" } } From 5d2392ea674e9ccefe567e35ef625314a81a91f7 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Mon, 6 Apr 2015 23:45:02 -0400 Subject: [PATCH 411/521] :shirt: Fix new coffeelint errors --- benchmark/benchmark-helper.coffee | 6 ++-- benchmark/benchmark-suite.coffee | 4 +-- benchmark/fixtures/medium.coffee | 14 ++++----- .../translate-crash-log-addresses.coffee | 9 +++--- spec/config-spec.coffee | 6 ++-- spec/fixtures/coffee.coffee | 3 +- .../package-with-config-defaults/index.coffee | 2 +- ...ample-with-tabs-and-leading-comment.coffee | 6 ++-- spec/fixtures/sample-with-tabs.coffee | 2 ++ spec/package-manager-spec.coffee | 24 +++++++-------- spec/pane-container-view-spec.coffee | 2 +- spec/pane-view-spec.coffee | 6 ++-- spec/spec-helper.coffee | 10 +++---- spec/text-editor-spec.coffee | 2 +- spec/theme-manager-spec.coffee | 10 +++---- spec/tokenized-buffer-spec.coffee | 6 ++-- spec/workspace-spec.coffee | 14 ++++----- src/atom.coffee | 2 +- src/browser/application-menu.coffee | 20 ++++++------- src/browser/atom-application.coffee | 2 +- src/command-installer.coffee | 8 ++--- src/config.coffee | 2 +- src/cursor.coffee | 22 +++++++------- src/decoration.coffee | 2 +- src/default-directory-provider.coffee | 2 +- src/display-buffer.coffee | 10 +++---- src/language-mode.coffee | 8 ++--- src/menu-manager.coffee | 2 +- src/notification.coffee | 6 ++-- src/overlay-manager.coffee | 2 +- src/pane-axis-element.coffee | 2 +- src/project.coffee | 2 +- src/scan-handler.coffee | 2 +- src/selection.coffee | 12 ++++---- src/text-editor-component.coffee | 2 +- src/text-editor.coffee | 6 ++-- src/token.coffee | 2 +- src/tokenized-buffer.coffee | 30 +++++++++---------- src/tokenized-line.coffee | 14 ++++----- src/window-event-handler.coffee | 2 +- src/workspace.coffee | 8 ++--- 41 files changed, 150 insertions(+), 146 deletions(-) diff --git a/benchmark/benchmark-helper.coffee b/benchmark/benchmark-helper.coffee index ae6bab740..d831572c5 100644 --- a/benchmark/benchmark-helper.coffee +++ b/benchmark/benchmark-helper.coffee @@ -29,7 +29,7 @@ window.benchmark = (args...) -> else count = defaultCount [fn, options] = args - { profile, focused } = (options ? {}) + {profile, focused} = (options ? {}) method = if focused then fit else it method description, -> @@ -69,7 +69,7 @@ window.keyIdentifierForKey = (key) -> "U+00" + charCode.toString(16) window.keydownEvent = (key, properties={}) -> - $.Event "keydown", _.extend({originalEvent: { keyIdentifier: keyIdentifierForKey(key) }}, properties) + $.Event "keydown", _.extend({originalEvent: {keyIdentifier: keyIdentifierForKey(key)}}, properties) window.clickEvent = (properties={}) -> $.Event "click", properties @@ -93,7 +93,7 @@ window.pagePixelPositionForPoint = (editorView, point) -> point = Point.fromObject point top = editorView.lines.offset().top + point.row * editorView.lineHeight left = editorView.lines.offset().left + point.column * editorView.charWidth - editorView.lines.scrollLeft() - { top, left } + {top, left} window.seteditorViewWidthInChars = (editorView, widthInChars, charWidth=editorView.charWidth) -> editorView.width(charWidth * widthInChars + editorView.lines.position().left) diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee index 7a17f22c2..7b06d9758 100644 --- a/benchmark/benchmark-suite.coffee +++ b/benchmark/benchmark-suite.coffee @@ -213,7 +213,7 @@ describe "TokenizedBuffer.", -> beforeEach -> editor = benchmarkFixturesProject.openSync('medium.coffee') - { languageMode, buffer } = editor + {languageMode, buffer} = editor benchmark "construction", 20, -> - new TokenizedBuffer(buffer, { languageMode, tabLength: 2}) + new TokenizedBuffer(buffer, {languageMode, tabLength: 2}) diff --git a/benchmark/fixtures/medium.coffee b/benchmark/fixtures/medium.coffee index 2bdb8c6f7..28ec156b0 100644 --- a/benchmark/fixtures/medium.coffee +++ b/benchmark/fixtures/medium.coffee @@ -209,13 +209,13 @@ template = (str) -> 'var p=[],print=function(){p.push.apply(p,arguments);};' + 'with(obj){p.push(\'' + str.replace(/[\r\t\n]/g, " ") - .replace(/'(?=[^<]*%>)/g,"\t") - .split("'").join("\\'") - .split("\t").join("'") - .replace(/<%=(.+?)%>/g, "',$1,'") - .split('<%').join("');") - .split('%>').join("p.push('") + - "');}return p.join('');" + .replace(/'(?=[^<]*%>)/g,"\t") + .split("'").join("\\'") + .split("\t").join("'") + .replace(/<%=(.+?)%>/g, "',$1,'") + .split('<%').join("');") + .split('%>').join("p.push('") + + "');}return p.join('');" # Create the template that we will use to generate the Docco HTML page. docco_template = template fs.readFileSync(__dirname + '/../resources/docco.jst').toString() diff --git a/script/utils/translate-crash-log-addresses.coffee b/script/utils/translate-crash-log-addresses.coffee index 7fb01532b..fdb540d64 100755 --- a/script/utils/translate-crash-log-addresses.coffee +++ b/script/utils/translate-crash-log-addresses.coffee @@ -17,7 +17,7 @@ parse_stack_trace = (raw) -> addresses = [] for line in raw columns = line.split /\ +/ - if columns[1] == 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3] + if columns[1] is 'libcef.dylib' and /0x[a-f0-9]+/.test columns[3] lines[columns[0]] = addresses.length addresses.push '0x' + parseInt(columns[5]).toString(16) + ' ' @@ -36,12 +36,12 @@ parse_log_file = (content) -> lines = content.split /\r?\n/ for line in lines - if state == 'start' + if state is 'start' if /Thread \d+ Crashed::/.test line console.log line state = 'parse' - else if state == 'parse' - break if line == '' + else if state is 'parse' + break if line is '' stack_trace.push line parse_stack_trace stack_trace @@ -53,4 +53,3 @@ process.stdin.on 'data', (chunk) -> input += chunk process.stdin.on 'end', -> parse_log_file input - diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 4abd3b0db..a7e1c6f39 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -251,9 +251,9 @@ describe "Config", -> it "removes all scoped and unscoped properties for that key-path", -> atom.config.setDefaults("foo.bar", baz: 100) - atom.config.set("foo.bar", { baz: 1, ok: 2 }, scopeSelector: ".a") - atom.config.set("foo.bar", { baz: 11, ok: 12 }, scopeSelector: ".b") - atom.config.set("foo.bar", { baz: 21, ok: 22 }) + atom.config.set("foo.bar", {baz: 1, ok: 2}, scopeSelector: ".a") + atom.config.set("foo.bar", {baz: 11, ok: 12}, scopeSelector: ".b") + atom.config.set("foo.bar", {baz: 21, ok: 22}) atom.config.unset("foo.bar.baz") diff --git a/spec/fixtures/coffee.coffee b/spec/fixtures/coffee.coffee index b8367ca59..d68b84267 100644 --- a/spec/fixtures/coffee.coffee +++ b/spec/fixtures/coffee.coffee @@ -1,4 +1,4 @@ -class quicksort +class Quicksort sort: (items) -> return items if items.length <= 1 @@ -13,6 +13,7 @@ class quicksort if current < pivot left.push(current) else + # coffeelint: disable=no_trailing_semicolons right.push(current); sort(left).concat(pivot).concat(sort(right)) diff --git a/spec/fixtures/packages/package-with-config-defaults/index.coffee b/spec/fixtures/packages/package-with-config-defaults/index.coffee index 554c6c5eb..6c48b2af4 100644 --- a/spec/fixtures/packages/package-with-config-defaults/index.coffee +++ b/spec/fixtures/packages/package-with-config-defaults/index.coffee @@ -1,5 +1,5 @@ module.exports = configDefaults: - numbers: { one: 1, two: 2 } + numbers: {one: 1, two: 2} activate: -> # no-op diff --git a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee index 0f81f6fe8..08e81aa68 100644 --- a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee +++ b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee @@ -1,4 +1,6 @@ # This is a comment + # coffeelint: disable=no_tabs + # coffeelint: disable=indentation if this.studyingEconomics - buy() while supply > demand - sell() until supply > demand + buy() while supply > demand + sell() until supply > demand diff --git a/spec/fixtures/sample-with-tabs.coffee b/spec/fixtures/sample-with-tabs.coffee index 1b937ea33..5e7595a7d 100644 --- a/spec/fixtures/sample-with-tabs.coffee +++ b/spec/fixtures/sample-with-tabs.coffee @@ -1,3 +1,5 @@ +# coffeelint: disable=no_tabs +# coffeelint: disable=no_trailing_whitespace # Econ 101 if this.studyingEconomics buy() while supply > demand diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 2789f36c3..db2a76135 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -330,32 +330,32 @@ describe "PackageManager", -> element2 = $$ -> @div class: 'test-2' element3 = $$ -> @div class: 'test-3' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0 - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])).toHaveLength 0 - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element2[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element3[0])).toHaveLength 0 waitsForPromise -> atom.packages.activatePackage("package-with-keymaps") runs -> - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1" - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2" - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])[0].command).toBe "test-1" + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element2[0])[0].command).toBe "test-2" + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element3[0])).toHaveLength 0 describe "when the metadata contains a 'keymaps' manifest", -> it "loads only the keymaps specified by the manifest, in the specified order", -> element1 = $$ -> @div class: 'test-1' element3 = $$ -> @div class: 'test-3' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])).toHaveLength 0 waitsForPromise -> atom.packages.activatePackage("package-with-keymaps-manifest") runs -> - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2' - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: element1[0])[0].command).toBe 'keymap-1' + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-n', target: element1[0])[0].command).toBe 'keymap-2' + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-y', target: element3[0])).toHaveLength 0 describe "when the keymap file is empty", -> it "does not throw an error on activation", -> @@ -645,8 +645,8 @@ describe "PackageManager", -> runs -> atom.packages.deactivatePackage('package-with-keymaps') - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target: ($$ -> @div class: 'test-1')[0])).toHaveLength 0 - expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target: ($$ -> @div class: 'test-2')[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: ($$ -> @div class: 'test-1')[0])).toHaveLength 0 + expect(atom.keymaps.findKeyBindings(keystrokes: 'ctrl-z', target: ($$ -> @div class: 'test-2')[0])).toHaveLength 0 it "removes the package's stylesheets", -> waitsForPromise -> diff --git a/spec/pane-container-view-spec.coffee b/spec/pane-container-view-spec.coffee index 6c088c343..1b9cf9813 100644 --- a/spec/pane-container-view-spec.coffee +++ b/spec/pane-container-view-spec.coffee @@ -15,7 +15,7 @@ describe "PaneContainerView", -> @deserialize: ({name}) -> new TestView(name) @content: -> @div tabindex: -1 initialize: (@name) -> @text(@name) - serialize: -> { deserializer: 'TestView', @name } + serialize: -> {deserializer: 'TestView', @name} getURI: -> path.join(temp.dir, @name) save: -> @saved = true isEqual: (other) -> @name is other?.name diff --git a/spec/pane-view-spec.coffee b/spec/pane-view-spec.coffee index 763cc9ab4..2df5aa68c 100644 --- a/spec/pane-view-spec.coffee +++ b/spec/pane-view-spec.coffee @@ -14,9 +14,9 @@ describe "PaneView", -> @content: ({id, text}) -> @div class: 'test-view', id: id, tabindex: -1, text initialize: ({@id, @text}) -> @emitter = new Emitter - serialize: -> { deserializer: 'TestView', @id, @text } + serialize: -> {deserializer: 'TestView', @id, @text} getURI: -> @id - isEqual: (other) -> other? and @id == other.id and @text == other.text + isEqual: (other) -> other? and @id is other.id and @text is other.text changeTitle: -> @emitter.emit 'did-change-title', 'title' onDidChangeTitle: (callback) -> @@ -222,7 +222,7 @@ describe "PaneView", -> fs.removeSync(filePath) waitsFor -> - pane.items.length == 4 + pane.items.length is 4 describe "when a pane is destroyed", -> [pane2, pane2Model] = [] diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 70fb4fb58..1c9e6fb6b 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -69,7 +69,7 @@ if specDirectory specPackageName = JSON.parse(fs.readFileSync(path.join(specPackagePath, 'package.json')))?.name specProjectPath = path.join(specDirectory, 'fixtures') -isCoreSpec = specDirectory == fs.realpathSync(__dirname) +isCoreSpec = specDirectory is fs.realpathSync(__dirname) beforeEach -> $.fx.off = true @@ -234,7 +234,7 @@ addCustomMatchers = (spec) -> else notText = if @isNot then " not" else "" this.message = => "Expected object with length #{@actual.length} to#{notText} have length #{expected}" - @actual.length == expected + @actual.length is expected toExistOnDisk: (expected) -> notText = this.isNot and " not" or "" @@ -297,7 +297,7 @@ window.mousemoveEvent = (properties={}) -> window.waitsForPromise = (args...) -> if args.length > 1 - { shouldReject, timeout } = args[0] + {shouldReject, timeout} = args[0] else shouldReject = false fn = _.last(args) @@ -328,7 +328,7 @@ window.fakeSetTimeout = (callback, ms) -> id window.fakeClearTimeout = (idToClear) -> - window.timeouts = window.timeouts.filter ([id]) -> id != idToClear + window.timeouts = window.timeouts.filter ([id]) -> id isnt idToClear window.fakeSetInterval = (callback, ms) -> id = ++window.intervalCount @@ -358,7 +358,7 @@ window.pagePixelPositionForPoint = (editorView, point) -> point = Point.fromObject point top = editorView.renderedLines.offset().top + point.row * editorView.lineHeight left = editorView.renderedLines.offset().left + point.column * editorView.charWidth - editorView.renderedLines.scrollLeft() - { top, left } + {top, left} window.tokensText = (tokens) -> _.pluck(tokens, 'value').join('') diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 439a1ddb6..ecb176ad5 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -547,7 +547,7 @@ describe "TextEditor", -> lastLine = buffer.lineForRow(lastLineIndex) expect(lastLine.length).toBeGreaterThan(0) - lastPosition = { row: lastLineIndex, column: lastLine.length } + lastPosition = {row: lastLineIndex, column: lastLine.length} editor.setCursorScreenPosition(lastPosition) editor.moveRight() diff --git a/spec/theme-manager-spec.coffee b/spec/theme-manager-spec.coffee index 5e65da1fa..c39e4994b 100644 --- a/spec/theme-manager-spec.coffee +++ b/spec/theme-manager-spec.coffee @@ -84,7 +84,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', []) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -92,7 +92,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', ['atom-dark-ui']) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -101,7 +101,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', ['atom-light-ui', 'atom-dark-ui']) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -111,7 +111,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', []) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> didChangeActiveThemesHandler.reset() @@ -120,7 +120,7 @@ describe "ThemeManager", -> atom.config.set('core.themes', ['theme-with-index-less', 'atom-dark-ui']) waitsFor -> - didChangeActiveThemesHandler.callCount == 1 + didChangeActiveThemesHandler.callCount is 1 runs -> expect($('style[priority=1]')).toHaveLength 2 diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index c1b16ff08..3cd776c2b 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -352,7 +352,7 @@ describe "TokenizedBuffer", -> tabAsSpaces = _.multiplyString(' ', tokenizedBuffer.getTabLength()) screenLine0 = tokenizedBuffer.tokenizedLineForRow(0) expect(screenLine0.text).toBe "# Econ 101#{tabAsSpaces}" - { tokens } = screenLine0 + {tokens} = screenLine0 expect(tokens.length).toBe 4 expect(tokens[0].value).toBe "#" @@ -452,7 +452,7 @@ describe "TokenizedBuffer", -> it "renders each UTF-8 surrogate pair as its own atomic token", -> screenLine0 = tokenizedBuffer.tokenizedLineForRow(0) expect(screenLine0.text).toBe "'abc\uD835\uDF97def'" - { tokens } = screenLine0 + {tokens} = screenLine0 expect(tokens.length).toBe 5 expect(tokens[0].value).toBe "'" @@ -464,7 +464,7 @@ describe "TokenizedBuffer", -> screenLine1 = tokenizedBuffer.tokenizedLineForRow(1) expect(screenLine1.text).toBe "//\uD835\uDF97xyz" - { tokens } = screenLine1 + {tokens} = screenLine1 expect(tokens.length).toBe 4 expect(tokens[0].value).toBe '//' diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index e40ef1925..dac2849c0 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -189,7 +189,7 @@ describe "Workspace", -> workspace.open('a', split: 'right').then (o) -> editor = o runs -> - pane2 = workspace.getPanes().filter((p) -> p != pane1)[0] + pane2 = workspace.getPanes().filter((p) -> p isnt pane1)[0] expect(workspace.getActivePane()).toBe pane2 expect(pane1.items).toEqual [] expect(pane2.items).toEqual [editor] @@ -218,7 +218,7 @@ describe "Workspace", -> workspace.open('a', split: 'right').then (o) -> editor = o runs -> - pane4 = workspace.getPanes().filter((p) -> p != pane1)[0] + pane4 = workspace.getPanes().filter((p) -> p isnt pane1)[0] expect(workspace.getActivePane()).toBe pane4 expect(pane4.items).toEqual [editor] expect(workspace.paneContainer.root.children[0]).toBe pane1 @@ -226,19 +226,19 @@ describe "Workspace", -> describe "when passed a path that matches a custom opener", -> it "returns the resource returned by the custom opener", -> - fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/) - barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//) + fooOpener = (pathToOpen, options) -> {foo: pathToOpen, options} if pathToOpen?.match(/\.foo/) + barOpener = (pathToOpen) -> {bar: pathToOpen} if pathToOpen?.match(/^bar:\/\//) workspace.addOpener(fooOpener) workspace.addOpener(barOpener) waitsForPromise -> pathToOpen = atom.project.getDirectories()[0]?.resolve('a.foo') workspace.open(pathToOpen, hey: "there").then (item) -> - expect(item).toEqual { foo: pathToOpen, options: {hey: "there"} } + expect(item).toEqual {foo: pathToOpen, options: {hey: "there"}} waitsForPromise -> workspace.open("bar://baz").then (item) -> - expect(item).toEqual { bar: "bar://baz" } + expect(item).toEqual {bar: "bar://baz"} it "notifies ::onDidAddTextEditor observers", -> absolutePath = require.resolve('./fixtures/dir/a') @@ -835,7 +835,7 @@ describe "Workspace", -> runs -> expect(results).toHaveLength 3 - resultForA = _.find results, ({filePath}) -> path.basename(filePath) == 'a' + resultForA = _.find results, ({filePath}) -> path.basename(filePath) is 'a' expect(resultForA.matches).toHaveLength 1 expect(resultForA.matches[0].matchText).toBe 'Elephant' diff --git a/src/atom.coffee b/src/atom.coffee index 701f2e91e..88c8257e1 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -499,7 +499,7 @@ class Atom extends Model # Extended: Toggle the full screen state of the current window. toggleFullScreen: -> - @setFullScreen(!@isFullScreen()) + @setFullScreen(not @isFullScreen()) # Schedule the window to be shown and focused on the next tick. # diff --git a/src/browser/application-menu.coffee b/src/browser/application-menu.coffee index 4544a963d..d88314c89 100644 --- a/src/browser/application-menu.coffee +++ b/src/browser/application-menu.coffee @@ -87,15 +87,15 @@ class ApplicationMenu # Replaces VERSION with the current version. substituteVersion: (template) -> - if (item = _.find(@flattenMenuTemplate(template), ({label}) -> label == 'VERSION')) + if (item = _.find(@flattenMenuTemplate(template), ({label}) -> label is 'VERSION')) item.label = "Version #{@version}" # Sets the proper visible state the update menu items showUpdateMenuItem: (state) -> - checkForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Check for Update') - checkingForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Checking for Update') - downloadingUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Downloading Update') - installUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label == 'Restart and Install Update') + checkForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Check for Update') + checkingForUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Checking for Update') + downloadingUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Downloading Update') + installUpdateItem = _.find(@flattenMenuItems(@menu), ({label}) -> label is 'Restart and Install Update') return unless checkForUpdateItem? and checkingForUpdateItem? and downloadingUpdateItem? and installUpdateItem? @@ -121,11 +121,11 @@ class ApplicationMenu [ label: "Atom" submenu: [ - { label: "Check for Update", metadata: {autoUpdate: true}} - { label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload() } - { label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close() } - { label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools() } - { label: 'Quit', accelerator: 'Command+Q', click: -> app.quit() } + {label: "Check for Update", metadata: {autoUpdate: true}} + {label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload()} + {label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close()} + {label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools()} + {label: 'Quit', accelerator: 'Command+Q', click: -> app.quit()} ] ] diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 45c0c8b5c..609d26d9f 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -95,7 +95,7 @@ class AtomApplication # Public: Removes the {AtomWindow} from the global window list. removeWindow: (window) -> @windows.splice @windows.indexOf(window), 1 - @applicationMenu?.enableWindowSpecificItems(false) if @windows.length == 0 + @applicationMenu?.enableWindowSpecificItems(false) if @windows.length is 0 # Public: Adds the {AtomWindow} to the global window list. addWindow: (window) -> diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 1d3a16777..c0ed22482 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -6,7 +6,7 @@ runas = null # defer until used symlinkCommand = (sourcePath, destinationPath, callback) -> fs.unlink destinationPath, (error) -> - if error? and error?.code != 'ENOENT' + if error? and error?.code isnt 'ENOENT' callback(error) else fs.makeTree path.dirname(destinationPath), (error) -> @@ -17,13 +17,13 @@ symlinkCommand = (sourcePath, destinationPath, callback) -> symlinkCommandWithPrivilegeSync = (sourcePath, destinationPath) -> runas ?= require 'runas' - if runas('/bin/rm', ['-f', destinationPath], admin: true) != 0 + if runas('/bin/rm', ['-f', destinationPath], admin: true) isnt 0 throw new Error("Failed to remove '#{destinationPath}'") - if runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true) != 0 + if runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true) isnt 0 throw new Error("Failed to create directory '#{destinationPath}'") - if runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) != 0 + if runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) isnt 0 throw new Error("Failed to symlink '#{sourcePath}' to '#{destinationPath}'") module.exports = diff --git a/src/config.coffee b/src/config.coffee index f7db867ed..50d8caba3 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1128,7 +1128,7 @@ splitKeyPath = (keyPath) -> startIndex = 0 keyPathArray = [] for char, i in keyPath - if char is '.' and (i is 0 or keyPath[i-1] != '\\') + if char is '.' and (i is 0 or keyPath[i-1] isnt '\\') keyPathArray.push keyPath.substring(startIndex, i) startIndex = i + 1 keyPathArray.push keyPath.substr(startIndex, keyPath.length) diff --git a/src/cursor.coffee b/src/cursor.coffee index 3ed9939ad..b54cc6bcd 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -156,7 +156,7 @@ class Cursor extends Model # Public: Returns whether the cursor is at the start of a line. isAtBeginningOfLine: -> - @getBufferPosition().column == 0 + @getBufferPosition().column is 0 # Public: Returns whether the cursor is on the line return character. isAtEndOfLine: -> @@ -210,7 +210,7 @@ class Cursor extends Model isInsideWord: (options) -> {row, column} = @getBufferPosition() range = [[row, column], [row, Infinity]] - @editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) == 0 + @editor.getTextInBufferRange(range).search(options?.wordRegex ? @wordRegExp()) is 0 # Public: Returns the indentation level of the current line. getIndentLevel: -> @@ -243,7 +243,7 @@ class Cursor extends Model # # Returns a {Boolean}. isLastCursor: -> - this == @editor.getLastCursor() + this is @editor.getLastCursor() ### Section: Moving the Cursor @@ -258,9 +258,9 @@ class Cursor extends Model moveUp: (rowCount=1, {moveToEndOfSelection}={}) -> range = @marker.getScreenRange() if moveToEndOfSelection and not range.isEmpty() - { row, column } = range.start + {row, column} = range.start else - { row, column } = @getScreenPosition() + {row, column} = @getScreenPosition() column = @goalColumn if @goalColumn? @setScreenPosition({row: row - rowCount, column: column}, skipSoftWrapIndentation: true) @@ -275,9 +275,9 @@ class Cursor extends Model moveDown: (rowCount=1, {moveToEndOfSelection}={}) -> range = @marker.getScreenRange() if moveToEndOfSelection and not range.isEmpty() - { row, column } = range.end + {row, column} = range.end else - { row, column } = @getScreenPosition() + {row, column} = @getScreenPosition() column = @goalColumn if @goalColumn? @setScreenPosition({row: row + rowCount, column: column}, skipSoftWrapIndentation: true) @@ -315,7 +315,7 @@ class Cursor extends Model if moveToEndOfSelection and not range.isEmpty() @setScreenPosition(range.end) else - { row, column } = @getScreenPosition() + {row, column} = @getScreenPosition() maxLines = @editor.getScreenLineCount() rowLength = @editor.lineTextForScreenRow(row).length columnsRemainingInLine = rowLength - column @@ -586,7 +586,7 @@ class Cursor extends Model # Public: Sets whether the cursor is visible. setVisible: (visible) -> - if @visible != visible + if @visible isnt visible @visible = visible @emit 'visibility-changed', @visible if Grim.includeDeprecatedAPIs @emitter.emit 'did-change-visibility', @visible @@ -664,7 +664,7 @@ class Cursor extends Model position = new Point(row, column - 1) @editor.scanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> - if !range.start.isEqual(start) + unless range.start.isEqual(start) position = range.start stop() position @@ -677,7 +677,7 @@ class Cursor extends Model position = new Point(0, 0) zero = new Point(0,0) @editor.backwardsScanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> - if !range.start.isEqual(zero) + unless range.start.isEqual(zero) position = range.start stop() position diff --git a/src/decoration.coffee b/src/decoration.coffee index 8654cf39a..48b26e81f 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -146,7 +146,7 @@ class Decoration matchesPattern: (decorationPattern) -> return false unless decorationPattern? for key, value of decorationPattern - return false if @properties[key] != value + return false if @properties[key] isnt value true onDidFlash: (callback) -> diff --git a/src/default-directory-provider.coffee b/src/default-directory-provider.coffee index a05c532a9..9e25e097b 100644 --- a/src/default-directory-provider.coffee +++ b/src/default-directory-provider.coffee @@ -16,7 +16,7 @@ class DefaultDirectoryProvider directoryForURISync: (uri) -> projectPath = path.normalize(uri) - directoryPath = if !fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) + directoryPath = if not fs.isDirectorySync(projectPath) and fs.isDirectorySync(path.dirname(projectPath)) path.dirname(projectPath) else projectPath diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index ec95d0619..d86fd13be 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -166,7 +166,7 @@ class DisplayBuffer extends Model @updateAllScreenLines() screenDelta = @getLastRow() - end bufferDelta = 0 - @emitDidChange({ start, end, screenDelta, bufferDelta }) + @emitDidChange({start, end, screenDelta, bufferDelta}) # Sets the visibility of the tokenized buffer. # @@ -740,7 +740,7 @@ class DisplayBuffer extends Model screenPositionForBufferPosition: (bufferPosition, options) -> throw new Error("This TextEditor has been destroyed") if @isDestroyed() - { row, column } = @buffer.clipPosition(bufferPosition) + {row, column} = @buffer.clipPosition(bufferPosition) [startScreenRow, endScreenRow] = @rowMap.screenRowRangeForBufferRow(row) for screenRow in [startScreenRow...endScreenRow] screenLine = @screenLines[screenRow] @@ -774,7 +774,7 @@ class DisplayBuffer extends Model # # Returns a {Point}. bufferPositionForScreenPosition: (screenPosition, options) -> - { row, column } = @clipScreenPosition(Point.fromObject(screenPosition), options) + {row, column} = @clipScreenPosition(Point.fromObject(screenPosition), options) [bufferRow] = @rowMap.bufferRowRangeForScreenRow(row) new Point(bufferRow, @screenLines[row].bufferColumnForScreenColumn(column)) @@ -828,8 +828,8 @@ class DisplayBuffer extends Model # # Returns the new, clipped {Point}. Note that this could be the same as `position` if no clipping was performed. clipScreenPosition: (screenPosition, options={}) -> - { wrapBeyondNewlines, wrapAtSoftNewlines, skipSoftWrapIndentation } = options - { row, column } = Point.fromObject(screenPosition) + {wrapBeyondNewlines, wrapAtSoftNewlines, skipSoftWrapIndentation} = options + {row, column} = Point.fromObject(screenPosition) if row < 0 row = 0 diff --git a/src/language-mode.coffee b/src/language-mode.coffee index 125b15ff6..3cbb8ce49 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -122,7 +122,7 @@ class LanguageMode continue unless startRow? # assumption: startRow will always be the min indent level for the entire range - if @editor.indentationForBufferRow(startRow) == indentLevel + if @editor.indentationForBufferRow(startRow) is indentLevel @editor.createFold(startRow, endRow) return @@ -178,7 +178,7 @@ class LanguageMode continue if @editor.isBufferRowBlank(row) indentation = @editor.indentationForBufferRow(row) if indentation <= startIndentLevel - includeRowInFold = indentation == startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row)) + includeRowInFold = indentation is startIndentLevel and @foldEndRegexForScopeDescriptor(scopeDescriptor)?.searchSync(@editor.lineTextForBufferRow(row)) foldEndRow = row if includeRowInFold break @@ -211,14 +211,14 @@ class LanguageMode startRow = bufferRow while startRow > firstRow - break if @isLineCommentedAtBufferRow(startRow - 1) != isOriginalRowComment + break if @isLineCommentedAtBufferRow(startRow - 1) isnt isOriginalRowComment break unless /\w/.test(@editor.lineTextForBufferRow(startRow - 1)) startRow-- endRow = bufferRow lastRow = @editor.getLastBufferRow() while endRow < lastRow - break if @isLineCommentedAtBufferRow(endRow + 1) != isOriginalRowComment + break if @isLineCommentedAtBufferRow(endRow + 1) isnt isOriginalRowComment break unless /\w/.test(@editor.lineTextForBufferRow(endRow + 1)) endRow++ diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 1991cba95..568d726a4 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -164,7 +164,7 @@ class MenuManager filtered = {} for key, bindings of keystrokesByCommand for binding in bindings - continue if binding.indexOf(' ') != -1 + continue if binding.indexOf(' ') isnt -1 filtered[key] ?= [] filtered[key].push(binding) diff --git a/src/notification.coffee b/src/notification.coffee index 0ca82e724..43044c182 100644 --- a/src/notification.coffee +++ b/src/notification.coffee @@ -27,9 +27,9 @@ class Notification getDetail: -> @options.detail isEqual: (other) -> - @getMessage() == other.getMessage() \ - and @getType() == other.getType() \ - and @getDetail() == other.getDetail() + @getMessage() is other.getMessage() \ + and @getType() is other.getType() \ + and @getDetail() is other.getDetail() dismiss: -> return unless @isDismissable() and not @isDismissed() diff --git a/src/overlay-manager.coffee b/src/overlay-manager.coffee index 6dc36b998..21a484fbe 100644 --- a/src/overlay-manager.coffee +++ b/src/overlay-manager.coffee @@ -37,7 +37,7 @@ class OverlayManager # The same node may be used in more than one overlay. This steals the node # back if it has been displayed in another overlay. - overlayNode.appendChild(itemView) if overlayNode.childNodes.length == 0 + overlayNode.appendChild(itemView) if overlayNode.childNodes.length is 0 cachedOverlay.pixelPosition = pixelPosition overlayNode.style.top = pixelPosition.top + 'px' diff --git a/src/pane-axis-element.coffee b/src/pane-axis-element.coffee index ba0cb4b19..569c36534 100644 --- a/src/pane-axis-element.coffee +++ b/src/pane-axis-element.coffee @@ -31,7 +31,7 @@ class PaneAxisElement extends HTMLElement view = atom.views.getView(child) view.remove() - childReplaced: ({index, oldChild, newChild}) -> + childReplaced: ({index, oldChild, newChild}) -> focusedElement = document.activeElement if @hasFocus() @childRemoved({child: oldChild, index}) @childAdded({child: newChild, index}) diff --git a/src/project.coffee b/src/project.coffee index 5094ef8ce..a02c7d747 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -339,7 +339,7 @@ class Project extends Model @findBufferForPath(@resolvePath(filePath))?.isModified() findBufferForPath: (filePath) -> - _.find @buffers, (buffer) -> buffer.getPath() == filePath + _.find @buffers, (buffer) -> buffer.getPath() is filePath # Only to be used in specs bufferForPathSync: (filePath) -> diff --git a/src/scan-handler.coffee b/src/scan-handler.coffee index 71917cc6e..74e15d930 100644 --- a/src/scan-handler.coffee +++ b/src/scan-handler.coffee @@ -34,7 +34,7 @@ module.exports = (rootPaths, regexSource, options) -> scanner.on 'path-found', -> pathsSearched++ - if pathsSearched % PATHS_COUNTER_SEARCHED_CHUNK == 0 + if pathsSearched % PATHS_COUNTER_SEARCHED_CHUNK is 0 emit('scan:paths-searched', pathsSearched) search regex, scanner, searcher, -> diff --git a/src/selection.coffee b/src/selection.coffee index 91f942524..f806acf43 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -110,7 +110,7 @@ class Selection extends Model range = @getBufferRange() start = range.start.row end = range.end.row - end = Math.max(start, end - 1) if range.end.column == 0 + end = Math.max(start, end - 1) if range.end.column is 0 [start, end] getTailScreenPosition: -> @@ -386,7 +386,7 @@ class Selection extends Model if autoIndentFirstLine @editor.setIndentationForBufferRow(oldBufferRange.start.row, desiredIndentLevel) - if options.autoIndentNewline and text == '\n' + if options.autoIndentNewline and text is '\n' currentIndentation = @editor.indentationForBufferRow(newBufferRange.start.row) @editor.autoIndentBufferRow(newBufferRange.end.row, preserveLeadingWhitespace: true, skipBlankLines: false) if @editor.indentationForBufferRow(newBufferRange.end.row) < currentIndentation @@ -601,7 +601,7 @@ class Selection extends Model # of levels. Leaves the first line unchanged. adjustIndent: (lines, indentAdjustment) -> for line, i in lines - if indentAdjustment == 0 or line is '' + if indentAdjustment is 0 or line is '' continue else if indentAdjustment > 0 lines[i] = @editor.buildIndentString(indentAdjustment) + line @@ -620,8 +620,8 @@ class Selection extends Model # * `options` (optional) {Object} with the keys: # * `autoIndent` If `true`, the line is indented to an automatically-inferred # level. Otherwise, {TextEditor::getTabText} is inserted. - indent: ({ autoIndent }={}) -> - { row, column } = @cursor.getBufferPosition() + indent: ({autoIndent}={}) -> + {row, column} = @cursor.getBufferPosition() if @isEmpty() @cursor.skipLeadingWhitespace() @@ -640,7 +640,7 @@ class Selection extends Model indentSelectedRows: -> [start, end] = @getBufferRowRange() for row in [start..end] - @editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) == 0 + @editor.buffer.insert([row, 0], @editor.getTabText()) unless @editor.buffer.lineLengthForRow(row) is 0 return ### diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index bd0e0ee86..4d04dc98f 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -117,7 +117,7 @@ class TextEditorComponent @cursorMoved = false @selectionChanged = false - if @editor.getLastSelection()? and !@editor.getLastSelection().isEmpty() + if @editor.getLastSelection()? and not @editor.getLastSelection().isEmpty() @domNode.classList.add('has-selection') else @domNode.classList.remove('has-selection') diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 2ca7d74bb..be8376ccb 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -949,14 +949,14 @@ class TextEditor extends Model # For each selection, if the selection is empty, converts the containing word # to upper case. Otherwise convert the selected text to upper case. upperCase: -> - @replaceSelectedText selectWordIfEmpty:true, (text) -> text.toUpperCase() + @replaceSelectedText selectWordIfEmpty: true, (text) -> text.toUpperCase() # Extended: Convert the selected text to lower case. # # For each selection, if the selection is empty, converts the containing word # to upper case. Otherwise convert the selected text to upper case. lowerCase: -> - @replaceSelectedText selectWordIfEmpty:true, (text) -> text.toLowerCase() + @replaceSelectedText selectWordIfEmpty: true, (text) -> text.toLowerCase() # Extended: Toggle line comments for rows intersecting selections. # @@ -2464,7 +2464,7 @@ class TextEditor extends Model {cursor} = selection if indentBasis? containsNewlines = text.indexOf('\n') isnt -1 - if containsNewlines or !cursor.hasPrecedingCharactersOnLine() + if containsNewlines or not cursor.hasPrecedingCharactersOnLine() options.indentBasis ?= indentBasis if fullLine and selection.isEmpty() diff --git a/src/token.coffee b/src/token.coffee index 941daf032..8aa4a8706 100644 --- a/src/token.coffee +++ b/src/token.coffee @@ -27,7 +27,7 @@ class Token isEqual: (other) -> # TODO: scopes is deprecated. This is here for the sake of lang package tests - @value == other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic == !!other.isAtomic + @value is other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic is !!other.isAtomic isBracket: -> /^meta\.brace\b/.test(_.last(@scopes)) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index b9d1d01f6..521cdb204 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -154,11 +154,11 @@ class TokenizedBuffer extends Model loop previousStack = @stackForRow(row) @tokenizedLines[row] = @buildTokenizedLineForRow(row, @stackForRow(row - 1)) - if --rowsRemaining == 0 + if --rowsRemaining is 0 filledRegion = false endRow = row break - if row == lastRow or _.isEqual(@stackForRow(row), previousStack) + if row is lastRow or _.isEqual(@stackForRow(row), previousStack) filledRegion = true endRow = row break @@ -280,7 +280,7 @@ class TokenizedBuffer extends Model ruleStack = startingStack stopTokenizingAt = startRow + @chunkSize tokenizedLines = for row in [startRow..endRow] - if (ruleStack or row == 0) and row < stopTokenizingAt + if (ruleStack or row is 0) and row < stopTokenizingAt screenLine = @buildTokenizedLineForRow(row, ruleStack) ruleStack = screenLine.ruleStack else @@ -390,7 +390,7 @@ class TokenizedBuffer extends Model iterateTokensInBufferRange: (bufferRange, iterator) -> bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange + {start, end} = bufferRange keepLooping = true stop = -> keepLooping = false @@ -399,13 +399,13 @@ class TokenizedBuffer extends Model bufferColumn = 0 for token in @tokenizedLines[bufferRow].tokens startOfToken = new Point(bufferRow, bufferColumn) - iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken) + iterator(token, startOfToken, {stop}) if bufferRange.containsPoint(startOfToken) return unless keepLooping bufferColumn += token.bufferDelta backwardsIterateTokensInBufferRange: (bufferRange, iterator) -> bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange + {start, end} = bufferRange keepLooping = true stop = -> keepLooping = false @@ -415,20 +415,20 @@ class TokenizedBuffer extends Model for token in new Array(@tokenizedLines[bufferRow].tokens...).reverse() bufferColumn -= token.bufferDelta startOfToken = new Point(bufferRow, bufferColumn) - iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken) + iterator(token, startOfToken, {stop}) if bufferRange.containsPoint(startOfToken) return unless keepLooping findOpeningBracket: (startBufferPosition) -> range = [[0,0], startBufferPosition] position = null depth = 0 - @backwardsIterateTokensInBufferRange range, (token, startPosition, { stop }) -> + @backwardsIterateTokensInBufferRange range, (token, startPosition, {stop}) -> if token.isBracket() - if token.value == '}' + if token.value is '}' depth++ - else if token.value == '{' + else if token.value is '{' depth-- - if depth == 0 + if depth is 0 position = startPosition stop() position @@ -437,13 +437,13 @@ class TokenizedBuffer extends Model range = [startBufferPosition, @buffer.getEndPosition()] position = null depth = 0 - @iterateTokensInBufferRange range, (token, startPosition, { stop }) -> + @iterateTokensInBufferRange range, (token, startPosition, {stop}) -> if token.isBracket() - if token.value == '{' + if token.value is '{' depth++ - else if token.value == '}' + else if token.value is '}' depth-- - if depth == 0 + if depth is 0 position = startPosition stop() position diff --git a/src/tokenized-line.coffee b/src/tokenized-line.coffee index 074e7a785..b81d972a0 100644 --- a/src/tokenized-line.coffee +++ b/src/tokenized-line.coffee @@ -52,9 +52,9 @@ class TokenizedLine # # Returns a {Number} representing the clipped column. clipScreenColumn: (column, options={}) -> - return 0 if @tokens.length == 0 + return 0 if @tokens.length is 0 - { clip } = options + {clip} = options column = Math.min(column, @getMaxScreenColumn()) tokenStartColumn = 0 @@ -65,9 +65,9 @@ class TokenizedLine if @isColumnInsideSoftWrapIndentation(tokenStartColumn) @softWrapIndentationDelta else if token.isAtomic and tokenStartColumn < column - if clip == 'forward' + if clip is 'forward' tokenStartColumn + token.screenDelta - else if clip == 'backward' + else if clip is 'backward' tokenStartColumn else #'closest' if column > tokenStartColumn + (token.screenDelta / 2) @@ -140,7 +140,7 @@ class TokenizedLine indentTokens softWrapAt: (column, hangingIndent) -> - return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column == 0 + return [new TokenizedLine([], '', [0, 0], [0, 0]), this] if column is 0 rightTokens = new Array(@tokens...) leftTokens = [] @@ -179,7 +179,7 @@ class TokenizedLine @lineEnding is null isColumnInsideSoftWrapIndentation: (column) -> - return false if @softWrapIndentationTokens.length == 0 + return false if @softWrapIndentationTokens.length is 0 column < @softWrapIndentationDelta @@ -190,7 +190,7 @@ class TokenizedLine _.reduce @softWrapIndentationTokens, ((acc, token) -> acc + token.screenDelta), 0 hasOnlySoftWrapIndentation: -> - @tokens.length == @softWrapIndentationTokens.length + @tokens.length is @softWrapIndentationTokens.length tokenAtBufferColumn: (bufferColumn) -> @tokens[@tokenIndexAtBufferColumn(bufferColumn)] diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 593d33476..96518c446 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -85,7 +85,7 @@ class WindowEventHandler if process.platform in ['win32', 'linux'] @subscribeToCommand $(window), 'window:toggle-menu-bar', -> - atom.config.set('core.autoHideMenuBar', !atom.config.get('core.autoHideMenuBar')) + atom.config.set('core.autoHideMenuBar', not atom.config.get('core.autoHideMenuBar')) @subscribeToCommand $(document), 'core:focus-next', @focusNext diff --git a/src/workspace.coffee b/src/workspace.coffee index 6a7a40a0c..b18799160 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -400,7 +400,7 @@ class Workspace extends Model uri = atom.project.resolvePath(uri) item = @getActivePane().itemForURI(uri) if uri - item ?= opener(uri, options) for opener in @getOpeners() when !item + item ?= opener(uri, options) for opener in @getOpeners() when not item item ?= atom.project.openSync(uri, {initialLine, initialColumn}) @getActivePane().activateItem(item) @@ -419,7 +419,7 @@ class Workspace extends Model if uri? item = pane.itemForURI(uri) - item ?= opener(uri, options) for opener in @getOpeners() when !item + item ?= opener(uri, options) for opener in @getOpeners() when not item try item ?= atom.project.open(uri, options) @@ -865,8 +865,8 @@ class Workspace extends Model openPaths = (buffer.getPath() for buffer in atom.project.getBuffers()) outOfProcessPaths = _.difference(filePaths, openPaths) - inProcessFinished = !openPaths.length - outOfProcessFinished = !outOfProcessPaths.length + inProcessFinished = not openPaths.length + outOfProcessFinished = not outOfProcessPaths.length checkFinished = -> deferred.resolve() if outOfProcessFinished and inProcessFinished From 2bb2022b5be282982812fe4c851a5c8f1b6a7372 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Tue, 7 Apr 2015 00:05:19 -0400 Subject: [PATCH 412/521] :shirt: --- build/tasks/spec-task.coffee | 2 +- build/tasks/task-helpers.coffee | 4 ++-- src/atom.coffee | 2 +- src/config.coffee | 2 +- src/grammar-registry.coffee | 2 +- src/tokenized-buffer.coffee | 2 +- src/workspace-element.coffee | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build/tasks/spec-task.coffee b/build/tasks/spec-task.coffee index 73bb63f70..b5547fe64 100644 --- a/build/tasks/spec-task.coffee +++ b/build/tasks/spec-task.coffee @@ -138,4 +138,4 @@ module.exports = (grunt) -> if process.platform is 'win32' and process.env.JANKY_SHA1 done() else - done(!coreSpecFailed and failedPackages.length == 0) + done(not coreSpecFailed and failedPackages.length is 0) diff --git a/build/tasks/task-helpers.coffee b/build/tasks/task-helpers.coffee index a862f291f..2819c952a 100644 --- a/build/tasks/task-helpers.coffee +++ b/build/tasks/task-helpers.coffee @@ -55,9 +55,9 @@ module.exports = (grunt) -> proc.stderr.on 'data', (data) -> stderr.push(data.toString()) proc.on 'error', (processError) -> error ?= processError proc.on 'close', (exitCode, signal) -> - error ?= new Error(signal) if exitCode != 0 + error ?= new Error(signal) if exitCode isnt 0 results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode} - grunt.log.error results.stderr if exitCode != 0 + grunt.log.error results.stderr if exitCode isnt 0 callback(error, results, exitCode) isAtomPackage: (packagePath) -> diff --git a/src/atom.coffee b/src/atom.coffee index 88c8257e1..b02d04d5c 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -846,7 +846,7 @@ class Atom extends Model setAutoHideMenuBar: (autoHide) -> ipc.send('call-window-method', 'setAutoHideMenuBar', autoHide) - ipc.send('call-window-method', 'setMenuBarVisibility', !autoHide) + ipc.send('call-window-method', 'setMenuBarVisibility', not autoHide) if includeDeprecatedAPIs # Deprecated: Callers should be converted to use atom.deserializers diff --git a/src/config.coffee b/src/config.coffee index 50d8caba3..cb2d8ab76 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1190,7 +1190,7 @@ if Grim.includeDeprecatedAPIs Config::toggle = (keyPath) -> Grim.deprecate 'Config::toggle is no longer supported. Please remove from your code.' - @set(keyPath, !@get(keyPath)) + @set(keyPath, not @get(keyPath)) Config::unobserve = (keyPath) -> Grim.deprecate 'Config::unobserve no longer does anything. Call `.dispose()` on the object returned by Config::observe instead.' diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee index 8272dce47..568de483a 100644 --- a/src/grammar-registry.coffee +++ b/src/grammar-registry.coffee @@ -57,7 +57,7 @@ if includeDeprecatedAPIs atom.config.scopedSettingsStore GrammarRegistry::addProperties = (args...) -> - args.unshift(null) if args.length == 2 + args.unshift(null) if args.length is 2 deprecate 'Consider using atom.config.set() instead. A direct (but private) replacement is available at atom.config.addScopedSettings().' atom.config.addScopedSettings(args...) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 521cdb204..d9f1bcba7 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -226,7 +226,7 @@ class TokenizedBuffer extends Model [start, end] = @updateFoldableStatus(start, end + delta) end -= delta - event = { start, end, delta, bufferChange: e } + event = {start, end, delta, bufferChange: e} @emit 'changed', event if Grim.includeDeprecatedAPIs @emitter.emit 'did-change', event diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 5f127d970..5768b2dbb 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -156,9 +156,9 @@ atom.commands.add 'atom-workspace', 'window:focus-pane-on-left': -> @focusPaneViewOnLeft() 'window:focus-pane-on-right': -> @focusPaneViewOnRight() 'window:save-all': -> @getModel().saveAll() - 'window:toggle-invisibles': -> atom.config.set("editor.showInvisibles", !atom.config.get("editor.showInvisibles")) + 'window:toggle-invisibles': -> atom.config.set("editor.showInvisibles", not atom.config.get("editor.showInvisibles")) 'window:log-deprecation-warnings': -> Grim.logDeprecations() - 'window:toggle-auto-indent': -> atom.config.set("editor.autoIndent", !atom.config.get("editor.autoIndent")) + 'window:toggle-auto-indent': -> atom.config.set("editor.autoIndent", not atom.config.get("editor.autoIndent")) 'pane:reopen-closed-item': -> @getModel().reopenItem() 'core:close': -> @getModel().destroyActivePaneItemOrEmptyPane() 'core:save': -> @getModel().saveActivePaneItem() From ef19b6ab223e7a9488cd8fa194f507d5f4bbc284 Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 7 Apr 2015 15:20:29 +0900 Subject: [PATCH 413/521] :arrow_up: find-and-replace@v0.160.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f8ebc304d..8f75a4a85 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", "feedback": "0.38.0", - "find-and-replace": "0.159.0", + "find-and-replace": "0.160.0", "fuzzy-finder": "0.72.0", "git-diff": "0.54.0", "go-to-line": "0.30.0", From 2e86e22d46fb22ab1a4acd8e011155ccf41b35ff Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 7 Apr 2015 16:42:50 +0900 Subject: [PATCH 414/521] :arrrow_up: one-dark-ui@v0.6.1 one-light-ui@v0.5.1 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8f75a4a85..9dc9ad061 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.25.0", "base16-tomorrow-light-theme": "0.8.0", - "one-dark-ui": "0.6.0", + "one-dark-ui": "0.6.1", "one-dark-syntax": "0.3.0", "one-light-syntax": "0.4.0", - "one-light-ui": "0.5.0", + "one-light-ui": "0.5.1", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", "archive-view": "0.55.0", From 5e5acb7432ff6cfe0f67468c5d0ab66e85caa0d7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 7 Apr 2015 12:24:41 +0200 Subject: [PATCH 415/521] :art: Rename to `TextEditor#mergeSelectionsOnSameRows` * :fire: Delete `Selection#intersectsByRowWith` --- src/selection.coffee | 12 ------------ src/text-editor.coffee | 6 +++--- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/selection.coffee b/src/selection.coffee index 49aa2c6b1..91f942524 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -162,18 +162,6 @@ class Selection extends Model intersectsScreenRow: (screenRow) -> @getScreenRange().intersectsRow(screenRow) - # Public: Identifies if this selection's rows intersects with another selection's rows. - # - # * `otherSelection` A {Selection} to check against. - # - # Returns a {Boolean} - intersectsByRowWith: (otherSelection) -> - otherScreenRange = otherSelection.getScreenRange() - - @getScreenRange().intersectsRowRange( - otherScreenRange.start.row, otherScreenRange.end.row - ) - # Public: Identifies if a selection intersects with another selection. # # * `otherSelection` A {Selection} to check against. diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 6395ccc32..8936e125a 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -1026,7 +1026,7 @@ class TextEditor extends Model # Extended: Delete all lines intersecting selections. deleteLine: -> - @mergeIntersectingSelectionsByRow() + @mergeSelectionsOnSameRows() @mutateSelectedText (selection) -> selection.deleteLine() ### @@ -2054,9 +2054,9 @@ class TextEditor extends Model previousSelection.intersectsWith(currentSelection, exclusive) - mergeIntersectingSelectionsByRow: (args...) -> + mergeSelectionsOnSameRows: (args...) -> @mergeSelections args..., (previousSelection, currentSelection) -> - previousSelection.intersectsByRowWith(currentSelection) + previousSelection.intersectsScreenRowRange(currentSelection.getBufferRowRange()...) mergeSelections: (args...) -> mergePredicate = args.pop() From a244c0fa072bbd36122849268e58766f402672ef Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 7 Apr 2015 12:30:51 +0200 Subject: [PATCH 416/521] :fire: Delete useless line in spec --- spec/text-editor-spec.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 05cc666c3..3dfbce82e 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -3373,7 +3373,6 @@ describe "TextEditor", -> it "deletes a line only once when multiple selections are on the same line", -> line1 = buffer.lineForRow(1) count = buffer.getLineCount() - editor.getLastCursor().moveToTop() editor.setSelectedBufferRanges([ [[0, 1], [0, 2]], [[0, 4], [0, 5]] From 9dddce495e19dfffb7cb494218dbd41ff867d1b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Tue, 7 Apr 2015 12:41:06 +0200 Subject: [PATCH 417/521] :arrow_up: notifications@0.36.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dc9ad061..9d71a3dc4 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "link": "0.30.0", "markdown-preview": "0.148.0", "metrics": "0.45.0", - "notifications": "0.35.0", + "notifications": "0.36.0", "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", From 662efb3d6ec8b9ea5b7abfbfccd254c15e90b45a Mon Sep 17 00:00:00 2001 From: simurai Date: Tue, 7 Apr 2015 19:57:24 +0900 Subject: [PATCH 418/521] :arrrow_up: one-dark-ui@v0.6.2 one-light-ui@v0.5.2 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9d71a3dc4..cf2ae12b4 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.25.0", "base16-tomorrow-light-theme": "0.8.0", - "one-dark-ui": "0.6.1", + "one-dark-ui": "0.6.2", "one-dark-syntax": "0.3.0", "one-light-syntax": "0.4.0", - "one-light-ui": "0.5.1", + "one-light-ui": "0.5.2", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", "archive-view": "0.55.0", From 36641884f904f6ae1f8744ab77612e8599653bed Mon Sep 17 00:00:00 2001 From: Ivan Zuzak Date: Tue, 7 Apr 2015 13:37:30 +0200 Subject: [PATCH 419/521] Point in-app link for reporting issues to CONTRIBUTING guide --- src/browser/atom-application.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 45c0c8b5c..9922a1380 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -169,7 +169,7 @@ class AtomApplication @on 'application:open-roadmap', -> require('shell').openExternal('https://atom.io/roadmap?app') @on 'application:open-faq', -> require('shell').openExternal('https://atom.io/faq') @on 'application:open-terms-of-use', -> require('shell').openExternal('https://atom.io/terms') - @on 'application:report-issue', -> require('shell').openExternal('https://github.com/atom/atom/issues/new') + @on 'application:report-issue', -> require('shell').openExternal('https://github.com/atom/atom/blob/master/CONTRIBUTING.md#submitting-issues') @on 'application:search-issues', -> require('shell').openExternal('https://github.com/issues?q=+is%3Aissue+user%3Aatom') @on 'application:install-update', -> @autoUpdateManager.install() From 4a95dd1234a5bbabed09583d387e8de6601ae7fd Mon Sep 17 00:00:00 2001 From: Ivan Zuzak Date: Tue, 7 Apr 2015 13:38:57 +0200 Subject: [PATCH 420/521] Update CONTRIBUTING guide section on reporting issues --- CONTRIBUTING.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a5ba9945..66080c614 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,13 +4,14 @@ The following is a set of guidelines for contributing to Atom and its packages, which are hosted in the [Atom Organization](https://github.com/atom) on GitHub. -If you're unsure which package is causing your problem or if you're having an -issue with Atom core, please open an issue on the [main atom repository](https://github.com/atom/atom/issues). These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request. ## Submitting Issues +* You can create an issue [here](https://github.com/atom/atom/issues/new), but + before doing that please read the notes below on debugging and submitting issues, + and include as many details as possible with your report. * Check the [debugging guide](https://atom.io/docs/latest/hacking-atom-debugging) for tips on debugging. You might be able to find the cause of the problem and fix things yourself. @@ -24,7 +25,8 @@ propose changes to this document in a pull request. will be logged. If you can reproduce the error, use this approach to get the full stack trace and include it in the issue. * On Mac, check Console.app for stack traces to include if reporting a crash. -* Perform a cursory search to see if a similar issue has already been submitted. +* Perform a [cursory search](https://github.com/issues?q=+is%3Aissue+user%3Aatom) + to see if a similar issue has already been submitted. * Please setup a [profile picture](https://help.github.com/articles/how-do-i-set-up-my-profile-picture) to make yourself recognizable and so we can all get to know each other better. @@ -38,6 +40,10 @@ many packages and themes that are stored in other repos under the [language-javascript](https://github.com/atom/language-javascript), and [atom-light-ui](https://github.com/atom/atom-light-ui). +If your issue is related to a specific package, open an issue on that package's +issue tracker. If you're unsure which package is causing your problem or if +you're having an issue with Atom core, open an issue on this repository. + For more information on how to work with Atom's official packages, see [Contributing to Atom Packages](https://github.com/atom/atom/blob/master/docs/contributing-to-packages.md) From cbf499243e0787b33ca486ec6c9a396d4cd74f31 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 7 Apr 2015 18:08:51 +0200 Subject: [PATCH 421/521] Use screen ranges consistently --- src/text-editor.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 8936e125a..7606cea7e 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2056,7 +2056,9 @@ class TextEditor extends Model mergeSelectionsOnSameRows: (args...) -> @mergeSelections args..., (previousSelection, currentSelection) -> - previousSelection.intersectsScreenRowRange(currentSelection.getBufferRowRange()...) + screenRange = currentSelection.getScreenRange() + + previousSelection.intersectsScreenRowRange(screenRange.start.row, screenRange.end.row) mergeSelections: (args...) -> mergePredicate = args.pop() From c0b685dd970ca8d72f4197c7f999ad2224fcb1e3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 09:48:10 -0700 Subject: [PATCH 422/521] :arrow_up: language-go@0.23 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf2ae12b4..50bd77e28 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "language-css": "0.28.0", "language-gfm": "0.67.0", "language-git": "0.10.0", - "language-go": "0.22.0", + "language-go": "0.23.0", "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", From 2aaf1fffe6eece195db41c3ea344b9195a054823 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 09:51:16 -0700 Subject: [PATCH 423/521] Move stack trace helpers into deprecation block --- src/workspace.coffee | 59 ++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 6a7a40a0c..2e433d6b9 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -7,7 +7,6 @@ Serializable = require 'serializable' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' Grim = require 'grim' fs = require 'fs-plus' -StackTraceParser = require 'stacktrace-parser' Model = require './model' TextEditor = require './text-editor' PaneContainer = require './pane-container' @@ -495,34 +494,6 @@ class Workspace extends Model getOpeners: -> @openers - getCallingPackageName: -> - error = new Error - Error.captureStackTrace(error) - stack = StackTraceParser.parse(error.stack) - - packagePaths = @getPackagePathsByPackageName() - - for i in [0...stack.length] - stackFramePath = stack[i].file - - # Empty when it was run from the dev console - return unless stackFramePath - - for packageName, packagePath of packagePaths - continue if stackFramePath is 'node.js' - relativePath = path.relative(packagePath, stackFramePath) - return packageName unless /^\.\./.test(relativePath) - return - - getPackagePathsByPackageName: -> - packagePathsByPackageName = {} - for pack in atom.packages.getLoadedPackages() - packagePath = pack.path - if packagePath.indexOf('.atom/dev/packages') > -1 or packagePath.indexOf('.atom/packages') > -1 - packagePath = fs.realpathSync(packagePath) - packagePathsByPackageName[pack.name] = packagePath - packagePathsByPackageName - ### Section: Pane Items ### @@ -907,6 +878,36 @@ if includeDeprecatedAPIs Grim.deprecate "Use ::getActivePane() instead of the ::activePane property" @getActivePane() + StackTraceParser = require 'stacktrace-parser' + + Workspace::getCallingPackageName = -> + error = new Error + Error.captureStackTrace(error) + stack = StackTraceParser.parse(error.stack) + + packagePaths = @getPackagePathsByPackageName() + + for i in [0...stack.length] + stackFramePath = stack[i].file + + # Empty when it was run from the dev console + return unless stackFramePath + + for packageName, packagePath of packagePaths + continue if stackFramePath is 'node.js' + relativePath = path.relative(packagePath, stackFramePath) + return packageName unless /^\.\./.test(relativePath) + return + + Workspace::getPackagePathsByPackageName = -> + packagePathsByPackageName = {} + for pack in atom.packages.getLoadedPackages() + packagePath = pack.path + if packagePath.indexOf('.atom/dev/packages') > -1 or packagePath.indexOf('.atom/packages') > -1 + packagePath = fs.realpathSync(packagePath) + packagePathsByPackageName[pack.name] = packagePath + packagePathsByPackageName + Workspace::eachEditor = (callback) -> deprecate("Use Workspace::observeTextEditors instead") From 9a647309167973a0d0bb76e455406229fec28e21 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 7 Apr 2015 11:23:22 -0700 Subject: [PATCH 424/521] :arrow_up: background-tips --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 50bd77e28..0360f085e 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "autocomplete": "0.44.0", "autoflow": "0.22.0", "autosave": "0.20.0", - "background-tips": "0.23.0", + "background-tips": "0.24.0", "bookmarks": "0.35.0", "bracket-matcher": "0.73.0", "command-palette": "0.35.0", From 06b8195fb8de1fe21755f1469004d11498280aec Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 11:43:35 -0700 Subject: [PATCH 425/521] Remove template config.cson file This old template file had several problems: * The entries in this file are already the schema defaults so they would get unset anyway when initially loaded * The file was in the old format that didn't have scope selectors * A race condition could occur when the file was copied, inited, and written to all during the very first run of Atom. Closes #6226 --- dot-atom/config.cson | 7 ------- spec/config-spec.coffee | 1 - 2 files changed, 8 deletions(-) delete mode 100644 dot-atom/config.cson diff --git a/dot-atom/config.cson b/dot-atom/config.cson deleted file mode 100644 index a3a5984af..000000000 --- a/dot-atom/config.cson +++ /dev/null @@ -1,7 +0,0 @@ -'editor': - 'fontSize': 16 -'core': - 'themes': [ - 'one-dark-ui' - 'one-dark-syntax' - ] diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 4abd3b0db..b8cfc67d0 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -987,7 +987,6 @@ describe "Config", -> expect(fs.existsSync(atom.config.configDirPath)).toBeTruthy() expect(fs.existsSync(path.join(atom.config.configDirPath, 'packages'))).toBeTruthy() expect(fs.isFileSync(path.join(atom.config.configDirPath, 'snippets.cson'))).toBeTruthy() - expect(fs.isFileSync(path.join(atom.config.configDirPath, 'config.cson'))).toBeTruthy() expect(fs.isFileSync(path.join(atom.config.configDirPath, 'init.coffee'))).toBeTruthy() expect(fs.isFileSync(path.join(atom.config.configDirPath, 'styles.less'))).toBeTruthy() From 4421d929a74d5fa867b8d88190947f26bee093fa Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 11:54:58 -0700 Subject: [PATCH 426/521] :arrow_up: language-javascript@0.70 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0360f085e..92a133ad6 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.69.0", + "language-javascript": "0.70.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From f39c67411aabb0c6dbb1ccd3dc68f051aa3bb0d7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 7 Apr 2015 11:59:14 -0700 Subject: [PATCH 427/521] Rename 'add-root-folder' -> 'add-project-folder' --- spec/atom-spec.coffee | 6 +++--- src/atom.coffee | 2 +- src/workspace-element.coffee | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index f888c433f..19a2cca5c 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -181,18 +181,18 @@ describe "the `atom` global", -> atom.openInitialEmptyEditorIfNecessary() expect(atom.workspace.open).not.toHaveBeenCalled() - describe "adding a root folder", -> + describe "adding a project folder", -> it "adds a second path to the project", -> initialPaths = atom.project.getPaths() tempDirectory = temp.mkdirSync("a-new-directory") spyOn(atom, "pickFolder").andCallFake (callback) -> callback([tempDirectory]) - atom.addRootFolder() + atom.addProjectFolder() expect(atom.project.getPaths()).toEqual(initialPaths.concat([tempDirectory])) it "does nothing if the user dismisses the file picker", -> initialPaths = atom.project.getPaths() tempDirectory = temp.mkdirSync("a-new-directory") spyOn(atom, "pickFolder").andCallFake (callback) -> callback(null) - atom.addRootFolder() + atom.addProjectFolder() expect(atom.project.getPaths()).toEqual(initialPaths) diff --git a/src/atom.coffee b/src/atom.coffee index 701f2e91e..f5e229962 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -774,7 +774,7 @@ class Atom extends Model setRepresentedFilename: (filename) -> ipc.send('call-window-method', 'setRepresentedFilename', filename) - addRootFolder: -> + addProjectFolder: -> @pickFolder (selectedPaths = []) => @project.addPath(selectedPath) for selectedPath in selectedPaths diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 5f127d970..46a005af0 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -138,7 +138,7 @@ atom.commands.add 'atom-workspace', 'application:open-safe': -> ipc.send('command', 'application:open-safe') 'application:open-api-preview': -> ipc.send('command', 'application:open-api-preview') 'application:open-dev-api-preview': -> ipc.send('command', 'application:open-dev-api-preview') - 'application:add-root-folder': -> atom.addRootFolder() + 'application:add-project-folder': -> atom.addProjectFolder() 'application:minimize': -> ipc.send('command', 'application:minimize') 'application:zoom': -> ipc.send('command', 'application:zoom') 'application:bring-all-windows-to-front': -> ipc.send('command', 'application:bring-all-windows-to-front') From ceaa86942673d583b6b9867182d27c6d97ecf740 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 12:33:41 -0700 Subject: [PATCH 428/521] Add application:add-project-folder keybinding --- keymaps/darwin.cson | 1 + keymaps/linux.cson | 1 + keymaps/win32.cson | 1 + 3 files changed, 3 insertions(+) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 5226bb5e6..46f949317 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -37,6 +37,7 @@ 'cmd-N': 'application:new-window' 'cmd-W': 'window:close' 'cmd-o': 'application:open' + 'cmd-alt-o': 'application:add-project-folder' 'cmd-T': 'pane:reopen-closed-item' 'cmd-n': 'application:new-file' 'cmd-s': 'core:save' diff --git a/keymaps/linux.cson b/keymaps/linux.cson index 59803d193..cea470635 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -21,6 +21,7 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' + 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-q': 'application:quit' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index da43ac364..382b280a8 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -25,6 +25,7 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' + 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' 'ctrl-s': 'core:save' From 54c238ba2d02c60884041df5236172c760274396 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 7 Apr 2015 12:34:08 -0700 Subject: [PATCH 429/521] :arrow_up: tree-view --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 92a133ad6..26dc284a1 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "symbols-view": "0.93.0", "tabs": "0.67.0", "timecop": "0.31.0", - "tree-view": "0.169.0", + "tree-view": "0.170.0", "update-package-dependencies": "0.9.0", "welcome": "0.26.0", "whitespace": "0.29.0", From 8e0efb184480a9be5bd184634741970f29e97bea Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 12:34:36 -0700 Subject: [PATCH 430/521] Add Add Project Folder system menu --- menus/darwin.cson | 1 + menus/linux.cson | 1 + menus/win32.cson | 1 + 3 files changed, 3 insertions(+) diff --git a/menus/darwin.cson b/menus/darwin.cson index 9454a7c34..effd19197 100644 --- a/menus/darwin.cson +++ b/menus/darwin.cson @@ -34,6 +34,7 @@ { label: 'New Window', command: 'application:new-window' } { label: 'New File', command: 'application:new-file' } { label: 'Open...', command: 'application:open' } + { label: 'Add Project Folder...', command: 'application:add-project-folder' } { label: 'Reopen Last Item', command: 'pane:reopen-closed-item' } { type: 'separator' } { label: 'Save', command: 'core:save' } diff --git a/menus/linux.cson b/menus/linux.cson index a3b3875c4..c92017de9 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -6,6 +6,7 @@ { label: '&New File', command: 'application:new-file' } { label: '&Open File...', command: 'application:open-file' } { label: 'Open Folder...', command: 'application:open-folder' } + { label: 'Add Project Folder...', command: 'application:add-project-folder' } { label: 'Reopen Last &Item', command: 'pane:reopen-closed-item' } { type: 'separator' } { label: '&Save', command: 'core:save' } diff --git a/menus/win32.cson b/menus/win32.cson index af26be7a5..2bd013ce3 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -6,6 +6,7 @@ { label: '&New File', command: 'application:new-file' } { label: '&Open File...', command: 'application:open-file' } { label: 'Open Folder...', command: 'application:open-folder' } + { label: 'Add Project Folder...', command: 'application:add-project-folder' } { label: 'Reopen Last &Item', command: 'pane:reopen-closed-item' } { type: 'separator' } { label: 'Se&ttings', command: 'application:show-settings' } From 1acc3a835673c7df91330ef482e800506c030647 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 12:41:59 -0700 Subject: [PATCH 431/521] Don't clash with existing linux/windows keybindings --- keymaps/linux.cson | 2 +- keymaps/win32.cson | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keymaps/linux.cson b/keymaps/linux.cson index cea470635..fed3bdc49 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -21,7 +21,7 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' - 'ctrl-alt-o': 'application:add-project-folder' + 'ctrl-alt-O': 'application:add-project-folder' 'ctrl-q': 'application:quit' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 382b280a8..d5e331f0c 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -25,7 +25,7 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' - 'ctrl-alt-o': 'application:add-project-folder' + 'ctrl-alt-O': 'application:add-project-folder' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' 'ctrl-s': 'core:save' From d41296b121bf2d2ed97992285aef3d9c6e136e61 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 13:02:11 -0700 Subject: [PATCH 432/521] Swap open-dev and add-project-folder keybindings --- keymaps/darwin.cson | 4 ++-- keymaps/linux.cson | 4 ++-- keymaps/win32.cson | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 46f949317..8f023427e 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -18,7 +18,7 @@ 'ctrl-d': 'core:delete' # Atom Specific - 'cmd-O': 'application:open-dev' + 'cmd-alt-o': 'application:open-dev' 'cmd-alt-ctrl-s': 'application:run-all-specs' 'enter': 'core:confirm' 'escape': 'core:cancel' @@ -37,7 +37,7 @@ 'cmd-N': 'application:new-window' 'cmd-W': 'window:close' 'cmd-o': 'application:open' - 'cmd-alt-o': 'application:add-project-folder' + 'cmd-O': 'application:add-project-folder' 'cmd-T': 'pane:reopen-closed-item' 'cmd-n': 'application:new-file' 'cmd-s': 'core:save' diff --git a/keymaps/linux.cson b/keymaps/linux.cson index fed3bdc49..6fef9f482 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -10,7 +10,7 @@ 'ctrl-shift-i': 'window:toggle-dev-tools' 'ctrl-alt-p': 'window:run-package-specs' 'ctrl-alt-s': 'application:run-all-specs' - 'ctrl-alt-o': 'application:open-dev' + 'ctrl-alt-shift-o': 'application:open-dev' 'ctrl-shift-o': 'application:open-folder' 'ctrl-shift-pageup': 'pane:move-item-left' 'ctrl-shift-pagedown': 'pane:move-item-right' @@ -21,7 +21,7 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' - 'ctrl-alt-O': 'application:add-project-folder' + 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-q': 'application:quit' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index d5e331f0c..968adb0a8 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -14,7 +14,7 @@ 'ctrl-alt-i': 'window:toggle-dev-tools' 'ctrl-alt-p': 'window:run-package-specs' 'ctrl-alt-s': 'application:run-all-specs' - 'ctrl-alt-o': 'application:open-dev' + 'ctrl-alt-shift-o': 'application:open-dev' 'ctrl-shift-o': 'application:open-folder' 'ctrl-shift-left': 'pane:move-item-left' 'ctrl-shift-right': 'pane:move-item-right' @@ -25,7 +25,7 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' - 'ctrl-alt-O': 'application:add-project-folder' + 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' 'ctrl-s': 'core:save' From b9db13ae064facbb9dc27650ffec254d7e08fe4e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 13:05:28 -0700 Subject: [PATCH 433/521] Group add-project-folder with open-folder --- keymaps/linux.cson | 2 +- keymaps/win32.cson | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keymaps/linux.cson b/keymaps/linux.cson index 6fef9f482..d8877d77c 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -12,6 +12,7 @@ 'ctrl-alt-s': 'application:run-all-specs' 'ctrl-alt-shift-o': 'application:open-dev' 'ctrl-shift-o': 'application:open-folder' + 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-shift-pageup': 'pane:move-item-left' 'ctrl-shift-pagedown': 'pane:move-item-right' 'F11': 'window:toggle-full-screen' @@ -21,7 +22,6 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' - 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-q': 'application:quit' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 968adb0a8..4d5bb5159 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -16,6 +16,7 @@ 'ctrl-alt-s': 'application:run-all-specs' 'ctrl-alt-shift-o': 'application:open-dev' 'ctrl-shift-o': 'application:open-folder' + 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-shift-left': 'pane:move-item-left' 'ctrl-shift-right': 'pane:move-item-right' 'F11': 'window:toggle-full-screen' @@ -25,7 +26,6 @@ 'ctrl-N': 'application:new-window' 'ctrl-W': 'window:close' 'ctrl-o': 'application:open-file' - 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-T': 'pane:reopen-closed-item' 'ctrl-n': 'application:new-file' 'ctrl-s': 'core:save' From a49f635fc0ba1d952320d6710d75731e7a106717 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 13:10:01 -0700 Subject: [PATCH 434/521] Remove application:open-dev keybindings --- keymaps/darwin.cson | 1 - keymaps/linux.cson | 1 - keymaps/win32.cson | 1 - 3 files changed, 3 deletions(-) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 8f023427e..34d18e159 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -18,7 +18,6 @@ 'ctrl-d': 'core:delete' # Atom Specific - 'cmd-alt-o': 'application:open-dev' 'cmd-alt-ctrl-s': 'application:run-all-specs' 'enter': 'core:confirm' 'escape': 'core:cancel' diff --git a/keymaps/linux.cson b/keymaps/linux.cson index d8877d77c..cd71d99e7 100644 --- a/keymaps/linux.cson +++ b/keymaps/linux.cson @@ -10,7 +10,6 @@ 'ctrl-shift-i': 'window:toggle-dev-tools' 'ctrl-alt-p': 'window:run-package-specs' 'ctrl-alt-s': 'application:run-all-specs' - 'ctrl-alt-shift-o': 'application:open-dev' 'ctrl-shift-o': 'application:open-folder' 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-shift-pageup': 'pane:move-item-left' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 4d5bb5159..656d9ec8e 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -14,7 +14,6 @@ 'ctrl-alt-i': 'window:toggle-dev-tools' 'ctrl-alt-p': 'window:run-package-specs' 'ctrl-alt-s': 'application:run-all-specs' - 'ctrl-alt-shift-o': 'application:open-dev' 'ctrl-shift-o': 'application:open-folder' 'ctrl-alt-o': 'application:add-project-folder' 'ctrl-shift-left': 'pane:move-item-left' From debe192d9eb34bba10769b8c61b62cbcb7863a33 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:14:46 -0700 Subject: [PATCH 435/521] Prepare 0.191 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26dc284a1..9b30cb63f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.190.0", + "version": "0.191.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From ff86712a22e3def0b2014095dd06de0eef60d53d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:15:30 -0700 Subject: [PATCH 436/521] Add missing View > Panes menu on Linux Closes #1897 --- menus/linux.cson | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/menus/linux.cson b/menus/linux.cson index c92017de9..2cfb17871 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -96,6 +96,25 @@ { label: '&Reload', command: 'window:reload' } { label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' } { label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' } + { + label: 'Panes' + submenu: [ + { label: 'Split Up', command: 'pane:split-up' } + { label: 'Split Down', command: 'pane:split-down' } + { label: 'Split Left', command: 'pane:split-left' } + { label: 'Split Right', command: 'pane:split-right' } + { type: 'separator' } + { label: 'Focus Next Pane', command: 'window:focus-next-pane' } + { label: 'Focus Previous Pane', command: 'window:focus-previous-pane' } + { type: 'separator' } + { label: 'Focus Pane Above', command: 'window:focus-pane-above' } + { label: 'Focus Pane Below', command: 'window:focus-pane-below' } + { label: 'Focus Pane On Left', command: 'window:focus-pane-on-left' } + { label: 'Focus Pane On Right', command: 'window:focus-pane-on-right' } + { type: 'separator' } + { label: 'Close Pane', command: 'pane:close' } + ] + } { label: 'Developer' submenu: [ From 2a95b18ffd6548cca99cfc66cceb4f7f2729786f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:38:26 -0700 Subject: [PATCH 437/521] :arrow_up: deprecation-cop@0.40 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b30cb63f..9e9b716d5 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "bookmarks": "0.35.0", "bracket-matcher": "0.73.0", "command-palette": "0.35.0", - "deprecation-cop": "0.39.0", + "deprecation-cop": "0.40.0", "dev-live-reload": "0.45.0", "encoding-selector": "0.19.0", "exception-reporting": "0.24.0", From baae0c0ac680a717be6033474baa2e3eee111172 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:40:27 -0700 Subject: [PATCH 438/521] Only include emissary Emitter in deprecation mode --- src/config.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index f7db867ed..918a18848 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1,6 +1,5 @@ _ = require 'underscore-plus' fs = require 'fs-plus' -EmitterMixin = require('emissary').Emitter {CompositeDisposable, Disposable, Emitter} = require 'event-kit' CSON = require 'season' path = require 'path' @@ -290,7 +289,6 @@ ScopeDescriptor = require './scope-descriptor' # module.exports = class Config - EmitterMixin.includeInto(this) @schemaEnforcers = {} @addSchemaEnforcer: (typeName, enforcerFunction) -> @@ -1147,6 +1145,9 @@ withoutEmptyObjects = (object) -> resultObject if Grim.includeDeprecatedAPIs + EmitterMixin = require('emissary').Emitter + EmitterMixin.includeInto(Config) + Config::restoreDefault = (scopeSelector, keyPath) -> Grim.deprecate("Use ::unset instead.") @unset(scopeSelector, keyPath) From e71c6b10611de175b1414842079464a74b4a9ffa Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:41:45 -0700 Subject: [PATCH 439/521] Remove unused require --- src/project.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index 5094ef8ce..49d7fe295 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -5,7 +5,6 @@ _ = require 'underscore-plus' fs = require 'fs-plus' Q = require 'q' {includeDeprecatedAPIs, deprecate} = require 'grim' -{Subscriber} = require 'emissary' {Emitter} = require 'event-kit' Serializable = require 'serializable' TextBuffer = require 'text-buffer' From 4b764f4a59a131d3775ac93b40c17f36b620923b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:43:27 -0700 Subject: [PATCH 440/521] Move emissary require to deprecation block --- src/text-editor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 7606cea7e..02e7b9ba6 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -3,7 +3,6 @@ path = require 'path' Serializable = require 'serializable' Delegator = require 'delegato' {includeDeprecatedAPIs, deprecate} = require 'grim' -EmitterMixin = require('emissary').Emitter {CompositeDisposable, Emitter} = require 'event-kit' {Point, Range} = TextBuffer = require 'text-buffer' LanguageMode = require './language-mode' @@ -3015,6 +3014,7 @@ if includeDeprecatedAPIs deprecate("Use TextEditor::isSoftWrapped instead") @displayBuffer.isSoftWrapped() + EmitterMixin = require('emissary').Emitter TextEditor::on = (eventName) -> switch eventName when 'title-changed' From 7b952e3f33d2a85c92ead87537800062af93df6d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 14:44:46 -0700 Subject: [PATCH 441/521] Remove unused emissary mixins --- src/language-mode.coffee | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/language-mode.coffee b/src/language-mode.coffee index 125b15ff6..54638965a 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -1,14 +1,10 @@ {Range} = require 'text-buffer' _ = require 'underscore-plus' {OnigRegExp} = require 'oniguruma' -{Emitter, Subscriber} = require 'emissary' ScopeDescriptor = require './scope-descriptor' module.exports = class LanguageMode - Emitter.includeInto(this) - Subscriber.includeInto(this) - # Sets up a `LanguageMode` for the given {TextEditor}. # # editor - The {TextEditor} to associate with @@ -16,7 +12,6 @@ class LanguageMode {@buffer} = @editor destroy: -> - @unsubscribe() toggleLineCommentForBufferRow: (row) -> @toggleLineCommentsForBufferRows(row, row) From 018fe0e8b8473bcc459e503742bdec193e7939ab Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 15:11:53 -0700 Subject: [PATCH 442/521] Only set atom.__workspaceView in deprecated mode --- src/atom.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/atom.coffee b/src/atom.coffee index f5e229962..dd86b382c 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -729,7 +729,10 @@ class Atom extends Model @workspace = Workspace.deserialize(@state.workspace) ? new Workspace workspaceElement = @views.getView(@workspace) - @__workspaceView = workspaceElement.__spacePenView + + if includeDeprecatedAPIs + @__workspaceView = workspaceElement.__spacePenView + @deserializeTimings.workspace = Date.now() - startTime @keymaps.defaultTarget = workspaceElement From 2fc132c97b51ee2f612cb5f55f1fc5879c7bd60c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 15:23:25 -0700 Subject: [PATCH 443/521] :racehorse: Use require to read/parse package.json This file is really large and should be read via require so it is cached --- src/package-manager.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 16142cda4..9d085e27f 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -276,9 +276,9 @@ class PackageManager getPackageDependencies: -> unless @packageDependencies? try - metadataPath = path.join(@resourcePath, 'package.json') - {@packageDependencies} = JSON.parse(fs.readFileSync(metadataPath)) ? {} - @packageDependencies ?= {} + @packageDependencies = require('../package.json')?.packageDependencies ? {} + catch error + @packageDependencies = {} @packageDependencies From 658629f45ec1101efbb6756cce132bc7217e4967 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 15:29:34 -0700 Subject: [PATCH 444/521] :art: --- src/package-manager.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 9d085e27f..386a65e68 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -276,9 +276,8 @@ class PackageManager getPackageDependencies: -> unless @packageDependencies? try - @packageDependencies = require('../package.json')?.packageDependencies ? {} - catch error - @packageDependencies = {} + @packageDependencies = require('../package.json')?.packageDependencies + @packageDependencies ?= {} @packageDependencies From ec11c89a7440f257de4a4f64bf4a6e449e58e56f Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Tue, 7 Apr 2015 19:24:29 -0400 Subject: [PATCH 445/521] Revert :shirt: for spec fixtures --- spec/fixtures/coffee.coffee | 3 +-- spec/fixtures/sample-with-tabs-and-leading-comment.coffee | 6 ++---- spec/fixtures/sample-with-tabs.coffee | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/spec/fixtures/coffee.coffee b/spec/fixtures/coffee.coffee index d68b84267..b8367ca59 100644 --- a/spec/fixtures/coffee.coffee +++ b/spec/fixtures/coffee.coffee @@ -1,4 +1,4 @@ -class Quicksort +class quicksort sort: (items) -> return items if items.length <= 1 @@ -13,7 +13,6 @@ class Quicksort if current < pivot left.push(current) else - # coffeelint: disable=no_trailing_semicolons right.push(current); sort(left).concat(pivot).concat(sort(right)) diff --git a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee index 08e81aa68..0f81f6fe8 100644 --- a/spec/fixtures/sample-with-tabs-and-leading-comment.coffee +++ b/spec/fixtures/sample-with-tabs-and-leading-comment.coffee @@ -1,6 +1,4 @@ # This is a comment - # coffeelint: disable=no_tabs - # coffeelint: disable=indentation if this.studyingEconomics - buy() while supply > demand - sell() until supply > demand + buy() while supply > demand + sell() until supply > demand diff --git a/spec/fixtures/sample-with-tabs.coffee b/spec/fixtures/sample-with-tabs.coffee index 5e7595a7d..1b937ea33 100644 --- a/spec/fixtures/sample-with-tabs.coffee +++ b/spec/fixtures/sample-with-tabs.coffee @@ -1,5 +1,3 @@ -# coffeelint: disable=no_tabs -# coffeelint: disable=no_trailing_whitespace # Econ 101 if this.studyingEconomics buy() while supply > demand From 79989a59a96cc646c0d0908b1c2a51cbdb0e9982 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:03:17 -0700 Subject: [PATCH 446/521] :arrow_up: settings-view@0.189 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e9b716d5..e5d3eac3e 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.187.0", + "settings-view": "0.189.0", "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.67.0", From 937fc27f6e3deb4827c87e748b2828be86902059 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:04:43 -0700 Subject: [PATCH 447/521] :arrow_up: keybinding-resolver@0.31 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5d3eac3e..20bbb5043 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "grammar-selector": "0.46.0", "image-view": "0.54.0", "incompatible-packages": "0.24.0", - "keybinding-resolver": "0.30.0", + "keybinding-resolver": "0.31.0", "link": "0.30.0", "markdown-preview": "0.148.0", "metrics": "0.45.0", From fe927280ff1983b4b0869ca4fdb2db64d6851c46 Mon Sep 17 00:00:00 2001 From: simurai Date: Thu, 9 Apr 2015 01:12:41 +0900 Subject: [PATCH 448/521] :arrrow_up: one-dark-ui@v0.6.3 one-light-ui@v0.5.3 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 20bbb5043..7d7a2ba9a 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "atom-light-ui": "0.41.0", "base16-tomorrow-dark-theme": "0.25.0", "base16-tomorrow-light-theme": "0.8.0", - "one-dark-ui": "0.6.2", + "one-dark-ui": "0.6.3", "one-dark-syntax": "0.3.0", "one-light-syntax": "0.4.0", - "one-light-ui": "0.5.2", + "one-light-ui": "0.5.3", "solarized-dark-syntax": "0.32.0", "solarized-light-syntax": "0.19.0", "archive-view": "0.55.0", From d0bd76072b6ed529b25ea6002f2a2183bb639db9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 15:58:44 -0700 Subject: [PATCH 449/521] Inline platform system menu --- build/tasks/compile-packages-slug-task.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 4e24f948e..ed9c2e9e4 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -6,6 +6,13 @@ _ = require 'underscore-plus' module.exports = (grunt) -> {spawn, rm} = require('./task-helpers')(grunt) + getMenu = (appDir) -> + menusPath = path.join(appDir, 'menus') + menuPath = path.join(menusPath, process.platform) + menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) + rm menusPath + menu ? {} + grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> appDir = fs.realpathSync(grunt.config.get('atom.appDir')) @@ -50,5 +57,6 @@ module.exports = (grunt) -> metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) metadata._atomPackages = packages + metadata._menu = getMenu(appDir) grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) From f36584903ff9d579962978d67e2e275008df9101 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:51:57 -0700 Subject: [PATCH 450/521] Inline all keymaps into package.json --- build/tasks/compile-packages-slug-task.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index ed9c2e9e4..574ce89d4 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -13,6 +13,12 @@ module.exports = (grunt) -> rm menusPath menu ? {} + getKeymaps = (appDir) -> + keymapsPath = path.join(appDir, 'keymaps') + keymaps = fs.listSync(keymapsPath, ['.cson', '.json']).map (keymapPath) -> CSON.readFileSync(keymapPath) + rm keymapsPath + keymaps ? [] + grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> appDir = fs.realpathSync(grunt.config.get('atom.appDir')) @@ -58,5 +64,6 @@ module.exports = (grunt) -> metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) metadata._atomPackages = packages metadata._menu = getMenu(appDir) + metadata._keymaps = getKeymaps(appDir) grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) From bdca781fb8edfa9f4cbcac63c489a8cc0ab7dd0a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:52:22 -0700 Subject: [PATCH 451/521] Add atom prefix to keys --- build/tasks/compile-packages-slug-task.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 574ce89d4..c5af73911 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -63,7 +63,7 @@ module.exports = (grunt) -> metadata = grunt.file.readJSON(path.join(appDir, 'package.json')) metadata._atomPackages = packages - metadata._menu = getMenu(appDir) - metadata._keymaps = getKeymaps(appDir) + metadata._atomMenu = getMenu(appDir) + metadata._atomKeymaps = getKeymaps(appDir) grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata)) From 0560687e966449e71652240c1f306ee7a5216d5f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:52:39 -0700 Subject: [PATCH 452/521] Remove unneeded default --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index c5af73911..0d95f3e89 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -17,7 +17,7 @@ module.exports = (grunt) -> keymapsPath = path.join(appDir, 'keymaps') keymaps = fs.listSync(keymapsPath, ['.cson', '.json']).map (keymapPath) -> CSON.readFileSync(keymapPath) rm keymapsPath - keymaps ? [] + keymaps grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', -> appDir = fs.realpathSync(grunt.config.get('atom.appDir')) From d30b61f7c9a5a1046311a53d275319271a1bf476 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 16:54:55 -0700 Subject: [PATCH 453/521] Load platform menu from package.json --- src/menu-manager.coffee | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 1991cba95..29fdbce25 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -8,6 +8,11 @@ fs = require 'fs-plus' MenuHelpers = require './menu-helpers' +try + platformMenu = require('../package.json')?._atomMenu +catch error + platformMenu = null + # Extended: Provides a registry for menu items that you'd like to appear in the # application menu. # @@ -144,10 +149,13 @@ class MenuManager @sendToBrowserProcess(@template, keystrokesByCommand) loadPlatformItems: -> - menusDirPath = path.join(@resourcePath, 'menus') - platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) - {menu} = CSON.readFileSync(platformMenuPath) - @add(menu) + if platformMenuPath + @add(menu) + else + menusDirPath = path.join(@resourcePath, 'menus') + platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) + {menu} = CSON.readFileSync(platformMenuPath) + @add(menu) # Merges an item in a submenu aware way such that new items are always # appended to the bottom of existing menus where possible. From 0d3d72c18114a5e5a63602ab94a3606a665a0f59 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:24:38 -0700 Subject: [PATCH 454/521] Add missing extension --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 0d95f3e89..3deed46c0 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -8,7 +8,7 @@ module.exports = (grunt) -> getMenu = (appDir) -> menusPath = path.join(appDir, 'menus') - menuPath = path.join(menusPath, process.platform) + menuPath = path.join(menusPath, "#{process.platform}.cson") menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) rm menusPath menu ? {} From 50688973e65416b17866d2d2f3cbddf9aa6c5c5f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:25:02 -0700 Subject: [PATCH 455/521] Load keymaps from package.json --- build/tasks/compile-packages-slug-task.coffee | 10 +++++++++- src/keymap-extensions.coffee | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index 3deed46c0..e9db9b8fa 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -3,6 +3,8 @@ CSON = require 'season' fs = require 'fs-plus' _ = require 'underscore-plus' +OtherPlatforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'].filter (platform) -> platform isnt process.platform + module.exports = (grunt) -> {spawn, rm} = require('./task-helpers')(grunt) @@ -15,7 +17,13 @@ module.exports = (grunt) -> getKeymaps = (appDir) -> keymapsPath = path.join(appDir, 'keymaps') - keymaps = fs.listSync(keymapsPath, ['.cson', '.json']).map (keymapPath) -> CSON.readFileSync(keymapPath) + keymaps = {} + for keymapPath in fs.listSync(keymapsPath, ['.cson', '.json']) + name = path.basename(keymapPath, path.extname(keymapPath)) + continue unless OtherPlatforms.indexOf(name) is -1 + + keymap = CSON.readFileSync(keymapPath) + keymaps[path.basename(keymapPath)] = keymap rm keymapsPath keymaps diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 551c6580d..3d1ca3547 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -5,11 +5,23 @@ CSON = require 'season' {jQuery} = require 'space-pen' Grim = require 'grim' +try + bundledKeymaps = require('../package.json')?._atomKeymaps +catch error + bundledKeymaps = null + KeymapManager::onDidLoadBundledKeymaps = (callback) -> @emitter.on 'did-load-bundled-keymaps', callback KeymapManager::loadBundledKeymaps = -> - @loadKeymap(path.join(@resourcePath, 'keymaps')) + keymapsPath = path.join(@resourcePath, 'keymaps') + if bundledKeymaps? + for keymapName, keymap of bundledKeymaps + keymapPath = path.join(keymapsPath, keymapName) + @add(keymapPath, keymap) + else + @loadKeymap(keymapsPath) + @emit 'bundled-keymaps-loaded' if Grim.includeDeprecatedAPIs @emitter.emit 'did-load-bundled-keymaps' From ab79f2cf50d9089af441cc7f9003f6bd08fed2ad Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:28:02 -0700 Subject: [PATCH 456/521] :art: Drop unneeded detail: --- src/keymap-extensions.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 3d1ca3547..06ff95cea 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -63,7 +63,7 @@ KeymapManager::subscribeToFileReadFailure = -> else error.message - atom.notifications.addError(message, {detail: detail, dismissable: true}) + atom.notifications.addError(message, {detail, dismissable: true}) # This enables command handlers registered via jQuery to call # `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler. From 3954a5fd84d791f66704137bcfdac7711e20747b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:32:00 -0700 Subject: [PATCH 457/521] .cson -> .json --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index e9db9b8fa..e31dc52e2 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -10,7 +10,7 @@ module.exports = (grunt) -> getMenu = (appDir) -> menusPath = path.join(appDir, 'menus') - menuPath = path.join(menusPath, "#{process.platform}.cson") + menuPath = path.join(menusPath, "#{process.platform}.json") menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) rm menusPath menu ? {} From c69af727cf5b9889e6a634310afac14e71b0cd51 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:34:48 -0700 Subject: [PATCH 458/521] Don't default menu value --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index e31dc52e2..f3b04683e 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -13,7 +13,7 @@ module.exports = (grunt) -> menuPath = path.join(menusPath, "#{process.platform}.json") menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath) rm menusPath - menu ? {} + menu getKeymaps = (appDir) -> keymapsPath = path.join(appDir, 'keymaps') From 4b8bb9e1d9fe927d0dd7566d068616608c463a92 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 17:39:50 -0700 Subject: [PATCH 459/521] platformMenuPath -> platformMenu --- src/menu-manager.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 29fdbce25..d0a95dd1f 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -149,8 +149,8 @@ class MenuManager @sendToBrowserProcess(@template, keystrokesByCommand) loadPlatformItems: -> - if platformMenuPath - @add(menu) + if platformMenu? + @add(platformMenu) else menusDirPath = path.join(@resourcePath, 'menus') platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) From 83541c01b59e0d8374e25e2460c1e6e61943cebf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 18:00:08 -0700 Subject: [PATCH 460/521] Pull out menu property from _atomMenu --- src/menu-manager.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index d0a95dd1f..6d4e4c77c 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -9,7 +9,7 @@ fs = require 'fs-plus' MenuHelpers = require './menu-helpers' try - platformMenu = require('../package.json')?._atomMenu + platformMenu = require('../package.json')?._atomMenu?.menu catch error platformMenu = null From ca67d33ebef514cdc4d879907809adf12bb979f5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 7 Apr 2015 18:00:23 -0700 Subject: [PATCH 461/521] Use inlined context menu from package.json when available --- src/context-menu-manager.coffee | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 00b635251..7446c6ac0 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -8,6 +8,11 @@ Grim = require 'grim' MenuHelpers = require './menu-helpers' {validateSelector} = require './selector-validator' +try + platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] +catch error + platformContextMenu = null + SpecificityCache = {} # Extended: Provides a registry for commands that you'd like to appear in the @@ -49,10 +54,13 @@ class ContextMenuManager atom.keymaps.onDidLoadBundledKeymaps => @loadPlatformItems() loadPlatformItems: -> - menusDirPath = path.join(@resourcePath, 'menus') - platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) - map = CSON.readFileSync(platformMenuPath) - atom.contextMenu.add(map['context-menu']) + if platformContextMenu? + @add(platformContextMenu) + else + menusDirPath = path.join(@resourcePath, 'menus') + platformMenuPath = fs.resolve(menusDirPath, process.platform, ['cson', 'json']) + map = CSON.readFileSync(platformMenuPath) + @add(map['context-menu']) # Public: Add context menu items scoped by CSS selectors. # From 80787ef1e20c1dbadd76fe45e90050e40966c0d8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:29:04 -0700 Subject: [PATCH 462/521] Remove try/catch around package.json requiring No other requires are ever guarded against and the package.json should be assumed to be valid JSON. --- src/context-menu-manager.coffee | 6 +----- src/keymap-extensions.coffee | 5 +---- src/menu-manager.coffee | 5 +---- src/package.coffee | 5 +---- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 7446c6ac0..8397da33d 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -8,11 +8,7 @@ Grim = require 'grim' MenuHelpers = require './menu-helpers' {validateSelector} = require './selector-validator' -try - platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] -catch error - platformContextMenu = null - +platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] SpecificityCache = {} # Extended: Provides a registry for commands that you'd like to appear in the diff --git a/src/keymap-extensions.coffee b/src/keymap-extensions.coffee index 06ff95cea..7ffd3d7ef 100644 --- a/src/keymap-extensions.coffee +++ b/src/keymap-extensions.coffee @@ -5,10 +5,7 @@ CSON = require 'season' {jQuery} = require 'space-pen' Grim = require 'grim' -try - bundledKeymaps = require('../package.json')?._atomKeymaps -catch error - bundledKeymaps = null +bundledKeymaps = require('../package.json')?._atomKeymaps KeymapManager::onDidLoadBundledKeymaps = (callback) -> @emitter.on 'did-load-bundled-keymaps', callback diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 6d4e4c77c..bd42dddb9 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -8,10 +8,7 @@ fs = require 'fs-plus' MenuHelpers = require './menu-helpers' -try - platformMenu = require('../package.json')?._atomMenu?.menu -catch error - platformMenu = null +platformMenu = require('../package.json')?._atomMenu?.menu # Extended: Provides a registry for menu items that you'd like to appear in the # application menu. diff --git a/src/package.coffee b/src/package.coffee index dd6701527..74c4f0eb8 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -11,10 +11,7 @@ Q = require 'q' ModuleCache = require './module-cache' ScopedProperties = require './scoped-properties' -try - packagesCache = require('../package.json')?._atomPackages ? {} -catch error - packagesCache = {} +packagesCache = require('../package.json')?._atomPackages ? {} # Loads and activates a package's main module and resources such as # stylesheets, keymaps, grammar, editor properties, and menus. From 6d61588467c529e99f5bcac7368d66f0ca9e2583 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 09:40:23 -0700 Subject: [PATCH 463/521] Only look for JSON keymaps --- build/tasks/compile-packages-slug-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/compile-packages-slug-task.coffee b/build/tasks/compile-packages-slug-task.coffee index f3b04683e..613a4a380 100644 --- a/build/tasks/compile-packages-slug-task.coffee +++ b/build/tasks/compile-packages-slug-task.coffee @@ -18,7 +18,7 @@ module.exports = (grunt) -> getKeymaps = (appDir) -> keymapsPath = path.join(appDir, 'keymaps') keymaps = {} - for keymapPath in fs.listSync(keymapsPath, ['.cson', '.json']) + for keymapPath in fs.listSync(keymapsPath, ['.json']) name = path.basename(keymapPath, path.extname(keymapPath)) continue unless OtherPlatforms.indexOf(name) is -1 From adbd539302b0a979e3e136d3a4122bf6861bb803 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Wed, 8 Apr 2015 14:36:00 -0400 Subject: [PATCH 464/521] Revert :shirt: --- benchmark/fixtures/medium.coffee | 14 +++++++------- .../package-with-config-defaults/index.coffee | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/benchmark/fixtures/medium.coffee b/benchmark/fixtures/medium.coffee index 28ec156b0..2bdb8c6f7 100644 --- a/benchmark/fixtures/medium.coffee +++ b/benchmark/fixtures/medium.coffee @@ -209,13 +209,13 @@ template = (str) -> 'var p=[],print=function(){p.push.apply(p,arguments);};' + 'with(obj){p.push(\'' + str.replace(/[\r\t\n]/g, " ") - .replace(/'(?=[^<]*%>)/g,"\t") - .split("'").join("\\'") - .split("\t").join("'") - .replace(/<%=(.+?)%>/g, "',$1,'") - .split('<%').join("');") - .split('%>').join("p.push('") + - "');}return p.join('');" + .replace(/'(?=[^<]*%>)/g,"\t") + .split("'").join("\\'") + .split("\t").join("'") + .replace(/<%=(.+?)%>/g, "',$1,'") + .split('<%').join("');") + .split('%>').join("p.push('") + + "');}return p.join('');" # Create the template that we will use to generate the Docco HTML page. docco_template = template fs.readFileSync(__dirname + '/../resources/docco.jst').toString() diff --git a/spec/fixtures/packages/package-with-config-defaults/index.coffee b/spec/fixtures/packages/package-with-config-defaults/index.coffee index 6c48b2af4..554c6c5eb 100644 --- a/spec/fixtures/packages/package-with-config-defaults/index.coffee +++ b/spec/fixtures/packages/package-with-config-defaults/index.coffee @@ -1,5 +1,5 @@ module.exports = configDefaults: - numbers: {one: 1, two: 2} + numbers: { one: 1, two: 2 } activate: -> # no-op From 7fb6e79c8dcb9f189409f317145ee891764fae55 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 17:03:50 -0700 Subject: [PATCH 465/521] :arrow_up: language-javascript@0.71 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d7a2ba9a..45b92bc33 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.70.0", + "language-javascript": "0.71.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 5fd767b9d8a7f3c43b7aa9accc7771b76556f0cb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Apr 2015 17:46:06 -0700 Subject: [PATCH 466/521] :arrow_up: symbols-view@0.94 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 45b92bc33..56bb2fa56 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "spell-check": "0.55.0", "status-bar": "0.67.0", "styleguide": "0.44.0", - "symbols-view": "0.93.0", + "symbols-view": "0.94.0", "tabs": "0.67.0", "timecop": "0.31.0", "tree-view": "0.170.0", From b8fb2f4d11cd6bdf2bd8b5ec2d01702d42c3cafb Mon Sep 17 00:00:00 2001 From: Ivan Zuzak Date: Thu, 9 Apr 2015 15:38:48 +0200 Subject: [PATCH 467/521] Clarify that URIs don't need to be files --- src/workspace.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 6c60cf22a..e864e2af2 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -371,11 +371,12 @@ class Workspace extends Model Section: Opening ### - # Essential: Opens the given URI in Atom asynchronously, if it's not already open. - # If no URI is given, or the URI is the path of a file that does not exist, - # a new empty text edtior is created. - # - # * `uri` (optional) A {String} containing a URI. + # Essential: Opens the given URI in Atom asynchronously. + # If the URI is already open, the existing item for that URI will be + # activated. If no URI is given, or no registered opener can open + # the URI, a new empty {TextEditor} will be created. + # + # * `uri` (optional) A {String} containing a URI. # * `options` (optional) {Object} # * `initialLine` A {Number} indicating which row to move the cursor to # initially. Defaults to `0`. From 1f9d8b129f13cca8249b115c0f791de858353b21 Mon Sep 17 00:00:00 2001 From: subesokun Date: Thu, 9 Apr 2015 20:32:06 +0200 Subject: [PATCH 468/521] :memo: Fix doc on getting the home directory --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66080c614..fe9a742b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,7 @@ For more information on how to work with Atom's official packages, see * Class methods and properties (methods starting with a `@`) * Instance methods and properties * Avoid platform-dependent code: - * Use `require('atom').fs.getHomeDirectory()` to get the home directory. + * Use `require('fs-plus').getHomeDirectory()` to get the home directory. * Use `path.join()` to concatenate filenames. * Use `os.tmpdir()` rather than `/tmp` when you need to reference the temporary directory. From 09be369544b9c7fe738e5a4b83c3d9b100c41266 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 9 Apr 2015 13:06:11 -0700 Subject: [PATCH 469/521] Update help message to reflect changes to multi-path handling --- src/browser/main.coffee | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/browser/main.coffee b/src/browser/main.coffee index 812771e9a..469d53fae 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -91,12 +91,10 @@ parseCommandLine = -> Usage: atom [options] [path ...] - One or more paths to files or folders to open may be specified. - - File paths will open in the current window. - - Folder paths will open in an existing window if that folder has already been - opened or a new window if it hasn't. + One or more paths to files or folders may be specified. If there is an + existing Atom window that contains all of the given folders, the paths + will be opened in that window. Otherwise, they will be opened in a new + window. Environment Variables: From f35187e8c343aa329fa151c8f8d6ad3622dd9e00 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 9 Apr 2015 14:21:03 -0700 Subject: [PATCH 470/521] Allow editor.completions to be an array or an object. --- src/config-schema.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index c2944911b..87e1040bc 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -99,9 +99,7 @@ module.exports = # These can be used as globals or scoped, thus defaults. completions: - type: "array" - items: - type: "string" + type: ['array', 'object'] default: [] fontFamily: type: 'string' From d9d319c4066744cd1edcf2a868f17e13dc5f127c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 9 Apr 2015 16:33:12 -0700 Subject: [PATCH 471/521] :arrow_up: settings-view@0.190 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 56bb2fa56..5339f582c 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.189.0", + "settings-view": "0.190.0", "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.67.0", From 94ebbccc9f8dee5c0861c454c45c4ef1c58ddf8b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 9 Apr 2015 16:36:56 -0700 Subject: [PATCH 472/521] :arrow_up: language-python@0.34 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5339f582c..8e071aaf0 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "language-perl": "0.22.0", "language-php": "0.22.0", "language-property-list": "0.8.0", - "language-python": "0.33.0", + "language-python": "0.34.0", "language-ruby": "0.51.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0", From 4d20e17b2b4631acfbc884d706a07c34d24d119b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 09:08:41 -0700 Subject: [PATCH 473/521] :arrow_up: language-javascript@0.72 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e071aaf0..9f0d43e57 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.31.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.71.0", + "language-javascript": "0.72.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 3bbf337d648a951f5046dad36a745f8f1c18e8d1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 14:59:17 -0700 Subject: [PATCH 474/521] :arrow_up: notifications@0.37 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f0d43e57..127f5fb46 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "link": "0.30.0", "markdown-preview": "0.148.0", "metrics": "0.45.0", - "notifications": "0.36.0", + "notifications": "0.37.0", "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", From 27e2a04ba9c8ebdd366e6d49de8ff70becc176f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Sat, 11 Apr 2015 10:30:32 +0200 Subject: [PATCH 475/521] :arrow_up: language-todo@0.18.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 127f5fb46..bc8f83188 100644 --- a/package.json +++ b/package.json @@ -151,7 +151,7 @@ "language-source": "0.9.0", "language-sql": "0.15.0", "language-text": "0.6.0", - "language-todo": "0.17.0", + "language-todo": "0.18.0", "language-toml": "0.15.0", "language-xml": "0.28.0", "language-yaml": "0.22.0" From 8aba0f721855f7152b0c428dfa0a1abae718983b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 13 Apr 2015 13:21:07 +1200 Subject: [PATCH 476/521] :arrow_up: settings-view to load config for inactive packages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc8f83188..88019a403 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.190.0", + "settings-view": "0.191.0", "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.67.0", From 16dbb7d0bb1edb1bf2fe542e5dfe122bc5273fa7 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 12:02:06 +0200 Subject: [PATCH 477/521] :penguin: :green_heart: Mock native clipboard appropriately --- spec/spec-helper.coffee | 2 +- spec/text-editor-spec.coffee | 2 +- src/clipboard.coffee | 8 +------- src/native-clipboard.coffee | 6 ++++++ 4 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 src/native-clipboard.coffee diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 1c9e6fb6b..33ec8c521 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -24,7 +24,7 @@ TextEditorElement = require '../src/text-editor-element' TokenizedBuffer = require '../src/tokenized-buffer' TextEditorComponent = require '../src/text-editor-component' pathwatcher = require 'pathwatcher' -clipboard = require 'clipboard' +clipboard = require "../src/native-clipboard" atom.themes.loadBaseStylesheets() atom.themes.requireStylesheet '../static/jasmine' diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 06f285fd0..38f17072d 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1,4 +1,4 @@ -clipboard = require 'clipboard' +clipboard = require '../src/native-clipboard' TextEditor = require '../src/text-editor' describe "TextEditor", -> diff --git a/src/clipboard.coffee b/src/clipboard.coffee index bc0926521..80ec464e7 100644 --- a/src/clipboard.coffee +++ b/src/clipboard.coffee @@ -1,11 +1,5 @@ crypto = require 'crypto' - -# Using clipboard in renderer process is not safe on Linux. -clipboard = - if process.platform is 'linux' - require('remote').require 'clipboard' - else - require 'clipboard' +clipboard = require "./native-clipboard" # Extended: Represents the clipboard used for copying and pasting in Atom. # diff --git a/src/native-clipboard.coffee b/src/native-clipboard.coffee new file mode 100644 index 000000000..f66d44646 --- /dev/null +++ b/src/native-clipboard.coffee @@ -0,0 +1,6 @@ +# Using clipboard in renderer process is not safe on Linux. +module.exports = + if process.platform is 'linux' + require('remote').require 'clipboard' + else + require 'clipboard' From 8daca6a63b76f484898fa751f4cac620a5f43e48 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 12:24:25 +0200 Subject: [PATCH 478/521] :penguin: :green_heart: Humanize keystrokes in specs --- spec/tooltip-manager-spec.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/tooltip-manager-spec.coffee b/spec/tooltip-manager-spec.coffee index 74b875658..88d235398 100644 --- a/spec/tooltip-manager-spec.coffee +++ b/spec/tooltip-manager-spec.coffee @@ -1,9 +1,13 @@ TooltipManager = require '../src/tooltip-manager' {$} = require '../src/space-pen-extensions' +_ = require "underscore-plus" describe "TooltipManager", -> [manager, element] = [] + ctrlX = _.humanizeKeystroke("ctrl-x") + ctrlY = _.humanizeKeystroke("ctrl-y") + beforeEach -> manager = new TooltipManager element = document.createElement('div') @@ -35,7 +39,7 @@ describe "TooltipManager", -> hover element, -> tooltipElement = document.body.querySelector(".tooltip") - expect(tooltipElement).toHaveText "Title ⌃X ⌃Y" + expect(tooltipElement).toHaveText "Title #{ctrlX} #{ctrlY}" describe "when no title is specified", -> it "shows the key binding corresponding to the command alone", -> @@ -45,7 +49,7 @@ describe "TooltipManager", -> hover element, -> tooltipElement = document.body.querySelector(".tooltip") - expect(tooltipElement).toHaveText "⌃X ⌃Y" + expect(tooltipElement).toHaveText "#{ctrlX} #{ctrlY}" describe "when a keyBindingTarget is specified", -> it "looks up the key binding relative to the target", -> @@ -57,7 +61,7 @@ describe "TooltipManager", -> hover element, -> tooltipElement = document.body.querySelector(".tooltip") - expect(tooltipElement).toHaveText "⌃X ⌃Y" + expect(tooltipElement).toHaveText "#{ctrlX} #{ctrlY}" it "does not display the keybinding if there is nothing mapped to the specified keyBindingCommand", -> manager.add element, title: 'A Title', keyBindingCommand: 'test-command', keyBindingTarget: element From 106f9fdf2e122acfecca759c53549f8f6fb5d5d3 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 12:28:20 +0200 Subject: [PATCH 479/521] Use src/native-clipboard in atom-application --- spec/text-editor-component-spec.coffee | 2 +- src/browser/atom-application.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index b2ef2ec51..ad1f50d74 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -2815,7 +2815,7 @@ describe "TextEditorComponent", -> clipboardWrittenTo = false spyOn(require('ipc'), 'send').andCallFake (eventName, selectedText) -> if eventName is 'write-text-to-selection-clipboard' - require('clipboard').writeText(selectedText, 'selection') + require('../src/native-clipboard').writeText(selectedText, 'selection') clipboardWrittenTo = true atom.clipboard.write('') diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 7c15d0f2a..950cb6b78 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -256,7 +256,7 @@ class AtomApplication clipboard = null ipc.on 'write-text-to-selection-clipboard', (event, selectedText) -> - clipboard ?= require 'clipboard' + clipboard ?= require '../native-clipboard' clipboard.writeText(selectedText, 'selection') # Public: Executes the given command. From f633a4f771b3f25728bd97ad057906dd06d2bf91 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 14:20:17 +0200 Subject: [PATCH 480/521] Use src/native-clipboard in TextEditorComponent --- src/text-editor-component.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 4d04dc98f..fb6f42a21 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -556,7 +556,7 @@ class TextEditorComponent pasteSelectionClipboard = (event) => if event?.which is 2 and process.platform is 'linux' - if selection = require('clipboard').readText('selection') + if selection = require('./native-clipboard').readText('selection') @editor.insertText(selection) window.addEventListener('mousemove', onMouseMove) From c4205e36a628ac1544344afeb760e0ee713abaab Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 14:32:40 +0200 Subject: [PATCH 481/521] :green_heart: Use a serif font to make sure char widths change --- spec/text-editor-component-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index ad1f50d74..d21b36118 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -2444,7 +2444,7 @@ describe "TextEditorComponent", -> initialLineHeightInPixels = editor.getLineHeightInPixels() initialCharWidth = editor.getDefaultCharWidth() - component.setFontFamily('sans-serif') + component.setFontFamily('serif') expect(editor.getDefaultCharWidth()).toBe initialCharWidth wrapperView.show() @@ -2453,7 +2453,7 @@ describe "TextEditorComponent", -> it "does not re-measure character widths until the editor is shown again", -> wrapperView.hide() - component.setFontFamily('sans-serif') + component.setFontFamily('serif') wrapperView.show() editor.setCursorBufferPosition([0, Infinity]) From 87972caf1e85d01a99b08264856027f307ccabde Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 16:24:22 +0200 Subject: [PATCH 482/521] :penguin: Disable failing spec --- spec/text-editor-component-spec.coffee | 17 +++++++++-------- src/text-editor-component.coffee | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index d21b36118..2ed17ab9f 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1352,17 +1352,18 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - editor.insertText('a') - nextAnimationFrame() + if process.platform isnt "linux" # see TextEditorComponent#measureWindowSize + editor.insertText('a') + nextAnimationFrame() - expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - editor.insertText('b') - nextAnimationFrame() + editor.insertText('b') + nextAnimationFrame() - expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' describe "hidden input field", -> it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", -> diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index fb6f42a21..4348279de 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -620,6 +620,10 @@ class TextEditorComponent measureWindowSize: -> return unless @mounted + + # FIXME: on Ubuntu (via xvfb) `window.innerWidth` reports an incorrect value + # when window gets resized through `atom.setWindowDimensions({width: + # windowWidth, height: windowHeight})`. @presenter.setWindowSize(window.innerWidth, window.innerHeight) sampleFontStyling: => From 4cb7bde4a6cc794cf1b57d2f59ac37b7f986936b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 13 Apr 2015 16:59:29 +0200 Subject: [PATCH 483/521] :green_heart: Fix race condition on window-spec ...caused by an afterEach block which was called before the SUT. --- spec/window-spec.coffee | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/spec/window-spec.coffee b/spec/window-spec.coffee index 883474e85..3c1a5b4ae 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -285,19 +285,35 @@ describe "Window", -> it "adds it to the project's paths", -> pathToOpen = __filename atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] - expect(atom.project.getPaths()[0]).toBe __dirname + + waitsFor -> + atom.project.getPaths().length is 1 + + runs -> + expect(atom.project.getPaths()[0]).toBe __dirname describe "when the opened path does not exist but its parent directory does", -> it "adds the parent directory to the project paths", -> pathToOpen = path.join(__dirname, 'this-path-does-not-exist.txt') atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] - expect(atom.project.getPaths()[0]).toBe __dirname + + waitsFor -> + atom.project.getPaths().length is 1 + + runs -> + expect(atom.project.getPaths()[0]).toBe __dirname describe "when the opened path is a file", -> it "opens it in the workspace", -> pathToOpen = __filename atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}] - expect(atom.workspace.open.mostRecentCall.args[0]).toBe __filename + + waitsFor -> + atom.workspace.open.callCount is 1 + + runs -> + expect(atom.workspace.open.mostRecentCall.args[0]).toBe __filename + describe "when the opened path is a directory", -> it "does not open it in the workspace", -> From aae4a4b016d86e189495834cdd4e1e1c2f312987 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 13 Apr 2015 11:01:54 -0700 Subject: [PATCH 484/521] :arrow_up: language-html --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88019a403..e65f94ff3 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "language-gfm": "0.67.0", "language-git": "0.10.0", "language-go": "0.23.0", - "language-html": "0.31.0", + "language-html": "0.32.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", "language-javascript": "0.72.0", From 2fcf5d6248107e4bbe59481b5c32962451844bd7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 13:45:03 -0700 Subject: [PATCH 485/521] Precompile bootstrap.less --- build/tasks/prebuild-less-task.coffee | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index bcaa0467f..58f5138a1 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -1,9 +1,24 @@ path = require 'path' fs = require 'fs' - +temp = require('temp').track() LessCache = require 'less-cache' module.exports = (grunt) -> + {rm} = require('./task-helpers')(grunt) + + compileBootstrap = -> + appDir = grunt.config.get('atom.appDir') + bootstrapLessPath = path.join(appDir, 'static', 'bootstrap.less') + bootstrapCssPath = path.join(appDir, 'static', 'bootstrap.css') + + lessCache = new LessCache + cacheDir: temp.mkdirSync('atom-less-cache') + resourcePath: path.resolve('.') + + bootstrapCss = lessCache.readFileSync(bootstrapLessPath) + grunt.file.write(bootstrapCssPath, bootstrapCss) + rm(bootstrapLessPath) + grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled LESS files', -> prebuiltConfigurations = [ ['atom-dark-ui', 'atom-dark-syntax'] @@ -78,3 +93,5 @@ module.exports = (grunt) -> for file in themeMains grunt.verbose.writeln("File #{file.cyan} created in cache.") cssForFile(file) + + compileBootstrap() From bc325c36c56a16afae8850cbb2d76195cefe4006 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 14:02:24 -0700 Subject: [PATCH 486/521] Exclude bootstrap/less from build --- build/tasks/prebuild-less-task.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index 58f5138a1..2fa5f16db 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -18,6 +18,7 @@ module.exports = (grunt) -> bootstrapCss = lessCache.readFileSync(bootstrapLessPath) grunt.file.write(bootstrapCssPath, bootstrapCss) rm(bootstrapLessPath) + rm(path.join(appDir, 'node_modules', 'bootstrap', 'less')) grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled LESS files', -> prebuiltConfigurations = [ From e7030ba4b38a42fc2d5db2befea9bb20d5e2fad0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 14:03:24 -0700 Subject: [PATCH 487/521] Compile bootstrap before prebuilding cache --- build/tasks/prebuild-less-task.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index 2fa5f16db..31adccc0a 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -21,6 +21,8 @@ module.exports = (grunt) -> rm(path.join(appDir, 'node_modules', 'bootstrap', 'less')) grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled LESS files', -> + compileBootstrap() + prebuiltConfigurations = [ ['atom-dark-ui', 'atom-dark-syntax'] ['atom-dark-ui', 'atom-light-syntax'] @@ -94,5 +96,3 @@ module.exports = (grunt) -> for file in themeMains grunt.verbose.writeln("File #{file.cyan} created in cache.") cssForFile(file) - - compileBootstrap() From 168c0d0dd71e536dc8717ff202b19e8a2b8841e9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 14:49:53 -0700 Subject: [PATCH 488/521] LESS -> Less --- build/tasks/prebuild-less-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index 31adccc0a..36bdd2bdd 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -75,7 +75,7 @@ module.exports = (grunt) -> themeMains.push(mainPath) if grunt.file.isFile(mainPath) importPaths.unshift(stylesheetsDir) if grunt.file.isDir(stylesheetsDir) - grunt.verbose.writeln("Building LESS cache for #{configuration.join(', ').yellow}") + grunt.verbose.writeln("Building Less cache for #{configuration.join(', ').yellow}") lessCache = new LessCache cacheDir: directory resourcePath: path.resolve('.') From 9d6248cabb86af672609e984c9e50fa8c8f3fa13 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 14:50:03 -0700 Subject: [PATCH 489/521] Don't ship bootstrap dist and fonts folders --- build/tasks/build-task.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index fcb1eb6a8..a94b38f75 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -49,6 +49,8 @@ module.exports = (grunt) -> path.join('oniguruma', 'deps') path.join('less', 'dist') path.join('bootstrap', 'docs') + path.join('bootstrap', 'dist') + path.join('bootstrap', 'fonts') path.join('bootstrap', '_config.yml') path.join('bootstrap', '_includes') path.join('bootstrap', '_layouts') From 932e7d4ad7d238849296bc1a04fb8b2ca311a5a2 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 10 Apr 2015 15:09:05 -0700 Subject: [PATCH 490/521] LESS -> Less --- build/tasks/prebuild-less-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index 36bdd2bdd..18a323403 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -20,7 +20,7 @@ module.exports = (grunt) -> rm(bootstrapLessPath) rm(path.join(appDir, 'node_modules', 'bootstrap', 'less')) - grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled LESS files', -> + grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled Less files', -> compileBootstrap() prebuiltConfigurations = [ From 838c3c1b5e0a27c6b5f4b4259d78236112409341 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 13:59:25 -0700 Subject: [PATCH 491/521] Remove bootstrap from prebuildLessConfig --- build/Gruntfile.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 05efaeb38..e4ebf3e9a 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -92,7 +92,6 @@ module.exports = (grunt) -> prebuildLessConfig = src: [ 'static/**/*.less' - 'node_modules/bootstrap/less/bootstrap.less' ] csonConfig = From 74caf89dd1a74103796e798bf74f1a4c4741e427 Mon Sep 17 00:00:00 2001 From: Sean Lee Date: Fri, 20 Mar 2015 14:23:37 +0800 Subject: [PATCH 492/521] :bug: fix rowRangeForParagraphAtBufferRow using \S --- spec/language-mode-spec.coffee | 8 ++++++++ src/language-mode.coffee | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/spec/language-mode-spec.coffee b/spec/language-mode-spec.coffee index 07b875a91..d23bd5506 100644 --- a/spec/language-mode-spec.coffee +++ b/spec/language-mode-spec.coffee @@ -124,6 +124,11 @@ describe "LanguageMode", -> // lines var sort = function(items) {}; // comment line after fn + + var nosort = function(items) { + return item; + } + }; ''' @@ -144,6 +149,9 @@ describe "LanguageMode", -> range = languageMode.rowRangeForParagraphAtBufferRow(15) expect(range).toEqual [[15,0], [15,26]] + range = languageMode.rowRangeForParagraphAtBufferRow(18) + expect(range).toEqual [[17,0], [19,1]] + describe "coffeescript", -> beforeEach -> waitsForPromise -> diff --git a/src/language-mode.coffee b/src/language-mode.coffee index 96c1073c1..267383ff4 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -194,7 +194,7 @@ class LanguageMode # Right now, a paragraph is a block of text bounded by and empty line or a # block of text that is not the same type (comments next to source code). rowRangeForParagraphAtBufferRow: (bufferRow) -> - return unless /\w/.test(@editor.lineTextForBufferRow(bufferRow)) + return unless /\S/.test(@editor.lineTextForBufferRow(bufferRow)) if @isLineCommentedAtBufferRow(bufferRow) isOriginalRowComment = true @@ -207,14 +207,14 @@ class LanguageMode startRow = bufferRow while startRow > firstRow break if @isLineCommentedAtBufferRow(startRow - 1) isnt isOriginalRowComment - break unless /\w/.test(@editor.lineTextForBufferRow(startRow - 1)) + break unless /\S/.test(@editor.lineTextForBufferRow(startRow - 1)) startRow-- endRow = bufferRow lastRow = @editor.getLastBufferRow() while endRow < lastRow break if @isLineCommentedAtBufferRow(endRow + 1) isnt isOriginalRowComment - break unless /\w/.test(@editor.lineTextForBufferRow(endRow + 1)) + break unless /\S/.test(@editor.lineTextForBufferRow(endRow + 1)) endRow++ new Range([startRow, 0], [endRow, @editor.lineTextForBufferRow(endRow).length]) From 2872000d13279b09c1624b526fb822875cccb3f3 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 16:26:24 -0700 Subject: [PATCH 493/521] Fix paragraph computation in blocks of single line comments. Closes #6050 Closes #5963 --- spec/language-mode-spec.coffee | 4 ++-- src/language-mode.coffee | 43 +++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/spec/language-mode-spec.coffee b/spec/language-mode-spec.coffee index d23bd5506..47fa30bdf 100644 --- a/spec/language-mode-spec.coffee +++ b/spec/language-mode-spec.coffee @@ -126,7 +126,7 @@ describe "LanguageMode", -> // comment line after fn var nosort = function(items) { - return item; + return item; } }; @@ -150,7 +150,7 @@ describe "LanguageMode", -> expect(range).toEqual [[15,0], [15,26]] range = languageMode.rowRangeForParagraphAtBufferRow(18) - expect(range).toEqual [[17,0], [19,1]] + expect(range).toEqual [[17,0], [19,3]] describe "coffeescript", -> beforeEach -> diff --git a/src/language-mode.coffee b/src/language-mode.coffee index 267383ff4..bff2c55a0 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -24,14 +24,8 @@ class LanguageMode # endRow - The row {Number} to end at toggleLineCommentsForBufferRows: (start, end) -> scope = @editor.scopeDescriptorForBufferPosition([start, 0]) - commentStartEntry = atom.config.getAll('editor.commentStart', {scope})[0] - - return unless commentStartEntry? - - commentEndEntry = _.find atom.config.getAll('editor.commentEnd', {scope}), (entry) -> - entry.scopeSelector is commentStartEntry.scopeSelector - commentStartString = commentStartEntry?.value - commentEndString = commentEndEntry?.value + {commentStartString, commentEndString} = @getCommentStartAndEndStrings(scope) + return unless commentStartString? buffer = @editor.buffer commentStartRegexString = _.escapeRegExp(commentStartString).replace(/(\s+)$/, '(?:$1)?') @@ -190,11 +184,24 @@ class LanguageMode return false unless 0 <= bufferRow <= @editor.getLastBufferRow() @editor.displayBuffer.tokenizedBuffer.tokenizedLineForRow(bufferRow).isComment() - # Find a row range for a 'paragraph' around specified bufferRow. - # Right now, a paragraph is a block of text bounded by and empty line or a - # block of text that is not the same type (comments next to source code). + # Find a row range for a 'paragraph' around specified bufferRow. A paragraph + # is a block of text bounded by and empty line or a block of text that is not + # the same type (comments next to source code). rowRangeForParagraphAtBufferRow: (bufferRow) -> - return unless /\S/.test(@editor.lineTextForBufferRow(bufferRow)) + scope = @editor.scopeDescriptorForBufferPosition([bufferRow, 0]) + {commentStartString, commentEndString} = @getCommentStartAndEndStrings(scope) + commentStartRegex = null + if commentStartString? and not commentEndString? + commentStartRegexString = _.escapeRegExp(commentStartString).replace(/(\s+)$/, '(?:$1)?') + commentStartRegex = new OnigRegExp("^(\\s*)(#{commentStartRegexString})") + + filterLineComments = (line) -> + if commentStartRegex? + matches = commentStartRegex.searchSync(line) + line = line.substring(matches[0].end) if matches?.length + line + + return unless /\S/.test(filterLineComments(@editor.lineTextForBufferRow(bufferRow))) if @isLineCommentedAtBufferRow(bufferRow) isOriginalRowComment = true @@ -207,14 +214,14 @@ class LanguageMode startRow = bufferRow while startRow > firstRow break if @isLineCommentedAtBufferRow(startRow - 1) isnt isOriginalRowComment - break unless /\S/.test(@editor.lineTextForBufferRow(startRow - 1)) + break unless /\S/.test(filterLineComments(@editor.lineTextForBufferRow(startRow - 1))) startRow-- endRow = bufferRow lastRow = @editor.getLastBufferRow() while endRow < lastRow break if @isLineCommentedAtBufferRow(endRow + 1) isnt isOriginalRowComment - break unless /\S/.test(@editor.lineTextForBufferRow(endRow + 1)) + break unless /\S/.test(filterLineComments(@editor.lineTextForBufferRow(endRow + 1))) endRow++ new Range([startRow, 0], [endRow, @editor.lineTextForBufferRow(endRow).length]) @@ -319,3 +326,11 @@ class LanguageMode foldEndRegexForScopeDescriptor: (scopeDescriptor) -> @getRegexForProperty(scopeDescriptor, 'editor.foldEndPattern') + + getCommentStartAndEndStrings: (scope) -> + commentStartEntry = atom.config.getAll('editor.commentStart', {scope})[0] + commentEndEntry = _.find atom.config.getAll('editor.commentEnd', {scope}), (entry) -> + entry.scopeSelector is commentStartEntry.scopeSelector + commentStartString = commentStartEntry?.value + commentEndString = commentEndEntry?.value + {commentStartString, commentEndString} From d38f6bb1d38871b71c4905ba7c4c0661d3cf62c8 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 16:26:50 -0700 Subject: [PATCH 494/521] Add toString to `ScopeDescriptor` --- src/scope-descriptor.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scope-descriptor.coffee b/src/scope-descriptor.coffee index d7ec263fd..7940cc630 100644 --- a/src/scope-descriptor.coffee +++ b/src/scope-descriptor.coffee @@ -44,3 +44,6 @@ class ScopeDescriptor scope = ".#{scope}" unless scope[0] is '.' scope .join(' ') + + toString: -> + @getScopeChain() From 8f2fbbfd9d329ab264004d40961e5b7fc04d1ff9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 16:29:10 -0700 Subject: [PATCH 495/521] Rename method to be more consistent --- src/language-mode.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/language-mode.coffee b/src/language-mode.coffee index bff2c55a0..d48c68d58 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -24,7 +24,7 @@ class LanguageMode # endRow - The row {Number} to end at toggleLineCommentsForBufferRows: (start, end) -> scope = @editor.scopeDescriptorForBufferPosition([start, 0]) - {commentStartString, commentEndString} = @getCommentStartAndEndStrings(scope) + {commentStartString, commentEndString} = @commentStartAndEndStringsForScope(scope) return unless commentStartString? buffer = @editor.buffer @@ -189,7 +189,7 @@ class LanguageMode # the same type (comments next to source code). rowRangeForParagraphAtBufferRow: (bufferRow) -> scope = @editor.scopeDescriptorForBufferPosition([bufferRow, 0]) - {commentStartString, commentEndString} = @getCommentStartAndEndStrings(scope) + {commentStartString, commentEndString} = @commentStartAndEndStringsForScope(scope) commentStartRegex = null if commentStartString? and not commentEndString? commentStartRegexString = _.escapeRegExp(commentStartString).replace(/(\s+)$/, '(?:$1)?') @@ -327,7 +327,7 @@ class LanguageMode foldEndRegexForScopeDescriptor: (scopeDescriptor) -> @getRegexForProperty(scopeDescriptor, 'editor.foldEndPattern') - getCommentStartAndEndStrings: (scope) -> + commentStartAndEndStringsForScope: (scope) -> commentStartEntry = atom.config.getAll('editor.commentStart', {scope})[0] commentEndEntry = _.find atom.config.getAll('editor.commentEnd', {scope}), (entry) -> entry.scopeSelector is commentStartEntry.scopeSelector From f6c1f95b65e8a8831b7d02b90849801b63cd9dc3 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 16:32:26 -0700 Subject: [PATCH 496/521] Rename method for clarity --- src/language-mode.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/language-mode.coffee b/src/language-mode.coffee index d48c68d58..b5529a05e 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -195,13 +195,13 @@ class LanguageMode commentStartRegexString = _.escapeRegExp(commentStartString).replace(/(\s+)$/, '(?:$1)?') commentStartRegex = new OnigRegExp("^(\\s*)(#{commentStartRegexString})") - filterLineComments = (line) -> + filterCommentStart = (line) -> if commentStartRegex? matches = commentStartRegex.searchSync(line) line = line.substring(matches[0].end) if matches?.length line - return unless /\S/.test(filterLineComments(@editor.lineTextForBufferRow(bufferRow))) + return unless /\S/.test(filterCommentStart(@editor.lineTextForBufferRow(bufferRow))) if @isLineCommentedAtBufferRow(bufferRow) isOriginalRowComment = true @@ -214,14 +214,14 @@ class LanguageMode startRow = bufferRow while startRow > firstRow break if @isLineCommentedAtBufferRow(startRow - 1) isnt isOriginalRowComment - break unless /\S/.test(filterLineComments(@editor.lineTextForBufferRow(startRow - 1))) + break unless /\S/.test(filterCommentStart(@editor.lineTextForBufferRow(startRow - 1))) startRow-- endRow = bufferRow lastRow = @editor.getLastBufferRow() while endRow < lastRow break if @isLineCommentedAtBufferRow(endRow + 1) isnt isOriginalRowComment - break unless /\S/.test(filterLineComments(@editor.lineTextForBufferRow(endRow + 1))) + break unless /\S/.test(filterCommentStart(@editor.lineTextForBufferRow(endRow + 1))) endRow++ new Range([startRow, 0], [endRow, @editor.lineTextForBufferRow(endRow).length]) From 626afe4e0dd06e814dd3471493f2c0f4647b896a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 16:23:26 -0700 Subject: [PATCH 497/521] Don't include fallback imports for static files --- build/tasks/prebuild-less-task.coffee | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index 18a323403..755003455 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -20,6 +20,9 @@ module.exports = (grunt) -> rm(bootstrapLessPath) rm(path.join(appDir, 'node_modules', 'bootstrap', 'less')) + importFallbackVariables = (lessFilePath) -> + lessFilePath.indexOf('static') isnt 0 + grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled Less files', -> compileBootstrap() @@ -82,12 +85,14 @@ module.exports = (grunt) -> importPaths: importPaths cssForFile = (file) -> - baseVarImports = """ - @import "variables/ui-variables"; - @import "variables/syntax-variables"; - """ less = fs.readFileSync(file, 'utf8') - lessCache.cssForFile(file, [baseVarImports, less].join('\n')) + if importFallbackVariables(file) + baseVarImports = """ + @import "variables/ui-variables"; + @import "variables/syntax-variables"; + """ + less = [baseVarImports, less].join('\n') + lessCache.cssForFile(file, less) for file in @filesSrc grunt.verbose.writeln("File #{file.cyan} created in cache.") From 930f30647631c07ec4c47b02d374c18a3706c170 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 16:45:48 -0700 Subject: [PATCH 498/521] Precompile atom-space-pen-views stylesheets --- build/Gruntfile.coffee | 1 + build/tasks/prebuild-less-task.coffee | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index e4ebf3e9a..dac5c8f1f 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -92,6 +92,7 @@ module.exports = (grunt) -> prebuildLessConfig = src: [ 'static/**/*.less' + 'node_modules/atom-space-pen-views/stylesheets/**/*.less' ] csonConfig = diff --git a/build/tasks/prebuild-less-task.coffee b/build/tasks/prebuild-less-task.coffee index 755003455..5e3bd274e 100644 --- a/build/tasks/prebuild-less-task.coffee +++ b/build/tasks/prebuild-less-task.coffee @@ -21,7 +21,12 @@ module.exports = (grunt) -> rm(path.join(appDir, 'node_modules', 'bootstrap', 'less')) importFallbackVariables = (lessFilePath) -> - lessFilePath.indexOf('static') isnt 0 + if lessFilePath.indexOf('static') is 0 + false + else if lessFilePath.indexOf('atom-space-pen-views') isnt -1 + false + else + true grunt.registerMultiTask 'prebuild-less', 'Prebuild cached of compiled Less files', -> compileBootstrap() From c2998900fd8ef965cec429f1d123952c7588b90f Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 17:26:03 -0700 Subject: [PATCH 499/521] :arrow_up: scandal@2.0.1 Fixes duplication when following symlinks --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e65f94ff3..69c32e2f9 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "react-atom-fork": "^0.11.5", "reactionary-atom-fork": "^1.0.0", "runas": "2.0.0", - "scandal": "2.0.0", + "scandal": "2.0.1", "scoped-property-store": "^0.17.0", "scrollbar-style": "^2.0.0", "season": "^5.1.4", From 7cd263dfb75dd12349b95875b5d0e9fc935cb549 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 17:46:53 -0700 Subject: [PATCH 500/521] :arrow_up: clear-cut@1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e65f94ff3..5e00878fe 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", - "clear-cut": "0.4.0", + "clear-cut": "^1", "coffee-cash": "0.8.0", "coffee-script": "1.8.0", "coffeestack": "^1.1.1", From 54496580118b2054647616cbc1c7900f5b5107ff Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 17:47:25 -0700 Subject: [PATCH 501/521] Remove specificity caching now handled by clear-cut --- src/command-registry.coffee | 3 +-- src/context-menu-manager.coffee | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/command-registry.coffee b/src/command-registry.coffee index 479d972fa..b3cacff0e 100644 --- a/src/command-registry.coffee +++ b/src/command-registry.coffee @@ -5,7 +5,6 @@ _ = require 'underscore-plus' {validateSelector} = require './selector-validator' SequenceCount = 0 -SpecificityCache = {} # Public: Associates listener functions with commands in a # context-sensitive way using CSS selectors. You can access a global instance of @@ -241,7 +240,7 @@ class CommandRegistry class SelectorBasedListener constructor: (@selector, @callback) -> - @specificity = (SpecificityCache[@selector] ?= specificity(@selector)) + @specificity = specificity(@selector) @sequenceNumber = SequenceCount++ compare: (other) -> diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 8397da33d..344173579 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -9,7 +9,6 @@ MenuHelpers = require './menu-helpers' {validateSelector} = require './selector-validator' platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] -SpecificityCache = {} # Extended: Provides a registry for commands that you'd like to appear in the # context menu. @@ -208,4 +207,4 @@ class ContextMenuManager class ContextMenuItemSet constructor: (@selector, @items) -> - @specificity = (SpecificityCache[@selector] ?= specificity(@selector)) + @specificity = specificity(@selector) From 2538191449073eead67a2eb0b11513e5c3a95ff9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 17:47:25 -0700 Subject: [PATCH 502/521] Default `core.followSymlinks` to true --- src/config-schema.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 87e1040bc..ba8150a26 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -18,7 +18,7 @@ module.exports = title: 'Exclude VCS Ignored Paths' followSymlinks: type: 'boolean' - default: false + default: true title: 'Follow symlinks' description: 'Used when searching and when opening files with the fuzzy finder.' disabledPackages: From 4c6722832b97f6795d6b1d2b1859a95f090d74b5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 18:01:40 -0700 Subject: [PATCH 503/521] :arrow_up: clear-cut@2.0 --- package.json | 2 +- src/command-registry.coffee | 4 ++-- src/context-menu-manager.coffee | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5e00878fe..66a2821c0 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", - "clear-cut": "^1", + "clear-cut": "^2", "coffee-cash": "0.8.0", "coffee-script": "1.8.0", "coffeestack": "^1.1.1", diff --git a/src/command-registry.coffee b/src/command-registry.coffee index b3cacff0e..89357268e 100644 --- a/src/command-registry.coffee +++ b/src/command-registry.coffee @@ -1,5 +1,5 @@ {Emitter, Disposable, CompositeDisposable} = require 'event-kit' -{specificity} = require 'clear-cut' +{calculateSpecificity} = require 'clear-cut' _ = require 'underscore-plus' {$} = require './space-pen-extensions' {validateSelector} = require './selector-validator' @@ -240,7 +240,7 @@ class CommandRegistry class SelectorBasedListener constructor: (@selector, @callback) -> - @specificity = specificity(@selector) + @specificity = calculateSpecificity(@selector) @sequenceNumber = SequenceCount++ compare: (other) -> diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index 344173579..a9b3449e0 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -2,7 +2,7 @@ _ = require 'underscore-plus' path = require 'path' CSON = require 'season' fs = require 'fs-plus' -{specificity} = require 'clear-cut' +{calculateSpecificity} = require 'clear-cut' {Disposable} = require 'event-kit' Grim = require 'grim' MenuHelpers = require './menu-helpers' @@ -207,4 +207,4 @@ class ContextMenuManager class ContextMenuItemSet constructor: (@selector, @items) -> - @specificity = specificity(@selector) + @specificity = calculateSpecificity(@selector) From b789a898cd28f9c89e1d01071cc53b31e7c4bae4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 18:01:55 -0700 Subject: [PATCH 504/521] :arrow_up: atom-keymap@5.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66a2821c0..847c02299 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "atomShellVersion": "0.22.3", "dependencies": { "async": "0.2.6", - "atom-keymap": "^5.1", + "atom-keymap": "^5.1.2", "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", From 84bab1c67badc4ae9fcf1db0f004a1d7c3b05174 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 Apr 2015 18:03:14 -0700 Subject: [PATCH 505/521] Use selector validator provided by clear-cut --- src/command-registry.coffee | 3 +-- src/context-menu-manager.coffee | 3 +-- src/selector-validator.coffee | 28 ---------------------------- 3 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 src/selector-validator.coffee diff --git a/src/command-registry.coffee b/src/command-registry.coffee index 89357268e..3969dc283 100644 --- a/src/command-registry.coffee +++ b/src/command-registry.coffee @@ -1,8 +1,7 @@ {Emitter, Disposable, CompositeDisposable} = require 'event-kit' -{calculateSpecificity} = require 'clear-cut' +{calculateSpecificity, validateSelector} = require 'clear-cut' _ = require 'underscore-plus' {$} = require './space-pen-extensions' -{validateSelector} = require './selector-validator' SequenceCount = 0 diff --git a/src/context-menu-manager.coffee b/src/context-menu-manager.coffee index a9b3449e0..bd5ff943e 100644 --- a/src/context-menu-manager.coffee +++ b/src/context-menu-manager.coffee @@ -2,11 +2,10 @@ _ = require 'underscore-plus' path = require 'path' CSON = require 'season' fs = require 'fs-plus' -{calculateSpecificity} = require 'clear-cut' +{calculateSpecificity, validateSelector} = require 'clear-cut' {Disposable} = require 'event-kit' Grim = require 'grim' MenuHelpers = require './menu-helpers' -{validateSelector} = require './selector-validator' platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] diff --git a/src/selector-validator.coffee b/src/selector-validator.coffee deleted file mode 100644 index f8dcb240a..000000000 --- a/src/selector-validator.coffee +++ /dev/null @@ -1,28 +0,0 @@ -selectorCache = null -testElement = null - -# Parses CSS selectors and memoizes their validity so each selector will only -# be parsed once. -exports.isSelectorValid = (selector) -> - selectorCache ?= {} - cachedValue = selectorCache[selector] - return cachedValue if cachedValue? - - testElement ?= document.createElement('div') - try - # querySelector appears to be faster than webkitMatchesSelector - # http://jsperf.com/query-vs-matches - testElement.querySelector(selector) - selectorCache[selector] = true - true - catch selectorError - selectorCache[selector] = false - false - -# Parse the given CSS selector and throw an error if it is invalid. -exports.validateSelector = (selector) -> - return if exports.isSelectorValid(selector) - - error = new Error("'#{selector}' is not a valid selector") - error.code = 'EBADSELECTOR' - throw error From c13dce2d8f6374933af21ab37256018a3dfbe867 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Apr 2015 18:32:01 -0700 Subject: [PATCH 506/521] Fix spec --- spec/atom-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index 19a2cca5c..a293edccd 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -55,7 +55,7 @@ describe "the `atom` global", -> describe "loading default config", -> it 'loads the default core config', -> expect(atom.config.get('core.excludeVcsIgnoredPaths')).toBe true - expect(atom.config.get('core.followSymlinks')).toBe false + expect(atom.config.get('core.followSymlinks')).toBe true expect(atom.config.get('editor.showInvisibles')).toBe false describe "window onerror handler", -> From 1c8cf4390c3cc08cdb8f5256c281d9356bcb47bb Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 14 Apr 2015 10:50:09 +0200 Subject: [PATCH 507/521] Rename to safe-clipboard ...and use remote only on Linux renderer processes. --- spec/spec-helper.coffee | 2 +- spec/text-editor-component-spec.coffee | 2 +- spec/text-editor-spec.coffee | 2 +- src/browser/atom-application.coffee | 2 +- src/clipboard.coffee | 2 +- src/native-clipboard.coffee | 6 ------ src/safe-clipboard.coffee | 6 ++++++ src/text-editor-component.coffee | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 src/native-clipboard.coffee create mode 100644 src/safe-clipboard.coffee diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 33ec8c521..0daf6586e 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -24,7 +24,7 @@ TextEditorElement = require '../src/text-editor-element' TokenizedBuffer = require '../src/tokenized-buffer' TextEditorComponent = require '../src/text-editor-component' pathwatcher = require 'pathwatcher' -clipboard = require "../src/native-clipboard" +clipboard = require "../src/safe-clipboard" atom.themes.loadBaseStylesheets() atom.themes.requireStylesheet '../static/jasmine' diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 2ed17ab9f..0b8282e43 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -2816,7 +2816,7 @@ describe "TextEditorComponent", -> clipboardWrittenTo = false spyOn(require('ipc'), 'send').andCallFake (eventName, selectedText) -> if eventName is 'write-text-to-selection-clipboard' - require('../src/native-clipboard').writeText(selectedText, 'selection') + require('../src/safe-clipboard').writeText(selectedText, 'selection') clipboardWrittenTo = true atom.clipboard.write('') diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 38f17072d..5e0fef9e6 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1,4 +1,4 @@ -clipboard = require '../src/native-clipboard' +clipboard = require '../src/safe-clipboard' TextEditor = require '../src/text-editor' describe "TextEditor", -> diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 950cb6b78..2fee79f0b 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -256,7 +256,7 @@ class AtomApplication clipboard = null ipc.on 'write-text-to-selection-clipboard', (event, selectedText) -> - clipboard ?= require '../native-clipboard' + clipboard ?= require '../safe-clipboard' clipboard.writeText(selectedText, 'selection') # Public: Executes the given command. diff --git a/src/clipboard.coffee b/src/clipboard.coffee index 80ec464e7..000eb70e3 100644 --- a/src/clipboard.coffee +++ b/src/clipboard.coffee @@ -1,5 +1,5 @@ crypto = require 'crypto' -clipboard = require "./native-clipboard" +clipboard = require "./safe-clipboard" # Extended: Represents the clipboard used for copying and pasting in Atom. # diff --git a/src/native-clipboard.coffee b/src/native-clipboard.coffee deleted file mode 100644 index f66d44646..000000000 --- a/src/native-clipboard.coffee +++ /dev/null @@ -1,6 +0,0 @@ -# Using clipboard in renderer process is not safe on Linux. -module.exports = - if process.platform is 'linux' - require('remote').require 'clipboard' - else - require 'clipboard' diff --git a/src/safe-clipboard.coffee b/src/safe-clipboard.coffee new file mode 100644 index 000000000..571ff4578 --- /dev/null +++ b/src/safe-clipboard.coffee @@ -0,0 +1,6 @@ +# Using clipboard in renderer process is not safe on Linux. +module.exports = + if process.platform is "linux" and process.type is "renderer" + require("remote").require("clipboard") + else + require("clipboard") diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 4348279de..4c8e567f0 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -556,7 +556,7 @@ class TextEditorComponent pasteSelectionClipboard = (event) => if event?.which is 2 and process.platform is 'linux' - if selection = require('./native-clipboard').readText('selection') + if selection = require('./safe-clipboard').readText('selection') @editor.insertText(selection) window.addEventListener('mousemove', onMouseMove) From 1e07cd0e5339953a1a60b5dd91f1e096cd48207e Mon Sep 17 00:00:00 2001 From: Daniel Hengeveld Date: Tue, 14 Apr 2015 08:54:49 -0700 Subject: [PATCH 508/521] :arrow_up: settings-view@0.192.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 69c32e2f9..7b11ebd5b 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "open-on-github": "0.36.0", "package-generator": "0.38.0", "release-notes": "0.52.0", - "settings-view": "0.191.0", + "settings-view": "0.192.0", "snippets": "0.88.0", "spell-check": "0.55.0", "status-bar": "0.67.0", From 888261eb747ca7842cf94a85ade8af2e4c2eae89 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 09:31:50 -0700 Subject: [PATCH 509/521] :arrow_up: language-ruby@0.52 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b11ebd5b..1fdaf3e5e 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "language-php": "0.22.0", "language-property-list": "0.8.0", "language-python": "0.34.0", - "language-ruby": "0.51.0", + "language-ruby": "0.52.0", "language-ruby-on-rails": "0.21.0", "language-sass": "0.36.0", "language-shellscript": "0.13.0", From 97865c688829a6f21367bb6a510893861a32e700 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 09:41:36 -0700 Subject: [PATCH 510/521] :arrow_up: clear-cut@2.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 847c02299..4f9a27320 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "atom-space-pen-views": "^2.0.4", "babel-core": "^4.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", - "clear-cut": "^2", + "clear-cut": "^2.0.1", "coffee-cash": "0.8.0", "coffee-script": "1.8.0", "coffeestack": "^1.1.1", From b106dadb1b4e97964b4149141d0353843d372d0e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 14 Apr 2015 10:22:20 -0700 Subject: [PATCH 511/521] :arrow_up: language-javascript --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e39ca1f14..0df4bab60 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "language-html": "0.32.0", "language-hyperlink": "0.12.2", "language-java": "0.14.0", - "language-javascript": "0.72.0", + "language-javascript": "0.73.0", "language-json": "0.14.0", "language-less": "0.25.0", "language-make": "0.14.0", From 4022d477aaaadf5a30381b61bfc5ffd37cd38120 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 14 Apr 2015 10:33:29 -0700 Subject: [PATCH 512/521] :arrow_up: fuzzy-finder@0.73.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0df4bab60..99ab51eb7 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "exception-reporting": "0.24.0", "feedback": "0.38.0", "find-and-replace": "0.160.0", - "fuzzy-finder": "0.72.0", + "fuzzy-finder": "0.73.0", "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", From 304b959ca83d51e3670a6917862e9f603c24f701 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 14 Apr 2015 19:34:04 +0200 Subject: [PATCH 513/521] :art: Use tags to exclude spec on Linux --- spec/text-editor-component-spec.coffee | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 0b8282e43..769ce424f 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1340,7 +1340,8 @@ describe "TextEditorComponent", -> afterEach -> atom.restoreWindowDimensions() - it "slides horizontally left when near the right edge", -> + # This spec should actually run on Linux as well, see TextEditorComponent#measureWindowSize for further information. + it "slides horizontally left when near the right edge on #win32 and #darwin", -> marker = editor.displayBuffer.markBufferRange([[0, 26], [0, 26]], invalidate: 'never') decoration = editor.decorateMarker(marker, {type: 'overlay', item}) nextAnimationFrame() @@ -1352,18 +1353,17 @@ describe "TextEditorComponent", -> expect(overlay.style.left).toBe position.left + gutterWidth + 'px' expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - if process.platform isnt "linux" # see TextEditorComponent#measureWindowSize - editor.insertText('a') - nextAnimationFrame() + editor.insertText('a') + nextAnimationFrame() - expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' - editor.insertText('b') - nextAnimationFrame() + editor.insertText('b') + nextAnimationFrame() - expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' - expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' + expect(overlay.style.left).toBe windowWidth - itemWidth + 'px' + expect(overlay.style.top).toBe position.top + editor.getLineHeightInPixels() + 'px' describe "hidden input field", -> it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", -> From 6190fe00d7861387a4fb98c093b68a40cf3d411f Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 14 Apr 2015 19:34:43 +0200 Subject: [PATCH 514/521] :art: Avoid string interpolation in require --- spec/spec-helper.coffee | 2 +- src/clipboard.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 0daf6586e..af0b03eb1 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -24,7 +24,7 @@ TextEditorElement = require '../src/text-editor-element' TokenizedBuffer = require '../src/tokenized-buffer' TextEditorComponent = require '../src/text-editor-component' pathwatcher = require 'pathwatcher' -clipboard = require "../src/safe-clipboard" +clipboard = require '../src/safe-clipboard' atom.themes.loadBaseStylesheets() atom.themes.requireStylesheet '../static/jasmine' diff --git a/src/clipboard.coffee b/src/clipboard.coffee index 000eb70e3..2412394a6 100644 --- a/src/clipboard.coffee +++ b/src/clipboard.coffee @@ -1,5 +1,5 @@ crypto = require 'crypto' -clipboard = require "./safe-clipboard" +clipboard = require './safe-clipboard' # Extended: Represents the clipboard used for copying and pasting in Atom. # From ae6b5e54ef9777acda7cea24f00cc1f0fa163f06 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 11:08:26 -0700 Subject: [PATCH 515/521] :art: " -> ' --- src/safe-clipboard.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/safe-clipboard.coffee b/src/safe-clipboard.coffee index 571ff4578..8301f9d54 100644 --- a/src/safe-clipboard.coffee +++ b/src/safe-clipboard.coffee @@ -1,6 +1,6 @@ # Using clipboard in renderer process is not safe on Linux. module.exports = - if process.platform is "linux" and process.type is "renderer" - require("remote").require("clipboard") + if process.platform is 'linux' and process.type is 'renderer' + require('remote').require('clipboard') else - require("clipboard") + require('clipboard') From 7b8cea2662bc75b2491c20c0ccd2def82c3aa22f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 11:21:20 -0700 Subject: [PATCH 516/521] :arrow_up: language-gfm@0.68 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99ab51eb7..2f7bb54c2 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "language-coffee-script": "0.39.0", "language-csharp": "0.5.0", "language-css": "0.28.0", - "language-gfm": "0.67.0", + "language-gfm": "0.68.0", "language-git": "0.10.0", "language-go": "0.23.0", "language-html": "0.32.0", From 8875746f771765c52b75d9e22532c35758cfaae8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 11:36:12 -0700 Subject: [PATCH 517/521] :arrow_up: status-bar@0.68 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2f7bb54c2..acca77a2f 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "settings-view": "0.192.0", "snippets": "0.88.0", "spell-check": "0.55.0", - "status-bar": "0.67.0", + "status-bar": "0.68.0", "styleguide": "0.44.0", "symbols-view": "0.94.0", "tabs": "0.67.0", From 7ea71deb96f264448676385f17279659846a324d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 14:24:15 -0700 Subject: [PATCH 518/521] Prepare 0.192 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index acca77a2f..157165272 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "0.191.0", + "version": "0.192.0", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 55b6499b7d932f4baa845c786d16e8da4d484547 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 14 Apr 2015 15:25:36 -0700 Subject: [PATCH 519/521] Add notification for ENXIO save error Closes #5576 --- src/pane.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pane.coffee b/src/pane.coffee index 8b12fcf7f..0d8c68066 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -644,6 +644,8 @@ class Pane extends Model atom.notifications.addWarning("Unable to save file: Read-only file system '#{error.path}'") else if error.code is 'ENOSPC' and error.path? atom.notifications.addWarning("Unable to save file: No space left on device '#{error.path}'") + else if error.code is 'ENXIO' and error.path? + atom.notifications.addWarning("Unable to save file: No such device or address '#{error.path}'") else if errorMatch = /ENOTDIR, not a directory '([^']+)'/.exec(error.message) fileName = errorMatch[1] atom.notifications.addWarning("Unable to save file: A directory in the path '#{fileName}' could not be written to") From a24e76fb60f9f50f250e4dbc84c2c744ce1ea88b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 14 Apr 2015 15:35:27 -0700 Subject: [PATCH 520/521] :arrow_up: fuzzy-finder@0.74.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 157165272..ef863920d 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "exception-reporting": "0.24.0", "feedback": "0.38.0", "find-and-replace": "0.160.0", - "fuzzy-finder": "0.73.0", + "fuzzy-finder": "0.74.0", "git-diff": "0.54.0", "go-to-line": "0.30.0", "grammar-selector": "0.46.0", From ca99ff4ce8cdd7e16f048152d8650a6807795531 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 14 Apr 2015 17:08:43 -0700 Subject: [PATCH 521/521] :arrow_up: scandal@2.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef863920d..a66753883 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "react-atom-fork": "^0.11.5", "reactionary-atom-fork": "^1.0.0", "runas": "2.0.0", - "scandal": "2.0.1", + "scandal": "2.0.2", "scoped-property-store": "^0.17.0", "scrollbar-style": "^2.0.0", "season": "^5.1.4",