Throwaway idea: Content aware Save As
Problem
Code already detect syntax, but we could extend capabilities depending on which content for, for example, a Saving As that already prefill the name depending on the content
Proposal
Upon doing a save As of an unnamed file, tweak initial_name according to the content:
- if it has a list of URI, Path, URL, call the initial_name "New playlist.m3u8"
- if it has all lines with commas, or a specified delimiter specified as per csv standard, append a ".csv" in the "unsaved document" initial name
- if it has a shebang on the first line, add a .sh, or .py, or according to what it is
- if it has some html, add a .html extension
- Vala, it's a NewDocument.vala...
Prior Art (Optional)
No response
Actually Code doesn't detect syntax from the content - it relies on the file extension/mime-type so the file has to have been saved with the correct extension first.
Maybe we could infer the mime-type from content using GLib.ContentType.guess () and only pre-fill the name if it returns result_uncertain = false. We don't want to get too clever for fear of annoying more people than helping. There are several things a list of URI could be other than a playlist for example.
Once we have built-in AI it could learn that for a particular individual a certain type of ambiguous content is intended to be a certain type of file :wink: