ue4-intellisense-fixes: IntelliSense really slow with bogus behaviour on M1 Mac

Hello!

  1. Thanks for making this extension!

Note: I am completely new to Unreal Engine development + Visual Studio Code and haven’t done anything in C++ for about 20 years. I do have a good WebDev background, so I hope/should be able to follow your guide on getting this to work.

I was not sure if I am having the same problem as this person, so I created a new Issue: https://github.com/boocs/ue4-intellisense-fixes/issues/10

I am using Unreal Engine 5.0.3 and VSC 1.70.0 on an MacBook Pro M1 Max and the Tom Looman C++ FPS Game Template available via his website/youtube video. Also had the same problem with basic UE C++ templates like the Top Down Template.

Problem: After starting VSC, I get the output message from your extension, that it is doing a lot of stuff, I should refresh my VSC workspace via UE Engine and restart VSC. I can do this how often I want to, it is an endless loop.

When looking at the project code, I see that IntelliSense is not working correctly, as basic methods/class names are not recognized - white colored. After a kind of random amount of time, the C++ Output Window throws out a confusing message about now using the wrong IntelliSense mode. A couple of minutes after that, IntelliSense kind of starts working. Method/Class name coloring is visible and typing simple stuff like #include or using Unreal Components works. But not always. Sometimes it gets stuck(?) and just tries to load paths etc…

This is the log of your extension.

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

Extension "UE Intellisense Fixes" 3.1.0 is now active!

Found Unreal Engine v5.0.3

Fixing compiler path in c_cpp_properties.json.
Extension compiler path is set to: /usr/bin/clang (can be blank)
End fix c_cpp_properties compiler path.

Fixing compiler paths in compile commands.
Will override compile commands' compiler paths with /usr/bin/clang
Below is the compile commands first entry command. (WARNING) If getting errors and the compiler path is unexpected reset your UE project.
command: "/usr/bin/clang" @'/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp'
File write: /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_FPSGame.json
Below is the compile commands first entry command. (WARNING) If getting errors and the compiler path is unexpected reset your UE project.
command: "/usr/bin/clang" @'/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_Default/FPSGame.198.rsp'
File write: /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_Default.json
Done fixing compiler paths.

Fixing invalid paths in response files.
FPSGame.198: Fixed paths count(50), Unfixed paths count(0)
FPSGame.198: Fixed paths count(50), Unfixed paths count(0)
End fixing invalid paths in response files.

Fixing *.generated.h files!
Searching with fast-glob found nothing. (Sometimes isn't bug)
Correct *.generated.h files are found! Note: This extension doesn't test if all *.generated.h files have been created.
For Intellisense, you'll need to Build any newly created project files with the 'Editor' suffix config (e.g. MyProjectNameEditor (platform) Development Build).

** Error **: No match found for RegExp((?<!Engine)[\/|\\]Intermediate[\/|\\]Build[\/|\\]\w+[\/|\\](?:Unreal|UE4)Editor[\/|\\]Inc) on file: /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp

** Error **: You must refresh your project by Generating Project files!

** Error **: You can do this with VSCode->Run/Debug(MS C# Ext required), right-clicking project's *.uproject file, or in the Unreal Engine menus.
End fixing *.generated.h

Fixing missing compile command files.
No missing file paths found. No fixes needed.
No missing file paths found. No fixes needed.
End fix missing compile commands.

Warning about Public/Private directory

** Warning **: Public/Private folders found in your Source directory.
*** Make sure to reset(Generate Project Files) your project, only once, to add these folders to the correct config files.
End warn Public/Private Directory

Attempting to fix UE workspace(Add empty tag parser).
UE's tag parser includes are set to empty array for performance.
The setting limitSymbolsToIncludedHeaders is already set to true.
End fix UE workspace(Add empty tag parser).

Attempting to fix wrong cppStandard.
Info : UE4 should be default c++14 (it can be c++17 with some special configuration)
Info : UE5 should be c++17
Current VSCode/cpptools cppStandard is:  (Can be blank)
Current c_cpp_properties.json's cppStandard is: undefined (Overrides VSCode/cpptools if not undefined)
This extension set MAIN workspace c_cpp_properties.json's cppStandard to c++17
Current c_cpp_properties.json's cppStandard is: undefined (Overrides VSCode/cpptools if not undefined)
This extension set MAIN workspace c_cpp_properties.json's cppStandard to c++17
Current VSCode/cpptools cppStandard is:  (Can be blank)
Current c_cpp_properties.json's cppStandard is: c++17 (Overrides VSCode/cpptools if not undefined)
UE workspace c_cpp_properties.json's cppStandard is already set.
Current c_cpp_properties.json's cppStandard is: c++17 (Overrides VSCode/cpptools if not undefined)
UE workspace c_cpp_properties.json's cppStandard is already set.
End fix wrong cppStandard.

Fixing launch.json.

Attempting to fix the json of launch.json...
There was nothing to fix!
End fix launch.json.

Start fix wrong intellisense mode
Cpu: Apple M1 Max
This extension set MAIN workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
This extension set MAIN workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
This extension set UE workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
This extension set UE workspace c_cpp_properties.json's intellisenseMode to macos-clang-arm64
End fix wrong intellisense mode.

Attempting to fix UE workspace optimization.

** Warning **: Optimization of UE is enabled!
Enabling UE optimization disables red squiggle compiling for the Unreal Engine source code.
This does not affect your project's source code (it still can have red squiggles).
You can disable this optimization in this extension's settings.
End fix UE optimization.


Writing /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/c_cpp_properties.json to file.

Writing /Users/Shared/Epic Games/UE_5.0/.vscode/c_cpp_properties.json to file.

*** Number of error messages: 3
*** Number of warning messages: 2
If you get any errors you can try restarting VSCode to check if they've been fixed.

Extension is done.

This is message that the C++ Output Window throws. It happens AFTER your extension runs on VSC startup.

[8/5/2022, 3:39:21 PM] For C source files, IntelliSenseMode was changed from "macos-clang-arm64" to "macos-clang-x64" based on compiler args and querying compilerPath: "/usr/bin/clang"
[8/5/2022, 3:39:23 PM] For C++ source files, IntelliSenseMode was changed from "macos-clang-arm64" to "macos-clang-x64" based on compiler args and querying compilerPath: "/usr/bin/clang"
[8/5/2022, 3:42:07 PM] For C source files, IntelliSenseMode was changed from "macos-clang-arm64" to "macos-clang-x64" based on compiler args and querying compilerPath: "/usr/bin/clang"
[8/5/2022, 3:42:07 PM] For C++ source files, IntelliSenseMode was changed from "macos-clang-arm64" to "macos-clang-x64" based on compiler args and querying compilerPath: "/usr/bin/clang"

Here is my c_pp_properties.json after your extension states that it changed IntelliSense back to x64.

{
    "configurations": [
        {
            "name": "FPSGameEditor Editor Mac Development (FPSGame)",
            "intelliSenseMode": "macos-clang-arm64",
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "compileCommands": "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_FPSGame.json",
            "compilerPath": "/usr/bin/clang",
            "cppStandard": "c++17"
        },
        {
            "name": "Mac",
            "intelliSenseMode": "macos-clang-arm64",
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "compileCommands": "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_Default.json",
            "compilerPath": "/usr/bin/clang",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Some more answers to questions you asked the other person with an M1 having problems

  1. c_cpp_properties.json => Has arm64 in both options.
  2. Extension setting compiler path: “/usr/bin/clang”
  3. Using strict mode for the compiler path
  4. All Fixes/Optimizations activated in your Extension

To sum my problems up in short:

  1. IntelliSense does not work until around 5-10 Minutes after VSC launch
  2. When it does work, it does not work smoothly at all. It runs perfect for seconds/minutes but then after doing some edits, it kind of randomly changes into snail/turtle speed and keeps “loading” instead of making code suggestions.

Hope you can help me with that! 😃

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 36 (24 by maintainers)

Most upvoted comments

I made the report here: https://github.com/microsoft/vscode-cpptools/issues/9882


You can cut the time in half without affecting your project.

  1. Enable optimizations in my extension.
  2. Go to the UE5 directory
  3. Open c_cpp_properties.json in the UE5/.vscode directory
  4. Comment out both compileCommand lines. image
  5. Restart VSCode

Note: The compileCommand lines will come back if you ever reset your project.

Found the reason. Can’t handle too many include directories in the response file. Will file report after I create a project that dupes the behavior.

In retrospect it does make more sense. x64 is what your project is targeting not what clang was built with.

So the setting it’s changing it to should be the correct one. I’ll need to add a fix like I did for c++14/c++17. This one will probably take longer for me to make.

You can just install like before https://gist.github.com/boocs/f63a4878156295b6e854cac68672f305#Installation

It’ll upgrade the previous version.