Open Tobls opened 1 week ago
Make sure that you has enabled the hybrid mode. The following is my configuration, it has no problem. (same version v2.1.10)
local ts_config = {
name = 'lsp-ts',
cmd = { 'typescript-language-server.cmd', '--stdio' },
root_dir = vim.fs.root(0, { 'package.json' }),
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = 'path/to/vue-language-server',
languages = { 'vue' },
}
}
}
}
local vue_config = {
name = 'lsp-vue',
cmd = { 'vue-language-server.cmd', '--stdio' },
root_dir = vim.fs.root(0, { 'package.json' }),
init_options = {
vue = {
hybridMode = true, -- Note
},
typescript = {
tsdk = 'path/to/tsdk'
}
}
}
vim.api.nvim_create_autocmd('FileType', {
pattern = {
'javascript', 'vue',
},
callback = function()
vim.lsp.start(ts_config)
vim.lsp.start(vue_config)
end,
})
Make sure that you has enabled the hybrid mode. The following is my configuration, it has no problem. (same version v2.1.10)
I have pretty much the same config
@Tobls I have tested all the config methods which listed on readme, the duplicate result only appear on Non-Hybrid mode 2th.
I assume you are using nvim-lspconfig and had installed ts, vue server. Following below steps:
mkdir -p ~/.config/nvim/pack/bucket/opt && cd ~/.config/nvim/pack/bucket/opt
git clone "https://github.com/neovim/nvim-lspconfig"
nvim -u test.lua ./src/App.vue
import { ref } from 'v
and press <C-x><C-o>
./test.lua:
vim.cmd('packadd nvim-lspconfig')
require('lspconfig').ts_ls.setup({
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = '/path/to/vue-language-server',
languages = {'vue'},
},
},
},
filetypes = { "javascript", "vue", },
})
require('lspconfig').volar.setup({
init_options = {
typescript = {
tsdk = '/path/to/tsdk'
}
}
})
i had same issue in vscode. i noticed that the issue only occurs when Hybrid is turned off.
Vue - Official extension or vue-tsc version
2.1.10
VSCode version
-
Vue version
3.4.30
TypeScript version
-
System Info
package.json dependencies
Steps to reproduce
When trying to auto-import anything from vue, I get two autocompletion items, with only the second one actually importing it if needed.
What is expected?
Only the second completion item, the one that also auto-imports.
What is actually happening?
I get two autocompletion items, and the one without auto-import is the default.
Link to minimal reproduction
No response
Any additional comments?
I am using neovim and the hyprid mode