Allow the TypeScript plugin to be configured via editor settings
remcohaszing opened this issue · 1 comments
remcohaszing commented
Based on the VSCode documentation on contributes.typescriptServerPlugins
, it’s possible to send configuration via an extension.
We could use this to provide a uniform interface to configure Volar based TypeScript plugins through either tsconfig.json
or VSCode settings.
The following VSCode extension:
import { activateTsPlugin } from '@volar/vscode'
export async function activate(context) {
await activateTsPlugin(
'@mdx-js/typescript-plugin',
context,
'mdx',
'config'
)
}
configures the TypeScript plugin using the following VSCode settings:
{
"mdx.config": {
"plugins": []
}
}
The TypeScript plugin would look something like this:
module.exports = createAsyncTSServerPlugin(
['.mdx'],
2,
// This tells Volar at which `tsconfig.json` key to look.
'mdx',
async (ts, info, options) => {
// The options are available here somehow.
}
)
This would be equivalen to having the following tsconfig.json
:
{
"compilerOptions": {/* … */},
"mdx": {}
}
Related:
johnsoncodehk commented
Closed due to no longer have needs on this. (Refs: mdx-js/mdx-analyzer#354 (comment))