Some help to implement a TypeScript language service using the new API #151
Unanswered
elchininet
asked this question in
Q&A
Replies: 1 comment 8 replies
-
You’re almost there! You have registered the TypeScript service plugin, which adds support for TypeScript features. However, you haven’t registered any language plugins, so Volar doesn’t understand how to handle Vue files. So in import { createVueLanguagePlugin } from '@vue/language-core';
// …
worker.initialize((ctx) => {
// …
return createTypeScriptWorkerService({
// …
languagePlugins: [createVueLanguagePlugin(/* … */)]
})
}) I don’t know the exact options |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I opened this issue some months ago. I have been trying to implement a TypeScript language service with custom type defintions following the instructions of the new API, but I have not succeed on that.
First of all I would like to double-check these small issues and know if the fix that I applied is correct on each case:
1.
createTypeScriptService
inservicePlugins
As the
createTypeScriptService
returns an array ofServicePlugin
it seems that it should be spreaded.2.
registerProviders
methodI also added the
getSyncUris
there following the types.If these fixes are OK, I would like to have your help to detect what I am missing. I have created a minimum reproducible repo.
In the old branch it is implemented using
@volar/[email protected]
and the language service works but without the ability of adding my own custom type definitions.In the master branch I'm using
@volar/[email protected]
and I cannot make the language service to work, it seems that something needs to be done, but I am not able to indentify what.On each branch just run
yarn
andyarn start
to open the dev server.Could you indicate what I am missing?
Regards and thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions