Giter Club home page Giter Club logo

avaloniaedit's Introduction

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

Getting started

How to set up a new project that displays an AvaloniaEdit editor?

  • Create an empty Avalonia application.
  • Add a the nuget reference to the latest version: <PackageReference Include="Avalonia.AvaloniaEdit" Version="x.y.z.t" />
  • Include the needed styles into your <Application.Styles> in your App.xaml:
    • If you're using 0.10.x.y based versions, include <StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />
    • If you're 11.x.y based versions, include <StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
  • Finally, add the AvaloniaEdit editor into your window:
<Window xmlns="https://github.com/avaloniaui"
        ...
        xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
        ...>
  ...
  <AvaloniaEdit:TextEditor Text="Hello AvaloniaEdit!"
                           ShowLineNumbers="True"
                           FontFamily="Cascadia Code,Consolas,Menlo,Monospace"/>
  ...
</Window>

You can see the Demo Application as a reference.

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

avaloniaedit's People

Contributors

danipen avatar gillibald avatar hendrikmennen avatar takoooooo avatar aelij avatar maxkatz6 avatar jeffreye avatar mgarstenauer avatar wieslawsoltes avatar krzysztofdusko avatar hez2010 avatar whistyun avatar siegfriedpammer avatar zenonet avatar bandysc avatar numpsy avatar alphanecron avatar kekekeks avatar markushaslinger avatar jameswalmsley avatar deadpikle avatar arhell avatar jl0pd avatar garyhertel avatar unconverged avatar jp2masa avatar luthfiampas avatar pazof avatar grokys avatar aldelaro5 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.