Skip to content

Commit

Permalink
docs(mason): more generic config snippet (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-cahu authored Oct 21, 2024
1 parent f2a7a51 commit f9b22ae
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit f9b22ae

Please sign in to comment.