PowerToys
PowerToys copied to clipboard
Add .log support to Monaco preview handler
Summary of the Pull Request
PR Checklist
- [X] Closes: #17506
- [X] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [X] Tests: Added/updated and all pass (none added/updated, but all pass)
- [-] Localization: All end user facing strings can be localized
- [-] Dev docs: Added/updated
- [-] New binaries: Added on the required places
- [-] JSON for signing for new binaries
- [-] WXS for installer for new binaries and localization folder
- [-] YML for CI pipeline for new test projects
- [-] YML for signed pipeline
- [-] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
Adds .log
file extension to monaco_languages.json
as supported plaintext
file.
Validation Steps Performed
Rather small addition, hence added the extension locally (via Registry) & immediately noticed succeeding file preview.
What do you think about the additional log names ".err" and (possibly more conflicting) ".out"?
Missing feedback from @crutkas or @Aaron-Junker within the linked issue made me focus on .log
.
In addition to that, your "possibly more conflicting" hint fueled my believe that error and/or general output should rather be "redirected" into error.log
& output.log
respectively even more.
Ultimately, I'd suggest using .log
as a "catch-all" logging file type & a file's actual name, i. e. everything left to the last .
, for stating what content (type) such log files hold.
I see. Still suggest to add ".err" ;-)
@Aaron-Junker:
monaco_languages.json gets suto-generated. You have to add another handler like in
https://github.com/microsoft/PowerToys/blob/db191b8b75ad456d5eb94eaa0aa0c7b59ecec900/src/modules/previewpane/MonacoPreviewHandler/monacoSpecialLanguages.js#L8
Just to get you right:
- I have to undo my changes inside
monaco_languages.json
? - Register a new handler despite there's no such thing as syntax highlighting for
.log
files & plaintext.txt
files are already handled without such a custom handler? - There's no simple "register
.log
as another plaintext file type" change possible?
@stefansjfw:
@Aaron-Junker I'm leaving this to you :) Good catch
May I ask you to remove your change request then? Because once I solved Aaron's request, yours seems to still block my PR. Or am I getting something wrong here?
@Aaron-Junker:
monaco_languages.json gets suto-generated. You have to add another handler like in
https://github.com/microsoft/PowerToys/blob/db191b8b75ad456d5eb94eaa0aa0c7b59ecec900/src/modules/previewpane/MonacoPreviewHandler/monacoSpecialLanguages.js#L8
Just to get you right:
- I have to undo my changes inside
monaco_languages.json
?- Register a new handler despite there's no such thing as syntax highlighting for
.log
files & plaintext.txt
files are already handled without such a custom handler?- There's no simple "register
.log
as another plaintext file type" change possible?
- Yes.
- Yes. And then you have to regenerate monaco_languages.json like described here: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/modules/powerpreview/monaco/readme.md
Alright, doin' some rocket science then - back in a day or two, keep your fingers crossed! 🥳
@Aaron-Junker Done with the changes, but IMHO this could've been done way easier & faster by just stating:
- Add
,{"id":"logExt","extensions":[".log"]}
tomonaco_languages.json
. - Add
registerAdditionalLanguage("logExt", [".log"], "log", monaco)
tomonacoSpecialLanguages.js
, replace a wrong<tab>
char with 4 spaces, remove a doubled trailing empty line in there, too & you're done.
This way, I'd have been much quicker getting this done & hence the preview handler supporting log files, too. Anyway, hope everything is well now - if not, please tell me right away & I'll fix it ASAP. :)
@Aaron-Junker The run failed due to some NuGet plugin error on Azure DevOps side, i. e. beyond my control - would you mind, getting the appropriate person to fix that & tell me how to re-trigger a run?
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
@Aaron-Junker Run completed, checks passed, LGTY?
@Aaron-Junker I'm leaving this to you :) Good catch
@stefansjfw since Aaron approved it & you stated that, you'll be leaving this to him, would you mind adding your approval, too? Because GitHub tells me it won't merge until you approved, too…
Thanks a lot for the contribution!