Missing items in autocomplete
FAQ
- [X] I have checked the FAQ and it didn't resolve my problem.
Announcement
- [X] I have checked Breaking change announcement.
Minimal reproducible full config
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<c-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<c-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<A-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<Tab>"] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Insert }),
["<c-l>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<c-h>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
}),
preselect = cmp.PreselectMode.None,
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {
{ name = "buffer" },
}),
window = {
completion = cmp.config.window.bordered(),
documentation = {
border = border("CmpDocBorder"),
winhighlight = "Normal:CmpDoc",
max_width = 20,
},
},
})
typescript config
require("typescript-tools").setup({
on_attach = function(cli, buf)
on_attach(cli, buf)
end,
capabilities = default_capabilities,
--handlers = { ... },
settings = {
-- spawn additional tsserver instance to calculate diagnostics on it
separate_diagnostic_server = true,
-- "change"|"insert_leave" determine when the client asks the server about diagnostic
publish_diagnostic_on = "insert_leave",
-- array of strings("fix_all"|"add_missing_imports"|"remove_unused")
-- specify commands exposed as code_actions
expose_as_code_action = {},
tsserver_plugins = {
-- for TypeScript v4.9+
--"@styled/typescript-styled-plugin",
-- or for older TypeScript versions
--"typescript-styled-plugin",
"typescript-plugin-css-modules",
},
tsserver_file_preferences = {
includeInlayParameterNameHints = "all",
includeCompletionsForModuleExports = true,
quotePreference = "single",
},
},
})
Description
Here is auto complete suggestions.
when i fire "< a - space>" to use cmp.mapping.complete()
Here is result
Steps to reproduce
I use it in nestjs project with typescript.
- npm i -g @nestjs/cli && nest new app to build project
- delete these lines in app.service.ts
import { Injectable } from '@nestjs/common';
@Injectable()
- input "@Inj" to auto import Injectable.But get nothing.
- fire < a - space > will get juggestion list has injectable complete item.
Expected behavior
get consistent result suggestion list
Actual behavior
canot get Injectable from auto complete suggetion list.
Additional context
It seems that the problem is not only here,
I use rust,And get same problem.
auto complete
map complete
and some suggestion list is ok. I can get consistent result suggestion list
something interesting,
I will get all item above of '@Injectable' but miss item above of class AppService
In vscode everything is ok.
The author of typescript-tools there is no problem in lsp, so it cloud be a something wrong in cmp?