[BUG] LSP tool drops non-file:// results (Roslyn source-generated code) via the gitignore filter

Status Open
Reported on v2.1.286
Maintainer reply None cached
Activity 0 comments · opened Oct 1, 2026

What's wrong

The LSP tool filters workspaceSymbol / findReferences / goToDefinition / goToImplementation results through git check-ignore. The URI → path conversion only strips a file:// prefix and URL-decodes the rest, so a non-file:// URI is handed to git as a relative path and can match ignore patterns.

Roslyn (Microsoft.CodeAnalysis.LanguageServer) returns source-generator output as

roslyn-source-generated://<guid>/Foo.g.cs?documentId=…&assemblyPath=%2F<repo>%2FGenerator%2Fbin%2FDebug%2Fnetstandard2.0%2FGenerator.dll

After decoding, the query string contains …/bin/Debug/…, which matches the standard Visual Studio .gitignore entry [Bb]in/, so the location is dropped.

Effect in a .NET repo whose CRUD layer comes from a source generator:

  • workspaceSymbol for a generated-only type → "No symbols found in workspace…", although the server returns it
  • findReferences on a base class → 50 results; the server returns 274 (224 are in generated files). The list looks complete but isn't, which matters when checking usages before a signature change.
  • hover is not filtered and works

What should happen

Apply the gitignore filter only to file:// URIs and pass other schemes through — they are not workspace files.

Steps to reproduce

  1. C# project with types produced by a source generator (generator built to bin/Debug), repo .gitignore containing [Bb]in/.
  2. Register Roslyn through a plugin .lsp.json (--stdio --autoLoadProjects).
  3. LSP workspaceSymbol for a type that exists only in generated code → empty. The same workspace/symbol request sent to the server directly returns a roslyn-source-generated://… location.

The filter alone, in any repo with [Bb]in/ in .gitignore:

$ git check-ignore -v 'roslyn-source-generated://x/A.g.cs?assemblyPath=/repo/Gen/bin/Debug/Gen.dll'
.gitignore:26:[Bb]in/	roslyn-source-generated://x/A.g.cs?assemblyPath=/repo/Gen/bin/Debug/Gen.dll

Git for Windows treats \ in a Windows assemblyPath as a separator, so it matches there too (checked with Git 2.55.0.windows.3).

Environment

  • Claude Code 2.1.286 (desktop app, macOS arm64)
  • Roslyn LSP 5.12.0 from the VS Code C# extension 2.160.4, .NET SDK 10
  • Related: #38683 (Roslyn compatibility, different causes)

View original on GitHub ↗