syndicate-js/packages/ts-plugin
Tony Garnock-Jones 6bec672087 Switch to yarn workspaces 2021-04-26 15:13:30 +02:00
..
examples/typescript Switch to yarn workspaces 2021-04-26 15:13:30 +02:00
src Adapt to latest Preserves changes 2021-03-03 10:28:10 +01:00
.npmignore Split up compiler into more packages 2021-01-23 23:38:00 +01:00
LICENCE Split up compiler into more packages 2021-01-23 23:38:00 +01:00
Makefile Split up compiler into more packages 2021-01-23 23:38:00 +01:00
README.md Switch to yarn workspaces 2021-04-26 15:13:30 +02:00
gpl-3.0.txt Split up compiler into more packages 2021-01-23 23:38:00 +01:00
package.json Switch to yarn workspaces 2021-04-26 15:13:30 +02:00
tsconfig.json Split up compiler into more packages 2021-01-23 23:38:00 +01:00

README.md

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.

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, you will have a node_modules/typescript directory.

Open VS Code, and select the version of TypeScript contained therein by following instructions here.

Specifically, when selecting a TypeScript version, choose "Use Workspace Version".

For me, the net effect of this is to create a .vscode/settings.json file containing:

{
    "typescript.tsdk": "node_modules/typescript/lib"
}