Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(mason): more generic config snippet #550

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions doc/mason.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ the `server.cmd` setting (see |rustaceanvim.config| and |RustaceanLspClientOpts|
server = {
cmd = function()
local mason_registry = require('mason-registry')
local ra_binary = mason_registry.is_installed('rust-analyzer')
-- This may need to be tweaked, depending on the operating system.
and mason_registry.get_package('rust-analyzer'):get_install_path() .. "/rust-analyzer"
or "rust-analyzer"
return { ra_binary } -- You can add args to the list, such as '--log-file'
if mason_registry.is_installed('rust-analyzer') then
-- This may need to be tweaked depending on the operating system.
local ra = mason_registry.get_package('rust-analyzer')
local ra_filename = ra:get_receipt():get().links.bin['rust-analyzer']
return { ('%s/%s'):format(ra:get_install_path(), ra_filename or 'rust-analyzer') }
else
-- global installation
return { 'rust-analyzer' }
end
end,
},
}
Expand Down
Loading