-
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 .ahk files as plaintext #35538
Conversation
…rted list. Ensure JsonDocument is disposed correctly in MonacoHelper.
I am currently looking into a bug with the exclusion code. Please hold off from reviewing for now. Thanks. |
Could I request some help here, please? When you add a file extension for previewing with Monaco by editing 'monacoSpecialLanguages.js' and 'monaco_languages.json', PowerToys will create a shellex entry in the Registry for that extension on startup: (With This is fine for file extensions which don't already have preview handlers defined. However, it looks like PowerToys will overwrite any existing entry present for that extension, too. I've been trying to study the code which registers the Monaco types in the registry (in 'modulesRegistry.h' and 'registry.h'), and I've done some testing to confirm the behaviour, but my C++ isn't very strong and I may be mistaken. In any case, I could use some advice. If this behaviour is correct, we can't add .csv to Monaco's supported list, as it would overwrite the existing Office-installed Excel previewer handler if someone had that installed. Also, is it intended that PowerToys overwrites any predefined handlers for the other file extensions, too? Shouldn't there be code in I'm sorry if this is intended behaviour or I'm misunderstanding, but it seemed suspicious and I wanted to be sure. |
This issue seems to confirm that existing preview handler entries are being overwritten by PowerToys. Handlers installed by Office would be common examples, but there could be others. |
As discussed previously, I have removed .csv and .tsv support, and this PR now only adds .ahk support for Peek. |
@daverayment |
@htcfreek Thanks for the reminder. Done. |
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.
LGTM! Thank you for the contribution!
Summary of the Pull Request
This replaces the previous #34824 PR. That PR's feature to allow the previewing of arbitrary plaintext files is not available here and is covered by a separate issue.
This change allows for the previewing of AutoHotKey .ahk script files with the Monaco renderer in Peek (via the WebBrowserPreviewer).
PR Checklist
Detailed Description of the Pull Request / Additional comments
The .ahk file extension has been added to the relevant Monaco settings files, in a similar manner to the addition of .srt files previously.
A small fix was made to MonacoHelper.cs by placing a
using
for the JsonDocument instantiation there, as it was not Disposed previously.Validation Steps Performed