using TAB for completion failed in local variable completion, when using vim with godot LSP
sloppydevil opened this issue · 5 comments
Result from CocInfo
Describe the bug
I'm using vim to edit gdscript code, connecting to the lsp of godot opened on my mac.
and I'm using the vscode like config from coc.nvim website.
For common suggestions from coc.nvim, it works fine;
For local self defined variables, e.g. "var end_position", when there are hints from lsp in the popup menu, I clicked "tab". it didn't work as expected (if popup is visible, just confirm), whereas it clears the characters already input.
Reproduce the bug
We will close your issue when you don't provide minimal vimrc and we can't
reproduce it
here is the confirm action that I'm using:
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Map <tab> for trigger completion, completion confirm, snippet expand and jump like VSCode: >
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ?
\ "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackspace() ? "\<TAB>" :
\ coc#refresh()
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
and this is the LSP config in coc-settings.json:
"languageserver": {
"godot": {
"host": "127.0.0.1",
"filetypes": ["gdscript"],
"port": 6005
}
},
Screenshots (optional)
If applicable, add screenshots to help explain your problem.
What do you mean _ local self defined variable_? Screenshot please.
Set suggest.insertMode
to insert
in your coc-settings.json and try again.
Set
suggest.insertMode
toinsert
in your coc-settings.json and try again.
I tried, it didn't work out.
I checked the demo issue I provided, it seems that "start_position" is some intrinsic property proposed for specific class “NavigationLink2D", it should not be here for the local self-defined variable for current class "Node2D". That can be the reason why no completion was accepted even though they were displayed and hinted.
Maybe the issue solving direction should be "how to filter some irrelevant completion candidates". i.e. only the valid intrinsic properties for current class can be hinted and selected, but no other ones.
it should not be here for the local self-defined variable for current class
only the valid intrinsic properties for current class can be hinted and selected
Should be problem of Godot language server, coc.nvim is a client that request to server for completions, the server response the completions to client to show.
Check https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel to trace the request and response.