aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/ccls/mac.lua
blob: bd2efe0a72b74f95b67dfcae3c1b9cb88a12ba64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local path = require "mason-core.path"
local platform = require "mason-core.platform"
local installer = require "mason-core.installer"
local fs = require "mason-core.fs"

local ccls_installer = require "mason-registry.ccls.common"

---@async
return function()
    local ctx = installer.context()
    local homebrew_prefix = platform.get_homebrew_prefix():get_or_throw()
    local llvm_dir = path.concat { homebrew_prefix, "opt", "llvm", "lib", "cmake" }
    if not fs.async.dir_exists(llvm_dir) then
        ctx.stdio_sink.stderr(
            (
                "LLVM does not seem to be installed on this system (looked in %q). Please install LLVM via Homebrew:\n  $ brew install llvm\n"
            ):format(llvm_dir)
        )
        error "Unable to find LLVM."
    end
    ccls_installer { llvm_dir = llvm_dir }
end