RFC: Language service extensions and tests by weswigham · Pull Request #9283 · microsoft/TypeScript
Continuing from #9038.
This adds language service extensions to the extension API (additionally, extensions should start functioning in language server contexts).
Language server plugins are expected to have any of the publicly useful members of the language service (which they then override), and/or any of those names plus the string Filter (which they then chain together). Props to @chuckjaz for proposing the API.
So a minimal language service plugin could look like this:
import {LanguageServiceProvider} from "typescript-plugin-api"; export default class extends LanguageServiceProvider { constructor(ts, host, service, registry, args) { super(ts, host, service, registry, args); } getProgramDiagnosticsFilter(previous) { previous.push({ file: undefined, start: undefined, length: undefined, messageText: "Test language service plugin loaded!", category: 2, code: "test-plugin-loaded", }); return previous; } }