Giter Site home page Giter Site logo

atom-alignment's Introduction

Hello I'm Freyskeyd!

Staff software engineer @toposware

I'm a curious, quick learner and passionate developer. Mostly working on Rust related projects.

About

I post stuff on my blog and sometimes on Twitter. Working on Real time messaging application by day building stuff in Rust by night.

⚡ Technologies

Talk to me about

  • Backend development using Rust, Erlang, Elixir
  • Front-end development (but be gentle)
  • Software architecture design for scalable and distributed application

atom-alignment's People

Contributors

caleb531 avatar changspivey avatar ericf avatar freyskeyd avatar jcmarchi avatar olmokramer avatar ricardodovalle avatar richrace avatar simongiraud avatar yodadacoda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atom-alignment's Issues

Uncaught Error: Module did not self-register.

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.3.2
System: Unknown Windows Version
Thrown From: atom-alignment package, v0.12.1

Stack Trace

Uncaught Error: Module did not self-register.

At ATOM_SHELL_ASAR.js:137

Error: Module did not self-register.
    at Error (native)
    at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:137:20)
    at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:148:18)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (D:\Atom\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (D:\Atom\resources\app.asar\node_modules\symbols-view\node_modules\ctags\lib\ctags.js:4:10)
    at Object.<anonymous> (D:\Atom\resources\app.asar\node_modules\symbols-view\node_modules\ctags\lib\ctags.js:60:4)
    at Module._compile (D:\Atom\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (D:\Atom\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (D:\Atom\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (D:\Atom\resources\app.asar\node_modules\symbols-view\lib\tag-reader.js:6:11)
    at Object.<anonymous> (D:\Atom\resources\app.asar\node_modules\symbols-view\lib\tag-reader.js:66:4)
    at Module._compile (D:\Atom\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (D:\Atom\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (D:\Atom\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.<anonymous> (D:\Atom\resources\app.asar\node_modules\symbols-view\lib\go-to-view.js:10:15)
    at Object.<anonymous> (D:\Atom\resources\app.asar\node_modules\symbols-view\lib\go-to-view.js:85:4)
    at Module._compile (D:\Atom\resources\app.asar\src\native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .js] (D:\Atom\resources\app.asar\src\compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (D:\Atom\resources\app.asar\src\native-compile-cache.js:50:27)
    at Object.module.exports.createGoToView (D:\Atom\resources\app.asar\node_modules\symbols-view\lib\main.js:82:20)
    at atom-text-editor.editorSubscription.atom.commands.add.symbols-view:go-to-declaration (D:\Atom\resources\app.asar\node_modules\symbols-view\lib\main.js:27:26)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (D:\Atom\resources\app.asar\src\command-registry.js:260:29)
    at CommandRegistry.handleCommandEvent (D:\Atom\resources\app.asar\src\command-registry.js:3:61)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (D:\Atom\resources\app.asar\src\command-registry.js:160:19)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchContextMenuCommand (D:\Atom\resources\app.asar\src\atom-environment.js:1016:28)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)
    at EventEmitter.ipc.sendSync (D:\Atom\resources\atom.asar\renderer\api\lib\ipc.js:21:31)
    at BrowserWindow.RemoteMemberFunction [as emit] (D:\Atom\resources\atom.asar\renderer\api\lib\remote.js:143:29)
    at ContextMenuManager.module.exports.ContextMenuManager.showForEvent (D:\Atom\resources\app.asar\src\context-menu-manager.js:156:33)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentContextmenu (D:\Atom\resources\app.asar\src\window-event-handler.js:250:47)
    at HTMLDocument.<anonymous> (D:\Atom\resources\app.asar\src\window-event-handler.js:3:61)

Commands

     -0:05.0 symbols-view:go-to-declaration (atom-text-editor.editor.vim-mode.insert-mode.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "atom-autocomplete-php",
      "atom-ctags"
    ]
  }
}

Installed Packages

# User
atom-alignment, v0.12.1
autocomplete-php, v0.3.7
color-picker, v2.0.14
docblockr, v0.7.3
emmet, v2.3.17
jsformat, v0.9.0
language-blade, v0.16.0
laravel, v0.7.0
laravel-snippets, v2.1.0
minimap, v4.18.2
php-cs-fixer, v2.5.1
php-debug, v0.1.4
php-server, v0.7.0
pigments, v0.19.3
symbols-tree-view, v0.10.1
travis-ci-status, v0.18.0
vim-mode, v0.64.0

# Dev
No dev packages

Alignment on commas

I'd like to align elements of my code for easier reading on the comma, but cannot get it to work. For example, I'd like to convert:

+navOption('biography', 'Biography and Timeline')
+navOption('books-articles', 'Books and Articles about Paul Rand')
+navOption('events-exhibits', 'Events and Exhibits')
+navOption('videos-interviews', 'Videos and Interview')
+navOption('portraits', 'Portraits')
+navOption('rand-house', 'The Rand House')
+navOption('his-inspirations', 'Inspirations')
+navOption('personal-items', 'Personal Items')
+navOption('death', 'Death')

to:

+navOption( 'biography'         , 'Biography and Timeline'             )
+navOption( 'books-articles'    , 'Books and Articles about Paul Rand' )
+navOption( 'events-exhibits'   , 'Events and Exhibits'                )
+navOption( 'videos-interviews' , 'Videos and Interview'               )
+navOption( 'portraits'         , 'Portraits'                          )
+navOption( 'rand-house'        , 'The Rand House'                     )
+navOption( 'his-inspirations'  , 'Inspirations'                       )
+navOption( 'personal-items'    , 'Personal Items'                     )
+navOption( 'death'             , 'Death'                              )

What combination of characters should I use? Have tried several combinations but nothing seems to work. Crashes Atom when trying to use just a comma.

Suggestions on undo grouping and cursor pos

  1. When I align 10 lines by once, It will create 10 undo grouping, which means I need to press ctrl+z for 10 times to revert the changing. Is there any way to merge those 10 steps into one?(In sublime I just need to press ctrl+z for one time when undo the change).
  2. After alignment, the cursor will goto the end of each line, but in sublime the cursor will just stay at the origin pos. Is there any way to change this?

Thanks xD

Should be an option to avoid mixed space character usage

If using tabs for indentation in a file and alignment is used, tabs and spaces are inserted to acheive alignment. This leads to lint warnings and issues with alignment when the number of spaces to which a tab is equivalent is different from the person who wrote it.

There should be an option to always use spaces to perform the alignment, regardless of the indentation type.

Package.activateResources is deprecated.

Hi Simon,

With Atom version 0.196.0 on MacOS the plugin reports the following problem:

The context menu CSON format has changed. Please see
https://atom.io/docs/api/latest/ContextMenuManager

Due to this, it is not possible to use atom-alignment within the Atom-0.196.0. I have managed to solve this problem by replacing

'context-menu':
  '.overlayer':
    'Enable atom-alignment': 'atom-alignment:align'

with

'context-menu':
  '.overlayer': [{ 'Enable atom-alignment': 'atom-alignment:align' }]

in ~/.atom/packages/atom-alignment/menus/atom-alignment.cson file. Hopefully, this will help you in debugging.

Best regards, Dusan

Align on : but not on ::

I'd like to be able to align on : in something like CSON, but not on :: in the case of C++ namespaces.

I've currently disabled aligning on : since I work more in C++ than CoffeeScript or similar, but having it would be nice (although #48 is also a bit of a blocker).

Could there be an override list?

Or maybe regex support for "Align By"? Then you could do something like [^:](:)[^:] to match : but never ::.

SUGGESTION: Allow optional settings plus default

Would love be able to set additional settings in addition to the default.

Currently, changing the "align by" settings overrides the defaults. Would that field to keep the default settings, PLUS whatever I enter there. Make sense?

Atom.Object.defineProperty.get is deprecated.

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.

Atom.Object.defineProperty.get (/Applications/Atom.app/Contents/Resources/app/src/atom.js:55:11)
Object.activate (/Users/ricardodovalle/.atom/packages/atom-alignment/lib/atom-alignment.coffee:10:13)

Uncaught TypeError: Cannot read property 'detach' of undefined

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.3.2
System: Unknown Windows Version
Thrown From: atom-alignment package, v0.12.1

Stack Trace

Uncaught TypeError: Cannot read property 'detach' of undefined

At /C:/Users/shaohua/.atom/packages/php-class-tree/lib/php-class-tree.coffee:44

TypeError: Cannot read property 'detach' of undefined
    at PhpClassTree.detach (file:///C:/Users/shaohua/.atom/packages/php-class-tree/lib/php-class-tree.coffee:34:14)
    at Function.Main.getPhpClassTreeByEditor (file:///C:/Users/shaohua/.atom/packages/php-class-tree/lib/php-class-tree.coffee:245:17)
    at file:///C:/Users/shaohua/.atom/packages/php-class-tree/lib/php-class-tree.coffee:212:22
    at Emitter.module.exports.Emitter.emit (D:\Atom\resources\app.asar\node_modules\event-kit\lib\emitter.js:86:11)
    at D:\Atom\resources\app.asar\src\pane-container.js:333:27
    at Emitter.module.exports.Emitter.emit (D:\Atom\resources\app.asar\node_modules\event-kit\lib\emitter.js:86:11)
    at Pane.module.exports.Pane.setActiveItem (D:\Atom\resources\app.asar\src\pane.js:248:22)
    at Pane.module.exports.Pane.activateItem (D:\Atom\resources\app.asar\src\pane.js:316:21)
    at atom-tabs.TabBarView.onMouseDown (D:\Atom\resources\app.asar\node_modules\tabs\lib\tab-bar-view.js:670:19)

Commands

Config

{
  "core": {
    "disabledPackages": [
      "atom-autocomplete-php"
    ]
  }
}

Installed Packages

# User
atom-alignment, v0.12.1
atom-beautify, v0.28.19
autocomplete-php, v0.3.7
color-picker, v2.0.14
docblockr, v0.7.3
emmet, v2.3.17
jsformat, v0.9.0
language-blade, v0.16.0
laravel, v0.7.0
laravel-snippets, v2.1.0
minimap, v4.18.2
php-cs-fixer, v2.5.1
php-debug, v0.1.4
pigments, v0.19.3
symbols-tree-view, v0.10.1
travis-ci-status, v0.18.0
vim-mode, v0.64.0

# Dev
No dev packages

Problems with '>=' and '<=' characters

Hi!

I've wrote this code:

var period  = $('#'+ContratoProveedor.form+' select[id=periodo_c]').val();
var periodMapValue = ContratoProveedor.periodsMap[period];
var periodValue = $('#'+ContratoProveedor.form+' input[id=valor_periodo_c]').val();
var totalValue = 0.0;
periodValue = ((!/\d+/.test(periodValue))?0:parseFloat(periodValue));
var t = (a>=z && b<= ad); // <-- align test!

Then, i applied the alignment... but, i got this... look the last line, the var t. There're a lot of spaces after a>.

var period         = $('#'+ContratoProveedor.form+' select[id =periodo_c]').val();
var periodMapValue = ContratoProveedor.periodsMap[period];
var periodValue    = $('#'+ContratoProveedor.form+' input[id  =valor_periodo_c]').val();
var totalValue     = 0.0;
periodValue        = ((!/\d+/.test(periodValue))?0:parseFloat(periodValue));
var t              = (a>                                      =z && b<= ad);

It's a setting problem? what would i do for obtain a correct alignment? In Sublime Text i can align properly.

Thanks! And sorry for my bad english! ✌️

Unexpected behaviour with angular directive

It returns an unexpected alignment result in case of this:

scope: {
  /* start selection */
  mapRef: '=',
  stateData: '=',
  polygons: '=',
  onWirecenterClicked: '=',
  onShowResultsChange: '='
  /* end selection */
}

Alignment space chars not working

I can't get the Alignment Space Chars setting to allow forward-slashes for aligning inline comments in PHP. I've tried the following strings in the field to make it work:

=, :, /
=:/
=://
=, :, //

None of them seem to make any difference to the functionality.

Package menu name

Very minor issue:
screen shot 2015-05-26 at 5 53 53 pm

The menu item name should be 'Atom Alignment' not 'atom-alignment'

Offer to align on custom char

It's true that most of the time we align on chars like ':' or '='

But i thinks that to make it more general, and open to other languages files.
We must have a a way to choose on what caracter the selection must be valigned

Usage clears history

After activating with keybinding, the history for the file is cleared (can not undo changes, they are all lost).

Failed to load the atom-alignment package

[Enter steps to reproduce below:]

  1. install atom-alignment
  2. restart app

Atom Version: 0.207.0
System: Mac OS X 10.10.1
Thrown From: atom-alignment package, v0.12.1

Stack Trace

Failed to load the atom-alignment package

At Cannot find module 'lodash'

Error: Cannot find module 'lodash'
    at Module._resolveFilename (module.js:328:15)
    at Function.Module._resolveFilename (/Applications/Atom.app/Contents/Resources/app.asar/src/module-cache.js:383:52)
    at Function.Module._load (module.js:270:25)
    at Module.require (module.js:357:17)
    at require (module.js:376:17)
    at Object.<anonymous> (/Users/mac/.atom/packages/atom-alignment/lib/aligner.coffee:7:7)
    at Object.<anonymous> (/Users/mac/.atom/packages/atom-alignment/lib/aligner.coffee:323:4)
    at Module._compile (module.js:452:26)
    at Object.requireCoffeeScript (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/coffee-cash/lib/coffee-cash.js:85:19)
    at Module.load (module.js:347:32)

Commands

Config

{
  "core": {
    "themes": [
      "seti-ui",
      "base16-tomorrow-dark-theme"
    ]
  }
}

Installed Packages

# User
atom-alignment, v0.12.1
seti-ui, v0.7.1
vim-mode, v0.51.0

# Dev
No dev packages

Cursors moved at the end of each lines after alignment

After multiple cursors alignment, cursors are moved at the end of each line.

Before:

import Parser |from "../../Parser";
import DocumentValidator |from "../../Parser/Document/Validator";

Expected:

import Parser            |from "../../Parser";
import DocumentValidator |from "../../Parser/Document/Validator";

Actual:

import Parser            from "../../Parser";|
import DocumentValidator from "../../Parser/Document/Validator";|

Atom-Alignment Throws Deprecation Cop Warning

The package seems to generate a strange error since the last update. It triggers a deprecation cop warning that associates the error with the Atom Core. I opened a previous ticket with the Atom. You can reference the thread here: atom/atom#6278

I'm on and running:
MacBook Pro Retina
OS X Yosemite 10.10.2
Atom Version 0.189.0 (0.189.0)

Here's a screenshot of the Deprecation Cop error.

deprecation cop - atom

Alignment issue

I tried to align in Windows using Alt+ctrl+a.
but i found the alignment was not proper in my ejs file.
it's not at all working in js file.

please help

Lambda handling

Hi,

Can it also align lambdas? I have tried to add -> to the default characters list but it didn't work out.
Here is what I have tried to add:

= , - ->

I want this:

  scope :unpublished, -> { ... }
  scope :published, -> { ... }
  scope :ordered, -> { ... }
  scope :recent, -> { ... }

to become this:

  scope :unpublished, -> { ... }
  scope :published,   -> { ... }
  scope :ordered,     -> { ... }
  scope :recent,      -> { ... }

Multi Match Alignment

Atom: 1.0.7
atom-alignment: 0.12.1

Strings that contain alignment characters should not be changed by the plugin.

Example:

var foo = {
    bar: '1   :abc',
    bazzzzzz : '2:  def'
};

Expected:

var foo = {
    bar      : '1   :abc',
    bazzzzzz : '2:  def'
};

Actual:

var foo = {
    bar      : '1 :abc',
    bazzzzzz : '2 : def'
};

Multi-cursor allignment

It would be great if multi-cursor allignment will work like in sublime alignment package.

WorkspaceView.getActivePaneItem is deprecated.

Use Workspace::getActivePaneItem instead

WorkspaceView.getActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace-view.js:564:7)
HTMLDivElement.<anonymous> (/Users/tsantor/.atom/packages/atom-alignment/lib/atom-alignment.coffee:15:37)
HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:400:16)
KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:181:22)
HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:142:20)

Aligning a single line containing brackets

Atom: 1.0.0
atom-alignment: 0.12.1

Trying to align a single line containing brackets ([...] or (...)) doesn't work as expected.
Trying to align multiple lines does work as expected.

Consider the following example:

Input:

var fs       = require( 'fs' );

Expected:

var fs = require( 'fs' );

Actual:

var fs = require(
'fs' );

Failed to activate the atom-alignment package

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.5.4
System: Mac OS X 10.11.3
Thrown From: atom-alignment package, v0.12.1

Stack Trace

Failed to activate the atom-alignment package

At Cannot read property 'command' of undefined

TypeError: Cannot read property 'command' of undefined
  at Object.module.exports.activate (/Users/JuLIANG/.atom/packages/atom-alignment/lib/atom-alignment.coffee:6:13)
  at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:181:20)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:155:32
  at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:92:15)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:148:26
  at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:145:34)
  at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:526:21)
  at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/settings-view/lib/package-manager.js:385:60
  at exit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/settings-view/lib/package-manager.js:73:16)
  at triggerExitCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:213:47)
  at ChildProcess.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:235:18)
  at emitTwo (events.js:87:13)
  at ChildProcess.emit (events.js:172:7)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

