https://github.com/lk-code/winui.monaco-editor
The Monaco Editor for WinUI 3
https://github.com/lk-code/winui.monaco-editor
Last synced: 5 months ago
JSON representation
The Monaco Editor for WinUI 3
- Host: GitHub
- URL: https://github.com/lk-code/winui.monaco-editor
- Owner: lk-code
- License: mit
- Created: 2022-09-18T20:41:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-10-03T23:00:59.000Z (9 months ago)
- Last Synced: 2025-10-04T21:23:26.683Z (9 months ago)
- Language: JavaScript
- Size: 68.7 MB
- Stars: 21
- Watchers: 2
- Forks: 5
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# WinUI.Monaco-Editor

[](http://www.nuget.org/packages/WinUI.Monaco)
[](https://github.com/lk-code/winui.monaco-editor/blob/master/LICENSE)
[](http://www.nuget.org/packages/WinUI.Monaco)
[](http://nuget.org/packages/WinUI.Monaco)
[](https://www.buymeacoffee.com/lk.code)
## Introduction
The [Monaco Editor](https://github.com/microsoft/monaco-editor) (Visual Studio Code) as UI Control for WinUI 3.0
**Notice:** As part of a project restructuring, the NuGet name of the library was changed from `winui.monaco-editor` to `WinUI.Monaco`.
## Install Monaco in a WinUI 3.0 Project
```
dotnet add package WinUI.Monaco
```
### WinUI.Monaco Version
The library version is composed as follows:
* the current project version
* the used Monaco Editor version
* the GitHub RunNumber of the build
`1.1.${{ env.MONACO_VERSION }}.${{ github.run_number }}` (example: `1.1.44.13`)
## Handler
This Monaco control uses handlers to provide certain actions that have nothing directly to do with the actual Monaco editor:
### MonacoWebViewDevToolsHandler
This handler can be used to open the WebView2 DevTools.
```
MonacoWebViewDevToolsHandler handler = this.MonacoEditor.GetHandler();
handler.OpenDebugWebViewDeveloperTools();
```
### MonacoFileRecognitionHandler
With this handler you can pass a file extension and get back the code language supported by the Monaco Editor, which can then be set in the Monaco Editor.
```
MonacoFileRecognitionHandler handler = this.MonacoEditor.GetHandler();
string fileCodeLanguage = handler.RecognizeLanguageByFileType(Path.GetExtension(file.Path));
await this.MonacoEditor.SetLanguageAsync(fileCodeLanguage);
```
## Contributors
[](https://github.com/lk-code/winui.monaco-editor/graphs/contributors)
## Development
### Update the Monaco Version
The monaco project is stored in the C#-Project Monaco under the folder `monaco-editor`.
To update the monaco version follow these steps ***(Only do this if it is really necessary. The project is always automatically updated to the latest release version of the monaco project via a GitHub workflow)***:
1. download the latest version from [Microsoft Monaco Project](https://microsoft.github.io/monaco-editor/)
2. extract the archive file
3. delete all files except for `index.html` from the folder `monaco-editor`. The `index.html` is **required** for the project
4. copy all new files from the extracted archive to the folder `monaco-editor`