RoslynLens: Give Your AI Assistant Semantic Eyes on .NET Code
RoslynLens is an open-source server that provides AI coding assistants like Claude Code direct access to Roslyn semantic analysis, allowing them to query .NET codebases efficiently without reading entire files.
Why it matters
RoslynLens enables AI coding assistants to work more efficiently with .NET codebases by providing direct access to semantic analysis, reducing the cost and improving the accuracy of common code understanding tasks.
Key Points
- 1AI assistants currently have two limited options to understand .NET code: read entire files or use text-based search, which miss semantic relationships
- 2RoslynLens loads .NET solutions into a Roslyn workspace and exposes 28 tools through the Model Context Protocol, enabling focused queries with minimal responses
- 3RoslynLens significantly reduces the number of tokens and time required to perform common code navigation tasks compared to file-based approaches
Details
RoslynLens is a tool that aims to address the limitations of how AI assistants currently work with .NET codebases. When an AI assistant like Claude Code tries to understand .NET code, it has to either read entire files (consuming 500-2,000+ tokens per file) or use text-based search, which cannot distinguish between different code elements like types, variables, and method declarations. This results in wasted context window, missed connections, and wrong assumptions. RoslynLens solves this by loading the .NET solution into a Roslyn workspace and exposing 28 semantic analysis tools through the Model Context Protocol. This allows the AI assistant to send focused queries and receive structured, minimal responses, significantly reducing the number of tokens and time required to perform common code navigation tasks. For example, finding all callers of the 'OrderService.SubmitAsync' method takes only 85 tokens with RoslynLens, compared to reading 12 files and consuming around 15,000 tokens with a file-based approach.
No comments yet
Be the first to comment