-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
Even when I create toy examples, the C# language server does not seem to work.
I have dotnet SDK installed with csharp-ls:
ls-test-cs > dotnet --version
9.0.203
ls-test-cs > dotnet tool list --global |grep csharp
csharp-ls 0.18.0 csharp-ls
Create a new project (does not matter if there's a solution or not, it doesn't work regardless:
ls-test-cs > dotnet new sln -n MySolution && \
dotnet new web -n MyProject && \
dotnet sln MySolution.sln add MyProject
The template "Solution File" was created successfully.
The template "ASP.NET Core Empty" was created successfully.
Processing post-creation actions...
Restoring /tmp/ls-test-cs/MyProject/MyProject.csproj:
Restore succeeded.
Project `MyProject/MyProject.csproj` added to the solution.
ls-test-cs > dotnet build
Restore complete (0.6s)
MyProject succeeded (2.3s) → MyProject/bin/Debug/net9.0/MyProject.dll
Build succeeded in 3.1s
I edit the file to trigger a diagnostic:
ls-test-cs > cat ./MyProject/Program.cs
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
int x = "432"; // Error - Cannot implicitly convert type 'string' to 'int'
app.MapGet("/", () => "Hello World!");
app.Run();
And neither the agent nor the opencode debug lsp
commands indicate that it works. Here's the debug output with logs:
ls-test-cs > opencode debug lsp diagnostics --print-logs ./MyProject/Program.cs
INFO 2025-08-11T08:47:47 +112ms service=default version=0.4.2 args=["debug","lsp","diagnostics","--print-logs","./MyProject/Program.cs"] opencode
INFO 2025-08-11T08:47:47 +1ms service=app cwd=/tmp/ls-test-cs creating
INFO 2025-08-11T08:47:47 +1ms service=app git
INFO 2025-08-11T08:47:47 +1ms service=bus type=storage.write subscribing
INFO 2025-08-11T08:47:47 +0ms service=app name=bus registering service
INFO 2025-08-11T08:47:47 +0ms service=format init
INFO 2025-08-11T08:47:47 +0ms service=bus type=file.edited subscribing
INFO 2025-08-11T08:47:47 +0ms service=bus type=* subscribing
INFO 2025-08-11T08:47:47 +0ms service=config.hooks init
INFO 2025-08-11T08:47:47 +0ms service=bus type=file.edited subscribing
INFO 2025-08-11T08:47:47 +0ms service=bus type=session.idle subscribing
INFO 2025-08-11T08:47:47 +0ms service=app name=lsp registering service
INFO 2025-08-11T08:47:47 +0ms service=app name=config registering service
INFO 2025-08-11T08:47:47 +2ms service=config path=/home/aagami/.config/opencode/config.json loading
INFO 2025-08-11T08:47:47 +3ms service=config path=/home/aagami/.config/opencode/opencode.json loading
INFO 2025-08-11T08:47:47 +0ms service=config path=/home/aagami/.config/opencode/opencode.jsonc loading
INFO 2025-08-11T08:47:47 +2ms service=config agent={} mode={} plugin=[] username=aagami loaded
INFO 2025-08-11T08:47:47 +3ms service=lsp.client serverID=csharp starting client
INFO 2025-08-11T08:47:47 +1ms service=lsp.client serverID=csharp sending initialize
INFO 2025-08-11T08:47:47 +609ms service=lsp.client serverID=csharp initialized
INFO 2025-08-11T08:47:47 +1ms service=lsp.client serverID=csharp path=/tmp/ls-test-cs/MyProject/Program.cs waiting for diagnostics
INFO 2025-08-11T08:47:47 +0ms service=bus type=lsp.client.diagnostics subscribing
INFO 2025-08-11T08:47:47 +0ms service=lsp.client serverID=csharp path=/tmp/ls-test-cs/MyProject/Program.cs textDocument/didOpen
INFO 2025-08-11T08:47:47 +279ms service=lsp.client serverID=csharp token=e507a269-0eae-405c-b1ed-0c382c57cdd9 window/workDoneProgress/create
INFO 2025-08-11T08:47:50 +2723ms service=bus type=lsp.client.diagnostics unsubscribing
{}
INFO 2025-08-11T08:47:50 +1ms service=app name=lsp shutdown
INFO 2025-08-11T08:47:50 +0ms service=lsp.client serverID=csharp shutting down
INFO 2025-08-11T08:47:50 +1ms service=lsp.client serverID=csharp shutdown
I'm using Ubuntu. I tested typescript and it worked fine (I could see diagnostics with opencode debug lsp diagnostics
)
nielpattin
Metadata
Metadata
Assignees
Labels
No labels