Skip to content
/ TsUML Public
forked from remojansen/TsUML

Generates UML diagrams from TypeScript source code

License

Notifications You must be signed in to change notification settings

rylphs/TsUML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TsUML

This VS Code extension was developed during a hackathon at the 2016 MVP Global Summit. This extension allows you to auto-generate UML diagrams for TypeScript applications:

About this repo

Please do not expect this to be a production-ready extension: IT IS JUST AN EXPERIMENT.

I decided to share the repo because it could be used as a reference in the development of VS Code extensions.

You can use this repo to find out the following:

  • How to use the TypeScript language service to access the AST generated by the TypeScript compiler.
  • How to traverse the AST.
  • How to access user-geerated source code from a VS Code extension.
  • How to create custom VS Code commands.
  • How to render a new page after triggering custom VS Code commands.

About the source code

This repo is divided in two main components.

/src/core

The core folder exposes a function named getDiagram.

This function expects an array of paths to be passed as an argument. The paths should point to some TypeScript source files.

The getDiagram function uses other core components:

  • Parser: Traversed the TypeScript AST to create a EntityDetails data structure.
  • Serializer: Transfroms EntityDetails data structure into the UML DSL.
  • Renderer: Transforms the DSL into a SVG class diagram.

The function returns a Promise<string>. If the promise is fulfilled, the returned string value will contain a svg diagram.

/src/extension & /src/provider

Contains the actial VS Code extension. It declares a new custom command. When the command is executed the current source file is passed to the code to get a class diagram. The diagram is then displayed in a new panel.

Missing features

Feel free to send PRs:

  • Display inheritance relationships
  • Display composition relationships
  • Display "implements"

Resources

I used the following links during the hackathon:

About

Generates UML diagrams from TypeScript source code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.7%
  • JavaScript 5.3%