This is an automated archive made by the Lemmit Bot.

The original was posted on /r/neovim by /u/alphabet_american on 2024-04-07 04:16:37.


vue-goto-definition

The Problem

When using vue with autoimports (unplugin-vue-components and unplugin-auto-import or using nuxt) vim.lsp.buf.definition will populate location list with the autoimport definition file and/or the typescript declaration for a symbol. | Another issue with Volar LSP is that since it uses typescript LSP, when vim.lsp.buf.definition is called it requests definitions from both volar and tsserver. Since the two LSP can return different results, the consequences can be unpredictable.

The Solution

vue-goto-definition waits a debounce period (configurable in opts) before processing definitions. This allows Volar and tsserver time to return definitions.

vue-goto-definition overrides vim.lsp.buf.definition to attempt to filter the location list and decide the best source for a symbol’s definition.