amir9480 / vscode-cpp-helper

vscode extension to create implementation for c++ function prototypes.

Home Page:https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.cpp-helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The extension fails to find the source file when it's not in "an obvious location".

HTD opened this issue · comments

I have a complicated project where the header and source files are not in the same directory, and they more than one directory level away from each other. However, the include directories are properly configured in the project settings.

The default switch "header / source" option in VS doesn't work, however, I installed a different extension (first match) for the search "header source" and it works.

I know the proper way to find the source is to consider include directories in the project settings, then look for the C / C++ file that includes the current header and its name matches the header name.

Somehow it's not what this extension does, since it doesn't find my source file. So for now I can create the implementation in the header file and then manually move it to the source file.

@HTD You should change CppHelper.SourcePattern configuration so the extension can find your source.

The default configuration seems not to fit your project.
https://github.com/amir9480/vscode-cpp-helper/blob/master/package.json#L77

In my Unreal project, I've got files that look like this:
C:\BaseFolder\Unreal\GameName\Source\GameName\Private\SomeFolder\SomeOtherFolder\MyFile.cpp
C:\BaseFolder\Unreal\GameName\Source\GameName\Public\SomeFolder\SomeOtherFolder\MyFile.h
Doing a bit of experimentation, I've figured out that I can get it to work by using
"/GameName/Source/GameName/Private/SomeFolder/SomeOtherFolder/{FILE}.cpp"
but I don't seem to be able to use directory wildcards, e.g.
"/GameName/Source/GameName/Private/**/{FILE}.cpp"
Is there any other way to make it more generic so I don't have to list every subdirectory (there are quite a few in the project, and new ones are added frequently)?