Skip to content

Commit

Permalink
fix(scripts): setup mason and init registries (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamboman committed Mar 23, 2023
1 parent c1f790c commit 1fcb620
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions lua/mason-registry/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,13 @@ local function get_store_age(time)
return time
end

---@async
---@param time integer
local function update_store_timestamp(time)
local dir = vim.fn.fnamemodify(STATE_FILE, ":h")
if not fs.async.dir_exists(dir) then
fs.async.mkdirp(dir)
if not fs.sync.dir_exists(dir) then
fs.sync.mkdirp(dir)
end
fs.async.write_file(STATE_FILE, _.join("\n", { sources.checksum(), tostring(time) }))
fs.sync.write_file(STATE_FILE, _.join("\n", { sources.checksum(), tostring(time) }))
end

---@param callback? fun(success: boolean, updated_registries: RegistrySource[])
Expand Down
6 changes: 3 additions & 3 deletions lua/mason/mappings/language.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ return {
c = { "clang-format", "clangd", "codelldb", "cpplint", "cpptools" },
["c#"] = { "clang-format", "csharp-language-server", "csharpier", "netcoredbg", "omnisharp", "omnisharp-mono", "semgrep" },
["c++"] = { "clang-format", "clangd", "codelldb", "cpplint", "cpptools" },
clarity = { "clarity-lsp" },
clarity = { "clarinet", "clarity-lsp" },
clojure = { "clj-kondo", "clojure-lsp", "joker" },
clojurescript = { "clj-kondo", "clojure-lsp", "joker" },
cmake = { "cmake-language-server", "cmakelang", "cmakelint", "gersemi", "neocmakelsp" },
Expand Down Expand Up @@ -78,7 +78,7 @@ return {
liquid = { "curlylint", "shopify-theme-check" },
lua = { "lemmy-help", "lua-language-server", "luacheck", "luaformatter", "selene", "stylua" },
luau = { "luau-lsp", "selene", "stylua" },
markdown = { "alex", "cbfmt", "glow", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-cli", "remark-language-server", "textlint", "vale", "write-good", "zk" },
markdown = { "alex", "cbfmt", "glow", "grammarly-languageserver", "ltex-ls", "markdown-toc", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-cli", "remark-language-server", "textlint", "vale", "write-good", "zk" },
["metamath zero"] = { "metamath-zero-lsp" },
mksh = { "shfmt" },
move = { "move-analyzer" },
Expand Down Expand Up @@ -118,7 +118,7 @@ return {
slint = { "slint-lsp" },
smithy = { "smithy-language-server" },
snakemake = { "snakefmt" },
solidity = { "solang", "solhint", "solidity", "solidity-ls" },
solidity = { "solang", "solang-llvm", "solhint", "solidity", "solidity-ls" },
sphinx = { "esbonio" },
sql = { "sql-formatter", "sqlfluff", "sqlls", "sqls" },
stylelint = { "stylelint-lsp" },
Expand Down
6 changes: 3 additions & 3 deletions scripts/lua/mason-scripts/mason/generate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ local script_utils = require "mason-scripts.utils"
local MASON_DIR = path.concat { vim.loop.cwd(), "lua", "mason" }
local MASON_REGISTRY_DIR = path.concat { vim.loop.cwd(), "lua", "mason-registry" }

require("mason").setup()
require("mason-registry").refresh()

---@async
local function create_language_map()
local registry = require "mason-registry"
require("mason-registry.sources").set_registries {
"lua:mason-registry.index",
}
print "Creating language map…"
local indexed_languages = {}
local language_map = {}
Expand Down
6 changes: 3 additions & 3 deletions scripts/lua/mason-scripts/mason/generate_package_index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ local a = require "mason-core.async"
local markdown = require "mason-scripts.markdown"
local script_utils = require "mason-scripts.utils"

require("mason").setup()
require("mason-registry").refresh()

---@async
local function create_markdown_index()
local registry = require "mason-registry"
require("mason-registry.sources").set_registries {
"lua:mason-registry.index",
}
print "Creating markdown index…"
local packages = _.sort_by(_.prop "name", registry.get_all_packages())

Expand Down

0 comments on commit 1fcb620

Please sign in to comment.