Giter VIP home page Giter VIP logo

atom-valign's People

Contributors

chemoish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

bosersteven

atom-valign's Issues

Preserve selection after aligning

Would it make sense to make valign preserve the selection of the lines it aligned once it's done? This would help when chaining multiple commands, e.g. valign and then sort-lines.

Uncaught TypeError: this.text_editor.getGrammar(...).tokenizeLine is not a function

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.32.0 x64
Electron: 2.0.9
OS: Mac OS X 10.14
Thrown From: valign package 1.1.3

Stack Trace

Uncaught TypeError: this.text_editor.getGrammar(...).tokenizeLine is not a function

At /Users/lazybone/.atom/packages/valign/lib/read/Base.coffee:71

TypeError: this.text_editor.getGrammar(...).tokenizeLine is not a function
    at Base.getLineConfigurationForRow (/packages/valign/lib/read/Base.coffee:71:40)
    at Base.findMatchingBlockForRow (/packages/valign/lib/read/Base.coffee:16:29)
    at Base.findMatchingBlock (/packages/valign/lib/read/Base.coffee:9:13)
    at Object.getBlock (/packages/valign/lib/read/read.coffee:15:20)
    at Object.align (/packages/valign/lib/valign.coffee:19:18)
    at /packages/valign/lib/valign.coffee:13:10)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:345848)
    at KeymapManager.t.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1226096)
    at KeymapManager.t.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1222230)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:281284)

Commands

     -3:36.1.0 core:copy (input.hidden-input)
  2x -3:35.6.0 core:close (input.hidden-input)
  2x -3:20 valign:align (input.hidden-input)
  7x -3:09.2.0 core:backspace (input.hidden-input)
     -2:39.9.0 pane:show-previous-item (div.package-detail.panels-item)
     -2:39.1.0 valign:align (input.hidden-input)
  2x -2:30.9.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -2:18 fuzzy-finder:toggle-file-finder (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -2:17.6.0 core:paste (input.hidden-input)
     -2:08.1.0 editor:consolidate-selections (input.hidden-input)
     -2:08.1.0 core:cancel (input.hidden-input)
     -2:04.7.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -1:12.9.0 editor:select-to-first-character-of-line (input.hidden-input)
     -1:12.6.0 core:backspace (input.hidden-input)
     -0:07.8.0 valign:align (input.hidden-input)
  2x -0:01.5.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)

Non-Core Packages

atom-beautify 0.33.1 
autocomplete 0.47.0 
busy-signal 1.4.3 
file-icons 2.1.24 
gemsource 0.3.0 
git-status 0.3.4 
goto-definition 1.3.4 
html2haml 0.10.0 
hyperclick 0.1.5 
hyperlink-hyperclick 2.0.0 
intentions 1.1.5 
language-haml 0.31.1 
language-vue 0.23.1 
linter 2.2.0 
linter-eslint 8.4.1 
linter-ruby 1.2.6 
linter-ui-default 1.7.1 
ruby-block 0.3.6 
ruby-slim 0.2.0 
ruby-solargraph 0.3.0 
show-invisibles-plus 0.3.1 
valign 1.1.3 

Align by comma

It would be nice to align by comma. Example (ansible YAML):

roles:
  - { role: apt, tags: apt, when: apt_enabled }
  - { role: users, tags: users, when: users_enabled }
  - { role: nginx, tags: nginx, when: nginx_enabled }

Expected result:

roles:
  - { role: apt,   tags: apt,   when: apt_enabled }
  - { role: users, tags: users, when: users_enabled }
  - { role: nginx, tags: nginx, when: nginx_enabled }

Is it easy to implement?
Thanks.

Aligning object keys differently

I'd like to see an option to align objects keys like so:

var foo = {
    test    : 1,
    testing : 2
}

Instead of

var foo = {
    test:    1,
    testing: 2
}

Also, note that there is always at least 1 space before the colons. I would think this could pretty much copy the exact logic used for "="

Javascript grammar is broken.

$element.attr({
    'data-external': href,
    href: '#leavingDisney'
});
$element.attr({
    'data-external': href,
    href:               '#leavingDisney'
});

[scss] wtf

/**
 * @name Colors
 * @description
 *
 */

$color-black:      #343434;
$color-blue-dark:  #31435e;
$color-blue-light: #32afc2;
$color-blue:       #2e79cc;
$color-brown:      #704b2b;
$color-green-dark: #255732;
$color-green-light: #9fc62a;
$color-green:      #46a841;
$color-orange:     #c4681e;
$color-pink:       #b32e5d;
$color-purple:     #5a3b68;
$color-red:        #b32e2e;
$color-yellow:     #d2b12d;

Multiple align pivot and regex patterns as pivot

This is a request for enhancement.

On my old (and favorite) editor, vim, there was a plugin called Tabalign, which is what I was looking for when I searched for this package.

The features that would be interesting to see would be the following:

Multiple pivots

Defining multiple pivots, on which text would be aligned.
eg. From:

one two three
a b c
alpha beta gamma

To (with align= Left, Right, Left, pivot=space)

one    two three
a        b c
alpha beta gamma

Regex pivots
eg.
From:

one two three
a b c
alpha beta gamma

To, with pivot = /(?<=\w+ \w+)\s/ (a space preceded by two words)

one two    three
a b        c
alpha beta gamma

Do you plan on developping this package further?

Aligning on variable assignment

This is a great plugin. I have only one suggestion

from

var myvar1 = sometext,
  myvar2 = sometextlonger,
  myvarlonger3 = somettext,
  myvar4 = moretext;

to

var myvar1       = sometext,
    myvar2       = sometextlonger,
    myvarlonger3 = somettext,
    myvar4       = moretext;

Text is added

From: (cursor on first character, marked as |)

|   'enter':     'native!'
    'backspace': 'native!'
    'shift-backspace': 'native!'
    'tab':       'native!'
    'delete':    'native!'
    'insert':    'native!'
    'left':      'native!'
    'right':     'native!'
    'up':        'native!'
    'down':      'native!'
    'pageup':    'native!'
    'pagedown':  'native!'

To: (cursor on first line, last character, marked as |)

    'enter':     'native!'|
    'backspace': 'native!'
    'shift-backspace': 'native!'
    'tab':       'native!'
    'delete':    'native!'
    'insert':    'native!'
    'enter':           'native!'
    'backspace':       'native!'
    'shift-backspace': 'native!'
    'tab':             'native!'
    'delete':          'native!'
    'insert':          'native!'
    'left':            'native!'
    'right':           'native!'
    'up':              'native!'
    'down':            'native!'
    'pageup':          'native!'
    'pagedown':        'native!'

Other packages: vim-mode, ex-mode, linter
atom v0.201.0
debian jessie

Javascript `var` grammar is broken—again?

// before
var src = video.attr('src'),
type = video.attr('type');

// after
var src = video.attr('src'),
type    = video.attr('type');

// before
var src = video.attr('src'),
    type = video.attr('type');

// after
var src = video.attr('src'),
    type = video.attr('type');

Text is aligned from the first ':', event if it is in a string

From:

        'open:snippets': -> ws.open('/home/romgrk/.atom/snippets.cson')
        'open:commands': -> ws.open('/home/romgrk/.atom/node_modules/commands.coffee')
        'open:functions': -> ws.open('/home/romgrk/.atom/node_modules/functions.coffee')
        'open:init':     -> ws.open('/home/romgrk/.atom/init.coffee')
        'open:keymap':   -> ws.open('/home/romgrk/.atom/keymap.cson')
        'open:config':   -> ws.open('/home/romgrk/.atom/config.cson')
        'open:style':    -> ws.open('/home/romgrk/.atom/styles.less')
        'open:scribble':  -> ws.open('/home/romgrk/tmp/scribble.coffee')

To

        'open: snippets': -> ws.open('/home/romgrk/.atom/snippets.cson')
        'open: commands': -> ws.open('/home/romgrk/.atom/node_modules/commands.coffee')
        'open: functions': -> ws.open('/home/romgrk/.atom/node_modules/functions.coffee')
        'open: init':     -> ws.open('/home/romgrk/.atom/init.coffee')
        'open: keymap':   -> ws.open('/home/romgrk/.atom/keymap.cson')
        'open: config':   -> ws.open('/home/romgrk/.atom/config.cson')
        'open: style':    -> ws.open('/home/romgrk/.atom/styles.less')
        'open: scribble':  -> ws.open('/home/romgrk/tmp/scribble.coffee')

As you see, the first ':' is considered, instead of the second.

Uncaught RangeError: Invalid array length

Using the below lines (puppet script)

$prefix = hiera('net::dns::vpngw::default')
$env = hiera('net::dns::environment')
$topdomain = hiera('net::dns::topdomain')

Atom Version: 0.187.0
System: Mac OS X 10.10.2
Thrown From: valign package, v0.13.4

Stack Trace

Uncaught RangeError: Invalid array length

At /Users/af/.atom/packages/valign/lib/valign-formatter.coffee:2

RangeError: Invalid array length
  at getSpaces (/Users/af/.atom/packages/valign/lib/valign-formatter.coffee:2:10)
  at Object.module.exports.buildText (/Users/af/.atom/packages/valign/lib/valign-formatter.coffee:55:21)
  at Object.module.exports.formatBlock (/Users/af/.atom/packages/valign/lib/valign-formatter.coffee:150:13)
  at Object.module.exports.align (/Users/af/.atom/packages/valign/lib/valign.coffee:12:21)
  at atom-text-editor.atom.commands.add.valign:align (/Users/af/.atom/packages/valign/lib/valign.coffee:6:27)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:246:29)
  at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:558:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:396:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:182:20)

Commands

     -0:12.3 vim-mode:move-left (atom-text-editor.editor.vim-mode.is-focused.command-mode)
  7x -0:12.1 vim-mode:move-down (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:11.5 vim-mode:move-up (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:11.1 vim-mode:move-right (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:10.8 vim-mode:move-left (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:10.3 vim-mode:move-up (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:10.1 vim-mode:move-down (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:08.5 core:save (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:08.2 core:close (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:08.2 blur (atom-text-editor.editor.vim-mode.is-focused.command-mode)
     -0:05.2 core:close (div.settings-view.pane-item)
     -0:05.1 blur (div.settings-view.pane-item)
     -0:03.7 vim-mode:move-left (atom-text-editor.editor.vim-mode.command-mode.is-focused)
     -0:02.4 vim-mode:move-down (atom-text-editor.editor.vim-mode.command-mode.is-focused)
     -0:02.1 vim-mode:move-up (atom-text-editor.editor.vim-mode.command-mode.is-focused)
     -0:01.2 valign:align (atom-text-editor.editor.vim-mode.command-mode.is-focused)

Config

{
  "core": {
    "followSymlinks": true,
    "disabledPackages": [
      "linter-shellcheck",
      "project-manager",
      "linter-clang",
      "linter-javac",
      "linter-tidy",
      "tabularize",
      "vertical-align"
    ],
    "themes": [
      "one-dark-ui",
      "one-dark-syntax"
    ]
  }
}

Installed Packages

# User
aligner, v0.9.1
atom-beautify, v0.23.0
autocomplete-plus, v2.6.0
git-control, v0.1.8
git-projects, v1.11.1
language-puppet, v0.10.0
linter, v0.12.0
linter-puppet-lint, v0.2.8
linter-pylint, v0.2.1
linter-ruby, v0.1.4
valign, v0.13.4
vim-mode, v0.40.0

# Dev
No dev packages

Align the whole file

I was wondering if there was a way to auto-format an entire file with Valign instead of having to place my cursor on the segment to be aligned?

Alignment replaces indentation with spaces

Whenever I trigger an alignment, my tab indentations are replaced with spaces. This makes the plugin too destructive for me to use. Why is it even touching my indentation in the first place?

PHP Keyed Arrays

When using Valign with keyed arrays in PHP, the = gets separated from the >, resulting in a syntax error.

Example after using Valign:

<?php 

$my_array = array(
  'A' => array(
    'one' => array(
      'z'  = > 'hey',
      'aa' = > 'bee'
    )
  )
);

REQUEST: Alignment of colons too

You've created a great plugin for Atom, and I use it a lot!

Please, may I suggest a new feature. I was wondering if you could consider aligning the colons like you align the =. So instead of

var obj = {
  "beer":       "belly",
  "pork belly": "yummy",
  "yummy":      42
};

align it like this

var obj = {
  "beer"      : "belly",
  "pork belly": "yummy",
  "yummy"     : 42
};

In case you prefer the current behavior, you could also add an extra option in the Settings so the user can decide which version he prefers.

Javascript `var` grammar is broken–still.

Expect no change.

// before
feature_toggle = _.reduce(data.flags.split(','), function (result, value, key) {
    result[value]=true;
    return result;
}, {});
// after
feature_toggle    = _.reduce(data.flags.split(','), function (result, value, key) {
    result[value] = true;
    return result;
}, {});

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.