.vscode folder, in multiple locations

Hi guys, I have this bit of confusion when following the Battle Tank project with UE4 4.26.1:
When generating Visual Studio project files, or refreshing the code from UE4 editor, UE4 keep creating .vscode folder not only in my Battle Tank project folder, but also in UE4 installation folder as well (as you can see from the screenshot). The problem is inside .vscode, UE4 creates this compileCommands_PROJECTNAME folders. That means I will have a bunch of compileCommands_PROJECTNAME folder with different projects.

With 4.24, I believe it only creates .vscode folder in the project directory only. Does anyone know if it’s a bug or something in 4.26?

What’s the issue with that exactly?

Hi,
The issue is 4.26 generates an extra .vscode folder under UE4 installation folder. I believe with 4.24, it only creates .vscode folder under my project directory (/Battle Tank in this case), which is totally fine.

And let say, I have a bunch of different UE4 C++ project, UE4 will generate a bunch of compileCommands_PROJECTNAME folders inside UE4 installation directory as well. This is going to clutter my C: drive quickly.

I tried deleting the .vscode folder under UE4 installation folder, and it seems my project still compiles and works just fine. So unless it is a must to keep an extra .vscode folder in UE4 installation, I like to keep things clean and tidy as much as possible.

Would you mind explaining why 4.26 is doing this way, unless it is a bug?

They changed the way of doing things in 4.26 for better IntelliSense, @SHuRiKeN could probably give you a better idea to the whole workings of it.

I’d love to have @SHuRiKeN elaborate more on this topic. :slight_smile:

No that is not a bug, It is by design, .vscode folder is still in other engine versions but compile commands were not in previous Engine versions because we didn’t had project specific compile commands instead “defines” were used. In Unreal Engine 4.26 the whole intellisense was reworked from defines to compile commands. You should not delete the .vscode under Unreal (you can regenerate it anytime tho) as it will also remove Unreal Engine specific project files for example changing the engine code (which many people probably won’t do) unless you are a engine developer you need to make changes to the engine using VS Code or sometimes in case of bugs. You can delete the project specific compile commands after you delete your project (from the unreal engine launcher for less bloat) if you don’t need that project ofcourse. Unreal Engine will also keep regenerating that file in case of regenerating project files so there is no point deleting it. You can always regenerate Engine project files or your project files so you can always regenerate the .vscode folder present in your engine directory or your project directory.

In Short - it is not a very important directory and you can always regenerate it. Both in your engine directory or in your project directory, but it can be helpful and also it saves time if you move your project alot it will always have the compile commands in your engine vscode directory as when you work with a team everyone have different IDE’s and people exclude .vscode files when version controlling of the project on github or gitlab or any git client. You can research on .gitignore file as well.

As you can see .vs files and in some gitignores .vscode files are also removed as it is not ideal to ship so many different IDE folders when working in a team as they can be 100 different IDE’s but your engine .vscode file will always remain with you and your system so it can be a real time saver and also for your engine changes using an IDE.
I tried my best to explain it :slight_smile:

Thank you for your explanation! So it is the new way of 4.26
In fact because of version control through GitHub I discovered that UE4 creates another .vscode in the engine directory, haha (I set up so .getignore excludes .vscode however).

Since I often work on 2 different computers (my main rig, and my laptop), one minor problem I ran into yesterday was after pulling all of the new changes I worked from my main rig, on my laptop, I couldn’t refresh/re-generate the code, UE4 kept throwing error about how its access to .vscode under engine directory is denied (this is how I discover the extra .vscode), even though I didn’t change anything on my laptop, and the project was originally created on this laptop. I had to manually turn on full access permission to fix it, it was weird.

It seems the compile_Commands_PROJECTNAME.json only keeps absolute file path to .h & .cpp files, which is only relevant to a specific machine. Due to the way I work on 2 different computers, I assume I always need to refresh/re-generate the code each time I switch to another computer?

Not sure why, however yes if you open the project on other system it will regenerate stuff and try to look in the engine directory which can save time but still it will have to generate a lot of stuff so no reason to think alot about the bloat. Unreal is an engine which will cause a bit of bloat like cache files which saves your Materials data, when it compiles your shaders for example it can always be deleted and regenerated by the engine but why delete as you may use those materials again later on and it will not have to recompile it. So Unreal Engine is like that by design it will cause bloat but it can always be deleted and regenerated and won’t cause any issue. That is how the engine is by design, so don’t think about it alot. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms