TypeScript Language Services Examples

TypeScript comes with source code, tests, and several samples, and the compiler apparently has an API for handling AST and things like code completion and coloring.

However, I could not find examples of how to use this API. Has anyone tried to figure this out? Maybe some bloggers?

The only example I could find was the base Sublime Text plugin .

+7
source share
1 answer

If you look at src\harness\fourslash.ts , you will see how tests are written that test the language services (in tests\ls\fourslash\ ). This file uses the mock host, implemented in src\harness\harness.ts , which controls the environment in which the language service runs. These tests handle things like lists of members and terminations, type information, formatting, renaming, finding links, etc.

+7
source

All Articles