-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[Peek] Add support for previewing AutoHotKey files, CSV, and other plaintext files #34824
Conversation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details. Unrecognized words (2)ahk Previously acknowledged words that are now absentapplayout appsfolder cswinrt systemsettings SYSTEMWOW USEPOSITION USESIZE 🫥To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands... in a clone of the [email protected]:daverayment/PowerToys.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/10821759987/attempts/1' Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionaryThis includes both expected items (1897) from .github/actions/spell-check/expect.txt and unrecognized words (2)
Consider adding them (in with:
extra_dictionaries:
cspell:r/src/r.txt
cspell:cpp/src/people.txt
cspell:cpp/src/ecosystem.txt To stop checking additional dictionaries, add (in check_extra_dictionaries: '' Warnings (1)See the 📂 files view, the 📜action log, or 📝 job summary for details.
See ℹ️ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
@htcfreek Hi. Are you able to add a new file to the spelling checker |
@daverayment
|
Thank you for reviewing the PR, @htcfreek 😊 Sorry, I don't think I explained the aims very well. The intention is to use the Monaco renderer as a plaintext viewer for AutoHotKey scripts and other currently unsupported file extensions. The decision was deliberately made not to add these as new languages to Monaco, or as extensions to existing supported Monaco languages. This has the following advantages:
Essentially, this adds a plaintext preview capability which just uses Monaco as the rendering engine, and I should have made that clearer. Apologies. I understand that I didn't ask about the CSV or TSV additions. I wanted to provide an example that showed that a file extension could be handled either with a preview handler (for those viewing CSVs with Microsoft Office installed) or with Monaco (for those without Office using this plaintext renderer). There is code within the PR which specifically excludes those extensions which are supported by the ShellHandlerPreviewer, using its I still think this is a worthwhile approach to displaying files which do not need special processing. If this PR is unsuitable, I would like to raise it as another issue and perhaps explain it better and open it up to further discussion. Thanks again. |
Why is this blocked? |
I think we should discuss first if we want this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some good stuff!
Would love to see this land! |
@crutkas , @Aaron-Junker |
this isn't directly a settings file but i do get the feeling. also reason why this isn't a settings file is this would be overwritten every release |
So imo, it should definitely be a settings file, so in the future we can also build an UI on top of it. But the bigger problem here is that this only adds support for using it in Peek, as for using it in File Explorer these file extensions would have to be registered additionally in the registry by the settings or the installer. This would require additional logic |
Imo this gets handled by PT settings and we provide a default value that the user can extend. I think we should add the three extensions in the regular way as fallback and open a new issue for the custom extension setting. (At the end the current way of this PR implements something that was never requested and discussed in the issues.) |
We do reg stuff for stuff on and off for when we but this does get a little complicated i think. If we shifted to more of a mental model like what #32817 it would unblock the "now" and get these extensions supported in both, no? I think for a good longer term #32817 |
@crutkas But the PR you referenced/adding the extensions to Later and discussed in a new issue we can implement a way for our users to add their own extension for txt files through PT settings. |
Thank you everyone for discussing this. The .txt file for user settings was not a good decision on my part. As @crutkas says, user entries would potentially be overwritten each install. Having an extra 'user-only' file where the user could list their own extensions could be a possibility, but discoverability would be a problem, it would be fragile, and it's all information I accept should really be exposed by an official PowerToys settings property. I agree that the way forward is to create a new issue for user-configurable plain text file support. I can certainly do that. I'm afraid I'm unfamiliar with the settings system at the moment, but I'll ask if I need a hand. Likewise, I can edit the Do you think it would be better if I closed this off and handled that via another PR? Thanks again. |
|
This allows for the previewing of AutoHotKey .ahk script files, .csv and .tsv files with the Monaco renderer in Peek (via the WebBrowserPreviewer).
It also introduces an extensible way to add further file extensions for plaintext previews in the future via a simple settings file.
PR Checklist
.txt
) (Unrelated to Office files preview) #33811Detailed Description of the Pull Request / Additional comments
This uses Monaco to preview plaintext files even if they are not contained within the Monaco supported languages JSON file.
.ahk, .csv, and .tsv extensions have been added for now. Others may be added (possibly by end-users) by editing the new 'Assets\Monaco\monacoExtraExtensions.txt' file.
A small additional fix was made to MonacoHelper.cs by placing a
using
for the JsonDocument instantiation there, as it was not Disposed properly previously.Care has been taken to not override any Shell preview handlers which could render these new file types. (This was necessary because
ShellPreviewHandlerPreviewer
is later thanWebBrowserPreviewer
in theIsItemSupported()
checks in PreviewerFactory.cs)It may be worthwhile enhancing this in the future. For example, by:
Validation Steps Performed
Please note: I don't own Microsoft Office / Office 365, so could not confirm that the Excel previewer handler for CSV files still works correctly with this update. Could this please be tested by one of the devs with that software installed? Many thanks.