63 lines
1.6 KiB
Markdown
63 lines
1.6 KiB
Markdown
# TypeScript plugin for Syndicate
|
|
|
|
Rewrites Syndicate DSL syntax into plain TypeScript as a `tsserver`
|
|
plugin, allowing your IDE to work directly with Syndicate constructs
|
|
and not requiring a separate preprocessing step.
|
|
|
|
Sadly, `tsc` doesn't pay attention to plugins (not as of April 2021,
|
|
anyway). If you're using `tsc` as part of your build, you will need to
|
|
use `@syndicate-lang/tsc`'s `syndicate-tsc` command instead.
|
|
|
|
## Installing the plugin
|
|
|
|
`package.json`:
|
|
|
|
{
|
|
"devDependencies": {
|
|
"@syndicate-lang/ts-plugin": "file:../..",
|
|
...
|
|
},
|
|
...
|
|
}
|
|
|
|
then `yarn install` or `npm install`.
|
|
|
|
## Enabling the plugin in the TypeScript compiler
|
|
|
|
`tsconfig.json`:
|
|
|
|
{
|
|
"compilerOptions": {
|
|
"plugins": [
|
|
{ "name": "@syndicate-lang/ts-plugin" }
|
|
],
|
|
...
|
|
},
|
|
...
|
|
}
|
|
|
|
## Getting it to work with specific editors
|
|
|
|
### Emacs with Tide
|
|
|
|
It should Just Work.
|
|
|
|
### Visual Studio Code
|
|
|
|
After `yarn install`/`npm install`, you will have a
|
|
`node_modules/typescript` directory.
|
|
|
|
Open VS Code, and select the version of TypeScript contained therein
|
|
by following instructions
|
|
[here](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions).
|
|
|
|
Specifically, when selecting a TypeScript version,
|
|
[choose "Use Workspace Version"](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript).
|
|
|
|
For me, the net effect of this is to create a `.vscode/settings.json`
|
|
file containing:
|
|
|
|
{
|
|
"typescript.tsdk": "node_modules/typescript/lib"
|
|
}
|