-
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
fix: remove the config.commands #2092
Conversation
doc/lspconfig.txt
Outdated
|
||
Warning: Commands is deprecated and will be removed in future releases. | ||
It is recommended to use `vim.api.nvim_create_user_command()` instead in an `on_attach` function. | ||
Custom commands only work for servers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Custom commands only work for servers | |
Custom commands only works for servers |
I think that entire section about custom commands is not needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can help some people so keep it . like some new vimer this can give them a tip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt new people are going to define custom commands. This is an advanced thing to do, and for that they should refer to neovim LSP documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. remove
lua/lspconfig/util.lua
Outdated
for command_name, def in pairs(commands) do | ||
local opts = M._parse_user_command_options(def) | ||
local _, opts = unpack(def) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local _, opts = unpack(def) | |
local opts = def[2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lua/lspconfig/util.lua
Outdated
return opts | ||
end | ||
|
||
---@deprecated | ||
function M.create_module_commands(module_name, commands) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, this function was only used in configs.lua
and was not documented. Can't we just get rid of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup. But I'm not sure if this function is used by anyone else. Because he is derived. so i didn't remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a quick search on github, and seems like there are only lspconfig forks. I think it's okay to get rid of it entirely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done .
I am a bit too late for this. But this breaks all the internal commands like local texlab_build_status = vim.tbl_add_reverse_lookup {
Success = 0,
Error = 1,
Failure = 2,
Cancelled = 3,
}
local texlab_forward_status = vim.tbl_add_reverse_lookup {
Success = 0,
Error = 1,
Failure = 2,
Unconfigured = 3,
}
local function buf_build(bufnr)
bufnr = util.validate_bufnr(bufnr)
local texlab_client = util.get_active_client_by_name(bufnr, 'texlab')
local params = {
textDocument = { uri = vim.uri_from_bufnr(bufnr) },
}
if texlab_client then
texlab_client.request('textDocument/build', params, function(err, result)
if err then
error(tostring(err))
end
print('Build ' .. texlab_build_status[result.status])
end, bufnr)
else
print 'method textDocument/build is not supported by any servers active on the current buffer'
end
end
--- and only then
vim.api.nvim_create_autocmd(--[[stuff]]) And with |
it should be rewrite I think follow this in doc. notice
|
Yes but the plan was to soft deprecate it over future releases. At least thats what was discussed during #1984 I added that messaage in And as far as I can tell, there are no plugins out there that do this for |
Oh, server configurations were not migrated before this? Sorry, I should've checked that. I think this has to be reverted for now then |
future releases so future is what time. now we have api can do this. I don't understand why this field was buggy in the past. So do you think there are any commands available. Because of this field, there are constantly some prs that are deeply bound to the server config. It's weird. And justin has removed part of it. I think should be provide a new api like a function to do that. not use this |
The plan discussed with justin was that we soft deprecate it, and no longer allow users to define it in their config, but keep the internals that are part of Also 3 days is by no means a sufficient warning to remove something with 0 alternattives |
But it's still used in default configurations. I don't think we can just set a default |
With this PR, the commands as part of default configuration no longer work |
Yes, this is exactly what I mean. |
maybe the design of this field |
I fully agree, 100%. But as it stands, this is part of so many (at least 8 that I know of) LSPs, and most users are accustomed to having it. It needs a bit of slow deprecation. |
need redesign and provide a new api to do .then they can implement what they want in local not in this project. |
This has to be done. But is not trivial. Some servers like pyright just need For some servers there are dedicated plugin. |
Some issues need to be looked at carefully. what do they need. Provide a function or something to bring some of the information they need. |
revert. I think there is a bug in |
Removal is the correct and long term idea. Maybe after |
now we can use
vim.api.nvim_create_user_command
inon_attach
field to create commands just work for this server. sothere is no need this field
config.commands
.Example:
Fix #1750