Monaco languages file includes multiple IDs with the same extension #35916
Labels
Issue-Bug
Something isn't working
Needs-Triage
For issues raised to be triaged and prioritized by internal Microsoft teams
Microsoft PowerToys version
0.86
Installation method
Dev build in Visual Studio
Running as admin
No
Area(s) with issue?
File Explorer: Preview Pane, Peek
Steps to reproduce
Please note: this is a minor issue, and I'm just reporting it to raise awareness and to include repro code so it may be tracked in the future.
The
monaco_languages.json
file includes a mapping of file extensions to language IDs. This allows for syntax highlighting on a per-language basis.There exist 3 cases where the same file extension is present for multiple languages. This may result in incorrect syntax highlighting in one of those cases.
The code to repro the issue is as follows:
(Setup a new Console application with this code as
Program.cs
and also copy in the currentmonaco_languages.json
file, setting that file to be copied to the output directory.)The results are:
The lookup for Monaco language matching in PowerToys will always pick the first match, so a file with a .pp extension will always be recognised as Pascal, even if it is a Puppet manifest file. (I assume the other 2 cases are OK, as the language IDs appear synonymous.)
I'm unsure what the resolution for this is without doing file introspection. That's probably unreasonable, especially for a single case such as this.
If it was decided to favour Puppet files over Pascal, the entry for Ruby should be moved before Pascal's in the file.
✔️ Expected Behavior
Files for Pascal and Puppet manifest files should be recognised as distinct, and highlighted differently by Monaco.
❌ Actual Behavior
As the files share the same extension, they cannot be distinguished from one another, and will always be rendered as Pascal.
Other Software
No response
The text was updated successfully, but these errors were encountered: