diff options
| author | William Boman <william@redwill.se> | 2022-07-22 23:21:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-22 21:21:01 +0000 |
| commit | 8d7dd71cfd3f1e36582a9a870e8f0564b768b935 (patch) | |
| tree | 1e3e11a42255135ae5adbb69d2e1499c0462427f /scripts/lua | |
| parent | feat: add luaformatter (#116) (diff) | |
| download | mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.tar mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.tar.gz mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.tar.bz2 mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.tar.lz mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.tar.xz mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.tar.zst mason-8d7dd71cfd3f1e36582a9a870e8f0564b768b935.zip | |
fix: ensure no duplicate languages with different casing (#117)
Diffstat (limited to 'scripts/lua')
| -rw-r--r-- | scripts/lua/mason-scripts/mason/generate.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/lua/mason-scripts/mason/generate.lua b/scripts/lua/mason-scripts/mason/generate.lua index 6f0bd4d2..4c2f47ce 100644 --- a/scripts/lua/mason-scripts/mason/generate.lua +++ b/scripts/lua/mason-scripts/mason/generate.lua @@ -10,11 +10,21 @@ local MASON_REGISTRY_DIR = path.concat { vim.loop.cwd(), "lua", "mason-registry" ---@async local function create_language_map() print "Creating language map…" + local indexed_languages = {} local language_map = {} local sorted_packages = _.sort_by(_.prop "name", registry.get_all_packages()) _.each(function(pkg) _.each(function(language) local language_lc = language:lower() + if indexed_languages[language_lc] and indexed_languages[language_lc] ~= language then + error( + ("Found two variants of same language with differing cases %s != %s"):format( + indexed_languages[language_lc], + language + ) + ) + end + indexed_languages[language_lc] = language language_map[language_lc] = _.append(pkg.name, language_map[language_lc] or {}) end, pkg.spec.languages) end, sorted_packages) |
