boocs / ue4-intellisense-fixes

Automatically fixes VSCode/Unreal Engine Intellisense Config bugs on startup
MIT License
162 stars 9 forks source link

IntelliSense doesn't recognize TObjectPtr as Pointers, TArray member functions #26

Closed reDBo0n closed 1 year ago

reDBo0n commented 1 year ago

Created a new UE5.1 First Person Project with the Epic Games provided Linux binaries (here). Added the following code block (to the Constructor of the Character)

TArray<USkeletalMeshComponent*> TestArray;
TestArray.AddUnique(Mesh1P);

TObjectPtr<USkeletalMeshComponent> TestPtr = Mesh1P;
if(TestPtr){
    TestPtr->SetOnlyOwnerSee(true);
}
Mesh1P->SetOnlyOwnerSee(true);

Following "errors" got marked by IntelliSense, although the code compiles just fine:

I reset the Database, refreshed the project, tried with and without the "Optional Fixes"

Got 2 times the same Warning

Warning : Epic Games has included 199 paths that don't exist. Is this on purpose? No invalid paths returned. No fixes needed.

boocs commented 1 year ago

You can ignore that warning.

I did get the same bug with Intellisense on Ubuntu. The bug isn't there with Windows using cl. Looking into it.

boocs commented 1 year ago

I was able to get it to work by using 13.0.1 from the llvm download page instead of the clang++ that comes with UE5.

https://stackoverflow.com/questions/17045954/how-to-install-clang-using-precompiled-binaries

I commented out the first two commands because I just downloaded the tarball from the website: https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.1

Even though I was on 22.04 I downloaded clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz

I extracted the contents. Created a new directory called ~/llvm_13.0.1 Then did a simple copy of the extracted contents to this new directory.

So llvm_13.0.1 should now have directories called bin,lib, etc.

I don't know if the other 2 steps are required but I did them. You also might want to add the export PATH=/home/s/bin:$PATH step permanently because it will go away once you close the terminal.

Note: This example uses 's' as the parent directory but I used llvm_13.0.1

# wget <clang-binaries-tarball-url>
# sudo tar -xf <clang+llvm-..tar.xz> --strip-components=1 -C /home/s  

# Set the path environmental variable  
export PATH=/home/s/bin:$PATH

# Tell ldconfig about new shared library in /home/s/lib
cd /home/s
cat > libs.conf << "END"
/home/s/lib
END

sudo mv libs.conf /etc/ld.so.conf.d/libs.conf
sudo ldconfig

I also had to add a clang dependency by using this command: sudo apt install libncurses5

I had to change the compiler path in my extension settings in VSCode. /home/yourUserName/llvm_13.0.1/bin/clang++

After you change the compiler path restart VSCode and it'll ask you which path you want to use. Choose the new one you just changed to.

boocs commented 1 year ago

Woops, I actually didn't test your code. I tested a simple TArray example and it was able to see all the TArray functions. Your code should still work with intellisense now though. I'll test it later to be sure.

boocs commented 1 year ago

Test the new Intellisense compiler with your code and all the Intellisense errors are gone.

reDBo0n commented 1 year ago

Yeah can confirm.

Changed the compiler inside the extension to my distro clang++ and it worked.