syndicate-js/packages/ts-plugin/README.md

1.6 KiB

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.

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"
}