@techee
I opened a similar issue at [geany/#2946](https://github.com/geany/geany/issues/2946). I was informed that the feature might be a better fit with one of the project-related plugins. Since the Project Organizer already has some file extension-related settings, setting filetype for ambiguous header files may be within its scope.
The issue is that `.h` files are ambiguous with respect to C and C++. Identifying the right type most visibly affects syntax highlighting. But it may also affect whether class structures and other symbols are correctly identified.
1. Many header files have corresponding source files. When a pair is found, the header type can be changed if needed.
2. Projects may have sufficient information about file locations to find related files in separate directories?
3. If pairing files is too troublesome, or wasteful of cpu cycles, whichever language predominates the project could be used.
4. The project organizer could have a setting that identifies the main project language. Ambiguous header files could then be set accordingly.
What do you think? Any other ideas?
Closed #1121.
Yeah, I think (1) should be doable quite easily. There would always be a problem if there is both `some_file.cpp`, `some_file.c` and `some_file.h` in the project to detect to which of the source files the header belongs (different projects use different directory structures and there's no easy way to tell which file belongs to which) but these cases should be exceptions.
I don't remember the Geany API exactly and implementing this feature would require that Geany allows plugins to specify the filetype that should be used to open the files but I believe there is such a function.
I'll have a look at this when I have time - should be quite easy to implement.
but I believe there is such a function.
`document_set_filetype()`
@techee I opened a PR that implements this feature. #1122
github-comments@lists.geany.org