Sublime Forum

Goto Anything picks low-ranked file

#1

I have a file called callbacks.c, and my IDE makes a ton of associated files that I want to look at frequently enough that I don’t exclude them from the project. Fortunately, Sublime Text 2 uses some magic algorithm to realize that I want .c and .h files more than, say, .i files.
Now say I’m trying to open callbacks.c using goto anything. Everything seems to be working fine:


but I’m tying really fast, and now I hit c and suddenly Goto Anything thinks I want a different file:


Coincidentally this is always around the time that I hit enter to open the file, and I end up having to retry and slow down.
What am I doing wrong? It seems like it shouldn’t be selecting callbacks.lst, because its match rank is only 548 to callbacks.c’s 590.
Thanks!

0 Likes

#2

Incidentally if I then hit “k” the selection pops back up to “callbacks.c”.

0 Likes

#3

My hunch is that this is related to it remembering your selection for previously entered terms, rather than something to do with typing fast. You can verify this by editing your .sublime-session (if you aren’t using a project) or .sublime-workspace (if you are using a project) and removing the “select_file” key, which maps search terms to the selected file.

0 Likes

#4

That is exactly what it was. I had

				"callbac",
				"Project/Debug/List/callbacks.lst"
			],

in there.
It’s related to typing fast only in that when I’m tying fast I’m not really paying attention to the actual results, and I get surprised when it suddenly picks a file I wasn’t expecting. :smile:
Is there any way I can stop it from maintaining a select_file list? It’s a cool feature, I think, but it also requires me to hold more state in my brain. I’d rather type “calllst” or something to get the list file than have it remember (and have to remember myself) that “callbac” means “callbacks.lst”.

0 Likes

#5

I discovered a similar issue. If I have two files with the same name in my project, but one of them is open, I want Goto File to give priority to the open file.

0 Likes