slynch8 / 10x

10x IDE/Editor
189 stars 34 forks source link

Forceinclude files set in VisualStudio Solution don't seem to be getting applied. #2643

Closed CodyOlivierRSGNWE closed 2 months ago

CodyOlivierRSGNWE commented 3 months ago

I have a series of forceinclude files set on each config of my VS sln and they are different for each config. It does not appear that they either either getting picked up or applied when I open 10x or change configs. I've tried writing a python script to apply a subset of the forceincludes for my most common config but either that isn't working or I'm not setting it up correctly. Either way, is is possible for 10x to pick up the forceinclude files already in my imported slns and change forceinclude files when I switch configs?

slynch8 commented 3 months ago

I added VS ForceIncludes a few versions back, so it should be working. Can you give an example of a simple project where it doesn't work?

CodyOlivierRSGNWE commented 3 months ago

Attached is a simple project with 4 configs (Debug/Release + x86/x64) and four header files with defines, each intended for a specific config. I've set up two of the configs to have forceinclude files from the list of headers. I've also included a screenshot of what VS looks like along side 10x with the same config selected. FWIW, VS also had mixed results with this behavior (sometimes I got no syntax highlighting from the macros defined in the forceincludes and once I got one of the macros working but not the other).

syntax_highlight_comparision

forceinclude_test.zip

CodyOlivierRSGNWE commented 3 months ago

Also forget to mention, I'm using version 1.0.17 of 10x

slynch8 commented 3 months ago

I see. 10x only supports force includes for the project, it doesn't support settings for specific files yet.

For now I recommend adding a force include settings in 10x for the project. You can set this up per config.

CodyOlivierRSGNWE commented 3 months ago

Thanks for the information. I recently tried both adding forced includes to the project along with a hardcoded path inside 10x and neither seemed to give the expected syntax highlighting. Attached is this new test. Note that both CONFIG_STR and PLATFORM_STR are defined inside the header file being force included and yet 10x does not reflect that they are previously defined in main.cpp

syntax_highlight_comparision2

I was also curious if it would be possible to get some [parser] output when forced include files are registered correctly and it we could get a way inside python to query values of macros recognized by the parser? All of this in service of gaining confidence that the correct values are being picked up.

slynch8 commented 3 months ago

That should work. Have you tried it without the quotes?

Good idea about outputting the force include files. I'll add that.

You can see the value of a macro or preprocessed line by hovering over it, or using the GetPreprocessedLine() python function.

CodyOlivierRSGNWE commented 3 months ago

Tried without quotes, still doesn't work :(.

I am able to hover over the macros and see the value which is useful. Sadly they show the value of the ifndef path seen in the main.cpp and not the one that should be picked up in the forced include header file.

slynch8 commented 3 months ago

I've found the problem. You need to restart 10x and do a ReparseAll for it to take effect (and it does need to be without quotes).

CodyOlivierRSGNWE commented 3 months ago

Playing around with these instructions a bit, I think there is another restriction. Using relative file path or an absolute filepath with forward slashes seemed to work with the restart/reparse recommendation. Using back slashes (even two of them) in an absolute filepath did not work at all.

I'll see if I can play around with this discover on our larger codebase but sadly I think trying to set these up manually will be time consuming. We have a lot of platforms/configs and various forced includes based on the solution we are trying to build. But hopefully getting setup with at least one platform/config combo can help me make progress. Thank you for all the help.

slynch8 commented 3 months ago

Noted. I'll look into these soon.

I might be able to support force includes per file, I'll see what I can do.

CodyOlivierRSGNWE commented 3 months ago

Thanks. FWIW I think the per-file experimentation was a mistake on my part in testing these features. I don't believe we have our main codebase setup like that. I believe we have per project and/or per solution forced includes but for some reason, 10x isn't picking those up from the VS files.

slynch8 commented 3 months ago

Ok, that's interesting. They should be being picked up, how are they specified in the vcxproj xml?

slynch8 commented 3 months ago

I think I might have found the bug. It gets confused switching between configs. If you reload the workspace after switching configs it starts working.

slynch8 commented 3 months ago

Here's some fixes: https://www.10xeditor.com/upload/10xForceincFixes.zip

Let me know if that fixes your original problem. I tested it with different force includes for different configs (for the project)

Includes:

slynch8 commented 3 months ago

fix in early access build (1.0.181)

slynch8 commented 2 months ago

fixed (1.0.189)

CodyOlivierRSGNWE commented 2 months ago

Just wanted to mention that I finally got a chance to grab 1.0.189 and it does seem to fix a majority of the issues I was seeing when it comes to force includes, macro resolution, and syntax highlighting. The codebase is large so I hesitate to say everything is fixed but certainly the major pain points are gone and have yet to find any additional issues. Thank you for fixing this.