Avalonia-based text editor (port of AvalonEdit)
Перейти к файлу
aldelaro5 a4e751a118 Upgrade to Avalonia 11.0.0-preview6 2023-03-22 01:15:18 -04:00
src Upgrade to Avalonia 11.0.0-preview6 2023-03-22 01:15:18 -04:00
test/AvaloniaEdit.Tests Upgrade to Avalonia 11.0.0-preview6 2023-03-22 01:15:18 -04:00
.gitattributes add git attributes to keep line feeds consistent for windows users. 2017-04-22 19:14:14 +01:00
.gitignore ignore .vscode 2021-12-30 21:33:03 +07:00
AvaloniaEdit.sln Use textmatesharp grammars nuget (#210) 2022-02-18 15:55:33 +00:00
Directory.Build.props Upgrade to Avalonia 11.0.0-preview6 2023-03-22 01:15:18 -04:00
LICENSE Initial commit 2017-04-22 15:54:31 +03:00
NuGet.config More fixes 2022-03-11 06:44:07 +01:00
README.md Update README.md 2022-09-08 22:34:58 +02:00
azure-pipelines.yml Pack AvaloniaEdit with Release configuration 2023-02-06 13:07:53 +02:00

README.md

downloads Current stable version

AvaloniaEdit

This project is a port of AvalonEdit, a WPF-based text editor for Avalonia.

AvaloniaEdit supports features like:

  • Syntax highlighting using TextMate grammars and themes.
  • Code folding.
  • Code completion.
  • Fully customizable and extensible.
  • Line numeration.
  • Display whitespaces EOLs and tabs.
  • Line virtualization.
  • Multi-caret edition.
  • Intra-column adornments.
  • Word wrapping.
  • Scrolling below document.
  • Hyperlinks.

and many,many more!

AvaloniaEdit currently consists of 2 packages

How to set up TextMate theme and syntax highlighting for my project?

First of all, if you want to use grammars supported by TextMateSharp, should install the following packages:

Alternatively, if you want to support your own grammars, you just need to install the AvaloniaEdit.TextMate package, and implement IRegistryOptions interface, that's currently the easiest way in case you want to use AvaloniaEdit with the set of grammars different from in-bundled TextMateSharp.Grammars.

//First of all you need to have a reference for your TextEditor for it to be used inside AvaloniaEdit.TextMate project.
var _textEditor = this.FindControl<TextEditor>("Editor");

//Here we initialize RegistryOptions with the theme we want to use.
var  _registryOptions = new RegistryOptions(ThemeName.DarkPlus);

//Initial setup of TextMate.
var _textMateInstallation = _textEditor.InstallTextMate(_registryOptions);

//Here we are getting the language by the extension and right after that we are initializing grammar with this language.
//And that's all 😀, you are ready to use AvaloniaEdit with syntax highlighting!
_textMateInstallation.SetGrammar(_registryOptions.GetScopeByLanguageId(_registryOptions.GetLanguageByExtension(".cs").Id));

avaloniaedit-demo