Searching in Xcode not finding results (searching my source) - xcode

I'm pulling my hair out on this and Google results 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:

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.

Related

Global search in Xcode 10.1

I'm trying to search through my entire project using CMD + SHIFT + F.
When I'm searching for anything that contains a dot (.) in the query the search will not find anything even though I literally just copied it from the code. For example I am searching for this:
self.init
and I get "no results for self.init"
I can't find any option that maybe regular expressions would be activated.
How can I make XCode to find any string I type into the search field (even when it contains dots)?
Press command4, or shiftcommandf to open the left side menu. In there, you can search using regular text search, regex, and more.
When searching for plain text, make sure that you're not matching regex. For this, press the button next to Find and select Text from the dropdown:

Is there a way to make the Quick Find dialog wait until you hit enter to find results in Visual Studio 2015?

When I'm trying to search for something in the current document, I think it's really annoying that VS immediately starts trying to find a match when I've only typed a single character. The document ends up jumping all over the place, causing me to lose my spot. Is there any way to make it so VS doesn't start looking for results until I actually hit enter?
You could just use the find and replace dialog instead of quick find. ctrl+shift+F or Edit > Find And Replace > Find in Files. Then just switch the dropdown to current document. Although this creates a list that you can click through rather than navigating directly.

Project wide word matching search on Xcode 5

I'm using Xcode 5, and want to find a word (ex:variable name) not by substring match but by exact match (or prefix match). In file wide search (Command-F), I can use Textual search or regular expression search by clicking the arrow button just right of the glass icon and choosing "Edit Find Options...".
But, I cannot find any option to search on project wide search ("Find in Project", Shift-Command-F), in Xcode 5.
One thing I can do is run "grep -w" on Terminal.app. But, isn't there any way to search word in Project inside Xcode?
Well it seems that the search tool in Xcode 5 is a bit confusing for a lot of people. In my opinion Apple should have done a better work letting the user know of what is clickable and what not... That being said, here is how you access the different options:
Once we switch to the Find Navigator we see 3 components (Find>Text>Containing)
Now, you can click on any of them to select between different options (à la jumpbar)
And finally you can also click the In Workspace (or In Project) to change the scope of your search
In Xcode 6 the problem I was having was that my Framework folder wasn't being searched, even though it was clearly part of the project (but in /Library/Frameworks), and even when I had one of its files open with the string showing in the editor.
Changing the scope from In Project to My Scope (as shown) even allowed me to find the search string in non-frameworks folders.

Excluding strings from Xcode project search

I have objects with similar names and when searching the project in xcode for e.g. currentTrack, objects with a name e.g. currentTrackList also appear in the search finder.
Is there a way to exclude strings or pick out e.g. only currentTrack and ignoring currentTrackList from search query?
I have heard about Code Pilot but never used it. Can code pilot do this?
If you look at the drop down in the search tab (next to the search icon there is a downwards arrow in the search field), there is an option called show find options, in that there is a section called Hits Must:
Change that to match search term
By default its on contain search term

Fastest way to "jump back" to a file in TextMate?

Often, when I am reading code or debugging, I want the ability to quickly jump around files. I especially want to "go back" to where I was. I know about "Command+T", "Command+Shift+T", and, bookmarks. But, I cannot figure out a way to jump around files quickly.
UPDATE: I do not think I my question was clear enough judging by two answers given. Specifically, I am looking for a way to "jump back" to where I was in a file. I know how to navigate in TextMate (in general). I want to know if TextMate has a "jump back" key binding.
It's subtle.
The command-T thing has the files listed in Most Recently Used order.
So, you can go command-T return to get back to your last file real quick. At first I couldn't find it either.
I don't think there's a go to last edit location as there is in, say, IDEA/RubyMine.
Courtesy of MacroMates.com
2.3 Moving Between Files (With Grace)
When working with projects there are a few ways to move between the open files.
The most straightforward way is by clicking on the file tab you need. This can also be done from the keyboard by pressing ⌘1-9, which will switch to file tab 1-9.
You can also use ⌥⌘← and ⌥⌘→ to select the file tab to the left or right of the current one.
It is possible to re-arrange the file tabs by using the mouse to drag-sort them (click and hold the mouse button on a tab and then drag it to the new location). This should make it possible to arrange them so that keyboard switching is more natural.
One more key is ⌥⌘↑ which cycles through text files with the same base name as the current file. This is mainly useful when working with languages which have an interface file (header) and implementation file (source).
When you want to move to a file which is not open you can use the Go to File… action in the Navigation menu (bound to ⌘T). This opens a window like the one shown below.
Go To File
This window lists all text files in the project sorted by last use, which means pressing return will open (or go to) the last file you worked on. So using it this way makes for easy switching to the most recently used file.
You can enter a filter string to narrow down the number of files shown. This filter string is matched against the filenames as an abbreviation and the files are sorted according to how well they match the given abbreviation. For example in the picture above the filter string is otv and TextMate determines that OakTextView.h is the best match for that (by placing it at the top).
The file I want is OakTextView.mm which ranks as #2. But since I have already corrected it in the past, TextMate has learned that this is the match that should go together with the otv filter string, i.e. it is adaptive and learns from your usage patterns.
If you have a project window open, you can leave frequently-accessed files open (in tabs), and then use ⌘+1-9 to jump to open tabs.

Resources