D15532: [Astyle] Add Objective C to list of languages with formatters
noreply at phabricator.kde.org
Sat Oct 9 18:25:14 BST 2021
igorkushnir added a comment.
I would like to eliminate the following warnings from KDevelop's output:
> kdevplatform.shell: formatter plugin "kdevastyle" supports unknown mimetype entry "text/x-objc++src"
> kdevplatform.shell: formatter plugin "kdevastyle" supports unknown mimetype entry "text/x-objchdr"
> kdevplatform.shell: formatter plugin "kdevcustomscript" supports unknown mimetype entry "text/x-objc++src"
> kdevplatform.shell: formatter plugin "kdevcustomscript" supports unknown mimetype entry "text/x-objchdr"
I am going to contribute Objective-C++ source MIME type to https://gitlab.freedesktop.org/xdg/shared-mime-info. But I don't have access to macOS, so need some information. @rjvbb, could you please try to answer the following questions?
1. KDevelop and QtCreator use //text/x-objc++src// as the MIME type name. But KSyntaxHighlighting <https://invent.kde.org/frameworks/syntax-highlighting/-/blob/0b2c0dc5368de519c4e9517a4dec69017df4cd6c/data/syntax/objectivecpp.xml> refers to //text/x-objcpp-src//. Is //text/x-objc++src// the canonical name used in macOS or is there some other reason to select one of these names?
2. The Objective-C Wikipedia article <https://en.wikipedia.org/wiki/Objective-C> and the KSyntaxHighlighting's data file linked-to above claim that //*.M// is one of the file extensions of Objective-C++ source files. But since macOS's filesystem is case-insensitive by default, I suppose //*.mm// is used almost universally and //*.M// practically never. Is that right? If so, there is no need to complicate the MIME database with 3 //case-sensitive// attributes.
3. Currently //text/x-objcsrc// has only one magic pattern: "#import". My brief research indicates that many Objective-C and Objective-C++ files start with comments or //#include//. Is that right? If so, I would like to add the following magic to these MIME types with a priority lower than //text/x-csrc//'s to facilitate distinguishing them from //text/x-matlab// and //text/x-troff-mm// MIME types with file extensions //*.m// and //*.mm// respectively:
+ <match type="string" value="/*" offset="0"/>
+ <match type="string" value="//" offset="0"/>
+ <match type="string" value="#include" offset="0"/>
4. My Internet searches indicate that //text/x-objchdr// MIME type is very rarely used. Qt Creator doesn't mention it. KSyntaxHighlighting refers to //text/x-c-hdr// in //data/syntax/objectivec[pp].xml//. This KCoreAddons commit <https://commits.kde.org/kcoreaddons/e5f09f84a945af4edf4f346aed409acf29905414> removed it as useless. Indeed, it shares the extension //*.h// with C. Not even C++ competes for this file extension in the MIME type database, even though a large proportion of //*.h// files are C++ headers. So I doubt the MIME type DB maintainers would agree to risk issues in C header detection to accommodate this rare case. Theoretically, Objective-C headers could be detected with //#import// magic, but that wouldn't be reliable, because Objective-C headers can start with a comment or with //#include//, which share C's syntax. So I am inclined to remove the references to //text/x-objchdr// from KDevelop. If I understand correctly, this MIME type is currently useless in KDevelop anyway, because it is only included in MIME type lists and never appears in conditions. Is //text/x-objchdr// used in macOS? If yes, how is it distinguished from //text/x-chdr// there?
To: rjvbb, #kdevelop, kossebau, kfunk
Cc: igorkushnir, aaronpuchert, kfunk, pino, kossebau, kdevelop-devel, hmitonneau, christiant, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KDevelop-devel