Code Monkey home page Code Monkey logo

idea-plugin-linessorter's Introduction

Lines Sorter is a plugin for Intellij-based products that sorts lines in text files (available from the Plugin Manager).

Just select lines and call either Edit->Sort Lines menu, or Alt+ Shift+L shortcut. When no lines are selected, the whole file is sorted.

##Notes

  • Sort is only case-insensitive and ascending
  • When the file ends with empty lines (only one line separator on the line), these empty lines are preserved at the end (they are not included in sort)
  • See Property Sorter plugin to sort property files in a smarter way
  • See String Manipulation for more advanced features about string operations. Should sort features have been implemented at the time, my plugin would not have existed!

idea-plugin-linessorter's People

Contributors

syllant 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  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

idea-plugin-linessorter's Issues

"linessorter.sort.group" was already registered.

com.intellij.diagnostic.PluginException: action with the ID "linessorter.sort.group" was already registered. Action being registered is null (null); Registered action is  (null) Plugin: Lines Sorter [Plugin: org.sylfra.idea.plugins.linessorter]
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.reportActionError(ActionManagerImpl.java:337)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.reportActionError(ActionManagerImpl.java:332)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.registerChameleon(ActionManagerImpl.java:1034)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.addToMap(ActionManagerImpl.java:1007)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.registerAction(ActionManagerImpl.java:990)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.registerOrReplaceActionInner(ActionManagerImpl.java:629)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.processGroupElement(ActionManagerImpl.java:687)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.processActionsChildElement(ActionManagerImpl.java:967)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.registerPluginActions(ActionManagerImpl.java:450)
	at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.<init>(ActionManagerImpl.java:136)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:85)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:62)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:45)
	at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:462)
	at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:246)
	at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:213)
	at org.picocontainer.defaults.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:77)
	at org.picocontainer.defaults.ComponentParameter.resolveInstance(ComponentParameter.java:114)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getConstructorArguments(CachingConstructorInjectionComponentAdapter.java:111)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:82)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:62)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:45)
	at com.intellij.openapi.components.impl.ServiceManagerImpl$MyComponentAdapter.getComponentInstance(ServiceManagerImpl.java:210)
	at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:246)
	at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:213)
	at org.picocontainer.defaults.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:77)
	at org.picocontainer.defaults.ComponentParameter.resolveInstance(ComponentParameter.java:114)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getConstructorArguments(CachingConstructorInjectionComponentAdapter.java:111)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:82)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:62)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:45)
	at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:462)
	at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:104)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$createComponents$9(ApplicationImpl.java:447)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
	at com.intellij.openapi.application.impl.ApplicationImpl.createComponents(ApplicationImpl.java:471)
	at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:88)
	at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:405)
	at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:391)
	at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:208)
	at com.intellij.idea.IdeaApplication.lambda$initApplication$0(IdeaApplication.java:74)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:342)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Not working in RubyMine 5.4.2

Heya,

Yeah I tried installing this into RubyMine 5.4.2 -- it seems to install ok, but the option doesn't show up in the Edit menu -- no "Sort Lines" or anything like that appears.

It can be found in the keyboard shortcut preferences pane, so I tried assigning it a keyboard shortcut -- but that doesn't work either.

Please let me know if you need more information. Thanks for creating this plugin.

Thanks,
Kevin Trowbridge
Software Developer
Lower Haight, SF
http://kevinmtrowbridge.com

Date sorting sorts based on day instead of month

Hello,

really nice effort.

However, the default sorting sorts date text based on the date, instead of month:

"03/11",
"03/12",
"04/01",
"04/02",
"04/03",
"04/04",
"04/05",
"04/06",
"04/07",
"04/08",
"05/02"

Is this something we could improve?

I can help with that if you want.

Regards,
Thodoris

remove duplicate lines

+1

i remember TextPad on windows had this functionality and it was super great to have! :)

Plugin prevents typing a pipe on french Mac keyboards

Just noticed this on PhpStorm 2016.2 : the plugin uses the default key combination used to input a pipe on a french Mac keyboard, causing very strange behaviors, like all the code getting reorganized when you are typing that very common character in a || in PHP, or a | in Bash.

Remapping from Preferences addresses the problem, but maybe it could avoid that combination.

Not sorting umlauts correctly

For example German countrys will be sorted to:

'Argentinien',
'Zypern',
'Ägypten',
'Äquatorialguinea',
'Äthiopien',
'Österreich',

but should be:

'Ägypten',
'Äquatorialguinea',
'Argentinien',
'Äthiopien',
'Österreich',
'Zypern',

Sorting is not handling "_" properly

Trying to sort these lines (which are already in order):

KOUNTA_GIFTCARD = "foo"
KOUNTA_GIFT_CARD = "bar"

Results in the reverse order:

KOUNTA_GIFT_CARD = "bar"
KOUNTA_GIFTCARD = "foo"

_ greater than C and c.

" vs '

I wish it could treat ' and " as the same for sorting. If I have a large file of import statements and some are using " and others ' it sorts all of the " before all of the '. Technically that's correct, but I feel like this is something that when sorting should be interchangable. Maybe add ` to that list as well?

Idealy it would be great to not have mixed quotation usage, but... ya know

Can't sort external window using menu action

When a file tab is in a separate window, the plugin cannot sort those tabs using the menu action.

Steps to reproduce:

  1. Open two different files in tabs,
  2. Drag one tab outside the main window,
  3. When you have that external tab focused, go to menu (necessarily of the main window) Edit -> Sort lines.

Expected behavior:
It sorts the lines in the external tab.

Actual behavior:
As soon as the menu is clicked, the main window is focused, and the last focused tab in the main window is now focused too. It sorts that tab instead of the external tab.

Possible workaround:
Use a keyboard binding to sort the external document.

Support to sort JSON

Hi @syllant, I am the co-author of Sort JSON and I am using your Lines Sorter plugin very much. Can you add the functionality to sort JSON? I often find myself in need to sort all JSON properties in WebStorm.

Here is an example of the source:

{
  "name": "@bennycode/my-package",
  "version": "1.1.2",
  "description": "Calculates the average.",
  "main": "index.js",
  "scripts": {
    "build": "tsc",
    "tscinit": "tsc --init",
    "prebenny": "echo before benny",
    "benny": "echo benny",
    "pretest": "echo before test",
    "test": "node getAverage.test.js",
    "posttest": "echo after test"
  },
  "author": "bennycode",
  "license": "MIT",
  "dependencies": {
    "ml-array-max": "1.x"
  },
  "devDependencies": {
    "typescript": "4.4.x"
  }
}

I would like to mark all the lines in WebStorm and sort them using your plugin like this:

{
  "author": "bennycode",
  "dependencies": {
    "ml-array-max": "1.x"
  },
  "description": "Calculates the average.",
  "devDependencies": {
    "typescript": "4.4.x"
  },
  "license": "MIT",
  "main": "index.js",
  "name": "@bennycode/my-package",
  "scripts": {
    "benny": "echo benny",
    "build": "tsc",
    "posttest": "echo after test",
    "prebenny": "echo before benny",
    "pretest": "echo before test",
    "test": "node getAverage.test.js",
    "tscinit": "tsc --init"
  },
  "version": "1.1.2"
}

Can you add this feature please?

Suggestion: sort lines based on columns or regex.

I made a similar suggestion for the atom 'lines' plugin...

I often need to sort lines, but not based on the entire value of the line, but just a portion of the line. For example consider this list of names and ages:

John Smith  22
Sally Smith 20
John Public 35

If I could sort using the values starting at column 12 (or, more specifically, columns 12-13), then I could sort by ages.

What's more, I often encounter text that isn't neatly formatted into columns. For example:

name="John Smith", age=22
name="Sally Smith", age=20
name="John Q. Public", age=35

In such a case, being able to use a RegEx to extract the group to sort by would be very powerful. For example, the RegEx /age=(\d+)/ would allow put the age value into group 1 ($1) which would then be sorted upon.

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.