-
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
Merge 0.7 branch (rebased to master) #1984
Conversation
Thank you! That is valuable to know. Why again was |
This is straight from the comments on the main PR "rename commands -> user commands to match API and free up commands On the one hand, the api resemblance is nice. But do you think its too confusing for the users? as these commands are essentially wrappers around unique Edit: after reading your edits, do you say it just be changed back to |
"API resemblance" here means "it literally matches
|
Will change it back to command |
Looking closer, and reviewing #1838 , I see that a migration will be required anyway, because the command structure changed. I wonder if instead we should maintain the old interface. And deprecate it. Because it's not really needed, people can just call |
Perhaps we remove the interface for user to define the commands, seeing as they could just use Not sure if any language specific plugins make use of them either. So perhaps just remove it from user_space? EDIT: Defining the commands in the setup/config of the language_server has the advantage of being able to access the server specific functions with little code. An example from the help.txt of this PR commands = {
{
name = "TexlabBuild"
command = function()
buf_build(0)
end,
opts = {
desc = "Build the current buffer",
}
},
},
---The `configs.__newindex` metamethod consumes the config definition and returns
---an object with a `setup()` method, to be invoked by users:
require'lspconfig'.SERVER_NAME.setup{}
---After you set `configs.SERVER_NAME` you can add arbitrary language-specific
---functions to it if necessary.
---Example
configs.texlab.buf_build = buf_build |
I'm in favor of that. We would need to provide a simple example of using
I don't see the advantage. The |
Many methods from this repo (chiefly With that in mind, this PR could supply a deprecation warning concerning |
I have added a deprecation notice for commands as discussed. There is also an example in Still not entirely sure this is ideal, having commands in individual LSP setups seems cleaner than having them in a common @justinmk Would appreciate your review and thoughts on this matter |
1b24cb4
to
cf1c616
Compare
5b3c2cc
to
ec8a6a0
Compare
@justinmk Gentle ping |
Not sure who the maintainers are now to request review from. |
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'm personally really opposed to breaking the command API, if the plan is to deprecate it anyway.
@ranjithshegde this is my fault, sorry. Let's see if we can make progress here without too much work. Here's what I suggest:
|
5cb37e5
to
5851ac0
Compare
Is there a way to see on which file and line codespell action fails at? |
ae467d4
to
61e2a79
Compare
* test: add failing test * fix(lspconfig): only consider servers that have been set up as available
return lspconfig.available_servers() | ||
return require("lspconfig.util").available_servers() |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
Well at the moment, the lspconfig.lua
simply sets up the metatable for lspconfig.configs
and nothing else. If we add this, then it will setup a metatable + a single function that can actually be in utils.
Utils holds all similar fucntions such as get_managed_clients
, get_active_clients
. It is perhaps a better place for it.
Then the logic is simple. The "main" portion of plugin simply sets up LSPs. Some commands in plugin/
and some useful functions in /utils
.
Any thoughts?
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.
Also, too many PRs are being merged that potentially clash with this. Requires a bit of reshuffling
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.
Then the logic is simple. The portion of plugin simply sets up LSPs, with some commands in
plugin/
and some useful functions in/utils
.
Yeah I agree it makes sense to remove it, I'm just thinking about not breaking parity with master
. This will for sure break some user configs and plugins out there, although easily remedied.
Also, too many PRs are being merged that potentially clash with this. Requires a bit of reshuffling
Yeah there seems to be a lot happening with this big PR still being open, I'll eject myself from further comments, let's get this merged haha
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.
Yeah I agree it makes sense to remove it, I'm just thinking about not breaking parity with
master
. This will for sure break some user configs and plugins out there, although easily remedied.
Well this is changing/simplifying the core mechanism of the project. We could merge this as a breaking change, with a tag for previous versions?
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.
@williamboman Seems this discussion was not reflected in the commit messages. Whats the best stragety to notify that M.available_servers
have been moved to utils
?
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.
Thanks everyone for the help here.
* switch to lua api for autocommands * switch to nvim_create_user_command * move to lua plugin initialization NOTICE: Defining commands in server configurations will be deprecated in future releases. Please refer to the exaple in `:help lspconfig.txt` to setup the same in an `on_attach` function
Squashed all the changes into single commit! |
Will merge this now. Can someone open a PR that removes stuff for 0.8? It won't be merged until 0.8 is released, but a PR will help us figure out what changes are expected. |
Will start with an issue. Maybe deprecation is requried as the first step. Many functions in |
Commit neovim#1984 included a breaking change. Function `require("lspconfig").available_servers` has been moved to the utils module. The new call is `require("lspconfig.util").available_servers`
BREAKING CHANGE: Functions from `lspconfig.lua` Commit neovim#1984 included a breaking change. Function `require("lspconfig").available_servers` has been moved to the utils module. The new call is `require("lspconfig.util").available_servers`
I almost just opened an issue for this but did a bit more digging first. I see that this commit introduces a breaking change. But I cannot tell from the conversation here what needs to be changed in my config to accommodate this change. Or if it's a problem with another plugin that depends on lspconfig and I should roll back to a previous version of this plug until other plug developers can update. Is there recommended guidance somewhere I should be looking at? Thanks and sorry for this annoying message. I did my research first but came up short. |
@ranjithshegde I wasn't expecting breaking changes here per #1984 (comment) :
What did we break? |
@justinmk looks like |
If this is a problem, it could just be added back: diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua
index 1178202..7838f53 100644
--- a/lua/lspconfig.lua
+++ b/lua/lspconfig.lua
@@ -4,6 +4,11 @@ local M = {
util = require 'lspconfig.util',
}
+function M.available_servers()
+ vim.deprecate('lspconfig.available_servers', 'lspconfig.util.available_servers', '0.1.4', 'lspconfig')
+ return M.util.available_servers()
+end
+
local mt = {}
function mt:__index(k)
if configs[k] == nil then edit: added |
Since the 0.7 branch had no one taking initiative, this is essentially #1838 rebased to master.
I have been running the branch of the PR since it was created, have zero issues.
Seeing as 0.7.2 is released and master already requires nvim >=0.7, it seems like the ideal time to revisit and merge this.
All credits go to the excellent work of mjlbach, who I wont tag to respect his privacy.