-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom command name may not conform user command naming rules #3087
Comments
use vim.lsp.start instead |
Are there no LSP providing codelens with custom commands? Wondering this is something we can consider support in the future or never will be. And other stuff I'm missing:
|
actually lspconfig just wrapper of vim.lsp.start . i don't know lazy nvim. if you want create a server config with some custom you can just use vim.lsp.start. |
Yeah I do need that wrapper part - at least |
Let me put it in this way - would you consider if I create a PR to skip registration of |
could you explain what's your custom commands do in codelens ? |
Not something standard LSP functionality. Here they are:
Just for reference, here is the real configuration: commands = {
['lsp_md/searchSimilar'] = function(args, client_info)
local client = vim.lsp.get_active_clients()[client_info.client_id]
client.request('workspace/executeCommand',
args,
function(_, resp, ctx, _)
local items = {}
for _, it in ipairs(resp) do
table.insert(items, {
filename = vim.uri_to_fname(it.location.uri),
lnum = it.location.range.start.line + 1,
col = it.location.range.start.character + 1,
text = string.format("%.3f: %s", it.score, it.title),
user_data = it,
})
end
vim.fn.setloclist(client_info.bufnr, {}, ' ', { title = "title", items = items, context = ctx })
vim.api.nvim_command("lopen")
end
)
end,
['lsp_md/keywords'] = function(args, client_info)
local client = vim.lsp.get_active_clients()[client_info.client_id]
client.request('workspace/executeCommand',
args,
function(_, resp, _, _)
local items = {}
for _, it in ipairs(resp) do
table.insert(items, it) -- it has text and score
end
local opts = {}
pickers.new(opts, {
prompt_title = "Keywords",
finder = finders.new_table {
results = items,
entry_maker = function(entry)
return {
value = entry,
display = entry.text,
ordinal = entry.score,
}
end,
},
sorter = conf.generic_sorter(opts),
attach_mappings = function(prompt_bufnr, _)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selected = action_state.get_selected_entry()
SearchByKeyword(selected.value.text)
end)
return true
end,
}):find()
end
)
end
} |
What I just realized is my And seems I need a way to pass |
Hi, Any updates on this? as 0.10 is officially released, I'd like to fix it if possible. |
Related possibly - #2632 |
Description
TLDR
I have a use case to register
commands
which is not actually user commands. In short, I wanna execute lsp.start_client without calling nvim_create_user_command.Minimal reproduction
note that I have my own LSP implementation, which is a part of the issue.
The problem
With 0.9.5 it works fine, but with 0.10-dev it fails as it tries to register
my_app/command1
as user command and fail because of the command name. I don't know why 0.9.5 is working fine though...Context
I need a client-side integration to implement codelens action properly. (e.g. I'd like to use telescope to show the result etc...), and relying on this neovim lsp client impl. So those commands are only to be run by codelens actions, not by user commands. I'm also fine if there's another way to add such custom command handlers without breaking neovim's user command name rules.
The text was updated successfully, but these errors were encountered: