Skip to content

Include filetypes from filetypes.lua in checks #560

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

Open
gegoune opened this issue Jan 27, 2025 · 3 comments
Open

Include filetypes from filetypes.lua in checks #560

gegoune opened this issue Jan 27, 2025 · 3 comments

Comments

@gegoune
Copy link
Collaborator

gegoune commented Jan 27, 2025

Not all filetypes will have syntax files (I think), so while checking for missing filetypes in https://github.com/nvim-tree/nvim-web-devicons/blob/master/scripts/filetypes.sh#L10-L20 we should, on top of presence of syntax/<filetype>, check $VIMRUNTIME/lua/vim/filetype.lua as well.

@alex-courtis
Copy link
Member

That looks like it feeds new API vim.filetype.match. I am wary, though, as this will vary based on vim version etc.

I'm keen on generating this list at startup time, based on the filetypes that are actually available. Less maintenance.

@gegoune
Copy link
Collaborator Author

gegoune commented Jan 28, 2025

What's the risk of defining filetype mapping for filetype that does not exist for user/their version of nvim?

@alex-courtis
Copy link
Member

What's the risk of defining filetype mapping for filetype that does not exist for user/their version of nvim?

I don't think there's any issue; it's only ever looked up as a map with the user provided filetype:

function M.get_icon_name_by_filetype(ft)
  return filetypes[ft]
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants