Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.
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
46 changes: 14 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,36 +118,17 @@ With mason:
```lua
local mason_registry = require("mason-registry")

---@type string[]
local cmd = {}

local roslyn_package = mason_registry.get_package("roslyn")
if roslyn_package:is_installed() then
vim.list_extend(cmd, {
"roslyn",
"--stdio",
"--logLevel=Information",
"--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()),
})

local rzls_package = mason_registry.get_package("rzls")
if rzls_package:is_installed() then
local rzls_path = vim.fn.expand("$MASON/packages/rzls/libexec")
table.insert(
cmd,
"--razorSourceGenerator=" .. vim.fs.joinpath(rzls_path, "Microsoft.CodeAnalysis.Razor.Compiler.dll")
)
table.insert(
cmd,
"--razorDesignTimePath="
.. vim.fs.joinpath(rzls_path, "Targets", "Microsoft.NET.Sdk.Razor.DesignTime.targets")
)
vim.list_extend(cmd, {
"--extension",
vim.fs.joinpath(rzls_path, "RazorExtension", "Microsoft.VisualStudioCode.RazorExtension.dll"),
})
end
end
local rzls_path = vim.fn.expand("$MASON/packages/rzls/libexec")
local cmd = {
"roslyn",
"--stdio",
"--logLevel=Information",
"--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()),
"--razorSourceGenerator=" .. vim.fs.joinpath(rzls_path, "Microsoft.CodeAnalysis.Razor.Compiler.dll"),
"--razorDesignTimePath=" .. vim.fs.joinpath(rzls_path, "Targets", "Microsoft.NET.Sdk.Razor.DesignTime.targets"),
"--extension",
vim.fs.joinpath(rzls_path, "RazorExtension", "Microsoft.VisualStudioCode.RazorExtension.dll"),
}
```

Finally, use the composed `cmd` and rzls handlers like so:
Expand Down Expand Up @@ -181,7 +162,7 @@ return {
-- Use one of the methods in the Integration section to compose the command.
local cmd = {}

require("roslyn").setup {
vim.lsp.config("roslyn", {
cmd = cmd,
handlers = require("rzls.roslyn_handlers"),
settings = {
Expand All @@ -204,7 +185,8 @@ return {
dotnet_enable_references_code_lens = true,
},
},
}
})
vim.lsp.enable("roslyn")
end,
init = function()
-- We add the Razor file types before the plugin loads.
Expand Down