Best way to find needed include?

Often times I am looking at code from elsewhere and for whatever reason they sometimes either don’t have, or don’t show the #includes, as something changed in ue4

Is there a good way to find what include I need to include for a particular class, or function?

a lot of times its semi intuitive as its the same name as what I want, but some things are sometimes hidden away, especially macros

e.g.
ARRAY_COUNT lives in UnrealTemplate.h

searching the epic’s github for unreal is decent some of the time, but often times it gives many pages of stuff of ‘use’ but not the original implementations location

I generally use Ctrl+, in VS and write what I am looking for.
Didn’t try yet but I think if you typed “ARRAY_COUNT” with this method, you should find the file quickly.
For specific function or class, this method should also work but in worst cases (function name is too generic for example), you can search in the documentation and at the end of the page, you have the name of the files that contains theses classes/functions.

The VAX Find Symbol dialog is invaluable for this sort of thing.

Ctrl Comma has no response in VS for me? Is this tied to a particular extension or something?

Searching the documentation is sometimes troublesome and doesn’t always provide clear answers. It works some of the time though! and searching github works some of the time, just as searching google does as well. None of them work great though, having to use a mixture of things to find what I need seems less than optimal.

for example if I search docs.unrealengine.com for array_count
the first response is for blueprints only, not helpful in this case
the second response is for TArray: Arrays in Unreal Engine | Unreal Engine Documentation which even shows USAGE of array_count, but has no mention of header file/library/where it exists.

Thanks, that is useful, however it doesn’t seem to work on macros/preprocessor things, and Epic tends to use them a lot :confused:

It does however, seemingly appear to work great on more traditional things though. Thanks!

This shortcut should match the “Edit > Navigate to…” command.

68629-navigateto.png

I tried to search “array_count” and the first result was correct :

how fascinating, what version of Visual studio are you using?

Aside from installing Visual Assist, I’ve made 0 changes from default Visual Studio 2015 Though I am on an enterprise edition, maybe I should try switching to the community edition?

However, Navigate to, did seem to work!

68631-interesting.png

The shortcut was ok by default in VS2013/2015 community.
You can set the shortcut in Tools > Options…, then Environment > Keyboard.
From here, search for “edit.navigateto”, select the line found and set the shortcut you want.

Thanks! shortcut fixed now. Seems to work quite well for several test cases!

I do wonder why it was unassigned for me. I feel like everything I saw indicated that what you had and now I do as well, are the defaults. Maybe I should try reinstalling VS sometime.