diff --git a/doc/devdocs/common/FilePreviewCommon.md b/doc/devdocs/common/FilePreviewCommon.md index 7293e8c978..aee9de2b2a 100644 --- a/doc/devdocs/common/FilePreviewCommon.md +++ b/doc/devdocs/common/FilePreviewCommon.md @@ -47,7 +47,16 @@ registerAdditionalNewLanguage("id", [".fileExtension"], idDefinition(), monaco) * The id can be anything. Recommended is one of the file extensions. For example "php" or "reg". -4. Execute the steps described in the [monaco_languages.json](#monaco_languagesjson) section. +4. In case you wish to add a custom color for a token, you can do so by adding the following line to [`customTokenColors.js`](/src/common/FilePreviewCommon/Assets/Monaco/customTokenColors.js): +```javascript +{token: 'token-name', foreground: 'ff0000'} +``` +> Replace `token-name` with the name of the token and `ff0000` with the hex code of the desired color. +> Note: you can also specify a `background` and a `fontStyle` attribute for your token. + +* Keep in mind that these rules apply to all languages. Therefore, you should not change the colors of any default tokens. Instead, create new tokens specific to the language you are adding. + +5. Execute the steps described in the [monaco_languages.json](#monaco_languagesjson) section. ### Add a new file extension to an existing language diff --git a/installer/PowerToysSetup/generateFileList.ps1 b/installer/PowerToysSetup/generateFileList.ps1 index 9d9fe36c10..f674eae374 100644 --- a/installer/PowerToysSetup/generateFileList.ps1 +++ b/installer/PowerToysSetup/generateFileList.ps1 @@ -21,7 +21,7 @@ $fileWxs = Get-Content $wxsFilePath; $fileExclusionList = @("*.pdb", "*.lastcodeanalysissucceeded", "createdump.exe", "powertoys.exe") -$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "monacoSpecialLanguages.js", "*.pri") +$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "monacoSpecialLanguages.js", "customTokenColors.js", "*.pri") $dllsToIgnore = @("System.CodeDom.dll", "WindowsBase.dll") diff --git a/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js b/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js index 365f8f69cc..e4539dd50a 100644 --- a/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js +++ b/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js @@ -5,8 +5,8 @@ tokenizer: { root: [ [/^#.*$/, 'comment'], - [/^\s*!.*/, 'invalid'], - [/^\s*[^#]+/, "tag"] + [/.*((?