I have a large number of files that are 99% JavaScript, but are processed by .Net code before they're served, so have a couple of lines of C# at the top. I've given them all filenames of the form *.js.aspx but when I try to use that in filetype_extensions.conf it has no effect and they're still considered to be XML files (per an earlier line in that file). The filetype_extensions.conf file contains this: ``` [Extensions] XML=*.xml;*.sgml;*.xsl;*.xslt;*.xsd;*.xhtml;*.aspx; Javascript=*.js;*.js.aspx; ```
It appears to me that Geany only recognises simple file extensions (i.e. just the bit after the last dot in the filename) rather than allowing for anything more complex. It would be great if this could be extended to support multi-part file extensions that include more than one dot.
Output from `geany -V` running on Ubuntu Mate 18.04.
`geany 1.32 (built on 2018-01-08 with GTK 3.22.26, GLib 2.54.1)`
The suffixes are naively matched and the first match wins, Geany doesn't do any kind of "longest match wins". So basically you'll have to drop `*.aspx` from XML, or make sure it's tried *after* your `*.js.aspx`.
I'm happy with first match wins - but that doesn't seem to be the case. I've swapped the lines so that the Javascript line is first but it doesn't appear to have made any difference.
I've reloaded the config, restarted Geany, and even checked that there's no "*.aspx" entry in /usr/share/geany/filetype_extensions.conf. Are there any other locations that I need to check that might be overriding my local setting?
(I can't just drop *.aspx from XML because although I have lots of *.js.aspx files, I have even more *.aspx files that *are* XML).
For clarity, my filetype_extensions.conf file now looks like this: ``` [Extensions] Javascript=*.js;*.js.aspx; XML=*.xml;*.sgml;*.xsl;*.xslt;*.xsd;*.xhtml;*.aspx; ```
@Peppertop did you close the files, Geany remembers the filetype of open files across quit and restart so it wouldn't look at the new filetype_extensions.conf
Yes, I closed the files, but just to be certain I've just done the following:
1. Closed all the *.js.aspx files, quit Geany and restarted it by double-clicking one of the files (Geany is set as the default handler).
2. Opened another file by dragging and dropping into Geany.
3. Opened a third file by using File ‣ Open.
4. Copied an existing file via the file manager to create a copy with a filename that Geany has never seen before, then opened it via drag and drop.
5. Copied a file onto my local machine (they're usually opened remotely over SMB) and tried opening by dragging and dropping.
6. Closed the file, quit Geany, double-clicked the local file.
7. Closed the file, quit Geany, Relaunched Geany from the MATE Applications menu then loaded the local file using File ‣ Open.
In every case the file opened as XML. I think I've covered all the obvious options there, and ruled out loading from SMB as an issue, but if there's anything else I should try, please let me know.
And just to be clear that was with Javascript before XML in filetype_extensions.conf
Nevermind I can reproduce.
It looks like the iteration order is not the order in `filetype_extensions.conf`, its the order in which filetypes are defined in `filetypes_array` so its not changable. @b4n to check [this](https://github.com/geany/geany/blob/3f20ad363a38e9f6b08877d5ade1290d7c69e670...) is called by [this](https://github.com/geany/geany/blob/3f20ad363a38e9f6b08877d5ade1290d7c69e670...)
its the order in which filetypes are defined in filetypes_array
Yes. With #2166 you can override just `Javascript=*.js;*.js.aspx;` in the user conf file and this will be preferred over a matching `*.aspx` system file XML pattern. This doesn't help if the latter is in the user file though.
Perhaps the longest matching pattern should win, that'd also fix #1499. I'll take a look.
Closed #1921 via #2167.
github-comments@lists.geany.org