TypeScript IDE Syndicate plugin: good news and bad news

Because the TypeScript implementation has been moving on along its own roadmap, the IDE-support (Language Server Protocol, LSP) part of the TypeScript compiler plugin that I wrote (npm, git) has stopped working properly with recent TypeScript releases.

ts-plugin versions older than 0.15.2 don’t work well with TypeScript 4.9; it’s possible they haven’t worked well since TypeScript 4.5.

The good news

The good news is that @syndicate-lang/ts-plugin version 0.15.2 includes a few changes that make it work much better with TypeScript 4.9. So if you update to 0.15.2, you should see good support for the Syndicate DSL overlaid atop the normal TypeScript support in Emacs, VSCode, etc.

The bad news

The bad news is that the monkeypatching I’ve been doing to hook into the necessary parts of the TypeScript tsserver will no longer work for TypeScript versions 5.0 and higher. The problem is that, in tsserver 4.9, simple properties were used for values like ts.createSourceFile and ts.server.ScriptInfo, so the ts-plugin was able to hook them to insert the Syndicate DSL expansion process. In 5.0, by contrast, Object.defineProperty is used to define a non-writable, non-configurable property. It’s essentially game over for the existing ts-plugin approach at this point.

So what now?

Having ts-plugin IDE support is really nice for Syndicate programming. So I feel compelled to find some kind of solution.

Perhaps I need to write a real LSP implementation, backing into a captive tsserver instance?

I’ve opened an issue on the ts-plugin repository about this.