Repository: godot
Issue: Scons-Generated VS Project is Missing Defines and Include Search Paths for IntelliSense
Labels: bug,topic:buildsystem,topic:thirdparty,needs testing

### Tested versions

- Reproducible in: master branch

### System information

Windows 10 - Godot master branch

### Issue description

When I generate a Visual Studio project using Scons, the resulting solution opens/compiles/runs in Visual Studio 2022 without issue. However, IntelliSense for various files throughout the codebase shows a ton of errors.

From what I can tell, these IntelliSense errors are caused by a disconnect between the Defines and Include Search Paths that are used to compile the projects versus the Defines and Include Search Paths that VS IntelliSense is using.

After digging into the Scons files a bit, here are a few examples of this problem manifesting:

- The file `modules/SCsub` adds the `GODOT_MODULE` define, but only for that subdirectory's environment (`env_modules`). Later on, when the VS project is generated, the `GODOT_MODULE` define isn't present in the global `env`. As a result, IntelliSense in VS acts as though it isn't defined and shows a lot of errors in module header and cpp files.
- In situations where a file depends on a third party library, the Include Search Paths are often included only in that file's `SCsub` file. For example, `thirdparty/harfbuzz/src` is only added as an include search path deep in the `text_server_adv` module. But then when the VS project is generated, that search path isn't added. As a result, Intellisense acts as though it can't find includes from harfbuzz, and shows a lot of errors.

One way I was able to fix this was by manually adding various defines and search paths to the `VSHINT_DEFINES` and `VSHINT_INCLUDES` environment variables before vsproj generation. These env vars appear to be meant exactly for this (specifying additional defines/includes for the VS project generation), but they appear to be otherwise unused.
```python
if env["vsproj"]:
    methods.generate_cpp_hint_file("cpp.hint")
    env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]]

    env["VSHINT_DEFINES"] = ["GODOT_MODULE"]
    env["VSHINT_INCLUDES"] = ["thirdparty/harfbuzz/src",
                              "thirdparty/icu4c/common",
                              "thirdparty/icu4c/i18n",
                              "thirdparty/msdfgen",
                              "thirdparty/mbedtls/include",
                              "thirdparty/libogg"]

    methods.generate_vs_project(env, ARGUMENTS, env["vsproj_name"])
```
You might argue that it isn't a big deal for IntelliSense to be broken, but I can tell you firsthand that it can be quite confusing for new contributors, and it can obviously be quite frustrating and confusing and distracting for IntelliSense to be telling you a ton of things are broken when that isn't actually the case.

I think some possible fixes for this issue could be:
- As I did in the above example, populate `VSHINT_DEFINES` and `VSHINT_INCLUDES` with reasonable values in the root `SConstruct` file to ensure that IntelliSense works as effectively as possible.
- Some other way to populate these two environment variables elegantly when `vsproj=yes` is specified and defines/includes are added in `SCsub` files that are then not included in the root env.
- If no source code changes are desired to fix this, at least updating the documentation (https://docs.godotengine.org/en/stable/contributing/development/configuring_an_ide/visual_studio.html) to highlight this issue and explain the correct way to populate these environment variables (e.g. can they be defined in a `custom.py`? or on the command line? or via some other means? if unfamiliar with Scons, it's unclear).

I'd also be happy to make the changes myself and issue a pull request to fix this, but would love some advisement as to the "best way" to fix the problem from the perspective of more seasoned Godot developers.

(Finally, just a note that this is similar to another issue (https://github.com/godotengine/godot/issues/94287), but that issue appears to be more related to custom module development. The issue I'm describing seems to happen for a clean clone with built-in Godot classes. But the root cause/fix may be the same?)

### Steps to reproduce

1. Clone the godot repo locally on a Windows machine with VS 2022 installed.
2. Generate a VS project in Scons: `scons platform=windows vsproj=yes dev_build=yes`
3. Open in VS 2022. Notice that building and running both work fine.
4. However, notice that many files appear broken and have a lot of IntelliSense issues. For example, `crypto_core.cpp` or `text_server_adv.cpp` or `text_server_adv.h`.
5. Add the `VSHINT_DEFINES` and `VSHINT_INCLUDES` lines from the description to the appropriate spot in the `SConstruct` file.
6. Regenerate the VS project.
7. Notice that IntelliSense now works for the files identified.

### Minimal reproduction project (MRP)

N/A