Skip to content

Commit

Permalink
feat(msbuild): config instruction for filetypes (neovim#3516)
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchen authored Dec 17, 2024
1 parent ae8a01b commit 495a7f1
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions lua/lspconfig/configs/msbuild_project_tools_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ local host_dll_name = 'MSBuildProjectTools.LanguageServer.Host.dll'

return {
default_config = {
filetypes = { 'xml.csproj', 'xml.fsproj', 'sln' },
filetypes = { 'msbuild' },
root_dir = function(fname)
return vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
end,
init_options = {},
cmd = { 'dotnet', host_dll_name },
},
docs = {
description = [[
description = [=[
https://github.com/tintoy/msbuild-project-tools-server/
MSBuild Project Tools Server can be installed by following the README.MD on the above repository.
Expand All @@ -22,6 +22,26 @@ lspconfig.msbuild_project_tools_server.setup {
}
```
]],
There's no builtin filetypes for msbuild files, would require some filetype aliases:
```lua
vim.filetype.add({
extension = {
props = 'msbuild',
tasks = 'msbuild',
targets = 'msbuild',
},
pattern = {
[ [[.*\..*proj]] ] = 'msbuild',
},
})
```
Optionally tell treesitter to treat `msbuild` as `xml` so you can get syntax highlighting if you have the treesitter-xml-parser installed.
```lua
vim.treesitter.language.register('xml', { 'msbuild' })
```
]=],
},
}

0 comments on commit 495a7f1

Please sign in to comment.