Avalonia preview integration for Neovim.
This plugin is experimental so expect bugs. It also expects a fairly standing file structure with a .sln file in the root.
- Open .axaml file
- Call
require("avalonia").open_preview()
- Edit .axaml
- Preview will update on saving the buffer or opening a new .axaml
2023-12-13.23-03-30.mp4
{
"Johanw123/avalonia.nvim",
}
require("avalonia.nvim").setup {
openUrlCommand = nil, -- start/open/xdg-open
forced_browser = nil, -- firefox/chrome/msedge etc
displayMethod = "html", -- html/kitty(not implemented yet)
tcp_port = 0, -- port for connecting to avalonia preview rendering process, leave as 0 to let OS decide
debug = false,
}
- kitty grahpics protocol support
For avalonia completion on .axaml im using the LSP from vscode-avalonia extension.
-- windows
local avalonia_lsp_bin = "%USERPROFILE%\\.vscode\\extensions\\avaloniateam.vscode-avalonia-0.0.25\\avaloniaServer\\AvaloniaLanguageServer.dll"
-- linux
local avalonia_lsp_bin = "~/.vscode/extensions/avaloniateam.vscode-avalonia-0.0.25/avaloniaServer/AvaloniaLanguageServer.dll"
vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"},{ pattern = {"*.axaml"}, callback =
function()
vim.cmd.setfiletype("xml")
vim.lsp.start({
name = "Avalonia LSP",
cmd = { "dotnet", avalonia_lsp_bin },
root_dir = vim.fn.getcwd(),
})
end})