Pretty Good UML
Pretty Good UML reads a C# solution and shows UML of what the code actually does. Open the sidebar, click an item, and a diagram opens in a new tab.
For now it is .NET only (C# .sln / .slnx / .csproj). Other languages are not supported yet.
Diagram text is generated locally with Roslyn. You can use Mermaid or PlantUML. Mermaid is rendered in the editor. PlantUML source is local; PNG preview uses the PlantUML server URL in settings (default http://localhost:8080, or https://www.plantuml.com/plantuml).
Diagrams
| Sidebar |
What you get |
| Overview |
Whole-solution class, component, and database (ER) diagrams |
| Classes |
Class diagram for that type and first-level connections (including stubs). Tree: project → namespace → class |
| APIs |
Sequence diagram for an HTTP endpoint. Tree: project → namespace → class → action |
| Methods explorer |
Activity diagram of a method (control flow and calls, not trivial setup). Right-click for sequence. Tree: project → namespace → class → method |
| Usecases explorer |
Sequence of a usecase: primary actor, handler (IRequestHandler / /features / /usecases), database, external system |
| Git |
Class / sequence / activity diffs for changed files vs HEAD |
| Git usecases |
Same diffs per usecase. Sequence and class views show concrete classes, not DI interfaces |
Git diagrams mark added, changed, and removed members or calls (green / yellow / red).
Export PNG, SVG, or PDF from the preview. Copy IR / IR JSON copies the diagram model. Ask AI sends the diagram (and git diff when relevant) to chat.
How to use
- Open a folder that contains a
.sln, .slnx, or .csproj.
- Open the Pretty Good UML activity-bar view and click Refresh.
- Pick Mermaid or PlantUML in the status bar (used until you switch).
- Click a class, API, method, usecase, or git change.
If analysis fails, open Output → Pretty Good UML and check dotnetUml.projectPath / dotnetUml.cliPath.
Requires .NET 8 or later (including .NET 10). If refresh still mentions pretty-good-uml-0.1.0, uninstall that old version and run Developer: Reload Window.
PlantUML PNG preview
Set UML: PlantUML server URL (status bar) to a running server:
- Local Docker:
http://localhost:8080 after docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
- Hosted:
https://www.plantuml.com/plantuml
The URL is the base (no /png on the end). A Node/CloudPanel site at /plantuml is not a PlantUML server and will not return a PNG.
Example diagrams
These are the kinds of diagrams the extension generates from C# (here: a MediatR create-todo usecase).
Usecase sequence (Usecases explorer):
sequenceDiagram
actor Caller as Primary actor
participant UseCase as CreateTodoItem
participant Database
Caller->>UseCase: Handle
UseCase->>Database: Add
UseCase->>Database: SaveChangesAsync
Class neighborhood (Classes):
classDiagram
class CreateTodoItemCommandHandler {
+Handle() int
}
class SqlTodoService {
+SaveAsync() Task
}
class ApplicationDbContext {
+Add()
+SaveChangesAsync() int
}
CreateTodoItemCommandHandler --> SqlTodoService : uses
CreateTodoItemCommandHandler --> ApplicationDbContext : uses
SqlTodoService --|> TodoServiceBase
Method activity (Methods explorer):
flowchart TD
start([Handle]) --> normalize[NormalizeTitle]
normalize --> save[SaveAsync]
save --> add[Add]
add --> commit[SaveChangesAsync]
commit --> stop([return])
Same usecase as PlantUML:
@startuml
title CreateTodoItem
actor "Primary actor" as Caller
participant "CreateTodoItem" as UseCase
database Database
Caller -> UseCase : Handle
UseCase -> Database : Add
UseCase -> Database : SaveChangesAsync
@enduml