SweetEditor 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SweetEditor --version 1.0.3
                    
NuGet\Install-Package SweetEditor -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SweetEditor" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SweetEditor" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="SweetEditor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SweetEditor --version 1.0.3
                    
#r "nuget: SweetEditor, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SweetEditor@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SweetEditor&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=SweetEditor&version=1.0.3
                    
Install as a Cake Tool

SweetEditor for WinForms

SweetEditor is a WinForms editor control backed by the SweetEditor C++ core. The core handles text layout, cursor/selection logic, folding, decoration data, and interaction math; WinForms handles native rendering and input dispatch.

GitHub:

Features

  • Syntax/semantic style spans
  • Inlay hints and ghost text
  • Diagnostics and custom decorations
  • Gutter icons and fold markers
  • Code folding and wrap mode switching
  • Current-line rendering modes
  • Completion and newline extension providers
  • Monospace and proportional font support

Requirements

  • .NET 8 (net8.0-windows)
  • Windows x64
  • Native runtime: sweeteditor.dll (included in NuGet package under runtimes/win-x64/native/)

Install

dotnet add package SweetEditor

Quick Start

using System.IO;
using System.Windows.Forms;
using SweetEditor;

public sealed class MainForm : Form
{
    private readonly EditorControl editor = new EditorControl { Dock = DockStyle.Fill };

    public MainForm()
    {
        Controls.Add(editor);

        editor.ApplyTheme(EditorTheme.Dark());
        editor.Settings.SetWrapMode(WrapMode.WORD_BREAK);
        editor.Settings.SetCurrentLineRenderMode(CurrentLineRenderMode.BORDER);

        var code = "int main() {\n    return 0;\n}\n";
        editor.LoadDocument(new Document(code));

        // Load another file later:
        // editor.LoadDocument(new Document(File.ReadAllText(\"sample.cpp\")));
    }
}

Common API

editor.InsertText("Hello");
editor.ReplaceText(new TextRange(new TextPosition(0, 0), new TextPosition(0, 5)), "Hi");
editor.SelectAll();
editor.SetSelection(0, 0, 0, 2);
editor.ScrollToLine(100);
editor.ToggleFold(42);
editor.TriggerCompletion();

Theme and Style Registration

var theme = EditorTheme.Dark()
    .DefineTextStyle(EditorTheme.STYLE_KEYWORD, new TextStyle(unchecked((int)0xFF7AA2F7), EditorControl.FONT_STYLE_BOLD));
editor.ApplyTheme(theme);

Extension Points

  • Decoration providers: IDecorationProvider
  • Completion providers: ICompletionProvider
  • Newline action providers: INewLineActionProvider
  • Icon rendering: EditorIconProvider

Build and Pack

From repository root:

dotnet build .\platform\WinForms\SweetEditor\SweetEditor.csproj -c Release
dotnet pack .\platform\WinForms\SweetEditor\SweetEditor.csproj -c Release

Output package:

  • platform/WinForms/SweetEditor/bin/Release/SweetEditor.<version>.nupkg

Publish to NuGet

dotnet nuget push .\platform\WinForms\SweetEditor\bin\Release\SweetEditor.<version>.nupkg `
  --api-key <NUGET_API_KEY> `
  --source https://api.nuget.org/v3/index.json
Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 100 4/6/2026
1.0.3 111 3/26/2026
1.0.0 103 3/9/2026