Open bjornsnoen opened 1 year ago
Hello! There are some other packages that have similar dynamics with extensions. For now I'm leaning towards making these available by introducing sub-packages that rely on a parent package to be installed. Imo it's a bit unfortunate that you need to explicitly register cspell extensions, but that is easily solved by leveraging the internal event system.
Hello! There are some other packages that have similar dynamics with extensions. For now I'm leaning towards making these available by introducing sub-packages that rely on a parent package to be installed. Imo it's a bit unfortunate that you need to explicitly register cspell extensions, but that is easily solved by leveraging the internal event system.
That sounds like a perfectly reasonable solution as well
Workaround snippet for astronvim
+ cspell.nvim
that installs dict-fr-fr
on update (I'm still new to nvim scripting, and this will cause nvim
to lag a bit and I have no idea how to fix it, if you have a clue please let me know, thanks!):
---@type LazySpec
return {
"davidmh/cspell.nvim",
-- HACK: Works around <https://github.com/williamboman/mason.nvim/issues/392>.
config = function()
local astrocore = require("astrocore")
require("mason-registry"):on(
"package:install:success",
vim.schedule_wrap(function(
pkg --[[@as Package]]
)
if pkg.name == "cspell" then
local plugins = { "@cspell/dict-fr-fr" }
local base_path =
vim.fn.resolve(vim.fn.stdpath("data") .. "/mason/packages/cspell/node_modules/cspell")
for _, plugin in ipairs(plugins) do
astrocore.notify("Installing cspell plugin `" .. plugin .. "`")
astrocore.cmd({ "npm", "--prefix", base_path, "install", plugin }, true)
local ext_path = base_path .. "/node_modules/" .. plugin .. "/cspell-ext.json"
astrocore.cmd({ "cspell", "link", "add", ext_path }, true)
end
end
end)
)
end,
}
I've searched open issues for similar requests
Is your feature request related to a problem? Please describe.
As a developer working on localized applications, I would like to be able to add language dictionaries to the instance of cspell installed by mason. As it is now, I would need to rewrite the entire app to use a localization framework just so I can extract the localized strings from the codebase in order to escape the huge amount of warnings cspell generates.
Cspell has a built in mechanism for adding language dictionaries, see @cspell/dict-nb-no
Describe the solution you'd like
I'd like to be able to customize the languages added and linked with npm when adding cspell with Mason. Ideally I'd like to pass a list of languages to mason setup, so that when it installs cspell with npm it would also add those languages it knows about and link them appropriately. It could look like this:
Describe potential alternatives you've considered
No response
Additional context
No response