boocs / ue4-intellisense-fixes

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

IntelliSense really slow with bogus behaviour on M1 Mac #21

Open mrjohnmc opened 2 years ago

mrjohnmc commented 2 years ago

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! :)

boocs commented 2 years ago

Seems like two errors. Have you tried Generating Project Files yet?

In the log it shows this:

Correct .generated.h files are found! Note: This extension doesn't test if all .generated.h files have been created. ... Error : No match found for RegExp((?<!Engine)[\/|\]Intermediate[\/|\]Build[\/|\]\w+\/|\Editor[\/|\]Inc) on file: /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp

But the path, to the .generated.h files, doesn't show up in the .rsp file like it should. Generating Project files should fix this. Right click on your *.uproject file and it should give you the option to do so. (Generate Visual Studio Project Files)

This also could be a bug with my Regex so let me know if it fixes it.

The other is possibly the compiler path. VSCode doesn't seem to like that path because it's changing away from the proper arm64 intellisense mode that it should be set to. This was the path the original M1 Mac user said worked but it probably should be set to the real clang path, that macs uses, which is the preinstalled xcode path to clang.

This also could be something to do with Rosetta? I don't know about Macs but it seems that Rosetta runs clang in x64 mode or something? So maybe that's a separate problem. https://apple.stackexchange.com/questions/438807/clang-showing-incorrect-target-on-m1-mac

So either the path is right and Rosetta is causing the switch or both are wrong.

boocs commented 2 years ago

This shows how to find clang path hopefully: https://stackoverflow.com/questions/12228382/after-install-xcode-where-is-clang

mrjohnmc commented 2 years ago

Seems like two errors. Have you tried Generating Project Files yet?

Hm, when right clicking the .ueproject file on my Mac, there is no option that generates Visual Studio Project Files. Is it the same thing as the "Refresh Visual Studio Project Files" command from within the UE Editor? I googled why I don't have the command in my right click context menu, as I do have "Generate Xcode Project Files" and as far as I understand, it is because you cant compile c++ with "Visual Studio" (but with Visual Studio Code...) on Macos.... Please correct me if I understood that wrong. I found this link about it for example. => https://forums.unrealengine.com/t/mac-generate-visual-studio-project-files/467048 If the "Refresh Visual Studio Code Project Files" command within UE should do the job: This is what I was doing before, without success. Now I am a bit lost on this...

This also could be something to do with Rosetta? I don't know about Macs but it seems that Rosetta runs clang in x64 mode or something? So maybe that's a separate problem.

Sadly I am not a Mac pro, I just know my way around, (I guess haha). So I checked where clang is located with clang -v / clang++ -v which tells me for both: InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin Weird thing is, I do also have the clang executable in the /usr/bin/clang path that VSC picked originally... I read through the link you posted about finding the clang path and tried out the command xcodebuild -find clang, which resulted in the following, which may be pointing at the problem:

➜  ~ xcodebuild -find clang
2022-08-07 14:27:05.312 xcodebuild[21947:6235138] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-07 14:27:05.312 xcodebuild[21947:6235138] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

So I switched out the path to the Xcode version one in your extension, restarted VSC but that did not help. I refreshed the VSC Project Files via UE, restarted VSC but it did not help. This is what the Output log of your extensions says now:

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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: c++17 (Overrides VSCode/cpptools if not undefined)
MAIN 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)
MAIN workspace c_cpp_properties.json's cppStandard is already set.
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.
boocs commented 2 years ago

The Xcode path, you're using now, should be the correct one. I would leave it. One thing that confused me was that it really should be clang++ but the previous Mac M1 users said that clang worked so I left it. I'm sure it worked because clang can do C and C++ and clang++ is just for C++. Does Visual Studio Code still change back to "macos-clang-x64" with the new clang path?

I think Xcode is required, on Mac, because it comes with all the necessary libraries. I could be wrong though.

It is weird it says Generate Xcode Project Files but probably a Mac thing so should be correct. You can test this by running the command and checking if the Visual Studio Code *.code-workspace file in your project directory changes its 'modified' time to the current time/date. On Windows it's called Date Modified but might be different on Mac.

I forgot to ask what the path is to your *.generated.h files (there will be one for every source file you have in your project I believe). I just need the path to the folder they're in. I need to check if the regex is broken for you. They are in your project's directory somewhere in Intermediate/Build Note: These are generated whenever you Build your project.

mrjohnmc commented 2 years ago

Hey there, sorry for the waiting!

Does Visual Studio Code still change back to "macos-clang-x64" with the new clang path?

Sadly, yes.

You can test this by running the command and checking if the Visual Studio Code *.code-workspace file in your project directory changes its 'modified' time to the current time/date.

I tried that out and besides Finder (Explorer for MacOS) kind of freezes for a couple of seconds and then comes back to life, nothing else happens. Nothing visible at least and the modification date does not change. Maybe it is a problem that I "had" UE4 and UE5 installed? UE4 was removed... I am thinking about completely removing UE and reinstalling it. See the context menu screenshot attachment of the options I have.

image

I forgot to ask what the path is to your *.generated.h files

Is this what you are looking for?

/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Inc/FPSGame/FPSCharacter.generated.h

Also, I tried using the clang++ path instead of the clang path, but that also does not help. Also, I was not able to re-open my project today so I re-downloaded the template I was working on and now it has new errors waiting for me. I am reinstalling UE now and will get back to you as soon as it's I am back to my old state of work.

boocs commented 2 years ago

I updated my extension to fix the regex but it probably won't fix your issue. Let me know if my extension's error message goes away about the regex/generated.h. If it doesn't then maybe the correct path isn't being added to your response file.

You can check this yourself. In FPSGame.198.rsp make sure this path /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Inc/FPSGame/ is being added. You might have 2 directories with FPSGame.198.rsp somewhere in your .vscode folder. Check them both. Remember that Generating Project Files should also add this directory (unless there is a bug).

I'm also thinking your issue could be a Rosetta issue. You might being running a Rosetta x64 build of clang instead of an arm64 build so VSCode switches to "macos-clang-x64". I'm not familiar with Mac M1s so I think that statement is correct.

mrjohnmc commented 2 years ago

I am sorry but due to reinstalling UE5 and the FPS Game template, I now have another new problem. It does not find the .rsp file anymore, according to the logs. It seems the path gets chopped at "master"?! :(

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

Extension "UE Intellisense Fixes" 3.1.4 is now active!

Found Unreal Engine v5.0.3

Fixing compiler path in c_cpp_properties.json.
Extension compiler path is set to: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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.

** Error **: Error reading master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp. Message: Unable to read file '/master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp' (Error: Unable to resolve nonexistent file '/master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp')

** Error **: Couldn't read response file

** Error **: Error reading master/.vscode/compileCommands_Default/FPSGame.198.rsp. Message: Unable to read file '/master/.vscode/compileCommands_Default/FPSGame.198.rsp' (Error: Unable to resolve nonexistent file '/master/.vscode/compileCommands_Default/FPSGame.198.rsp')

** Error **: Couldn't read response file
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 **: Error reading master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp. Message: Unable to read file '/master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp' (Error: Unable to resolve nonexistent file '/master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp')

** Error **: File was empty or nonexistant: master/.vscode/compileCommands_FPSGame/FPSGame.198.rsp

** Error **: Error reading master/.vscode/compileCommands_Default/FPSGame.198.rsp. Message: Unable to read file '/master/.vscode/compileCommands_Default/FPSGame.198.rsp' (Error: Unable to resolve nonexistent file '/master/.vscode/compileCommands_Default/FPSGame.198.rsp')

** Error **: File was empty or nonexistant: master/.vscode/compileCommands_Default/FPSGame.198.rsp
All response files have the correct *.generated.h path!
End fixing *.generated.h

Fixing missing compile command files.
Found 2 missing file paths.
File write: /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_FPSGame.json
Found 2 missing file paths.
File write: /private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/.vscode/compileCommands_Default.json
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: c++17 (Overrides VSCode/cpptools if not undefined)
MAIN 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)
MAIN workspace c_cpp_properties.json's cppStandard is already set.
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: 8
*** 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.

If it doesn't then maybe the correct path isn't being added to your response file.

The rsp file says

-include "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/FPSGame/Definitions.FPSGame.h" 
-include "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/FPSGameEditor/Development/Engine/SharedPCH.Engine.h" 

I'm also thinking your issue could be a Rosetta issue. You might being running a Rosetta x64 build of clang instead of an arm64 build so VSCode switches to "macos-clang-x64". I'm not familiar with Mac M1s so I think that statement is correct.

I checked with clang --version and it says I

Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Refreshing the VSC Files via UE5 does not help :(

boocs commented 2 years ago

Yikes, I guess none of my regex have support for dashes or any other legit symbol. I'll have to release an update.

boocs commented 2 years ago

I released 3.1.6. Seems it was only one regex. I only fixed dashes and added a better error message for any future problems.

mrjohnmc commented 2 years ago

I released 3.1.6. Seems it was only one regex. I only fixed dashes and added a better error message for any future problems.

Thanks, very fast! :) Ill try to find out how to install the update on my mac manually, as VSC currently only lists 3.1.4 as the newest version via the extension browser. Ill update you as soon as I tested it out.

Big thx for your support!

boocs commented 2 years ago

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

It'll upgrade the previous version.

mrjohnmc commented 2 years ago

Now I installed version 3.1.6 and the extension output now tells 0 Errors and 2 Warnings. Yay?!

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

Extension "UE Intellisense Fixes" 3.1.6 is now active!

Found Unreal Engine v5.0.3

Fixing compiler path in c_cpp_properties.json.
Extension compiler path is set to: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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).
All response files have the correct *.generated.h path!
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: c++17 (Overrides VSCode/cpptools if not undefined)
MAIN 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)
MAIN workspace c_cpp_properties.json's cppStandard is already set.
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: 0
*** 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.

The .rsp file still has the include paths I showed in my previous post. Intellisense still does not work properly and only going by estimating it - now it takes longer until Intellisense starts to work at all.

The C/C++ Output still reports changing back to the x64 version after a while. The time it takes for this to happen seems random / I did not find out how to trigger this so far.

[8/17/2022, 9:54:00 PM] For C source files, IntelliSenseMode was changed from "macos-clang-arm64" to "macos-clang-x64" based on compiler args and querying compilerPath: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
[8/17/2022, 9:54:02 PM] For C++ source files, IntelliSenseMode was changed from "macos-clang-arm64" to "macos-clang-x64" based on compiler args and querying compilerPath: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

I also checked if I accidently installed the intel version of VSC but I got the silicon version. Should I try out using the other two version instead (universal and intel)? Just re-Installing the silicon version of VSC did not help. EDIT: Just tried out the universal version of VSC. It loads up freaking slow + Intellisense still not working. Going back to the silicon version, as it runs super fast (except Intellisense :D)

mrjohnmc commented 2 years ago

Another update on this. After waiting for a while until Intellisense starts working, now I see this notification at the bottom right corner of VSC. Thats new to me!

image

But it seems that just opens up the C/C++ Extension settings file. :(

Current state still switches back to x64.

When Intellisense works, the Problems tab shows me this:

[{
    "resource": "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame/Public/FPSCharacter.h",
    "owner": "C/C++",
    "code": "1696",
    "severity": 8,
    "message": "#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit (/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame/Private/FPSCharacter.cpp).",
    "source": "C/C++",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 1
}]

Im happy if you have any further ideas on how to fix this. :)

boocs commented 2 years ago

I'd change my compiler to clang++ just to be safe. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++

Looking at the Unreal code for the VSCode project generator it shows it specifically using clang++

else if (HostPlatform == UnrealTargetPlatform.Mac)
            {
                MacToolChainSettings Settings = new MacToolChainSettings(false);
                CompilerPath = FileReference.FromString(Settings.ToolchainDir + "clang++");
            }

This probably won't fix your include errors though. We need to check what include paths are missing in your rsp file.

Paste both of these files here but remove any line that has an Unreal Engine path. Most of the paths will be Unreal Engine paths so you should only have to paste a few lines. If the lines from both files turn out to be equal you can omit one of them.

/.vscode/compileCommands_FPSGame/FPSGame.198.rsp

/.vscode/compileCommands_Default/FPSGame.198.rsp

Also you never said what happens when you run Generate Project Files. Does your project's *.code-workspace file update to the current date/time?

For example I just Generated Project Files on my current project and it shows the updated date/time image

Generating project files is suppose to add missing include paths to your rsp files.

boocs commented 2 years ago

I could be misunderstanding intellisenseMode. I asked and am awaiting reply.

"macos-clang-x64" could be correct...

Does intellisense work after this changes or does it still give include errors?

boocs commented 2 years ago

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.

mrjohnmc commented 2 years ago

Here you go

Paste both of these files here but remove any line that has an Unreal Engine path

/.vscode/compileCommands_FPSGame/FPSGame.198.rsp

-include "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/FPSGame/Definitions.FPSGame.h"
-include "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/FPSGameEditor/Development/Engine/SharedPCH.Engine.h"
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame/Private"
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Inc/FPSGame" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame/Public" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame" 

/.vscode/compileCommands_Default/FPSGame.198.rsp

-include "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Development/FPSGame/Definitions.FPSGame.h" 
-include "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/FPSGameEditor/Development/Engine/SharedPCH.Engine.h" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Intermediate/Build/Mac/x86_64/UnrealEditor/Inc/FPSGame" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame/Public" 
-I "/private_path/Documents/Unreal Projects/SimpleFPSTemplate-master/Source/FPSGame" 

Also you never said what happens when you run Generate Project Files. Does your project's *.code-workspace file update to the current date/time?

Sadly nothing happens. Finder freezes for a couple of seconds and nothing else visible happens. File modification time stays the same. :(

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

Makes sense too me! Intellisense still works after a random(?) time has past, but I got a feeling we are closing to fixing this too :) This is what I see for a long time when starting up VSC and hovering over UE code. The loading does not disappear. image

So I switched back to clang++ as you recommended and measured the time, how long it takes until Intellisense works. It was about 15 minutes of VSC beeing opened up. I checked all the log types in the output window, to maybe find a clue what has activated Intellisense, in case it is not "loading time", but was not able to see something that points to it / has the a matching timestamp. :( Any further ideas what I could do on my end?

boocs commented 2 years ago

1. I released 3.2.0 It has a new intellisenseMode setting. M1 Mac will auto set to clang-x64. I found that Unreal doesn't use the first part 'macos-' so trying it like this. Let me know if it switches to 'macos-clang-x64'.


2. There are two different intellisenses in the C++ extension. One is the smart default and the other is the tag parser. If you have include errors it might default to the tag parser intellisense which seems like what you're describing.

When you switch to different cpp/header files or modify header file class the (circled)fire icon will appear (default smart intellisense). The icon next to it, cylinder, is the tag parser activity symbol. Both icons can appear when using the default smart intellisense. If you're using only tag parser then the fire icon shouldn't appear or only maybe a few microseconds. image


3. If you're correct and didn't miss any paths from the response files then there could be a problem. Check VSCode at the bottom right. image

The circled might be named different for you. It could say MacOS or something like that or it could be very long and say the name of your project plus other stuff like this: image

boocs commented 2 years ago

Actually it's better to make sure the setting is off so it doesn't fallback to tag parser.

C_Cpp.intelliSenseEngine should be set to default
C_Cpp.intelliSenseEngineFallback should be set to disabled
mrjohnmc commented 2 years ago

FY: I did not forget about this, currently just big time busy with the stuff that pays my bills. Will give you proper feedback ASAP!

boocs commented 1 year ago

I've released 3.3.0 with new strict path setting behavior. Basically don't use the strict path extension setting anymore. Uncheck and reset your project (Generate Project Files)

I've also done a initial release of my guide on checking for config errors. This is just a partial Include Errors release. Note: This will get reorganized and changed.

https://github.com/boocs/Unreal-VSCode-diy-config-check-github

boocs commented 1 year ago

Even though I recommend against it I have another Mac(non M1) that says /usr/bin/clang worked for them. So you can also try enabling the extension's strict setting and putting /usr/bin/clang in the extension's path setting

Other M1 users have said this has worked as well. Not sure why though.

boocs commented 1 year ago

I rented a cloud M1 Mac and just changing the compile commands path to /usr/bin/clang made Intellisense work.

Strange behavior but hope that helps!

I'll probably change the way my extension works so it's easier to set.

boocs commented 1 year ago

New update makes the compiler path setup easier.

I tested it on an M1 Mac and changed my compiler path to /usr/bin/clang++ and it worked.

mrjohnmc commented 1 year ago

I finally found the time to dig into this again and see if it works now. Short Version: Nope :(

Both icons can appear when using the default smart intellisense. If you're using only tag parser then the fire icon shouldn't appear or only maybe a few microseconds.

In 99% of the time, I only have the Fire Icon on the left corner side in the status bar, which always just tells me "OmniServer is running". Clicking it brings me to the output of it, which so far never stated any errors.

image

In very rare cases, the fire icon jumps to the right side of the status bar and then I can also see the cylinder icon, which shows me the amount of files that are getting indexed. When that is done, the code gets some more color and IntelliSense starts to work halfway properly. It is then positioned where it is on your screenshot.

If it's set to the short name you'll want to click this and set it to the long project name version. I clicked and changed it to the long version name.

I updated your plugin to the newest version. Only going by its feedback, Intellisense "should" work.

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

Extension "UE Intellisense Fixes" 3.4.0 is now active!

Found Unreal Engine v5.0.3

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++" @'/Users/privatepath/Documents/Unreal Projects/SimpleFPSTemplate/.vscode/compileCommands_FPSGame/FPSGame.198.rsp'
Compile Command Object wasn't modifed. Will not write file.
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++" @'/Users/privatepath/Documents/Unreal Projects/SimpleFPSTemplate/.vscode/compileCommands_Default/FPSGame.198.rsp'
Compile Command Object wasn't modifed. Will not write file.
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++" @'/Users/Shared/Epic Games/UE_5.0/.vscode/compileCommands_FPSGame/FPSGame.198.rsp'
Compile Command Object wasn't modifed. Will not write file.
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++" @'/Users/Shared/Epic Games/UE_5.0/.vscode/compileCommands_Default/FPSGame.198.rsp'
Compile Command Object wasn't modifed. Will not write file.
Done fixing compiler paths.

Fixing compiler path in c_cpp_properties.json.
End fix c_cpp_properties compiler path.

Fixing invalid paths in response files.
No invalid paths returned. No fixes needed.
No invalid paths returned. No fixes needed.
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).
All response files have the correct *.generated.h path!
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: c++17 (Overrides VSCode/cpptools if not undefined)
MAIN 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)
MAIN workspace c_cpp_properties.json's cppStandard is already set.
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
End fix wrong intellisense mode.

Attempting to fix UE workspace optimization.
Optimization of UE is disabled.
End fix UE optimization.

No need to write FPSGame CCppProperties. It was unchanged.
No need to write UE5 CCppProperties. It was unchanged.

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

Extension is done.

I sadly don't know how I did it, but after opening different project templates / creating blank projects, at one time VScode almost instantly had Intellisense working. I am not able to reproduce it.

To me it looks like your plugin is doing its job - making it possibly work - but something else is messing up, ending in really bad performance. I am basing this on

  1. the time it takes until it Intellisense is working, based on the template/new project I am testing this on.
  2. How Intellisense works, when it is active. Example: I have this line in a header file, colored blue-ish and showing the syntax help when hovering it. TSubclassOf<AFPSProjectile> ProjectileClass; When I copy that line, I would assume that it should only take like a millisecond/second until the IDE connects my typed syntax with the code database in the background, but it takes quiet long (5-10 seconds, sometimes a bit longer) until it recognizes the code.

Good thing, while trying a lot of stuff, updating Xcode to v14 and then downgrading back to 13, I learned some stuff like for example how to generate the visual studio project files via command line, which I believe is what the missing context menu action is doing. If any mac users are reading this and want to know how: cd into /Users/Shared/Epic\ Games/UE_5.0/Engine/Build/BatchFiles/Mac and then run this command (swap in your user and project names) ./GenerateProjectFiles.sh -project=/Users/<username>/Documents/Unreal\ Projects/<project>/<project>.uproject -game -vscode

Would you say I am correct with it, that it is working but the remaining problem is just being ULTRA slow? BTW: I tried it with and without the Optimization Option in you Extension.

While typing this, I did another test. It takes around 15 Minutes until Intellsense "works" in my FPSgame tutorial.

boocs commented 1 year ago

Yep I noticed it slow to start as well but the cloud M1 Mac I rented it only took ~4 minutes. But I'll retest once I get my cloud mac working again.

My cloud m1 Mac was using clang 13.1.6 iirc.

Probably something we should ask the cpptools extension developers about. The slowness is cause by the cpptools extension querying clang about it's defaults when first starting up VSCode.

After all the clang querying is finished it seems to work like normal though. I did search their github and no one else seemed to have the issue.


Also my rented m1 Mac is not an admin account. Are you running an admin account? Maybe that could have something to do with it.


The omnisharp server and default Intellisense use the same icons. You can ignore the omnisharp fire symbol that appears on the left.

boocs commented 1 year ago

Can you also type '/usr/bin/clang++ -v' on the console again to see what version it goes to?

mrjohnmc commented 1 year ago

Yep I noticed it slow to start as well but the cloud M1 Mac I rented it only took ~4 minutes. But I'll retest once I get my cloud mac working again.

Interesting. I got the biggest MacBook Pro M1 Max model that was available, I was hoping that there will be NOTHING running slow for the next two years. Seems I was wrong with that assumption. :D

The omnisharp server and default Intellisense use the same icons. You can ignore the omnisharp fire symbol that appears on the left.

Ok. good to know that they share icon. Then I have to correct my last posting: The Intellisense fire icon is never there, unless Intellisense starts to work.

Can you also type '/usr/bin/clang++ -v' on the console again to see what version it goes to?

I tested both paths, just to be sure if there are two different versions at work. But both seem to point at the same Xcode package.

➜ Mac clang++ -v Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

➜ Mac /usr/bin/clang++ -v Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

mrjohnmc commented 1 year ago

Also my rented m1 Mac is not an admin account. Are you running an admin account? Maybe that could have something to do with it.

Yes.

boocs commented 1 year ago

Hmm for some reason my cloud mac got upgraded to XCode 14, but yes it also does the same query clang defaults slowness ( but also works after).

On the UE5 site it says a very specific XCode 12.4 is required for Macs. If the project is for IOS you can use 12.4 or the latest XCode 13 version(for specific reasons).

https://docs.unrealengine.com/5.0/en-US/hardware-and-software-specifications-for-unreal-engine/ https://docs.unrealengine.com/5.0/en-US/ios-ipados-and-tvos-development-requirements-for-unreal-engine/

Would it be possible to try XCode 12.4 and see if it fixes the clang query slowness? I would have to jump through hoops to get it installed on my cloud M1 Mac or probably denied.

boocs commented 1 year ago

I've been preparing to make a bug report to the cpptools extension. I decided to create a single workspace project and just copied over an unreal project and fixed it to work. Basically removed the UE5 folder.

It has no clang defaults query slowness...

Back to testing.

boocs commented 1 year ago

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.

boocs commented 1 year ago

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.

boocs commented 1 year ago

Another thing to try: For an existing project, on my cloud Mac, it seems to work. Also check if Building your project works because I'm unable to test Building with this clang version. I also can't try a new project because of wrong clang version.

  1. Uninstall the C++ extension.
  2. Download and install the vsix file for the Native Apple Silicon version of the C++ extension https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools (It's on the right side dropdown 'Download Extension' called MacOS Apple Silicon)
  3. Change the VSCode C++ config to the Project Name config instead of the Mac config

    1. Open a .h/.cpp file
    2. 'Mac' will probably show on the bottom right (Showing Windows version though) image
    3. Click on Mac and a config menu will appear
    4. Choose the "Project Name" config
    5. The bottom right should show your "Project Name" config image

    Does it work?

boocs commented 1 year ago

Just a note, don't do this: image

Just remove the line instead. My extension reads that file as a json file and it'll see it as malformed if you put comments in it.

Or keep the line uncommented if trying the above post.

mrjohnmc commented 1 year ago

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.

Awesome man, thanks for the effort! :) Wondering how few people use a M1 Mac with UE5, as nobody else seems to have this problem and the M1 is almost like "old gear" already.

I installed the silicon version of the C++ extension, which already gave a huge speed boost to the Intellisense init. I removed the compile paths out of the cpp JSON file but did not really experience any further improvements with my current project files. When changing code in a cpp/h file, I now instantly see the fire icon showing up, updating intellisense. It is way better now, but hopefully still improvable on the C++ Extension part. Again, thanks already for your plugin and effort on this!