[Github-comments] [geany/geany] Filetype is not redetected on reload, even when current filetype is None (Issue #2996)

xiota notifications at xxxxx
Fri Nov 12 18:43:33 UTC 2021


Currently, the filetype is autodetected only when a new document is opened.  If a user adds a filetype shebang line, the only way to redetect the filetype is to close and reopen the document.  (While the user could manually change the filetype, the purpose of the shebang line is to avoid manual filetype selection, which is cumbersome because of the multiply nested menus.)

The following change could address this issue without affecting most other users:

* Re-detect filetype on reload, but change filetype only when the current filetype is None or a shebang line is used.
  - Users are unlikely to change the filetype to None.
  - Users are unlikely to keep a shebang line for the wrong type.

There is a PR (not yet merged) for the project organizer plugin that changes the filetype of header files to match the corresponding source file.  It currently does so only on the document-open signal, so changing the filetype on could cause the "wrong" filetype to be reassigned to the header.  However, since the change would be restricted to when the current filetype is None or a new type is determined by shebang, incorrect filetype reassignment is unlikely.

This functionality cannot be implemented in a plugin because `filetypes_detect_from_file` does not report whether the filetype was detected from filename or shebang line.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2996
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211112/cae2202d/attachment.htm>


More information about the Github-comments mailing list