Ericsson / CodeCompass

CodeCompass is a software comprehension tool for large scale software written in C/C++ and Java
https://codecompass.net
GNU General Public License v3.0
516 stars 101 forks source link

C++ Reparse: the AST isn't coloured anymore #528

Open whisperity opened 3 years ago

whisperity commented 3 years ago

The current version when generating the AST HTML output does not seem to call the appropriate methods which would result in calls to our ANSI colours -> HTML sequences formatting. It is very likely that during the uplift to LLVM 10.0 (#432) we forgot to add a virtual method's override or something like that.

Screenshot of the broken reparse AST-view. It shows the AST output in one giant default-coloured (black) monospace widget, with the Developer Tools visible underneath showing some HTML sequences like monospace font or explicit newlines.

Oddly enough, some of the logic, such as putting things between ' in the raw output to <tt> still runs, as seen in the picture. The relevant code snippet that seems to get executed properly:

https://github.com/Ericsson/CodeCompass/blob/e39c21346ccdfe8c36e12254c50e4932b2d3b3dd/plugins/cpp_reparse/service/src/asthtml.cpp#L54-L66

mcserep commented 3 years ago

I cannot reproduce this bug in my development environment with LLVM 10. However the bug is still present on https://codecompass.net/demo/ , where it was located initally.

Since codecompass.net uses the modelcpp/codecompass:web-pgsql Docker image we produce, that could be the next target for debugging locally.

whisperity commented 3 years ago

Okay, at the top of my head, we should check the following, because Clang tries to be too smart about what escape sequences it emits or what sort of callbacks it runs... Most likely it doesn't detect that the shell it is running in would be capable of using colours.

mcserep commented 3 years ago

The source of the issue indeed seems to be when the docker container is executed in detached mode (-d).

Unfortunately, setting any of the proposed environment variables has no effect.

whisperity commented 3 years ago

Well, that's sad, but not unexpected... :frowning: I'll try to look into it, mayhaps we can do some clever change to the inheritance we're already doing wrt. the ColorHTMLStream or what its name was...