I am using VB.NET. In Visual Studio, if I right-click a property name and click "Find All References", it searches for all instances of the property being used.
However, a property is always used either for assignment (Set method) or retrieval (Get method). Is there any way of searching for only one of these uses? e.g. search for all uses of the property in code where it is being assigned a value, not when the value is being retrieved.
Use the compiler to turn what you want to find into errors. Remove the setter to find all the places were it was going to be used.
With Resharper, if you simply use the "Find Results" tool, and then there is a filter icon in the results window. You can then limit the results to only "Show Write Usages".
You can also use Reflector to browse through your assembly.
Resharper (MSVS addin) has the exact feature you are looking for.
Check:
ReSharper.FindUsages
or
ReSharper.FindUsagesAdvanced
in keyboard shortcuts mapping (Tools -> Options -> Keyboard) to find out what shortcut is used.
Related
I have a large constants.properties file.
When reading properties from it with constants.getProperty("PROPERTY_NAME") I often have to copy/paste the property names which is rather long.
I see that IntelliJ is able to detect when properties are used inside the code, is it be possible to have auto-completion of property names when I type the name in getProperty()?
Yes, IntelliJ IDEA provides the completion for the Java Properties, use Ctrl+Space to get the hints:
I would like to have a way to search for methods in a class, only methods, not class member variables, is there a way to do that?.
Afaik there is not a dedicated way of doing this, but you can use the find action and search on a regex. E.g. something like: [ ][a-zA-Z]{2,}\(
With cmd+G you can navigate to the next occurrence. You can easily tweak the regex to search for public methods only if you like.
Alternatively you can press cmd+F12 to open the "File structure". (you can look it up in the keymap if you want to know the keyboard shortcut for other OS).
You will get more or less the same information when you write "this." and press the shortkey for autocompletion.
Tip: if you want to know if something is available you can always press shift twice and type what you are looking for. Check the "actions" section to see the available actions. Or press the cmd+shift+A to search for actions and options instantly.
Use Structural search. For java there is a pre-defined template for class methods exists (All methods of the class):
Is there a shortcut to quickly show the type of a variable in JetBrains' AppCode? Preferably this would be something akin to Visual Studio, which shows the type of a variable when you hover over it with the mouse.
Alternately, if you hold the command key while hovering, you can hover the variable to have the executive summary info bubble. By then clicking the keyword (not the info-bubble) you can then get 'beamed over' to the code that declares or implements the specific interface. For example, in the following line :
[fa.AoEspec addTileSpec:[AoEtile AoEtileFromString:#"0,0,50,hit"]];
I will get an 'info bubble' for fa (local variable), AoeSpec (a property) AoEtile (a class) AoeTileFromString ... all clickable.
You can press SHIFT-COMMAND I to see the definition of the variable under the cursor. It shows you the line that defines the variable, as well as which file. Pretty handy when looking at code you didn't write.
In AppCode 2.1.x Cmd+Shift+I is not a predefined keyboard shortcut (anymore?!). And the previous mentioned Cmd+MouseOver may not be suitable for keyboard-only-junkies. So here come some alternatives:
Cmd+B - to go to the definition (and Cmd+Alt+CursorLeft to go back)
Alt+Space or Cmd+y - to show the quick definition window [1]
Maybe this is helpful.
[1] In AppCode 2.1.2 there seems to be a bug I filed with JetBrains that the quick definition window is empty for iVars (these underscore variables that are generate by auto-synthesize from #property fields). But in all other cases quick definition window works fine! And maybe the bug is fixed when you read this...
What works for me in AppCode 2018.2 is control + command + ? when the variable is under the cursor (quick documentation under View).
You can see a couple of other useful combinations under the View menu.
I am using Visual Studio 2010 Prof.
In C# I can create my own Enumerator and use it like this:
MyEnum value =
Now, Intellisense will suggest a value of MyEnum.
In VB, when I write:
Dim value As MyEnum =
I get a huge list of every types. When starting to write my enumerator value (could be a word like "sunny") it filters out some types but I would like to have it like in C#. Anyway I will use the MyEnum type and no "String nor Objecte nor IntPtr...".
Any idea?
Screenshot
Also I made a short video:
Video with sample (new)
Regards
Simple, all you have to do is click the "Common" tab at the bottom of the Intellisense drop-down.
To prove it, here's a screenshot of what I see in VS 2010, immediately after typing =:
But, even if you have the "All" tab selected, the values defined in the enum will still be automatically displayed first, and even appear grouped together. You will indeed see all possible members and types, even those that are completely unrelated, but it's still pretty easy to find the ones you want.
And no, I'm not using any third-party add-ins or extensions to achieve the demonstrated feat. As best I can tell, I also haven't reconfigured any relevant options from the default settings.
This is a documented issue in VS 2010, pre-SP1. See: https://connect.microsoft.com/VisualStudio/feedback/details/551699/intellisense-enum-values. It has been fixed in SP1. If you can't install SP1, the only workaround is to use the mouse or Alt + , to switch from the "All" to the "Common" tab.
In our code base there are a few very long methods (several pages worth of code). When reading the code, it would sometimes be good to be able to see the name of the method the current line belongs to, without paging up to the beginning of the method. Is this possible in Intellij IDEA? I am using Intellij IDEA 7.0.3.
You can use View | Context Info (Alt+Q, Ctrl+Shift+Q on Macs). It will display a pop-up on the top of the editor with the current context information (class/method signature).
IntelliJ 2018
This is shown by default at the bottom.
Unfortunately, the method is shown only by name (not including the parameters). If a method is overloaded you won't know for sure where you are.
If you want to move it from bottom to top, go to File > Settings... > Editor > General > Breadcrumbs > check Top:
In the structure panel select the "Autoscroll from source" option.
This way when you place the cursor inside any method the structure panel will show which method you're in.
Intellij now has support for breadcrumbs. Go to settings > appearance and tick "Show breadcrumbs". In this way you can view class/method name without Alt+Q.
For some reason (Alt-Q) wasn't consistent in Android Studio for me. I find (Ctrl-F12) to be pretty satisfactory for this purpose (Navigate|File Structure) though it can be a little laggy in larger files. And by pressing the hotkey again it will populate the list with all the inherited methods as well.