-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New default sortables #2
Comments
Hey, great work on this plugin, it's really cool! The first thing I went for was trying to sort the values of an array in typescript. This code works for string and number values :
Small caveat, there are many filetypes that the sortables should apply to. So maybe it would make sense to extract some defaults and let users apply them to the filetypes that they're interested in, e.g. vue/astro/svelte |
Hey, glad you like the plugin! This looks good. Just a heads up the order_by is optional as that's the default behavior (sort alphabeticlaly) so this can be simplified to: sortables = {
typescript = {
array = {
node = { "number", "string" },
},
},
}, Yes unfortunately javascript has a lot of filetypes 😅. With the current implementation you would have to define the same sortable for each filetype (assuming they all have the same capture nodes). I think the idea of having defaults that can be reused across multiple filetypes is interesting, I can definitely look into that. Another idea worth looking at would be to have filetype groups. I'm currently doing some clean up of the code and adding testing to make it easier to contribute to so I'll have to get back to this at a later date. I appreciate the issue though! |
Sorting a list of arguments in
|
What is the config to sort HTML attributes in a PHP ? When I use |
Have you tried running |
Hey @uwla thank you for the ticket. I was able to repro this as well. It looks like I need to take injected languages into account when getting the current node under the cursor. It was completely ignoring those attribute nodes and jumping straight to the top level text node. I'll have a fix out in a few minutes. |
@mtrajano It does work now, at least in PHP. THanks! |
Submit requests for any new default sortables in this issue. Please include the filetype and the behavior you think should be default.
The text was updated successfully, but these errors were encountered: