CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

Full Quick Look Support.

Open LeonardoLarranaga opened this issue 1 year ago • 6 comments

Description

This pull request brings full Quick Look support. This means that now, any type of file compatible with Quick Look can be viewed within CodeEdit (such as videos).

Related Issues

  • closes #1806

Checklist

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

Screenshots

Videos inside CodeEdit

Menu

Quick Look Menu

Video

https://github.com/CodeEditApp/CodeEdit/assets/83844690/78291c2e-0c7a-472d-a2d3-ff69b2271b12

Update 1

Opened in code editor (left). Opened with Quick Look (right). Icon when opening with Quick Look.

Update 2

Open As -> Source Code menu item is now enabled. When having a file opened with Quick Look, clicking this option will opened the file in the default CodeEdit editor.

https://github.com/CodeEditApp/CodeEdit/assets/83844690/b60f09b8-7291-43ca-80a1-5c1aa9b184dc

LeonardoLarranaga avatar Jul 21 '24 19:07 LeonardoLarranaga

Great work! A few small things...

  1. I am not sure if opening QuickLook externally is necessary, it just adds another level to the menu which means more time to get to the end item selection.
  2. I think the eye icon on the tab is a bit much because it competes with the main icon.

austincondiff avatar Jul 28 '24 04:07 austincondiff

@austincondiff

  1. I think the eye icon on the tab is a bit much because it competes with the main icon.

What about an option in the Settings window? So we can let the user decide.

LeonardoLarranaga avatar Jul 29 '24 18:07 LeonardoLarranaga

I'd rather keep settings as concise as possible. Xcode doesn't include this, I'd like to follow suit if you wouldn't mind.

austincondiff avatar Jul 29 '24 19:07 austincondiff

@activcoding This seems to be an issue with that way the conditional for showing Source Code works. if type.conforms(to: .sourceCode) doesn't appear to work for all text files, such as .md.

Should I go ahead and change it to if type.conforms(to: .text)? Or should the Source Code option always appear?

Running in a Playground the the following code for .sourceCode, we are able to see which extensions belong to that UTType.

  1. s
  2. c
  3. m
  4. swift
  5. cp
  6. cpp
  7. c++
  8. cc
  9. cxx
  10. mm
  11. h
  12. hh
  13. hp
  14. hpp
  15. hxx
  16. h++
  17. ipp
  18. applescript
  19. scpt
  20. js
  21. jscript
  22. javascript
  23. mjs
  24. sh
  25. pl
  26. pm
  27. py
  28. rb
  29. rbw
  30. php
  31. php3
  32. php4
  33. ph3
  34. ph4
  35. phtml
  36. pl
  37. pm
  38. py
  39. rb
  40. rbw
  41. php
  42. php3
  43. php4
  44. ph3
  45. ph4
  46. phtml
  47. make
  48. mak
  49. gmk
  50. mk
  51. applescript
  52. scpt
  53. js
  54. jscript
  55. javascript
  56. mjs
  57. sh
  58. pl
  59. pm
  60. py
  61. rb
  62. rbw
  63. php
  64. php3
  65. php4
  66. ph3
  67. ph4
  68. phtml
  69. pl
  70. pm
  71. py
  72. rb
  73. rbw
  74. php
  75. php3
  76. php4
  77. ph3
  78. ph4
  79. phtml
  80. make
  81. mak
  82. gmk
  83. mk

LeonardoLarranaga avatar Aug 14 '24 20:08 LeonardoLarranaga

Do we need the Quick Look dropdown? It seems like an unnecessary step. Since it's only 2 options, we can just display those two as "Quick Look in Modal" or "Quick Look in Tab". Thoughts?

FastestMolasses avatar Aug 20 '24 02:08 FastestMolasses

@FastestMolasses, Open In Modal ways removed as suggested by @austincondiff. See Removed Quick Look icon, removed Open In Modal option.

My previous comment highlights a current issue, and I’m waiting for a response on that so I can move forward with the edits.

LeonardoLarranaga avatar Aug 20 '24 05:08 LeonardoLarranaga

Should I go ahead and change it to if type.conforms(to: .text)? Or should the Source Code option always appear?

My personal opinion is this is a text editor so editing text should be prioritized and should be default. I don't think we should allow only a specified set of file types to edit text. There will always be new and/or custom filetypes that we are not aware of that needs to be editable via text.

That said I think this option should be available where possible. Now I can see that potentially being problematic when dealing with images and videos where it is not possible to edit them in this way and if this is the case, disabling this option might be a good thing.

@CodeEditApp/maintainers thoughts on this?

austincondiff avatar Sep 03 '24 03:09 austincondiff

Sorry about that. Had some conflicts with my fork but they're now fixed.

LeonardoLarranaga avatar Sep 05 '24 07:09 LeonardoLarranaga

That said I think this option should be available where possible. Now I can see that potentially being problematic when dealing with images and videos where it is not possible to edit them in this way and if this is the case, disabling this option might be a good thing.

Text editting should be the priority.

0xWDG avatar Sep 18 '24 06:09 0xWDG

Closing this for now as it no longer works with the current CodeFileDocument implementation. :(

LeonardoLarranaga avatar Sep 28 '24 07:09 LeonardoLarranaga