Its not that simple, the process is:

  1. read shebang, finds various shells, perl, python, php, ruby, tcl, make, D, js, rust
  2. detect HTMLy prefix, eg <html, but not if the file extension is perl, python, or php.
  3. detect XML prefix, but not if the file extension is html, docbook, perl, php, or python
  4. detect PHP prefix
  5. attempt to read the filetype out of the file using the regex at Edit->Preferences->Various->files.extract_filetype_regex (the default regex is what detects the -*- Sh -*- but users can modify or add to it)
  6. detect from extension using filetypes.extensions

Not much is left for mime, but if "somebody" made a well written PR that used the GIO interface to get mime type and a configuration file that maps mimetype to Geany filetype it might be accepted.

The problems with mimetypes that I know of are they can't distinguish .h files as C or C++, and of course C++ system headers have no extension, so file managers show them as C, not C++. But its important to open these as the right filetype to get keyword highlighting and symbol parsing to work right. There are probably others.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/issues/3884/2132078568@github.com>