Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the TypeScript plugin to be configured via editor settings #114

Open
remcohaszing opened this issue Dec 19, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@remcohaszing
Copy link
Member

remcohaszing commented Dec 19, 2023

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 johnsoncodehk added the enhancement New feature or request label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants