github / semantic

Parsing, analyzing, and comparing source code across many languages
8.94k stars 453 forks source link

Semantic not working with C++ standard headers. #704

Open Markkolas opened 10 months ago

Markkolas commented 10 months ago

I have read that semantic has some problems with C++ so I don't know if this is expected behavior.

I added C++ headers dir path with (semantic-add-system-include [path]) and, for example, semantic-ia-fast-jump dosen't recognize C++ standard header files like or (and of course the tags defined in such files). If the header ends with .h (like math.h) the function works correctly and I noted that when applying the function to a include directive with <randomgibberish>, semantic-ia-fast-jump does not complain and just jump to the tag itself.

So I'm guessing that semantic can only process tags as header files only if they end with .h. Is there any way to make semantic process anything in a include directive as a header file or do I just have to live with it? I may have something wrong with my config tho (I hope not).

Thanks in advance.

EDIT: Seems like if I include C++ system files like #include \<./iostream> then semantic-ia-fast-jump jumps to the file correctly. Again, is this normal behavior?

Markkolas commented 9 months ago

By pure chance I discovered that the jump works properly when the cursor is OVER the #include, the space (if any), or the '<' symbol. If it is in the same line but over the standard library name it does no jump. I won't close the issue just in case this is not expected behavior (which, at least for me, it is not, and if it is, then I find it pretty inconsistent).