PowerToys/doc/devdocs/common/FilePreviewCommon.md

85 lines
5.1 KiB
Markdown
Raw Normal View History

Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
# [FilePreviewCommon](/src/common/FilePreviewCommon)
This project contains common code used for previewing and displaying files.
## Monaco preview
Monaco preview enables to display developer files. It is based on [Microsoft's Monaco Editor](https://microsoft.github.io/monaco-editor/) which is maintained by the Visual Studio Code team.
This previewer is used for the File Explorer Dev File Previewer, as well as PowerToys Peek.
### Update Monaco Editor
1. Download Monaco editor with [npm](https://www.npmjs.com/): Run `npm i monaco-editor` in the command prompt.
2. Delete everything except the `min` folder (the minimised code) from the downloaded files.
3. Copy the `min` folder into the `/src/Monaco/monacoSRC` folder of the PowerToys project.
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
4. Generate the JSON file as described in the generate [monaco_languages.json file](#monaco_languagesjson) section.
### Add a new language definition
As an example on how to add a new language definition you can look at the one for [registry files](/src/Monaco/customLanguages/reg.js).
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
1. Add the new language definition (written with [Monarch](https://microsoft.github.io/monaco-editor/monarch.html)) as a new file to the [folder containing Monaco custom languages](/src/Monaco/customLanguages/) (Remember the file name and the string you used for "idDefinition" as you need it later.). The file should be formatted like in the example below. (Please change `idDefinition` to the name of your language.)
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
```javascript
export function idDefinition() {
return {
...
}
}
```
2. Add the following line to the [`monacoSpecialLanguages.js`](/src/Monaco/monacoSpecialLanguages.js) file, after the other import statements:
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
```javascript
import { idDefinition } from './customLanguages/file.js';
```
> Replace file.js with the name of your definition file from step 1. Please replace idDefinition with the string you used in step 1.
3. In the [`monacoSpecialLanguages.js`](/src/Monaco/monacoSpecialLanguages.js) file add the following line into the `registerAdditionalLanguages` function:
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
```javascript
registerAdditionalNewLanguage("id", [".fileExtension"], idDefinition(), monaco)
```
> Replace id and idDefinition with your id and string used in step 1. Replace fileExtension with a set of file extensions you want the language to register to.
* The id can be anything. Recommended is one of the file extensions. For example "php" or "reg".
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/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 information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
### Add a new file extension to an existing language
1. In the [`monacoSpecialLanguages.js`](/src/Monaco/monacoSpecialLanguages.js) file add the following line to the `registerAdditionalLanguages` function. (`existingId` is the id of the language you want to add the extension to. You can find these id's in the [`monaco_languages.json`](/src/Monaco/monaco_languages.json) file):
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
```javascript
registerAdditionalLanguage("id", [".fileExtension"], "existingId", monaco)
```
* If for instance you want to add more extensions to the php language set the id to `phpExt` and the existingId to `php`.
2. Copy the existing language definition into the `languageDefinitions` function in the same file. You can find the existing definitions in the following folder: [`/src/Monaco/monacoSRC/min/vs/basic-languages/`](/src/Monaco/monacoSRC/min/vs/basic-languages/).
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
3. Execute the steps described in the [monaco_languages.json](#monaco_languagesjson) section.
### monaco_languages.json
[`monaco_languages.json`](/src/Monaco/monaco_languages.json) contains all extensions and IDs for the languages supported by Monaco. The [`MonacoHelper`](/src/common/FilePreviewCommon/MonacoHelper.cs) class and the installer are using this file to register preview handlers for the defined extensions.
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
After updating Monaco Editor and/or adding a new language you should update the [`monaco_languages.json`](/src/Monaco/monaco_languages.json) file.
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
1. Run the [`generateLanguagesJson.html`](/src/Monaco/generateLanguagesJson.html) file on a local webserver (as webbrowsers will block certain needed features when running the file locally.)
Add information about how to add new languages to monaco (#24906) * Add information about how to add new languages to monaco * Update expect.txt * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * Adress PR feedback * fix spelling errors * Update doc/devdocs/modules/FileExplorer/monaco/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update readme.md * Update readme.md * Address PR comments * Fix spelling * address PR comments * address PR comments and move files * Update expect.txt * Update doc/devdocs/common/readme.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Adress PR comments * Fix spelling * Adress PR comments * Add peek stub documentation * Update doc/devdocs/common/FilePreviewCommon.md Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Update doc/devdocs/common/FilePreviewCommon.md * Fix spelling --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-12-11 23:45:16 +08:00
* This can for example be achieved by using the [Preview Server](https://marketplace.visualstudio.com/items?itemName=yuichinukiyama.vscode-preview-server) extension for Visual Studio Code: Open the file in Visual Studio Code, right click in the code editor and select `vscode-preview-server: Launch on browser`. The file will be opened in a browser.
2. The browser will download the new `monaco_languages.json` file
3. Replace the old file with the newly downloaded one in the source code folder.