EmmyLua.LanguageServer.Framework 0.9.0

dotnet add package EmmyLua.LanguageServer.Framework --version 0.9.0
                    
NuGet\Install-Package EmmyLua.LanguageServer.Framework -Version 0.9.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="EmmyLua.LanguageServer.Framework" Version="0.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EmmyLua.LanguageServer.Framework" Version="0.9.0" />
                    
Directory.Packages.props
<PackageReference Include="EmmyLua.LanguageServer.Framework" />
                    
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 EmmyLua.LanguageServer.Framework --version 0.9.0
                    
#r "nuget: EmmyLua.LanguageServer.Framework, 0.9.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 EmmyLua.LanguageServer.Framework@0.9.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=EmmyLua.LanguageServer.Framework&version=0.9.0
                    
Install as a Cake Addin
#tool nuget:?package=EmmyLua.LanguageServer.Framework&version=0.9.0
                    
Install as a Cake Tool

Language Server Framework

License: MIT NuGet CI Code Quality

A modern, high-performance .NET framework for building Language Server Protocol (LSP) servers with full LSP 3.18 specification support.

✨ Features

  • 🎯 Full LSP 3.18 Support - Complete implementation of the latest LSP specification
  • ⚑ High Performance - Built with System.Text.Json source generation for optimal performance
  • πŸš€ AOT Ready - Full support for Ahead-of-Time (AOT) compilation
  • πŸ“¦ Zero Dependencies - No dependency on Newtonsoft.Json or other third-party libraries
  • πŸͺŸ Window & Progress - Complete support for window messages, logging, and progress reporting
  • πŸ”§ Easy to Use - Simple, intuitive API for building language servers
  • πŸ“Š Performance Metrics - Built-in performance monitoring and telemetry support
  • 🎨 Type Safe - Strongly typed protocol messages with full IntelliSense support

πŸ“¦ Installation

Install via NuGet Package Manager:

dotnet add package EmmyLua.LanguageServer.Framework

Or via Package Manager Console:

Install-Package EmmyLua.LanguageServer.Framework

πŸš€ Quick Start

Basic Language Server

using EmmyLua.LanguageServer.Framework.Server;
using EmmyLua.LanguageServer.Framework.Protocol.Message.Initialize;

// Create a language server
var server = LanguageServer.From(Console.OpenStandardInput(), Console.OpenStandardOutput());

// Handle initialization
server.OnInitialize((request, serverInfo) =>
{
    serverInfo.Name = "My Language Server";
    serverInfo.Version = "1.0.0";
    return Task.CompletedTask;
});

// Handle initialized notification
server.OnInitialized(async (request) =>
{
    await server.Client.LogInfo("Server initialized!");
});

// Run the server
await server.Run();

Adding Handlers

using EmmyLua.LanguageServer.Framework.Server.Handler;

// Create a hover handler
public class MyHoverHandler : HoverHandlerBase
{
    protected override Task<Hover?> Handle(HoverParams request, CancellationToken token)
    {
        var hover = new Hover
        {
            Contents = new MarkupContent
            {
                Kind = MarkupKind.Markdown,
                Value = "**Hello from LSP!**"
            }
        };
        return Task.FromResult<Hover?>(hover);
    }

    public override void RegisterCapability(ServerCapabilities serverCapabilities,
        ClientCapabilities clientCapabilities)
    {
        serverCapabilities.HoverProvider = true;
    }
}

// Add handler to server
server.AddHandler(new MyHoverHandler());

πŸ“š Documentation

Window Features

Display messages and collect user input:

// Show a message
await server.Client.ShowMessage(new ShowMessageParams
{
    Type = MessageType.Info,
    Message = "Operation completed successfully!"
});

// Request user action
var result = await server.Client.ShowMessageRequest(new ShowMessageRequestParams
{
    Type = MessageType.Warning,
    Message = "Do you want to continue?",
    Actions = new List<MessageActionItem>
    {
        new() { Title = "Yes" },
        new() { Title = "No" }
    }
}, cancellationToken);

// Log messages
await server.Client.LogError("An error occurred");
await server.Client.LogInfo("Processing file...");

Progress Reporting

Report progress for long-running operations:

// Using the helper class (recommended)
using var progress = await WorkDoneProgressReporter.Create(
    server.Client,
    title: "Analyzing workspace",
    cancellable: true
);

for (int i = 0; i < 100; i++)
{
    await progress.Report($"Processing file {i + 1}/100", (uint)i);
}

await progress.End("Analysis complete!");

For detailed examples, see LSP_WINDOW_PROGRESS_USAGE.md

Performance Monitoring

Enable performance metrics to monitor your server:

var options = new LanguageServerOptions
{
    EnablePerformanceTracing = true,
    PerformanceMetricsPrintInterval = TimeSpan.FromMinutes(5)
};

var server = LanguageServer.From(input, output, options);

// Get metrics at any time
var metrics = server.GetMetrics();
Console.WriteLine($"Total requests: {metrics.TotalRequestsHandled}");
Console.WriteLine($"Average duration: {metrics.AverageRequestDurationMs}ms");

🎯 Supported LSP Features

Text Document Synchronization

  • βœ…DidOpen / DidChange / DidClose / DidSave
  • βœ… WillSave / WillSaveWaitUntil

Language Features

  • βœ… Completion (with resolve support)
  • βœ… Hover
  • βœ… Signature Help
  • βœ… Definition / Declaration / Type Definition / Implementation
  • βœ… References
  • βœ… Document Highlight
  • βœ… Document Symbol
  • βœ… Code Action
  • βœ… Code Lens
  • βœ… Document Link
  • βœ… Document Color / Color Presentation
  • βœ… Document Formatting / Range Formatting / On Type Formatting
  • βœ… Rename / Prepare Rename
  • βœ… Folding Range
  • βœ… Selection Range
  • βœ… Call Hierarchy
  • βœ… Semantic Tokens
  • βœ… Inlay Hint
  • βœ… Inline Value
  • βœ… Type Hierarchy
  • βœ… Inline Completion
  • βœ… Linked Editing Range

Workspace Features

  • βœ… Workspace Symbols
  • βœ… Configuration
  • βœ… Workspace Folders
  • βœ… File Operations (Create/Rename/Delete)
  • βœ… File Watching
  • βœ… Diagnostics
  • βœ… Execute Command
  • βœ… Apply Edit

Window Features

  • βœ… ShowMessage / ShowMessageRequest
  • βœ… LogMessage
  • βœ… Work Done Progress
  • βœ… Telemetry

πŸ—οΈ Architecture

The framework is designed with extensibility and performance in mind:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Language Server Application         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚           Handler Layer                 β”‚
β”‚  (HoverHandler, CompletionHandler...)   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         LanguageServer Core             β”‚
β”‚   (Protocol, Routing, Lifecycle)        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      JSON-RPC Protocol Layer            β”‚
β”‚  (JsonProtocolReader/Writer)            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         Transport Layer (stdio)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“– Examples

Check out the LanguageServer.Test project for a complete working example that demonstrates:

  • Server initialization
  • Multiple handlers implementation
  • Configuration management
  • Progress reporting
  • Error handling

🌟 Projects Using This Framework

🀝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on how to submit pull requests, report issues, and contribute to the project.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Resources

πŸ’¬ Support


Made with ❀️ by the EmmyLua community

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 is compatible.  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.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on EmmyLua.LanguageServer.Framework:

Repository Stars
JaneySprings/DotRush
Lightweight C# development environment for VSCode
Version Downloads Last Updated
0.9.0 178 10/29/2025
0.8.1 1,136 4/21/2025
0.8.0 299 2/18/2025
0.7.1 177 2/1/2025
0.7.0 152 1/20/2025
0.6.1 434 8/14/2024
0.6.0 190 8/14/2024
0.5.2 165 8/13/2024
0.5.1 242 7/25/2024
0.5.0 256 7/18/2024
0.4.0 163 7/16/2024
0.3.3 163 7/16/2024
0.3.2 135 7/16/2024
0.3.1 143 7/16/2024
0.3.0 140 7/15/2024
0.2.2 141 7/15/2024
0.2.1 140 7/15/2024
0.2.0 125 7/15/2024
0.1.2 142 7/15/2024
0.1.1 158 7/14/2024
0.1.0 141 7/14/2024
0.0.4 138 7/14/2024
0.0.3 154 7/14/2024
0.0.2 136 7/14/2024
0.0.1 142 7/13/2024