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

Is vue-tsc supported? #259

Closed
silverwind opened this issue Nov 21, 2024 · 6 comments
Closed

Is vue-tsc supported? #259

silverwind opened this issue Nov 21, 2024 · 6 comments

Comments

@silverwind
Copy link

silverwind commented Nov 21, 2024

tsc can not resolve imports for .vue files from .ts, and there exists a patched tsc called vue-tsc which fixes that. Is there a way to get LSP-typescript to use vue-tsc? Ideally on a per-project basis.

Also see https://vuejs.org/guide/typescript/overview#overview for reference.

@rchl
Copy link
Member

rchl commented Nov 21, 2024

That's not exactly how it works. There exists a Vue plugin for Typescript which can be used with LSP-typescript. The sublimelsp/LSP-vue#130 might not give a step by step instructions but it should be clear enough on how to enable that plugin (that comes with LSP-vue).

@silverwind
Copy link
Author

silverwind commented Nov 21, 2024

Thanks, I will try that later. My understanding is that LSP-vue is for .vue files and LSP-typescript is for .ts, so that's why I've been coming to this repo.

@silverwind
Copy link
Author

I tried with reconfiguring LSP-vue like that, but it wouldn't get rid of the resolution errors at locations where .vue files are imported into .ts files. I had success eliminating the errors by adding this plugin to typescript-language-server like this in my LSP-typescript config:

{
  "initializationOptions": {
    "plugins": [
      {
        "name": "@vue/typescript-plugin",
        "location": "/Users/silverwind/.npm-global/lib/node_modules/@vue/language-server",
        "languages": ["vue"],
      },
    ],
  },
}

The absolute path obviously is not ideal, and ideally I'd like this plugin to be auto-loaded when present in the project's node_modules.

@rchl
Copy link
Member

rchl commented Nov 27, 2024

Well, that's how my linked thread suggests to configure it, doesn't it?

I'm not sure if it makes sense to include the vue language server in the project since the project doesn't really have any use for it. I would say that getting it from the language server handled by the editor would make more sense.

As I've mentioned in sublimelsp/LSP-vue#130, the absolute path to the plugin is one of the issues to solve but the solution would likely make it possible to reference the plugin from LSP-vue rather than from the project itself.

@silverwind
Copy link
Author

Yeah, on second look, it's part of what you suggested, just that my path points to the module folder.

Maybe it's worth trying to get typescript-language-server to ship with that plugin pre-installed? I wonder how vscode solves this issue.

@rchl
Copy link
Member

rchl commented Nov 28, 2024

In VSCode the Vue extension extends Typescript with the plugin.

I thought about including Vue plugin in the LSP-typescript package but it doesn't really make sense since those are only relevant to some users.

Watch the before-mentioned issue for any developments in this area or provide any suggestions there.

@rchl rchl closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2024
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

No branches or pull requests

2 participants