boocs / ue4-intellisense-fixes

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

UE5 Ubuntu - Cannot open source file #13

Open JoshEthan opened 2 years ago

JoshEthan commented 2 years ago

@boocs I was able to for sure generate the uproject file, but still no luck.

boocs commented 2 years ago

I'm downloading the full source now on Windows(I used to have Ubuntu full source...).

If you don't want to say, just say the class type that you added. I want to recreate what you have.

Also that link was showing how to Generate Visual Studio Project Files for UE5. It's a soft reset for your project and will add all your current project source files to your compile commands file.

boocs commented 2 years ago

I can confirm this. When compiling my, full source, project the *.generated.h files aren't being created.

I'll have to mess with this more tomorrow.

boocs commented 2 years ago

@JoshEthan

I was able to fix mine. I had to do a full rebuild of my project. Make sure it's your project and not the Full Source UE5 like I did... Luckily I didn't need the editor to fix my project.

To rebuild, I used MyProjectNameEditor Win64 Developement. Once the 5 hours were done I had my *.generated.h files. After, hopefully you don't have to do a full rebuild of the project, after adding another class, and just a normal build will do.

Now you have to Generate Project Files so the *.generated.h path is added to your rsp files that the compile command files use. I didn't have to use the command line on Windows but I'm not sure if this will work on Linux. In VSCode there is a Run and Debug icon on the left. If you scroll through the long list of options there's Generate Project Files option. Once I ran that, I had to wait for Intellisense to update and finally no errors.

To run Generate Project Files from VSCode you need the Microsoft C# extension. If you can't get it to work go to the Run and Debug and choose Generate Project Files but don't run it. Click the sprocket to the right of the name and it'll open launch.json and take you to the entry for Generate Project Files. At least you'll know the command line and flags that it uses so you can try it manually.

JoshEthan commented 2 years ago

I rebuilt it, generated the files, and I still have the error. I think I will just call it good here lol. Seems to be destiny.

boocs commented 2 years ago

You can manually check the .rsp file to see if it added the correct path. It's basicially a file of compiler flags that will be used with Intellisense. Most project files will use the YourProjectName.#.rsp format. For example my project, named CoopGame, uses CoopGame.182.rsp for the Intellisense compiler flags. The number will probably differ for your .rsp files.

Maybe I can add that to a fix where it will detect if you have no .generated files and if you do that it's added to the .rsp file automatically if not there.

JoshEthan commented 2 years ago

The rsp file did not have any generated files, CoreMinimal, or even GameModeBase in it. Seems like it's just missing a bunch of paths. If I understood that correctly.

boocs commented 2 years ago

Yeah it will only have the paths to those files, which it will. The bug is that it doesn't have the path to your *.generated.h files. It will usually be only one path.

Maybe it needs to be a specific Build for it to work.

When you click Terminal->Run Build Task... Which option do you choose?

I've been using YouProjectNameEditor (notice the Editor suffix) and "Win64 Development Build" (or Rebuild if the *.generated.h files don't get created)

Remember to do the Generate Project Files after.

JoshEthan commented 2 years ago

I run the YourProjectEditor Linux Development Rebuild. I don't have a Win64 option. I've also ran "YourProject Linux Development Build" and "YourProject LinuxArm64 Development Build"

boocs commented 2 years ago

When I do it with the Editor Suffix and Win64 the *.generated.h files get created in: Intermediate\Build\Win64\UnrealEditor\Inc\MyProjectName directory.

Yours should be similiar.

Now if I look into my rsp files I have this: /I "K:\ME\Documents\Unreal Projects\UE5_RelTest\Intermediate\Build\Win64\UnrealEditor\Inc\UE5_RelTest"

Win64 will be different for you. UnrealEditor is because of the Editor suffix when building. I think it will be UnrealGame if you don't use the suffix.

Try it with the Editor Suffix and Linux. Then Generate Project Files and see if it adds it to YourProjectName.#.rsp. It won't add it to most of the *.rsp files so make sure it's the specific one.