-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
base: main
Are you sure you want to change the base?
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 git@github.com: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. |
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.