coq_nvim
coq_nvim copied to clipboard
Cursor jumps few lines down after LSP import
Hey,
First of all, I love this plugin. I think it was enough to motivate me to switch my config to Lua. I installed COQ + LSP (w/ intelephense for PHP).
When typing a function outside of the namespace, LSP provides suggestions for the function and on <CR>
it inserts the required use function
statement with the function name.
However, this moves the cursor few lines down, away from the completed keyword.
https://user-images.githubusercontent.com/1190255/130318441-d4b74b46-2b39-4ca6-a5e8-221e5cb30be5.mp4
This is something that happens to me also when using coc.nvim
, so maybe it's not an issue with the package, but rather the LSP implementation?
humm, on a different LSP it looks ok, im gonna install intelephense
later and try it out and figure out whats wrong.
possibly LSP server side issue, but then really, even if its a server side issue, sometimes the client can do workarounds, but then it depends on if the workaround will break other LSPs or not.
https://user-images.githubusercontent.com/50598611/130556476-1a68d40e-38e8-4e32-baee-cc2e9ac96ae3.mov
Hmm, as you said, this might be the problem with Intelephense as I'm having similar issues on coc.nvim. Feel free to close this issue if you don't want to work on any workarounds. Frankly, I don't think you should make them.
Thank you!
:: replied to wrong thread
:: replied to wrong thread
I have some problem.
my config:
local nvim_lsp = require('lspconfig')
local coq = require "coq"
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
end
nvim_lsp.intelephense.setup(coq.lsp_ensure_capabilities({
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}))
how to repeat bug:
- mkdir test
- cd test
- git init
- mkdir A
- cd A
- nvim A.php
- paste:
<?php
namespace A;
final class A
{
public static function aaa()
{
}
}
- :wq
- cd ..
- nvim B.php
- paste:
<?php
final class B
{
public function test(): void
{
A::aaa();
}
public function test2(): void
{
}
}
- :w
-
:7^a<C-space><Tab><CR>