Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Feature request: Sorting Packages & Themes #9

Open
thedaniel opened this issue Aug 12, 2015 · 35 comments
Open

Feature request: Sorting Packages & Themes #9

thedaniel opened this issue Aug 12, 2015 · 35 comments

Comments

@thedaniel
Copy link
Contributor

From @boustanihani on February 17, 2015 11:4

Could you please allow sorting search results on https://atom.io/packages & https://atom.io/themes by the number of downloads and the number of stars ?

And maybe also inside the Atom Editor...

Copied from original issue: atom/apm#303

@thedaniel
Copy link
Contributor Author

From @jwerre on June 26, 2015 15:2

👍

apm search --packages --sort downloads|stars package_name

@thedaniel
Copy link
Contributor Author

From @simurai on June 30, 2015 4:29

This is already possible on atom.io, but kinda hidden and not that obvious:

  1. Click on the "See all" link
    screen shot 2015-06-30 at 1 23 55 pm
  2. Then change to "Most Downloads"
    screen shot 2015-06-30 at 1 24 21 pm

Maybe there could be an "All packages" as a 4th section, but instead of having the package cards, it could have the dropdown to filter or just links.

@thedaniel
Copy link
Contributor Author

From @boustanihani on June 30, 2015 14:11

The "See all" link disappears when you search for something, there is still no way to sort search results...

Currently you can only sort all packages without filtering...

@thedaniel
Copy link
Contributor Author

From @simurai on June 30, 2015 23:21

@boustanihani I see, I missed the "search results" part.

@thedaniel
Copy link
Contributor Author

From @kenden on July 29, 2015 13:9

+1
Allowing to order packages/themes by number of stars / number of downloads from the Settings inside Atom would really help in choosing one.

@MatthewSteen
Copy link

👍

@danielbayley
Copy link

+1 for sorting search results based on downloads or stars 👍

@grantcarthew
Copy link

+1

@faddat

This comment has been minimized.

@a-laughlin
Copy link

+1. As someone trying out Atom, being able to see popular packages in preferred languages would help to get a feel of how much package support for there is for each language.

@gtranchedone
Copy link

+1

1 similar comment
@yevgeniy-belov
Copy link

+1

@TakanashiOuken
Copy link

I tried to add &sort=downloads after search, but does not work :(

@PixelT
Copy link

PixelT commented May 9, 2016

+1

@shakvaal

This comment has been minimized.

@alan-givati
Copy link

Sorting in Atom itself would also be great, but at least at atom.io would be good enough. Its really hard to find packages at the moment - too much noise.

@boustanihani

This comment has been minimized.

@samueloph
Copy link

Just to give an idea of how bad it is right now to find a package, i was just willing to install the linter package and by searching "linter " i had to scroll down to the last result, that is, to find one package that perfectly matched my search string and has about 100 times more downloads than the 5 first results that do not perfectly match the search string i had to go to the last result (i believe the editor only shows the first page of the searches.

@samueloph
Copy link

thedaniel commented on 12 Aug 2015

From @jwerre on June 26, 2015 15:2

👍

apm search --packages --sort downloads|stars package_name

That didn't work, i've tried with stars and downloads.

@doivosevic
Copy link

Am I missing some package that fixes this due to this bug?

@Toub

This comment has been minimized.

@mibamur
Copy link

mibamur commented Jun 29, 2016

Command line solution

Zsh "Atom Find with Sort Package + Cache Hour"

Create file /usr/local/bin/apms

#!/bin/zsh

a=$1
b=$2
F="$a.`Date +%H`"

echo "\nAtom Find with Sort Package + Cache Hour"
# Cache by Last Find Sort Package + Hour
mkdir -p ~/.apmrc
if [[ -f ~/.apmrc/$F ]]; then
  echo ''
else
  apm search $a > ~/.apmrc/$F
fi

case $b in
  "-s" )
    cat ~/.apmrc/$F | sed "s#(#( #g" | grep \) | awk '{print $(NF-1),$0}' | sort -n -r
    ;;
  "-d" )
    cat ~/.apmrc/$F | sed "s#(#( #g" | grep \) | awk '{print $(NF-3),$0}' | sort -n -r
    ;;
  *)
    echo "Usage: apms package -s|-d"
esac

chmod +x /usr/local/bin/apms

Example usage

apms git -s stars
apms git -d downloads

Atom Find with Sort Package + Cache Hour

673401 ├── git-plus Do git things without the terminal 673401 downloads, 1580 stars)
222739 ├── language-git Git editing support in Atom 222739 downloads, 37 stars)
...
63 ├── git-authors View authors for the currently active authors 63 downloads, 1 star)
23 ├── simple-git Git commands to help your workflow. 23 downloads, 0 stars)

@mibamur
Copy link

mibamur commented Jun 29, 2016

JS solution

Draft for json apm search --json package

var fs = require('fs');
var packs = JSON.parse(fs.readFileSync('~/.apmrc/package.json', 'utf8'));
packs.sort(function(a, b) {
  return b.downloads - a.downloads;
});

console.log(packs.map(function(arg) {
  var downloads, name;
  name = arg.name, downloads = arg.downloads;
  return {
    name: name,
    downloads: downloads
  };
}));

@jt3k
Copy link

jt3k commented Jul 25, 2016

do sorting packages in search results

@jon-freed
Copy link

jon-freed commented Aug 30, 2016

Good news in relation to @thedaniel 's request (at top) for sorting inside the Atom Editor, because its search results are now defaulted to sort by the number of downloads in descending order. This is true as of the settings-view package's release v0.241.2 on 2016-08-10.

However, that package is part of core, and therefore it cannot be updated via the normal Atom Editor's functionality for updating a package. It is not part of Atom 1.9 releases. It is part of 1.10, which is currently available as a beta release](https://atom.io/releases).

Credit/blame for this new sort-by functionality would appear to go to @bastilian, who put the sortBy downloads code in place on 2016-04-05. (Thank you @bastilian!)


For posterity, here is the walk-through I did just before I discovered that the sortBy downloads functionality is already in a release.

  1. Start with Atom editor's Settings > Install package's search code. (See lines 154-176.) There is already a sortBy option that is hard-coded to "downloads" on line 160.
  2. That code calls the package-manager search. (See line 222.)
  3. That package-manager code calls "apm" search, which (see lines 27-41) seems to requests search results in json format from https://atom.io/api/packages/search and then does some filtering and formatting. (If the website or apm can do sorting, then that functionality is not being used at this time. I haven't yet been able to find the api/packages/search code at the moment to identify its capabilities, and arguably the sorting of a reasonably limited set of search results is a task for the client code anyways.)
  4. The package-manager code then JSON-parses the apm search results and processes the sortBy option (see lines 236-237). In this case, sortBy was set to "downloads", so this code is sorting the results by downloads.
      packages = _.sortBy packages, (pkg) ->
        return pkg[options.sortBy]*-1

@TigersWay
Copy link

Any news about this one? It's still quite a mess to find any relevant package, no sort and no keyword combination.
Thanks

@alpha358
Copy link

alpha358 commented Apr 2, 2017

Is there any specific reason why sorted search is not implemented here ?

@awhillas

This comment has been minimized.

@tweakimp
Copy link

tweakimp commented Feb 7, 2018

This is such a needed feature and rather easy to implement, the code is already there, just put it on the search results page and in the atom editor, too.

@jt3k

This comment has been minimized.

@charrismatic
Copy link

Please consider adding this feature. When I try to search for a package to add sometimes the top three results will each have only 2-4 stars and somewhere far down the page a much more developed and stable package with 200,000 stars will almost be overlooked.

It leads people to install packages that might not be production ready when much better options are out there.

@milesfrain
Copy link

@johnmgarretson's fix seems perfectly reasonable for the time being, but was rejected because the Atom team wants to keep package search sorting and filtering logic in the closed-source backend.

We believe that this would be a step backward and the real solution is to fix the search behind the API. Because of that, we've decided to not accept this change.

Originally posted in atom/settings-view#1128 (comment)

Backend sorting has been broken for at least 4 years. #9 (comment)

Here's the ordering we see today in the editor (same as CLI). The most-adopted package is number 16 in the list. Lots of scrolling. Not a good user experience, especially for new users.

apm search --packages --sort downloads vim
Search Results For 'vim' (30)
├── vim-mode-zz Allows to close opened tabs with Vim's ZZ command (5485 downloads, 12 stars)
├── vim-surround vim-surround for Atom! (28806 downloads, 97 stars)
├── atom-vim-like-tab Add Vim like tab features in Atom (1882 downloads, 8 stars)
├── vim-modeline Enable Vim-style modeline in Atom. (7002 downloads, 14 stars)
├── vim-mode-clipboard-plus Add clipboard-plus feature to vim-mode-plus (8299 downloads, 36 stars)
├── vim-mode-plus-duplicate Duplicate an area of text using vim-mode-plus motions and text-objects. (431 downloads, 1 star)
├── atom-vim-keymap A vim keymap for the one time you forgot a command. (700 downloads, 2 stars)
├── vim-mode-plus-macros Implements macros for vim mode plus (1363 downloads, 3 stars)
├── vim-mode-plus-exchange Exchange two areas of text like vim-exchange. (647 downloads, 2 stars)
├── open-vim Open a current file in Vim (3753 downloads, 13 stars)
├── vim-mode Deprecated - please install vim-mode-plus instead (627952 downloads, 1018 stars)
├── atom-vim-colon-command-on-command-pallete Add colon command on Command Pallete to vim-mode (1897 downloads, 1 star)
├── vim-mode-plus-patch-switch-ime Deprecated - Vim-mode-plus has integrated the patch (94 downloads, 0 stars)
├── vim-mode-plus-keymaps-for-git Provides keymaps for vim-like navigation and control of git functionality in atom (212 downloads, 0 stars)
├── vim-mode-plus-keymaps-for-tree-view Provides keymaps for vim-like navigation and control of the tree-view in atom (309 downloads, 0 stars)
├── vim-mode-plus vim-mode improved (691289 downloads, 482 stars)
├── vim-mode-next Deprecated in favor of vim-mode-plus (2363 downloads, 6 stars)
├── vim-mode-visual-block [DEPRECATED] Add visual-blockwise feature to vim-mode (16429 downloads, 53 stars)
├── vim-mode-transpose Transpose characters with one command in vim-mode (177 downloads, 0 stars)
├── vim-mode-plus-auto-ime automatically change ime when vim mode changes (376 downloads, 2 stars)
├── vim-fold-one A short description of your package (103 downloads, 1 star)
├── vim-shift-movers Give your arrow keys a reason to live! (775 downloads, 0 stars)
├── vim-mode-plus-ex-mode Use original ex-mode instead of this package (51181 downloads, 97 stars)
├── language-viml Vim Script language support for Atom (11100 downloads, 53 stars)
├── atom-keyboard-macros-vim A short description of your package (3464 downloads, 13 stars)
├── vim-mode-plus-move-to-symbols Motion for move-to-symbols (3637 downloads, 9 stars)
├── vim-mode-plus-move-selected-text Move selected text like object (5304 downloads, 16 stars)
├── vim-plus-autocomplete-emmet-compatibility A short description of your package (1374 downloads, 1 star)
├── no-evil-eol-newline Hide the last 'new line', just like vim does. (163 downloads, 2 stars)
└── vim-mode-plus-jasmine-increase-focus increase, decrease focus level of jasmine spec (973 downloads, 3 stars)

@jt3k
Copy link

jt3k commented Oct 2, 2019

it is sad

Does anyone here know about the existence of a plugin that could add sorting capability to Atom?

@charrismatic
Copy link

I wanted to see how hard it would be to create solution to this problem, so this weekend I sat down and made a little wrapper utility around the apm search command. I think it turned out pretty nice, it can sort by stars or downloads, and filter by theme, package, or show the current featured list. It also formats the list cleanly, cuts off long text at the screen edge (so theres no broken lines from wrapping) and colorizes the columns.

If youre interested the project repo is here https://github.com/charrismatic/atom-advanced-search and I published it to NPM so you can also install it directly with npm install -g atom-advanced-search

Hopefully someone find this useful.

@glenntanner3
Copy link

glenntanner3 commented Nov 24, 2021

If someone wants to make this cleaner and commit it, this works on v1.58.0.

  • Checkboxes not aligned
  • No default selection configuration
  • Does not invoke search on change, intentional

/usr/lib/atom/node_modules/settings-view/lib/install-panel.js

--- a/usr/lib/atom/node_modules/settings-view/lib/install-panel.js.bak
+++ b/usr/lib/atom/node_modules/settings-view/lib/install-panel.js
@@ -181,7 +181,25 @@ var InstallPanel = (function () {
                   { ref: 'searchThemesButton', className: 'btn btn-default', onclick: this.didClickSearchThemesButton.bind(this) },
                   'Themes'
                 )
-              )
+              ),
+              _etch2['default'].dom(
+                'div',
+                { className: 'checkbox' },
+                _etch2['default'].dom(
+                  'input',
+                  { ref: 'searchSortDownloads', className: 'input-checkbox selected', type: 'checkbox', id: 'searchSortDownloadsID', checked: true }
+                ),
+                'Downloads'
+              ),
+              _etch2['default'].dom(
+                'div',
+                { className: 'checkbox' },
+                _etch2['default'].dom(
+                  'input',
+                  { ref: 'searchSortStars', className: 'input-checkbox', type: 'checkbox', id: 'searchSortStarsID' }
+                )
+              ),
+              'Stars'
             ),
             _etch2['default'].dom('div', { ref: 'searchErrors' }),
             _etch2['default'].dom('div', { ref: 'searchMessage', className: 'alert alert-info search-message icon icon-search' }),
@@ -322,6 +340,9 @@ var InstallPanel = (function () {
           this.refs.searchMessage.style.display = '';
         }
 
+        if (searchSortDownloadsID.checked && searchSortStarsID.checked) { packages.sort(function(a, b) {return b.downloads - a.downloads || b.stargazers_count - a.stargazers_count;}); }
+        else if (searchSortDownloadsID.checked) { packages.sort(function(a, b) {return b.downloads - a.downloads;}); }
+        else if (searchSortStarsID.checked) { packages.sort(function(a, b) {return b.stargazers_count - a.stargazers_count;}); }
         this.addPackageViews(this.refs.resultsContainer, packages);
       } catch (error) {
         this.refs.searchMessage.style.display = 'none';

EDIT: atom/settings-view#1203

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests