boocs / ue4-intellisense-fixes

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

"Choose response file" continously propted for included plugins #31

Closed SilentGodot closed 10 months ago

SilentGodot commented 10 months ago

When including plugins with source code (for exaple the Wwise plugin) in the project by adding them to the "Plugins" directory and regenerating the vscode project files, a prompt continously pops up for every single cource file in the plugin.

For example: image

I'm not sure what to pick in every one of these. Perhaps I am doing something wrong. But I couldn't find anything in the documentation about including plugins in the project.

I'll attach the full extension log.

ue4_int_fix_log_2023111.txt

Thanks

boocs commented 10 months ago

It's now under the Multiple Module projects & Plugins header

I stupidly didn't have it in the Table of Contents.

Basically cancel the window and reset your project again using these instructions: https://gist.github.com/boocs/f63a4878156295b6e854cac68672f305#reset

boocs commented 10 months ago

Updated gist and link above.

SilentGodot commented 10 months ago

Thanks for the reply.

I tried this multiple times:

  1. Click Cancel (I get prompted for the next file)
  2. Click Cancel remaining (I sometimes get prompted for the next module)
  3. Close VSCode
  4. Regenerate Project Files
  5. Reopen VSCode
  6. I get prompted again

So the solution detailed doesn't seem to work..

boocs commented 10 months ago

Strange, I'll have to look at the code and see what's going on. It might be awhile but I'll try to update you about what's going on.


If you want, you can try my clangd extension for VSCode. (I've actually stopped using my other Unreal extension)

Clangd works way better than the Microsoft C++ extension, imo. I've used it for months with Unreal 5.2, on Windows, but haven't used it much with 5.3 because I'm developing a clang-tidy guide.

Although if you're on Mac it hasn't been shown to work yet. It's only been tested on Windows and Ubuntu 22.04.

https://github.com/boocs/unreal-clangd

boocs commented 10 months ago

So basically we are trying to find the correct response file for that file and Unreal doesn't know how to handle these files. My extension allows you to choose a response file instead of resetting your project which should do it automatically.

Response files hold all the command line flags sent to the compiler doing intellisense. Response files aren't required but make it easier to organize.

Of course maybe these particular files don't use response files, if that's the case then my plugin needs updating because I assume all files need a response file. I wouldn't think Unreal would mix no response file + response file.

Another thing is my extension automatically adds source files to the compile commands file. Maybe Unreal isn't adding these to the compile commands files. Maybe my extension adds them and then asks you which response file it should use.

What does the compile commands file say for the file of HoloLenseAPI_2022_1.cpp?

  1. Reset your project.
  2. Don't open your project in VSCode yet.
  3. Go to Project/.vscode and open compileCommands_Default.json in some other editor
  4. Search for HoloLenseAPI_2022_1.cpp
  5. Is it there?
  6. If it's not then that means Unreal doesn't even see this as a source file and it's not adding it to your compile commands file automatically.
SilentGodot commented 10 months ago

This file is indeed not there. And neither is any file from the wwise plugin. I suppose that explains the issue. How should I go about fixing it?

I'll try the clang-based plugin soon, as I'm curious about it anyway. This extension has made my coding experience many orders of magnitude better. So if it's anything like this one, I'm sure I'll enjoy it as well.

boocs commented 10 months ago

I'm pretty sure it would be the plugin author's job to make sure Intellisense files get created when you install a plugin. Epic's free Lyra project has a lot of plugin's and they all come with Intellisense files.

Also, is it even a plugin that you need Intellisense for? Cause that's all it means is you won't have Intellisense for this plugin's files.

If you don't want to mess with clangd, you can just pick any response file that my extension gives a choice for. It just means Intellisense won't work with these files. Actually you might get lucky and the random response file you choose could have everything the file needs to compile correctly and start working with Intellisense.

Of course, you'll have to do this every time you reset your project...

I was actually doing this extension feature as a shortcut instead of resetting your project. Instead of my extension attempting to fix it, a better way would just be to warn to reset your project with a button to never warn again for situations such as yours.


SilentGodot commented 10 months ago

Well I don't plan to edit the source code for this plugin, so I don't really need intellisense for it. I added it to my source control so that I can compile the binaries so that my non-coder teammates can then open the project without building it.

A button to never show again would be good, I think. Or even like a setting where I can detail paths in my project for the plugin to ignore. That way I can ignore my Plugins\ directory.

boocs commented 10 months ago

I am working on an update so it just explains to reset your project whenever you add a source file. It also has an option to never warn again. I should have never tried to auto fix it without prompt because I see a scenario where that wouldn't work. Not that not having intellisense on a plugin is a terrible outcome though.

I'm also going to configure this extension with esbuild for smaller download and faster loading. Already had done it with my clangd extension.

Speaking of which you should definitely try my unreal-clangd extension even if it's just with a small test project. Clangd is faster, especially with headers. You can also configure it to your liking. Like you mentioned about removing the plugins folder from Intellisense. You can do this with the .clangd config file.

boocs commented 10 months ago

I published my extension update. Thanks for the report!

SilentGodot commented 10 months ago

Thanks for the quick responses! I'll definitely check out the clangd extension