boocs / ue4-intellisense-fixes

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

Extension fails to find c_cpp_properties.json #14

Open MagdielM opened 2 years ago

MagdielM commented 2 years ago

As of version 3.0.2, it seems the extension fails to detect c_cpp_properties.json in my workspace's .vscode directory. I last tested this with the recent Lyra sample project released by Epic. I'm currently running UE version 5.0.1.

Searching for *.uproject file...
Searching with fast-glob found nothing. (Sometimes isn't bug)
*.uproject file was found!

Extension "UE Intellisense Fixes" 3.0.1 is now active!

Found Unreal Engine v5.0.1

Searching with fast-glob found nothing. (Sometimes isn't bug)
Couldn't find files in UE5 workspace's .vscode folder with glob: .vscode/c_cpp_properties.json
** Error **: No files found for getCCppConfigCopy().
** Error **: The main cCppProperties wasn't enabled at construction setup.
** Error **: This fixable project hasn't been initialized properly and is invalid.

I can confirm the .vscode folder is at the root of the project directory. image

Interestingly, the UE-generated workspace file did not point to the engine folder, but this was simple to fix manually. Not sure if anything else about the generated configuration may be causing issues.

{
    "folders": [
        {
            "name": "LyraStarterGame",
            "path": "."
        },
    ],
    "settings": {
        "typescript.tsc.autoDetect": "off"
    },
    "extensions": {
        "recommendations": [
            "ms-vscode.cpptools",
            "ms-dotnettools.csharp"
        ]
    }
}
boocs commented 2 years ago

I tried this with v5.0.1 on Windows and it worked for me. Can you tell me the exact steps to reproduce this? How I got mine to work:

I did already have my Unreal Engine set to use VSCode.

boocs commented 2 years ago

I do still get a bunch of Intellisense errors. I'll have to figure that out.

boocs commented 2 years ago

After Building it creates *.generated.h files. I had to do Generate Visual Studio Project Files again so that the path to those are added to the appropriate files.

Everything seems to work after that. There are a few small Intellisense errors in certain files but I'm sure those will be easy to fix with a little work. For example in LyraCharacter.cpp the only error now is: "message": "incomplete class type \"TTuple<uint8, FGameplayTag>\" is not allowed",

boocs commented 2 years ago

I am going to add a fix for this. It will warn if no .generated.h files and will auto add .generated.h files path to the main *.rsp file.

MagdielM commented 2 years ago
  • Installed the Lyra Project.
  • Opened folder and saw that it didn't automatically install any project files.
  • Right clicked on the *.uproject file and chose Generate Visual Studio Project Files

Sorry for taking so long to get back to this. I followed pretty much these exact steps except I first used the "Create Visual Studio Code" project from the Tools menu in the editor, then did it from the .uproject file with the editor closed when the previous option didn't fix the problem.

boocs commented 2 years ago

They only thing I can do is give a better warning. My extension relies on that path being there since different projects can use different Unreal versions.

Pretty strange bug!

boocs commented 2 years ago

I forgot if you right click on the *.uproject there is a Switch Unreal Engine Version option. If this happens to you again try selecting the unreal version you created your project with and hit ok. It will also generate project files.

I tested this out with a 5.0.1 project and removed the path to the unreal engine in the code-workspace file. When I switched engines, to the same version, it created the unreal path in code-workspace.