The semantic analysis in KDevelop is great when it works but unfortunately it doesn't for GLSL code, which means it thinks more or less every line is incorrect and it keeps throwing tons of popups in my face. This is driving me up the wall and I can't find a way to turn it off for GLSL files. So basically I'd like some way of forcing it off for specific file types. Even better would be if it could actually handle GLSL code but I realize that would require quite a bit more effort so at least turning it off would be good. Typical file endings for GLSL code is *.glsl *.vert *.frag, *.vs *.fs and probably a couple more for other types of shaders.
Do you have an minimal working example which exhibits the problem?
Created attachment 108063 [details] Test project for GLSL parsing issues Sure, here's one. It's not a complete program, just some vertex and fragment shaders that triggers the problem mentioned.
Created attachment 108064 [details] Screenshot of the problem Here is a screenshot of it. The Problem tab is full of errors because it parses it as C(++) code when it isn't.
The C++ file matching is extremely overzealous...see also: https://bugs.kde.org/show_bug.cgi?id=360081 "Attempting to parse text/plain files as C or C++" (reported by me) for *.nml files. https://bugs.kde.org/show_bug.cgi?id=381709 "Matlab script interpreted as C++" for *.m files. It also tries to parse TypeScript (*.ts), and generally anything remotely C-like. This occurs despite kmimetypefinder returning text/x-matlab, text/x-typescript etc.
ArchLinux, KDevelop v5.3.3. The same issue. Editing is possible in some other program (it's good that KDevelop allows opening files by default in another program), but when I commit changes, these "errors" interfere. If someone found a solution to this problem, please share it.
I fixed it as follows: 1. Right-click on the project 2. Configure project 3. Cppcheck 4. Include Directories 5. Ignored includes - here I pasted the path to the folder with shaders
For me, adding a new MIME type "text/x-glsl" in system settings -> Applications -> File Associations with the appropriate file endings (e.g. *.glsl) helps. Then kmimetypefinder5 returns text/x-glsl instead of text/x-csrc. I had to clear out my kdevelop cache to remove any lingering error markers.