Skip to content

Commit

Permalink
feat(command): add completion for option flags for :MasonInstall (#1379)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamboman committed Jun 28, 2023
1 parent 758ac5b commit e507af7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/mason/api/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ local function MasonInstall(package_specifiers, opts)
version = version,
debug = opts.debug,
force = opts.force,
strict = opts.strict,
target = opts.target,
}
end)
Expand Down Expand Up @@ -149,7 +150,14 @@ end, {
complete = function(arg_lead)
local registry = require "mason-registry"

if _.matches("^.+@", arg_lead) then
if _.starts_with("--", arg_lead) then
return _.filter(_.starts_with(arg_lead), {
"--debug",
"--force",
"--strict",
"--target=",
})
elseif _.matches("^.+@", arg_lead) then
local pkg_name, version = unpack(_.match("^(.+)@(.*)", arg_lead))
local ok, pkg = pcall(registry.get_package, pkg_name)
if not ok then
Expand Down

0 comments on commit e507af7

Please sign in to comment.