TagStudio icon indicating copy to clipboard operation
TagStudio copied to clipboard

feat: code syntax highlighting

Open TrigamDev opened this issue 2 weeks ago • 0 comments

Summary

Replaces the thumbnail display for plaintext files with a new TextDisplay widget, which supports syntax highlighting.

image

The syntax highlighting style is configurable, with GitHub Dark being the default.

image

Notes:

  • superqt's CodeSyntaxHighlight utility is used to provide syntax highlighting to the QTextEdit widget that TextDisplay is based on. The syntax highlighting itself and all of the styles are provided by pygments.
    • Instead, a custom implementation of CodeSyntaxHighlight could be made to reduce the number of dependencies. This was just a quick way to get something working. Plus, superqt's widgets could potentially prove useful.
  • This PR is based on #1217. Originally, the idea was to also provide syntax highlighting to the thumbnails in the entry grid, but this has been dropped for the time being. This does follow some changes made in #1217, though.
  • This PR follows the file organization from some of my previous PRs. As is said in them, the file organization changes can be reverted if the previous organization is preferred.

Tasks Completed

  • Platforms Tested:
    • [ ] Windows x86
    • [ ] Windows ARM
    • [ ] macOS x86
    • [ ] macOS ARM
    • [x] Linux x86
    • [ ] Linux ARM
  • Tested For:
    • [x] Basic functionality
    • [ ] PyInstaller executable

TrigamDev avatar Nov 24 '25 16:11 TrigamDev