From f338373ac51da907d8191a3ee5dba99139c7e285 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 26 Apr 2021 14:21:48 +0200 Subject: [PATCH] README for ts-plugin --- packages/ts-plugin/README.md | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 packages/ts-plugin/README.md diff --git a/packages/ts-plugin/README.md b/packages/ts-plugin/README.md new file mode 100644 index 0000000..7ee6065 --- /dev/null +++ b/packages/ts-plugin/README.md @@ -0,0 +1,62 @@ +# 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" + }