开发者

Searching in Xcode not finding results (searching my source)

I'm pulling my hair out on this and Google res开发者_StackOverflow社区ults are skewed since it thinks I want to find out how to code something.

My problem is that when trying to search my code with the String Matching box it finds nothing, even if I enter something that is on the screen below.

Is it Spotlight that is delivering these results? I'm not excluding anything in my Spotlight index so should I just rebuild the index?


At the top of the Xcode search field, you probably want to select:

Find > Text > Containing

rather than any of:

Find > Text > Matching
Find > References > Matching
Find > References > Containing

I did not (knowingly) switch this to "Text Matching" or "References", but there it was set. "Text Containing" is a more useful search type for most searches.


This happens to me after doing this: from editor, select a word, then right-click on it, then choose "Find Selected Symbol in Workspace".

As a consequence, the finder automatically sets itself to:

Find > Reference > Containing

To search for a given text, you have to re-set it to:

Find > Text > Containing


Sometimes this happens to me when the "In Selected Items" is selected in the combobox on the right side of the search string.

If this selected, you only get a search in whatever files are selected in your project window. Change it to "In Project" to search all your source files.

Note that the files need to be inside of your current Xcode project (just opening them from the finder won't add them.) You may also be interested in the "In Open Files" option, which is faster for large projects.


Even with all filters disabled as described in previous answers, Xcode still doesn't always find all occurrences of a string in some of my projects, even though these occurrences are reached just fine when choosing Jump to Definition.

To do a literal full text search (note, this is much slower than the pre-indexed search), you can create a Search Scope that just searches the full project folder, by adding a Folder location in the Scope editor:

Searching in Xcode not finding results (searching my source)


I got stuck on this one because I didn't realize that I had to hit RETURN to see the search results, haha. Normally the results changes dynamically as you write, but Xcode 11 apparently doesn't have that feature yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