Bug 381709 - Matlab script interpreted as C++
Summary: Matlab script interpreted as C++
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: All editors (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-27 06:04 UTC by peje66
Modified: 2023-09-28 18:28 UTC (History)
3 users (show)

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


Attachments
Imge of Matlab script showing erroneous C++-problems (117.27 KB, image/png)
2017-06-27 06:04 UTC, peje66
Details

Note You need to log in before you can comment on or make changes to this bug.
Description peje66 2017-06-27 06:04:50 UTC
Created attachment 106331 [details]
Imge of Matlab script showing erroneous C++-problems

If I load a matlab-script in kdevelop it's parsed as C++-code and generates a ton of warnings.
Se image. All the markings in the editor window is distracting.
Document is marked as Tools->Mode->Scientific->Matlab

"kmimetypefinder5 reformat_flux.m" reports "text/x-matlab"
Comment 1 Sven Brauch 2017-06-27 16:59:30 UTC
I just tried, the issue is reproducible here ... not sure what is responsible for that :/
Comment 2 geetam chawla 2017-06-27 18:59:42 UTC
@Sven: For me it is only reproducible if I add it to a session which has existing cpp projects, if a new session is created for matlab project(s), matlab scripts are not interpreted as cpp.
Comment 3 Igor Kushnir 2023-09-28 18:28:13 UTC
*.m is registered as both a Matlab and an Objective-C MIME type extension. kdevelop/plugins/clang/kdevclangsupport.json contains "text/x-objcsrc" among X-KDevelop-SupportedMimeTypes. When any file parsed by KDevelop's Clang plugin is loaded (C, C++ or Objective-C), LanguageController adds all of the plugin's supported extensions into the MimeTypeCache. The cache is consulted before MIME type detection. So it returns ClangSupport for any *.m file afterward.

Note that the MimeTypeCache is not just an optimization. Simply removing the cache would make LanguageController::languagesForUrl() always return an empty list in a background thread because of an early return required for thread safety.