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

How to specify typescript path to volar lsp #4332

Closed
immdevrov opened this issue May 1, 2024 · 2 comments
Closed

How to specify typescript path to volar lsp #4332

immdevrov opened this issue May 1, 2024 · 2 comments
Labels
question Further information is requested

Comments

@immdevrov
Copy link

immdevrov commented May 1, 2024

From documentation for hybridMode: false:
Make sure you have typescript installed globally or pass the location to volar

How to pass typescript location to volar?

A an trying to configure neovim lsp

require'lspconfig'.volar.setup {
  filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
  init_options = {
    vue = {
      hybridMode = false,
    },
  },
  on_attach = on_attach,
  capabilities = capabilities
}
@RayGuo-ergou
Copy link
Contributor

RayGuo-ergou commented May 2, 2024

In most case lspconfig will do that for you, e.g. find tsdk in pwd first then find in root. see: https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/volar.lua#L27

If you want to define yourself you can do

require'lspconfig'.volar.setup {
  filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
  init_options = {
    vue = {
      hybridMode = false,
    },
+   typescript = {
+     tsdk = <YOUR_PATH>
+   },
  },
  on_attach = on_attach,
  capabilities = capabilities
}

see:

typescript: {
tsdk: string;
};

@immdevrov
Copy link
Author

Thanks!

@johnsoncodehk johnsoncodehk added the question Further information is requested label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants