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
<PackageReference Include="EmmyLua.LanguageServer.Framework" Version="0.9.0" />
<PackageVersion Include="EmmyLua.LanguageServer.Framework" Version="0.9.0" />
<PackageReference Include="EmmyLua.LanguageServer.Framework" />
paket add EmmyLua.LanguageServer.Framework --version 0.9.0
#r "nuget: EmmyLua.LanguageServer.Framework, 0.9.0"
#:package EmmyLua.LanguageServer.Framework@0.9.0
#addin nuget:?package=EmmyLua.LanguageServer.Framework&version=0.9.0
#tool nuget:?package=EmmyLua.LanguageServer.Framework&version=0.9.0
Language Server Framework
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
- EmmyLuaAnalyzer - A feature-rich Lua language server
π€ 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
- π« Report bugs via GitHub Issues
- π‘ Request features via GitHub Discussions
Made with β€οΈ by the EmmyLua community
| Product | Versions 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. |
-
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 |