Commands

  2x -0:50.2.0 settings-view:check-for-package-updates (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)

Config

{
  "core": {}
}

Installed Packages

# User
atom-alignment, v0.12.1

# Dev
No dev packages

Alignment brings everything to far left

When I use the shortcut to align arrays it always pulls all of the data to the left but leaves 1 space between the beginning of the line and the first character. Shouldn't it keep all the values in the same starting position as they are often following indentation from classes or functions.

alignment_issue

align in jsdoc

 * @param {int} xxxxxxxxxxx
 * @param    {string} yyyyyyyyyyyyyyy
 * @param  {function} zzzzzzzzzzz
 * @param  {Object} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 * @return {Promise} bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 */

Should align to:

 * @param {int}      xxxxxxxxxxx
 * @param {string}   yyyyyyyyyyyyyyy
 * @param {function} zzzzzzzzzzz
 * @param {Object}   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 * @return {Promise} bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 */

Align for '.='

I'd like this plugin took into account the token '.=' for concatenation in PHP code.

"WorkspaceView.getActivePaneItem is deprecated."

Started getting this error this morning. Not entirely sure what it means?

Use Workspace::getActivePaneItem instead

WorkspaceView.getActivePaneItem (/Applications/Atom.app/Contents/Resources/app/src/workspace-view.js:564:7)
HTMLDivElement.<anonymous> (/Users/user/.atom/packages/atom-alignment/lib/atom-alignment.coffee:15:37)
HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
Object.trigger (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4594:12)
HTMLInputElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:5119:17)
Function.jQuery.extend.each (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:590:23)
[object Object].each (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:237:17)
[object Object].trigger (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:5118:15)
Package.module.exports.Package.handleActivationEvent (/Applications/Atom.app/Contents/Resources/app/src/package.js:555:23)
HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/package.js:3:61)
HTMLDivElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676:9)
HTMLDivElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360:46)
KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:400:16)
KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:181:22)
HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:142:20)

Add option to control spacing around alignment chars

When writing JavaScript, I like to have at least one space before = and one space after. But for :, I like zero or more spaces before and one space after; e.g.:

var foo = {
    someKey   : true,
    anotherKey: true
}

Sublime Alignment has a setting for the collection of alignment chars that should be preceded by at least one space. Can you add an option so that this can be set by the user?

Indentation Breaking When Using Hard Tabs

This works great when files are indented with soft tabs, but WordPress coding standards require hard tabs for all PHP files. I'm not sure if it's a setting that I'm not quite understanding, but when aligning a block with hard tabs the indention is replaced with a single space.

The alignment works fine, but the entire block is then indented with a single space rather than whatever the previous indentation was.

Gif for a Better Explanation:

notify

Multiple cursor history

After aligning cursors, there is one history event added per cursor, which is quite annoying. I originally submitted this to atom directly and was told "[atom-alignment] needs to use the TextEditor::transact method to group these changes."

{
  "a"|: 1,
  "ab"|: 1,
  "abc"|: 1

align cursors

{
  "a"  |: 1,
  "ab" |: 1,
  "abc"|: 1

undo (note nothing happens, it's resetting the 3rd cursor which didn't move):

{
  "a"  |: 1,
  "ab" |: 1,
  "abc"|: 1

undo:

{
  "a"  |: 1,
  "ab"|: 1,
  "abc"|: 1

undo:

{
  "a"|: 1,
  "ab"|: 1,
  "abc"|: 1

Not working?

Hi @Freyskeyd,

I just installed your package and it does not appear to be working? I have tried calling the command using both the keyboard shortcut cmd+ctrl+a and through the command-panel and nothing happens?

Not that I imagine it matters, but I have a simple JavaScript file:

var A = 0;
var AB = 1;
var ABC = 2;

...with three cursors located to the left of the 3 = characters when I trigger your script.

I just started using Atom today, so not sure if I'm being really silly?!

I can't allign `|`

I want to use this package to allign my markdown tables but it looks like that it doesn't word for this symbol |.

Yes, I have added this to the package settings: Alignment Space Chars: =, :, |, ", ', =>

Uncaught TypeError: Cannot read property 'getCursors' of undefined

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.0
System: user
Thrown From: atom-alignment package, v0.12.1

Stack Trace

Uncaught TypeError: Cannot read property 'getCursors' of undefined

At C:\Users\user\.atom\packages\atom-alignment\lib\aligner.coffee:16

TypeError: Cannot read property 'getCursors' of undefined
  at Aligner.module.exports.Aligner.__getRows (C:\Users\user\.atom\packages\atom-alignment\lib\aligner.coffee:16:39)
  at Aligner.__getRows (C:\Users\user\.atom\packages\atom-alignment\lib\aligner.coffee:1:1)
  at Aligner.module.exports.Aligner.align (C:\Users\user\.atom\packages\atom-alignment\lib\aligner.coffee:214:14)
  at Aligner.align (C:\Users\user\.atom\packages\atom-alignment\lib\aligner.coffee:1:1)
  at alignLinesMultiple (C:\Users\user\.atom\packages\atom-alignment\lib\atom-alignment.coffee:48:7)
  at atom-workspace.atom.commands.add.atom-alignment:alignMultiple (C:\Users\user\.atom\packages\atom-alignment\lib\atom-alignment.coffee:33:17)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\user\AppData\Local\atom\app-1.0.0\resources\app.asar\src\command-registry.js:241:29)
  at CommandRegistry.handleCommandEvent (C:\Users\user\AppData\Local\atom\app-1.0.0\resources\app.asar\src\command-registry.js:3:61)
  at CommandRegistry.module.exports.CommandRegistry.dispatch (C:\Users\user\AppData\Local\atom\app-1.0.0\resources\app.asar\src\command-registry.js:156:19)
  at EventEmitter.<anonymous> (C:\Users\user\AppData\Local\atom\app-1.0.0\resources\app.asar\src\window-event-handler.js:70:30)
  at emitOne (events.js:77:13)
  at EventEmitter.emit (events.js:166:7)

Commands

     -0:15.9.0 command-palette:toggle (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -0:13.9.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:12.8.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -0:12.8.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -0:11.8.0 command-palette:toggle (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -0:10.2.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -0:10.2.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -0:08.4.0 window:run-package-specs (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
  2x -0:06.2.0 atom-alignment:alignMultiple (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)

Config

{
  "core": {
    "disabledPackages": [
      "git-diff",
      "language-c",
      "language-clojure",
      "language-csharp",
      "language-go",
      "language-java",
      "language-less",
      "language-make",
      "language-objective-c",
      "language-perl",
      "language-python",
      "language-ruby",
      "language-ruby-on-rails",
      "language-sass",
      "language-toml",
      "metrics",
      "package-generator",
      "language-mustache",
      "bookmarks",
      "autoflow",
      "autoclose-html"
    ],
    "ignoredNames": [
      ".svn"
    ]
  },
  "atom-alignment": {}
}

Installed Packages

# User
atom-alignment, v0.12.1
autocomplete-php, v0.3.6
color-picker, v2.0.7
highlight-selected, v0.10.1
linter, v1.1.0
linter-js-standard, v1.0.4
linter-php, v0.0.15
minimap, v4.10.1
minimap-highlight-selected, v4.3.0
project-manager, v1.15.10
tortoise-svn, v0.4.2
tree-view-open-files, v0.2.4

# Dev
No dev packages

Align on _different_ Align By sequences in each line?

Just for reference, I'm using atom-alignment version 0.12.1, where the default configuration appears to be:

  • Align By: [ '=>', ':=', ':', '=' ]
  • Alignment Space Chars: [ '=>', ':=', '=' ]

(By the way, can someone explain to me why : is left out of "Alignment Space Chars"? Is that intentional? What purpose does it serve?)


When I select the following lines and invoke "Align":

aaa = 1
aaaa = 1
bbb: 2
bbbb: 2
ccc : 3
cccc : 3
ddd=>4
ddd=>4
eee => 5
eee => 5
fff := 6
ffff := 6

I get the following:

aaa    = 1
aaaa   = 1
bbb: 2
bbbb: 2
ccc : 3
cccc : 3
ddd    =>4
ddd    =>4
eee    => 5
eee    => 5
fff :  = 6
ffff : = 6

Note that in particular the = and => lines seem to have been properly aligned (or at least aligned as I expected) but that the : character seems to have been ignored, and := has actually been split at the =.

If I move the bbb (colon) lines above the aaa (equals) lines, like this:

bbb: 2
bbbb: 2
aaa = 1
aaaa = 1
ccc : 3
cccc : 3
ddd=>4
ddd=>4
eee => 5
eee => 5
fff := 6
ffff := 6

and invoke align, now I get this:

bbb  : 2
bbbb : 2
aaa = 1
aaaa = 1
ccc  : 3
cccc : 3
ddd=>4
ddd=>4
eee => 5
eee => 5
fff  := 6
ffff := 6

Here the : and := patterns have been aligned and the = and => lines have been ignored.

If I understand this correctly, it looks like atom-alignment looks for the first line in the selection that contains one of the Align By patterns, and then aligns the remaining lines in the selection based on that pattern. Hence, as seen in the example above, it matters whether : or = appears first in the selection.

What I expected is (1) consistent behavior given the same set of lines (regardless of the order in which they appear and (2) to align by the first occurrence of any character sequence in the Align By list in each line (where the order of elements in the Align By list determines which sequence to use when more than one Align By sequence is found in the line.)

In other words, I expected this alignment:

aaa  = 1
aaaa = 1
bbb  : 2
bbbb : 2
ccc  : 3
cccc : 3
ddd  =>4
ddd  =>4
eee  => 5
eee  => 5
fff  := 6
ffff := 6

To be honest it isn't clear to me whether or not the behavior I reported above is the expected behavior, but the align-by-any logic that leads to my final listing seems to me to be both a more intuitive result but also an objectively better result, in that it doesn't break operators like =>, ?=, +=, etc. during the alignment. (Even worse, the current behavior is to sometimes break those operators depending upon which lines are selected and/or the order in which the lines are found.)

Is there any way to accomplish the alignment found in my final listing?

alignment for ruby: json style version of hashrocket

json-style version of hashrocket...

shared_assessment_1 = Assessment.create!(
  name: "seed_me #{lsn.title}",
  lesson: lsn,
  template: false,
  publish: true,
  online: true)

breaks to

shared_assessment_1 = Assessment.create!(
  name     : "seed_me #{lsn.title}",
  lesson   : lsn,
  template : false,
  publish  : true,
  online   : true)

should be

shared_assessment_1 = Assessment.create!(
  name:     "seed_me #{lsn.title}",
  lesson:   lsn,
  template: false,
  publish:  true,
  online:   true)

or

shared_assessment_1 = Assessment.create!(
      name: "seed_me #{lsn.title}",
    lesson: lsn,
  template: false,
   publish: true,
    online: true)

Uncaught Error: Cannot find module '../services/php-proxy.coffee'

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.3.2
System: Unknown Windows Version
Thrown From: atom-alignment package, v0.12.1

Stack Trace

Uncaught Error: Cannot find module '../services/php-proxy.coffee'

At module.js:338

Error: Cannot find module '../services/php-proxy.coffee'
    at Module._resolveFilename (module.js:336:15)
    at Function.Module._resolveFilename (D:\Atom\resources\app.asar\src\module-cache.js:383:52)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (D:\Atom\resources\app.asar\src\native-compile-cache.js:50:27)
    at ClassProvider.module.exports.ClassProvider.getTooltipForWord (file:///C:/Users/shaohua/.atom/packages/atom-autocomplete-php/lib/tooltip/class-provider.coffee:20:17)
    at ClassProvider.module.exports.AbstractProvider.showPopoverFor (file:///C:/Users/shaohua/.atom/packages/atom-autocomplete-php/lib/tooltip/abstract-provider.coffee:109:24)
    at HTMLSpanElement.<anonymous> (file:///C:/Users/shaohua/.atom/packages/atom-autocomplete-php/lib/tooltip/abstract-provider.coffee:78:22)
    at HTMLDivElement.jQuery.event.dispatch (D:\Atom\resources\app.asar\node_modules\jquery\dist\jquery.js:4435:9)
    at HTMLDivElement.elemData.handle (D:\Atom\resources\app.asar\node_modules\jquery\dist\jquery.js:4121:28)

Commands

Config

{
  "core": {
    "disabledPackages": [
      "atom-autocomplete-php"
    ]
  }
}

Installed Packages

# User
atom-alignment, v0.12.1
atom-beautify, v0.28.19
autocomplete-php, v0.3.7
color-picker, v2.0.14
docblockr, v0.7.3
emmet, v2.3.17
jsformat, v0.9.0
language-blade, v0.16.0
laravel, v0.7.0
laravel-snippets, v2.1.0
minimap, v4.18.2
php-cs-fixer, v2.5.1
php-debug, v0.1.4
pigments, v0.19.3
symbols-tree-view, v0.10.1
travis-ci-status, v0.18.0
vim-mode, v0.64.0

# Dev
No dev packages

Multiple alignments in a single row

Is there any utility in using multiple alignments in the same row?
example:
align1
turns into:
align2

What's the purpose in aligning the second symbol?
In my opinion, it sometimes make the code confuse instead clean up.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.