microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.91k stars 6.53k forks source link

[Peek] Add user-configurable support for previewing plaintext files #35516

Open daverayment opened 1 week ago

daverayment commented 1 week ago

Description of the new feature / enhancement

Note: this is based on a prior discussion on #34824 .

Peek discriminates supported files based on their file extension, and currently supports previewing a variety of plain text files, including source code files, .txt and so on.

However, this is currently a hard-coded list and cannot be edited or overridden by the user. Attempting to preview an unsupported file results in the summary information being displayed, not its contents.

This new feature would add support for previewing plaintext files, either by auto-detecting them at the time of preview (if we can find a reliable method), and/or by giving the user the ability to edit a list of text file extensions via Settings.

This would not replace the current method of editing the Monaco JSON file to add new languages or adding extensions to existing languages. It is proposed that if the same file extension were present in both the Monaco supported list and the user's setting, that the Monaco setting would take precedence; this is because the Monaco could also include support for syntax highlighting and other formatting improvements over a simple text-only preview.

Scenario when this would be used?

This would be useful because power users often want to quickly preview plaintext files from a wide variety of both popular and niche applications, and also their own filetypes with custom extensions. It is infeasible for us to support all these by adding them manually for each PowerToys release.

Supporting information

Requests for supporting new plaintext files are relatively common in the issues forum, e.g.:

35515 - support .ion files

34483 - support .ahk files

33811 - support .csv files without the Office extension

etc.

The previous attempt at integrating this functionality also received supportive comments, so I believe there is demand.

similar-issues-ai[bot] commented 1 week ago

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.