Open strash opened 3 weeks ago
doesnt seem to happen with gopls and clangd, might be a special case with your lsp
Which LSP are you using? Would be super helpful if you could send the item
itself so I can test it. You can do this by adding a vim.print(item)
in accept/init.lua
which you can find at ~/.local/share/nvim/lazy/blink.cmp/lua/accept/init.lua
(assuming lazy.nvim on linux)
Hi! The lsp is dartls.
{
client_id = 1,
cursor_column = 3,
documentation = {
kind = "markdown",
value = "Insert a Flutter StatelessWidget."
},
editRange = {
["end"] = {
character = 3,
line = 10
},
start = {
character = 0,
line = 10
}
},
filterText = "stless",
insertTextFormat = 2,
insertTextMode = 1,
kind = 15,
label = "Flutter Stateless Widget",
score_offset = 0,
sortText = "zzzstless",
source_id = "lsp",
source_name = "LSP",
textEditText = "class ${1:MyWidget} extends StatelessWidget {\n const ${1:MyWidget}({super.key});\n\n @override\n Widget build(BuildContext context) {\n return ${0:const Placeholder()}
;\n }\n}"
}
or
{
client_id = 1,
cursor_column = 1,
documentation = {
kind = "markdown",
value = "Insert a Flutter StatefulWidget."
},
editRange = {
["end"] = {
character = 1,
line = 11
},
start = {
character = 0,
line = 11
}
},
filterText = "stful",
insertTextFormat = 2,
insertTextMode = 1,
kind = 15,
label = "Flutter Stateful Widget",
score_offset = 0,
sortText = "zzzstful",
source_id = "lsp",
source_name = "LSP",
textEditText = "class ${1:MyWidget} extends StatefulWidget {\n const ${1:MyWidget}({super.key});\n\n @override\n State<${1:MyWidget}> createState() => _${1:MyWidget}State();\n}\n\nclass _
${1:MyWidget}State extends State<${1:MyWidget}> {\n @override\n Widget build(BuildContext context) {\n return ${0:const Placeholder()};\n }\n}"
}
Sorry I messed up, I actually need the value of resolved_item
Sure, no worries
{
additionalTextEdits = { {
insertTextFormat = 2,
newText = 'import "package:flutter/widgets.dart";\n\n',
range = {
["end"] = {
character = 0,
line = 0
},
start = {
character = 0,
line = 0
}
}
} },
documentation = {
kind = "markdown",
value = "Insert a Flutter StatelessWidget."
},
filterText = "stless",
insertTextFormat = 2,
insertTextMode = 1,
kind = 15,
label = "Flutter Stateless Widget",
sortText = "zzzstless",
textEditText = "class ${1:MyWidget} extends StatelessWidget {\n const ${1:MyWidget}({super.key});\n\n @override\n Widget build(BuildContext context) {\n return ${0:const Placeholder()};
\n }\n}"
}
or
{
additionalTextEdits = { {
insertTextFormat = 2,
newText = 'import "package:flutter/widgets.dart";\n\n',
range = {
["end"] = {
character = 0,
line = 0
},
start = {
character = 0,
line = 0
}
}
} },
documentation = {
kind = "markdown",
value = "Insert a Flutter StatefulWidget."
},
filterText = "stful",
insertTextFormat = 2,
insertTextMode = 1,
kind = 15,
label = "Flutter Stateful Widget",
sortText = "zzzstful",
textEditText = "class ${1:MyWidget} extends StatefulWidget {\n const ${1:MyWidget}({super.key});\n\n @override\n State<${1:MyWidget}> createState() => _${1:MyWidget}State();\n}\n\nclass _$
{1:MyWidget}State extends State<${1:MyWidget}> {\n @override\n Widget build(BuildContext context) {\n return ${0:const Placeholder()};\n }\n}"
}
Make sure you have done the following
blink.cmp
Bug Description
now
After expanding a snippet that triggers auto import, the line with import is placed after the snippet.
before
This wasn't the case in
0.4.1
. The import line was placed at the top of the buffer but with minor inconvenience - the cursor remained on this line.Relevant configuration
neovim version
NVIM v0.10.2 Build type: Release LuaJIT 2.1.1727870382
blink.cmp
version: branch, tag, or commitv0.*