Xcode "OmniSearch" in autocomplete - xcode

In other IDEs during code complete, I could type any char/word inside the method (doesn't have to be in the order it apears) and it will filter out those methods.
So far, it seems like in Xcode, I'll have to type out the name of the method from beginning to end in order, else the autocomplete popup disappears.
Is there any way to get this "omnisearch" feature in Xcode?

XCode's auto complete does not support that.

Related

Can Xcode show call hierarchy of property setter?

In Xcode, you can control-click on a function definition, and choose "Find Call Hierarchy" from the context menu. This shows all the callers of that function, in the left side navigation area.
This also works for properties, but it it only shows calls to the getter. Is there a way to see calls to the setter?
Selecting the menu item caused Xcode to write Foo.setter:bar in the search field. I tried replacing getter with setter, and it didn't seem to work. (Actually, it seems to have triggered a bug in a Xcode. A process called com.apple.dt.SKAgent is now chewing huge amounts of CPU and has to be killed.)
This has changed in Xcode 11 (checked in version 11.4.1). Now using either "Find Call Hierarchy" or "Find Selected Symbol in Workplace" context menu command finds usages of all getters and setters of the property. There doesn't seem to be a way to find either only getter or setter at the moment.

Visual Studio option to turn a written code block into a method?

A while ago I was watching a video where the presenter cleaned up his code by highlighting already written code, and choosing some option that converted the code into a method. It also automatically recognized what parameters needed to be passed, and all he needed to do was name the method.
Does anyone know what this option is called? I have looked all over and cannot find it. I can't remember the video either.
It was probably refactoring. Highlight your code, right click and select "Quick Actions and Refactorings", then select "Extract Method". (Or choose Edit Menu > Refactor > Extract Method.)
You'll be able to change the name of the new method. Visual Studio does its best to figure out what types are needed as parameters, what should be returned, what visibility for the method is needed, etc. You'll still want to double check the result and make sure it does what you want.
Yes, it's called refactoring your code. You can extract a method by right clicking on the highlighted method and choosing Extract Method from context menu. VS will extract the method and set the parameters for you.

Define the class of the sender when making an IBAction connection in Xcode 4,2.1

In Xcode 4 or above, it has a handy function allowing us to CTRL + drag an object from the interface to the .h file to quickly connect the object with an event method (assume the Assistant Editor is enabled).
Say we have an UIButton in the interface, and we want to add an IBAction for its "touch up inside", we enable the assistant window and press/hold CTRL + Drag the button to the .h file to quickly generate the necessary codes.
In the popup prompt box, say we set "connection" as "Action".
In the "Type" drop-down, we can select "id" or "UIButton". <--- this is where my problem is.
The strange thing in Xcode 4.2.1 is: no matter what I select, it always generates code: "(id)sender" as the argument.
I know it is easy to manually change it to "(UIButton *) sender", but what is the point of this drop-down when it always generates "(id)"?
Is this is a bug of Xcode or am I missing something to make it directly generate the code "(UIButton *) sender" when I select "UIButton" in this drop-down?
Edited on 27/Feb/2012: This is confirmed solved in Xcode 4.3
- (void)action:(id)sender is just the way actions are defined. you can, in theory, connect different UI elements to the same action. after you've created the connection, you can manually change id to whatever class you want, or just do a cast inside the method.

Duplicate of first entry in navigation bar in custom Visual Studio Language Service

I'm implementing a Visual Studio Language Service for a custom scripting language used internally at my company, and I've run into an issue with the navigation bar implemented as a subclass of TypeAndMemberDropdownBars. The subclass is created by my LanguageService subclass' LanguageService.CreateDropDownHelper method.
In the OnSynchronizeDropdowns method I'm iterating through the types defined in the file and adding DropDownMembers to the passed-in array to fill out the navigation bar. The issue I'm seeing is that the first item in the array is being duplicated and placed at the end of the listing by code that I don't have access to. This extra item does not behave correctly when selected (nothing happens), but doesn't seem to cause any other issues; the rest of the items in the list work fine. Additionally, this only seems to happen for the type dropdown box - the members dropdown box does not display this behavior.
I'm hoping someone else has seen and resolved this issue and could provide some assistance. Thanks!
Turns out this was caused by me calling LanguageService.SynchronizeDropdowns from my LanguageService.ParseSource method, which was being called on a background thread. I've fixed the problem by setting a flag when ParseSource does a Check parse, and then implementing a check for that flag in my LanguageService.OnIdle function that will call SynchronizeDropdowns. It's now working as expected!
A better solution is to implement the LanguageService.OnParseComplete callback, and call SynchronizeDropdowns from there. OnParseComplete is always called from the main thread, so this prevents any synchronization issues from coming up, and also keeps you from having to keep track of whether or not you need to call SynchronizeDropdowns().

"User-defined type not defined" error in VB 6 under Windows 7

I am using Windows 7 and my project is in VB 6.0. I am getting errors while I am executing my program. It shows the error:
User-defined type not defined.
Here is my code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "trace": Call mntrace_Click
Case "snrplot": Call mnSnrplot_Click
Case "skyplot": Call mnskyplot_Click
Case "nmea": Call mnNmea_Click
Case "navigation": Call mnNavigation_Click
Case "survey": Call mnSurvey_Click
Case "pause/start": Call mnpause_Click
Case "save": Call mnsave_Click
Case "print": Call mnprint_Click
Case "offline": Call mnoffline_Click
End Select
End Sub
How can I solve this error?
The compiler is automatically highlighting the first line of the function declaration for you when the error appears. That means the error occurs somewhere within that line. Sometimes that's not as helpful as you'd like, but in this case, it manages to tell you quite a lot.
Specifically, the only "user-defined type" (really, the only "type" at all) that appears in the function declaration is MSComctlLib.Button. What the compiler error message is telling you here is that it doesn't know what a MSComctlLib.Button is. It therefore assumes it's a "user-defined" type because it often doesn't know what the user is talking about. :-)
Either way, the fix is simple: you need to tell the compiler what an MSComctlLib.Button is. In this case, it guessed wrong in assuming that it is a user-defined type. It's actually a button control provided in the Microsoft Windows Common Controls Library. To tell VB 6 about this control, you need to add the corresponding component to your project. Follow these steps:
From the "Project" menu, select "Components".
In the dialog box that appears, scroll about 2/3 of the way down the list to the M's. Place a check by both the "Microsoft Windows Common Controls 6.0" and "Microsoft Common Controls-2 6.0" items. (Don't worry if yours have a different service pack designation.)
     
Click the OK button. If you're quick, you'll see some additional controls being added to your toolbox. These are the controls provided by the component libraries that you just added. Among those controls is one called Button.
Finally, try to compile and run your project again—everything should be fine this time, because now the compiler knows what the MSComctlLib.Button type is. In case you still don't, it's a button that appears on your toolbar. The toolbar control is provided by the Common Controls library, and it includes a type that defines an individual button appearing on that toolbar.
Sounds like you are missing a reference to an object library.
(Have you executed it without errors elsewhere?)
I think you just copied and pasted that code from elsewhere. Normally, if you wanted to reference MSComctlLib, you will normally do first the steps stated by Cody Gray here before you can access the Type Library.

Resources