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

Error getting definition of imports in neovim #4282

Closed
Ralstonnn opened this issue Apr 20, 2024 · 2 comments
Closed

Error getting definition of imports in neovim #4282

Ralstonnn opened this issue Apr 20, 2024 · 2 comments
Labels
bug Something isn't working upstream

Comments

@Ralstonnn
Copy link

Ralstonnn commented Apr 20, 2024

Getting this error when using vue with typescript

Error appears if file has any errors or warnings and I'm trying to get definition of first import

Set up looks like this

-- If you are using mason.nvim, you can get the ts_plugin_path like this
local mason_registry = require('mason-registry')
local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() .. '/node_modules/@vue/language-server'

local lspconfig = require('lspconfig')

lspconfig.tsserver.setup {
  init_options = {
    plugins = {
      {
        name = '@vue/typescript-plugin',
        location = vue_language_server_path,
        languages = { 'vue' },
      },
    },
  },
  filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
}

-- No need to set `hybridMode` to `true` as it's the default value
lspconfig.volar.setup {}
image

Edit

Checked in vscode and it works the same just doesn't show an error

@RayGuo-ergou
Copy link
Contributor

RayGuo-ergou commented Apr 21, 2024

I can reproduce this with following code

<template>
  <div>
    <HelloWorld msg="Hello world" />
  </div>
</template>

<script setup lang="ts">
import HelloWorld from './components/HelloWorld.vue';

const a:number = '1'
</script>

Seeing the same error when trying to find definition of HellowWorld.vue


And not seeing the error if disable hybirdMode

@Ralstonnn
Copy link
Author

Ralstonnn commented Apr 21, 2024

I can reproduce this with following code

<template>

  <div>

    <HelloWorld msg="Hello world" />

  </div>

</template>



<script setup lang="ts">

import HelloWorld from './components/HelloWorld.vue';



const a:number = '1'

</script>

Seeing the same error when trying to find definition of HellowWorld.vue


And not seeing the error if disable hybirdMode

Yes tried disabling hybrid mode too. It has other problem, every time I change exports in a file or add a new file I have to restart the lsp to be able to import it with lsp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

3 participants