From a444f770b40bce70d2d4e0f88bcb8344958411d5 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 8 Jul 2022 23:16:01 +0200 Subject: feat(mason-lspconfig): add :LspInstall and :LspUninstall commands (#35) These should be in complete parity with the nvim-lsp-installer commands. Now even better than before. --- lua/mason-core/optional.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lua/mason-core/optional.lua') diff --git a/lua/mason-core/optional.lua b/lua/mason-core/optional.lua index 10af8ccb..5710ce0c 100644 --- a/lua/mason-core/optional.lua +++ b/lua/mason-core/optional.lua @@ -93,6 +93,14 @@ function Optional:if_present(fn) return self end +---@param fn fun(value: any) +function Optional:if_not_present(fn) + if not self:is_present() then + fn(self._value) + end + return self +end + function Optional:is_present() return self._value ~= nil end -- cgit v1.2.3-70-g09d2