Sublime Forum

Don't show 'Files that are unable to open' in find results

#1

Hi team,

I don’t want ‘files that are unable to open’ in my find results. Is there any option to do this?

5 Likes

#2

We show this since we can not tell if the file contained the string or not. We don’t want to give users the impression that we are returning every instance of the search terms, so we show that there were errors.

3 Likes

#3

If you know which files can’t be opened, whether it be due to permissions or whatever, you can exclude them from the search in the first place using the relevant glob that will match the path of the files.

3 Likes

#5

Thanks for the reply. Ya I got that. But how can i exclude a folder purposely from search?

1 Like

#6

Thanks kingkeith. May I know how i can exclude a folder during search? What should be my exclude filter, say my folder name is ‘modules’ and path is parent\test\modules

1 Like

#7

Using Find In Files, set the Where field to:

/my/path,-/my/path/modules/*
3 Likes

#8

+1 for the ability to turn this off or minimize. I know the ways around it, but sometimes you just want to search everything without worrying that you excluded the file you are looking for.

2 Likes

#9

maybe a good solution would be if ST3 logs the files that couldn’t be searched to the console, and just contains a single message in the search results to say “some files couldn’t be searched, check the console for details”.

That way, the people that want to see the details can easily do so, and people that don’t want it getting in the way of actual search results are also satisfied :slightly_smiling:

1 Like

#10

These errors are not displayed when a file is excluded, but a filesystem permissions error occurs, or the file is too large to read into memory, or some similar “exceptional” case where Sublime Text is unable to do what you asked it to (search for terms in all files in a folder).

I don’t really want to add UI for something that generally makes it easier to shoot yourself in the foot. One possible option would be to maintain a list of files with errors and print them all at the end of the search results.

If you like this idea, I suggest submitting it at https://github.com/SublimeTextIssues/Core/issues so we can track it with other enhancement ideas.

2 Likes

#13

Nice idea, but in my case the files are all over my code base - not limited to a single file location that I could eliminate in a glob. In addition, the files that are in the list end up being empty - they often belong to a different git branch than the one I’m currently on.

It’s increasingly difficult to do a search - and then have to scroll through all of the errors. Do I have any other options I can use to get rid of noisy results?

Thanks!

2 Likes

#14

You could copy and paste the search results to a new tab and use find & replace with a regex to remove the files with errors. However, you would lose the ability to double click on the results to open the relevant file at the location of the search result…

1 Like

#15

I’m developing Python with virtualenvs. Some symlinks in the internal lib dirs are usually broken because they are valid only in some docker containers. Therefore, every search shows tons of “Unable to open” items. But I don’t care about these and don’t want to spend time every time to set the globs correctly.

All in all, I’d be grateful if there was a setting where I could turn this off.

2 Likes

#16

Hi is there a workaround for this? Im in the same case as @allprog

1 Like

#17

Hi!

I created a Sublime Text plugin disabling those “ERROR: Unable to open file” messages.
Just install “Ignore Unable to Open File Error” plugin through Package Control and you won’t see the errors.

Let me know if you have any feedback!

GitHub repo: https://github.com/everyonesdesign/IgnoreErrorUnableToOpenFile

2 Likes

#18

Putting this here for when my future self has the same question.

For me this was caused by files in venv/.

Solution: The workaround is adding -*venv/* to the where: field when using find all.

0 Likes

#19

Hello. I just registered to leave this message for other people that find this thread later.
Since Build 4151, SublimeText has a flag called “find_in_files_suppress_errors”.
Set it to true and you will not see these errors, only a summary of how many errors were suppressed.

1 Like