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

feat: Support for Plugin API #1687

Merged
merged 1 commit into from Aug 10, 2022
Merged

feat: Support for Plugin API #1687

merged 1 commit into from Aug 10, 2022

Conversation

johnsoncodehk
Copy link
Member

@johnsoncodehk johnsoncodehk commented Aug 10, 2022

Closes #185

Please note that the API interface is not stable, it may change before v1.0.

Usage

  • tsconfig.json
{
  "vueCompilerOptions": {
    "plugins": ["./your-plugin"]
  }
}

Example: https://github.com/johnsoncodehk/volar-starter/blob/master/vue-i18n.js
Built-in plugins: https://github.com/johnsoncodehk/volar/tree/master/packages/vue-language-core/src/plugins

@johnsoncodehk johnsoncodehk merged commit d0b9bec into master Aug 10, 2022
@johnsoncodehk johnsoncodehk deleted the plugin-api branch August 10, 2022 09:27
@phil294
Copy link

phil294 commented Aug 10, 2022

Hi, thanks for your work on this! This should make adding e.g. a custom HTML parser a breeze. However, am I understanding the plugin syntax correctly, in that it is not yet possible to integrate an external LSP for scripts (#533)? (Or at least not without significant effort) So that go-tos, autocomplete etc. all can work with JS preprocessor languages like CoffeeScript or Elm, when there exists a LSP server implementation. It would be great to just plug them in somehow.

@johnsoncodehk
Copy link
Member Author

@phil294 You can convert CoffeeScript code to TypeScript code with mapping in resolveEmbeddedFile API, it can provide the same level language capabilities as TypeScript script blocks in theory. But currently implement cannot reuse https://github.com/johnsoncodehk/volar/blob/master/packages/vue-language-core/src/plugins/vue-tsx.ts code-gen logic with JS preprocessor, so yes this way not without significant effort.

You can open a feature request (and best to attach sample repro, so I can see what I actually need to solve), I need to find a suitable implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Plugin API
2 participants