Skip to content
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

revert: "refactor!: make available_servers function private" #3589

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/lspconfig/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ local function check_lspconfig(bufnr)
bufnr = (bufnr and bufnr ~= -1) and bufnr or nil

health.start('LSP configs active in this session (globally)')
health.info('Configured servers: ' .. table.concat(util._available_servers(), ', '))
health.info('Configured servers: ' .. table.concat(util.available_servers(), ', '))
local deprecated_servers = {}
for server_name, deprecate in pairs(require('lspconfig').server_aliases()) do
table.insert(deprecated_servers, ('%s -> %s'):format(server_name, deprecate.to))
Expand Down
3 changes: 2 additions & 1 deletion lua/lspconfig/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ function M.get_managed_clients()
return clients
end

function M._available_servers()
--- @deprecated use `vim.lsp.config` in Nvim 0.11+ instead.
function M.available_servers()
Copy link
Member

@justinmk justinmk Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function M.available_servers()
--- @deprecated use `vim.lsp.confg` in Nvim 0.11+ instead.
function M.available_servers()

future: we should probably add lspconfig.util will be removed; use vim.lsp.confg in Nvim 0.11+ to all util.lua deprecation notices

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, people using nvim 0.10 won't have a way to remove this warning. I guess it's an acceptable tradeoff?

Copy link
Member

@justinmk justinmk Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our nvim-lspconfig deprecation plan didn't really consider concerns about non-breaking, soft warnings for Nvim 0.10, AFAIR. It doesn't strike me as too important, as long as their code doesn't break.

local servers = {}
local configs = require 'lspconfig.configs'
for server, config in pairs(configs) do
Expand Down
2 changes: 1 addition & 1 deletion plugin/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
local lsp_complete_configured_servers = function(arg)
return completion_sort(vim.tbl_filter(function(s)
return s:sub(1, #arg) == arg
end, util._available_servers()))
end, util.available_servers()))
end

local lsp_get_active_clients = function(arg)
Expand Down
2 changes: 1 addition & 1 deletion test/lspconfig_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('lspconfig', function()
local _ = lspconfig.lua_ls
local _ = lspconfig.tsserver
lspconfig.rust_analyzer.setup {}
same({ 'rust_analyzer' }, require('lspconfig.util')._available_servers())
same({ 'rust_analyzer' }, require('lspconfig.util').available_servers())
end)

it('provides user_config to the on_setup hook', function()
Expand Down
Loading