Sublime Forum

Sorting CTRL-R

#1

Is there any way to sort (alphabetical order) CTRL-R output ?

0 Likes

#2

I do not believe so. I’m pretty sure it is sorted by a combination of factors, including how close a match it is to what you typed, and how recently you opened the file.

0 Likes

#3

Or maybe it is not sorted since the labels given to quick_panel are an iterative keys ?

0 Likes

#4

Ok, so no default sort.

But do you know if there is a way to sort this usigng a plugin ?

I searched in the API but didn’t find a way to do this. Because of the lack of outline panel, this probleme is kind of blocking for big projects.

0 Likes

#5

I’ll post you my home-made plugin tomorrow : it displays a list of attributes for a given as3 or MXML file. I guess you’ll easily be able to convert it for your language and then sort the way you want the results.

0 Likes

#6

Here it is : github.com/lorem–ipsum/SublimeOutliner

This is my first attempt at coding in Python, so please be indulgent :smile:

0 Likes

#7

[quote=“loremipsum”]Here it is : github.com/lorem–ipsum/SublimeOutliner

This is my first attempt at coding in Python, so please be indulgent :smile:[/quote]

Just take a quick look but wonder what’s the difference with the standard ctrl+r ?

0 Likes

#8

Well, it only matches with methods or properties, depending on what you invoke. I find it quite useful…

0 Likes

#9

Why couldn’t you use the Symbol List config for this task ?
Take a look at:

Packages\Python\Symbol List.tmPreferences
0 Likes

#10

Yes, that’s interesting. I assume I could develop a cross-languages version of my plugin…

0 Likes

#11

Actually, what I mean is that you probably don’t need any plugin.
Just set showInSymbolList settings for your file syntax and the ctrl+r will be populated with what you want.
But your tmLanguage must clearly identify what you want with a scope name.

And you couldn’t change the order of the items in the list, what the OP asked.

Using syntax scope searching is way more generic than using regexp, take a look at this post (https://forum.sublimetext.com/t/goto-symbol-performance-issue/2646/1) for a small example.

0 Likes

#12

You’re right, but I like the fact that I can choose whether the QuickPanel display properties or methods. Can I do such a distinction with the built-in got_to command ?

0 Likes

#13

I didn’t notice the parameter of run().
You’re right, I don’t think there is a way to dynamically change the showInSymbolList settings.

You can still use the self.view.find_by_selector() API method to search the properties or methods, probably more generic if you intend to use your plugin for other language.

0 Likes