Skip to content

How do I get a list of installed LSPs by mason? #1210

Answered by yutkat
TroySigX asked this question in Q&A
Discussion options

You must be logged in to vote

all packages

vim.print(require("mason-registry").get_installed_package_names())

LSP only

function MasonLspPackages()
	local registry = require("mason-registry")
	local lsp = {}
	for _, pkg_info in ipairs(registry.get_installed_packages()) do
		for _, type in ipairs(pkg_info.spec.categories) do
			if type == "LSP" then
				table.insert(lsp, pkg_info.name)
			end
		end
	end
	return lsp
end

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TroySigX
Comment options

Answer selected by TroySigX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants