Giter VIP home page Giter VIP logo

atom-sorter's Introduction

atom-sorter's People

Contributors

florianwendelborn avatar phyllisstein avatar xapphire13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

phyllisstein

atom-sorter's Issues

YAML Sorting Priority

No idea how to solve the current issues with YAML sorting being far too greedy. Probably gonna need another keyboard shortcut or something similar. ๐Ÿ˜ข

Uncaught TypeError: Cannot read property 'replace' of null

[Enter steps to reproduce:]

  1. Right click -> Sort

Atom: 1.38.2 x64
Electron: 4.1.4
OS: linux 5.1.15-arch1-1-ARCH
Thrown From: sorter package 1.3.0

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of null

At /usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:1319

TypeError: Cannot read property 'replace' of null
    at TextBuffer.setTextInRange (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:859:27)
    at newRange.transact (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:846:49)
    at TextBuffer.transact (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:1316:16)
    at TextBuffer.setTextInRange (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:846:29)
    at TextEditor.setTextInBufferRange (/usr/lib/atom/src/text-editor.js:1364:29)
    at getRanges.forEach.range (/packages/sorter/source/index.js:54:10)
    at Array.forEach (<anonymous>)
    at sort (/packages/sorter/source/index.js:53:27)
    at /packages/sorter/source/index.js:37:25)
    at CommandRegistry.handleCommandEvent (/usr/lib/atom/src/command-registry.js:384:43)
    at CommandRegistry.dispatch (/usr/lib/atom/src/command-registry.js:273:17)
    at AtomEnvironment.dispatchContextMenuCommand (/usr/lib/atom/src/atom-environment.js:1383:19)
    at EventEmitter.outerCallback (/usr/lib/atom/src/application-delegate.js:305:47)
    at EventEmitter.emit (events.js:182:13)

Commands

     -2:31.3.0 application:add-project-folder (ol.tree-view-root.full-menu.list-tree.has-collapsable-children.focusable-panel)
  2x -2:12.4.0 editor:newline (input.hidden-input)
     -2:10.1.0 core:paste (input.hidden-input)
     -2:09.0 core:move-up (input.hidden-input)
     -2:05.8.0 core:paste (input.hidden-input)
  2x -1:55.4.0 sorter:sort (div.line)
     -1:47.2.0 duplicate-removal:toggle (div.line)
     -1:36.7.0 window:save-all (input.hidden-input)
     -0:35.5.0 editor:newline (input.hidden-input)
     -0:30.5.0 core:paste (input.hidden-input)
     -0:29.8.0 editor:newline (input.hidden-input)
     -0:28.3.0 core:paste (input.hidden-input)
     -0:21.9.0 sorter:sort (div.line)
     -0:19.9.0 duplicate-removal:toggle (div.line)
     -0:15.1.0 window:save-all (input.hidden-input)

Non-Core Packages

atom-beautify 0.33.4 
atom-file-icons 0.7.1 
duplicate-removal 0.1.3 
scroll-color 0.3.0 
sorter 1.3.0 

Uncaught TypeError: Cannot read property 'replace' of null

[Enter steps to reproduce:]

  1. Right click -> Sort

Atom: 1.42.0 x64
Electron: 4.2.12
OS: linux 5.4.12-arch1-1
Thrown From: sorter package 1.3.0

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of null

At /usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:1323

TypeError: Cannot read property 'replace' of null
    at TextBuffer.setTextInRange (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:863:27)
    at newRange.transact (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:850:49)
    at TextBuffer.transact (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:1320:16)
    at TextBuffer.setTextInRange (/usr/lib/atom/node_modules/text-buffer/lib/text-buffer.js:850:29)
    at TextEditor.setTextInBufferRange (/usr/lib/atom/src/text-editor.js:1561:29)
    at getRanges.forEach.range (/packages/sorter/source/index.js:54:10)
    at Array.forEach (<anonymous>)
    at sort (/packages/sorter/source/index.js:53:27)
    at /packages/sorter/source/index.js:37:25)
    at CommandRegistry.handleCommandEvent (/usr/lib/atom/src/command-registry.js:405:43)
    at CommandRegistry.dispatch (/usr/lib/atom/src/command-registry.js:292:17)
    at AtomEnvironment.dispatchContextMenuCommand (/usr/lib/atom/src/atom-environment.js:1583:19)
    at EventEmitter.outerCallback (/usr/lib/atom/src/application-delegate.js:329:47)
    at EventEmitter.emit (events.js:182:13)

Commands

     -8:09.5.0 core:paste (input.hidden-input)
     -5:17.2.0 core:copy (span.syntax--meta.syntax--paragraph.syntax--text)
  2x -5:15.8.0 core:backspace (input.hidden-input)
     -5:13.3.0 find-and-replace:show (input.hidden-input)
     -5:11.6.0 core:paste (input.hidden-input)
  3x -5:10.5.0 core:confirm (input.hidden-input)
     -4:42.3.0 sorter:sort (div.line.cursor-line)
     -4:40.6.0 duplicate-removal:toggle (div.line)
     -4:32.1.0 window:save-all (input.hidden-input)
     -2:01.4.0 editor:newline (input.hidden-input)
     -2:00.1.0 core:paste (input.hidden-input)
  2x -1:50.9.0 core:backspace (input.hidden-input)
     -1:39.5.0 core:copy (span.syntax--meta.syntax--paragraph.syntax--text)
     -0:46.4.0 sorter:sort (div.line)
     -0:44.8.0 duplicate-removal:toggle (div.line)
     -0:35.9.0 window:save-all (input.hidden-input)

Non-Core Packages

atom-beautify 0.33.4 
atom-file-icons 0.7.1 
duplicate-removal 0.1.3 
scroll-color 0.3.0 
sorter 1.3.0 

Can only sort JSON and YAML

With the recent update for YAML, everything that isn't JSON is sorted as YAML which yields a garbage file.

The culprit is this try/catch

Seems like the solution is to detect if a file is actually YAML, this could easily be done by checking the current grammar of the file.

Note: Kind of a dupe of #4, however the title of that issue is more of feature description rather than symptom description.

Sorting inline stuff (html attributes, javascript object keys, css)

  • JSON
  • HTML attributes
  • CSS
  • JavaScript Objects

This is just such an awesome plugin. Thank you for it. I use it regularly to sort keys in javascript objects:

{z:true, b:false} => {b:false, z:true}

But I was hoping to use it on html attributes as well, but it splits on the = so it doesnt work. Is it possible to make it not split on =?

Like:

zid="body" key="body"

Should sort to:

key="body" zid="body"

Also some time in my js objects I have a space between the colon so like this:

{z: true, b: false}

And this fails to sort, is it possible to ignore the first space after a colon?

Example of inline css:

position: absolute; top: 1; bottom: 3;

A regex split that would work for this is /\:\w*/ or for equals sign: /\=\w*/

Unable to sort if has default options

In javascript lots of times we have default values for arguments, something like this:

function({ foo, bar, qux=8, baz=9 })

Some people put spaces between the ='s sign.

If I highlight within the curlies and try to sort it fails. :(

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.