Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typst (.typ) files sometimes wrongly seen as Objective-C or C source files #2507

Open
wpkelso opened this issue Oct 16, 2024 · 2 comments
Open

Comments

@wpkelso
Copy link
Member

wpkelso commented Oct 16, 2024

What Happened?

In the list view, Typst files (.typ) are recognized as Objective-C files sometimes, rather than always falling back to a generic text file

Steps to Reproduce

  1. Open a directory containing a .typ file
  2. Open list view, or look at the properties of any .typ file

Expected Behavior

I would expect the file browser to either fall back to recognizing a file as a generic text file if it doesn't know what the extension is. Alternatively, add Typst source file as a recognized file type

OS Version

7.x (Horus)

Session Type

Classic Session (X11, This is the default)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response

@jeremypw
Copy link
Collaborator

Files gets the displayed "Type" field from a FileAttribute (STANDARD_CONTENT_TYPE or FAST_CONTENT_TYPE) associated with the file. This is probably why the result may vary - it depends on what mime-type was given to the file. Could you check on the Properties of the .typ files with different Type descriptions to see what MIME type they have?

A quick look at /usr/share/mime/globs (on OS7.1) indicates there is no system level association of the extension *.typ with any mime-type. usr/share/mime/types shows that there is at least one mime-type (text/x-objcsrc) recognised as an Objective C source file.

So it looks like some of your files do not have sufficient metadata for the system to determine their exact type and it cannot be recognized from the extension so it is regarded as generic text. There is not a lot Files can do about that.

It is possible to register a new mimetype-extension association (this is often done by applications to register their own custom extension/mimetype/icon), but which ones are present out of the box is a system level responsibility I think.

@jeremypw
Copy link
Collaborator

If this is fixed at system level then it will also enable other application (e.g. Code) to correctly recognise *.typ files as Objective C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants