Bug 385113 - Turn off semantic analysis for GLSL (or fix it)
Summary: Turn off semantic analysis for GLSL (or fix it)
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Problem reporter (other bugs)
Version First Reported In: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-27 00:09 UTC by Staffan Palmroos
Modified: 2021-03-01 14:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Test project for GLSL parsing issues (31.76 KB, application/x-compressed-tar)
2017-09-27 19:52 UTC, Staffan Palmroos
Details
Screenshot of the problem (177.44 KB, image/png)
2017-09-27 19:55 UTC, Staffan Palmroos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Staffan Palmroos 2017-09-27 00:09:23 UTC
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.
Comment 1 Kevin Funk 2017-09-27 07:27:31 UTC
Do you have an minimal working example which exhibits the problem?
Comment 2 Staffan Palmroos 2017-09-27 19:52:39 UTC
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.
Comment 3 Staffan Palmroos 2017-09-27 19:55:03 UTC
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.
Comment 4 Francis Herne 2017-09-27 20:47:59 UTC
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.
Comment 5 Daniel Bernar 2019-07-24 08:46:42 UTC
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.
Comment 6 Daniel Bernar 2019-07-25 10:17:45 UTC
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
Comment 7 Max Schwarz 2021-03-01 14:40:27 UTC
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.