Skip to content

add UTType conformance checks in NonTextFileView to properly preview files using QuickLook #1783

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

Merged

Conversation

plbstl
Copy link
Contributor

@plbstl plbstl commented Jul 1, 2024

Description

This PR helps to properly preview files using QuickLook.

See #1768.

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Cc: @bombardier200

This helps to properly preview files using QuickLook
@thecoolwinter
Copy link
Collaborator

Does this fix a bug or is it just for semantics? It looks like the functionality is the same w/ the switch statement

@matthijseikelenboom
Copy link
Contributor

The switch statement looks cleaner imo...

@armartinez
Copy link
Contributor

@thecoolwinter @matthijseikelenboom I thought the same thing but I think the difference is the call to the conforms method, since many UTTypes can conform to a base UTType, am I right @plbstl ?

@plbstl
Copy link
Contributor Author

plbstl commented Jul 4, 2024

Yes @armartinez. Without the conformance checks, smaller images will not be shown in their proper dimensions, instead, they'll be scaled up to fit the editor view.

You can test it out in the main branch with any of the CodeEdit icons. Or something similar.

Copy link
Collaborator

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I see the difference now.

@thecoolwinter thecoolwinter merged commit fd3917a into CodeEditApp:main Jul 7, 2024
2 checks passed
@thecoolwinter thecoolwinter added the bug Something isn't working label Jul 19, 2024
plbstl added a commit to plbstl/CodeEdit that referenced this pull request Jul 23, 2024
austincondiff added a commit that referenced this pull request Jul 27, 2024
…ed (#1822)

* important fix to preview fileDocuments (using QuickLook) that have a utType but are neither images nor PDFs

See #1783

* make `NonTextFileView` a bit more readable

* nest duplicate `utType` if checks in `NonTextFileView`

* Update CodeEdit/Features/Editor/Views/NonTextFileView.swift

---------

Co-authored-by: Austin Condiff <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants