[Monaco] Add .uproject and .uplugin support for Unreal Engine files#47931
Open
Ares9323 wants to merge 1 commit into
Open
[Monaco] Add .uproject and .uplugin support for Unreal Engine files#47931Ares9323 wants to merge 1 commit into
Ares9323 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Unreal Engine .uproject and .uplugin file support to Monaco-based preview paths so they can be discovered by PowerPreview and Peek as source-previewable files.
Changes:
- Registers a new Monaco language extension entry for Unreal project/plugin files.
- Regenerates
monaco_languages.jsonwith the new extension mapping.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Monaco/monacoSpecialLanguages.js |
Adds runtime registration for .uproject/.uplugin via jsonExt. |
src/Monaco/monaco_languages.json |
Adds generated language metadata for the new extensions. |
Files not reviewed (1)
- src/Monaco/monacoSpecialLanguages.js: Language not supported
| registerAdditionalLanguage("vbExt", [".vbs"], "vb", monaco); | ||
| registerAdditionalLanguage("iniExt", [".inf", ".gitconfig", ".gitattributes", ".editorconfig"], "ini", monaco); | ||
| registerAdditionalLanguage("shellExt", [".ksh", ".zsh", ".bsh"], "shell", monaco); | ||
| registerAdditionalLanguage("jsonExt", [".uproject", ".uplugin"], "json", monaco); |
ee20c85 to
01b9499
Compare
Register .uproject and .uplugin (Unreal Engine project and plugin files) as JSON in Monaco preview, enabling syntax highlighting, folding, and validation for these files in the Monaco preview pane and Peek. Appends the two extensions to the existing built-in "json" entry in monaco_languages.json, so MonacoHelper.GetLanguage returns "json" and Monaco renders the file with its full built-in JSON mode. Follows the same pattern as microsoft#39246 (.shproj/.projitems added to the built-in xml entry). No change is needed in monacoSpecialLanguages.js since Monaco's JSON support is provided by the language service (vs/language/json/), not by a basic-languages module, as noted in the Copilot review on the prior approach.
01b9499 to
60c82f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Register
.uprojectand.uplugin(Unreal Engine project and plugin files) as JSON in Monaco preview, enabling syntax highlighting, folding, and structured navigation for these files in the Monaco preview pane and Peek.This supersedes #45523, which mixed an unrelated de-minification refactor with the feature change.
PR Checklist
Detailed Description of the Pull Request / Additional comments
A single-line edit in
src/Monaco/monaco_languages.json:.uprojectand.upluginare appended to the existing built-injsonlanguage entry.MonacoHelper.GetLanguage()then returns"json"for these files, and Monaco renders them with its full built-in JSON mode (tokenizer, brace matching, folding, schema validation).Follows the same pattern as #39246, which added
.shproj/.projitemsdirectly to the built-inxmlentry.No change is needed in
monacoSpecialLanguages.js: Monaco's JSON support is provided by the language service (vs/language/json/), not by avs/basic-languages/json/jsonmodule, so theregisterAdditionalLanguage(...)helper used for other alias languages doesn't apply here.About the force-pushes on this PR
Apologies for the churn. The original commit tried to register a
jsonExtalias viaregisterAdditionalLanguage("jsonExt", [...], "json", monaco). Copilot correctly pointed out that this can't work: the helper requires avs/basic-languages/<id>/<id>module, and Monaco's JSON support lives undervs/language/json/, notvs/basic-languages/json/— so the alias would have been registered with no tokenizer attached and.uproject/.upluginwould have rendered as plaintext.While iterating I also overthought the regeneration concern around
monaco_languages.json(generated bysrc/Monaco/generateLanguagesJson.html) and pushed a couple of intermediate approaches that touchedmonacoSpecialLanguages.jsas well. After checking the repo history (#39246, #36499) and confirming there's no CI/pipeline that regenerates this file, the convention here is to editmonaco_languages.jsondirectly when the change is purely an extension association on a built-in language — hence the final minimal diff.Validation Steps Performed