-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: add ftdetect for .props #186
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for making a PR. I have also missed this previously!❤️❤️
I do worry that this might interfere with other non-dotnet scenarios. We should consider the following.
- Could we use the
is_dotnet_project()
function uponVimEnter
to enable this? - Could we add a property to options for enabling/disabling this, in case it interferes with other scenarios
Thoughts? We could also merge it and wait for possible issues on this before implementing some variant of the options above
lua/easy-dotnet/init.lua
Outdated
@@ -190,6 +190,9 @@ M.setup = function(opts) | |||
require("easy-dotnet.fs-mappings").add_test_signs() | |||
end | |||
|
|||
if merged_opts.enablenable_filetypes == true then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable_filetypes
Hi! Sorry I didn't reply to the comment. the original implementation was taken from go.nvim (where just filetype.vim is used), but the feature toggle approach looks better. Now I'm not sure how to properly implement the project type check once to create autocmd once, and how not to set filetype in the buffer without closing it (i.e. avoid setting filetype when |
Im on vacation without a computer until Friday so probably wont be able to merge before then. Hmm have you tried |
Havent tested extensively but this seems to work for me, only creates the autocmd once and only sets the filetype once per buffer. local M = {}
M.enable_filetypes = function()
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
pattern = "*.props",
group = vim.api.nvim_create_augroup("solution_props", { clear = true }),
callback = function()
vim.bo.filetype = "xml"
end,
})
end
return M |
Messed around in some other vim plugins today and came across this. Seems to be working and be the best and easiest solution local M = {}
M.enable_filetypes = function()
vim.filetype.add({
extension = {
props = "xml",
},
})
end
return M |
Didnt mean to hijack your PR. Let me know if you disagree with the changes |
We should extend this to also add xml for slnx, #220 |
Adding icons to nvim-web-devicons also |
When working with
Directory.Build.props
orDirectory.Packages.props
files, it is annoying that the file type is not detected, which makes commenting plugins and syntax highlighting not work.