Unexpected Array Method Suggestions
Hi, I'm encountering a strange behavior in Neovim with TypeScript LSP (using Drizzle ORM) and blink.cmp.
Code Example
export async function getFolderById(folderId: number) {
const folders = await db
.select()
.from(folderSchema)
.where(eq(folderSchema.id, folderId));
return folders[0];
}
The Problem
When I try to chain another method after .from—like Drizzle's .orderBy()—I'm also getting autocomplete suggestions for regular array methods like .sort(), .forEach(), etc. And as you can see in the screenshot, to formatting is also incorrect.
However, if I remove the async keyword from the function declaration, those array methods no longer show up in the suggestions.
I tested the same code in VS Code and with nvim-cmp, and it behaves correctly there—no array method suggestions appear in this context.
Questions
- Is this an issue with
blink.cmpor a deeper issue with how the LSP handles async context? - Why does removing
asyncchange the behavior of completion suggestions? - Any suggestions for debugging or resolving this?
Environment
- Neovim (with LazyVim)
- TypeScript LazyExtra (vtsls)
- Blink LazyExtra
Thanks in advance for any help!
Does nvim-cmp show the array methods in the list (.sort and so on) after only typing the . without any other characters?
I've included a comparison table below between blink.cmp and nvim-cmp. These screenshots were taken after typing just a single . — the completion menu opens automatically in both cases:
blink.cmp |
nvim-cmp |
|---|---|
However, when I type something like sort (which should not be in the completion list) when using blink.cmp, the completion suggestion appear in the wrong position:
typing sort |
accepted sort |
|---|---|