SweetLine 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SweetLine --version 1.1.0
                    
NuGet\Install-Package SweetLine -Version 1.1.0
                    
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="SweetLine" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SweetLine" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SweetLine" />
                    
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 SweetLine --version 1.1.0
                    
#r "nuget: SweetLine, 1.1.0"
                    
#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 SweetLine@1.1.0
                    
#: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=SweetLine&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SweetLine&version=1.1.0
                    
Install as a Cake Tool

SweetLine for .NET (C# / WinForms)

SweetLine is a high-performance syntax highlighting engine for modern editors.
This package provides the C# wrapper over the SweetLine native core.

Features

  • Full-text highlighting (TextAnalyzer)
  • Incremental highlighting (DocumentAnalyzer)
  • Scope/indent guide analysis
  • Style-ID and inline-style output modes

Install

dotnet add package SweetLine

Quick Start

using SweetLine;

var config = new HighlightConfig(showIndex: true, inlineStyle: false);
using var engine = new HighlightEngine(config);

engine.RegisterStyleName("keyword", 1);
engine.RegisterStyleName("string", 2);
engine.CompileSyntaxFromFile("syntaxes/csharp.json");

using var document = new Document("file:///example.cs", "public class Demo {}");
using var analyzer = engine.LoadDocument(document);

if (analyzer != null)
{
    DocumentHighlight highlight = analyzer.Analyze();
    IndentGuideResult guides = analyzer.AnalyzeIndentGuides();
}

Incremental Highlighting

var changeRange = new TextRange(
    new TextPosition(line: 2, column: 4),
    new TextPosition(line: 2, column: 8));

DocumentHighlight updated = analyzer!.AnalyzeIncremental(changeRange, "modified");
DocumentHighlightSlice visible = analyzer.AnalyzeIncrementalInLineRange(
    changeRange,
    "modified",
    new LineRange(startLine: 0, lineCount: 120));

Native Library

  • This package currently bundles native library for: win-x64
  • Bundled file path inside package: runtimes/win-x64/native/sweetline.dll

Native resolver search order in SweetLineNative:

  1. SWEETLINE_LIB_PATH (file or directory)
  2. App base / current directory candidates
  3. Runtime native folders and common build output folders
  4. System default loader

If needed, set explicit path:

$env:SWEETLINE_LIB_PATH = "C:\\path\\to\\native"

Requirements

  • .NET 8.0+
  • Windows x64 (for bundled native binary in current package)

Maintainer: Pack and Publish

  1. Build native library to:
    • cmake-build-release-visual-studio/bin/sweetline.dll
  2. Pack:
dotnet pack platform/CSharp/SweetLine/SweetLine.csproj -c Release -o artifacts/nuget /p:PackageVersion=0.1.0
  1. Push:
$env:NUGET_API_KEY = "<your-nuget-api-key>"
dotnet nuget push artifacts/nuget/SweetLine.0.1.0.nupkg --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos 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

    • 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.2.4 92 5/10/2026
1.2.2 107 4/18/2026
1.2.1 106 4/12/2026
1.2.0 128 3/28/2026
1.1.1 104 3/25/2026
1.1.0 99 3/22/2026
1.0.0 98 3/21/2026