Skip to content

Implement a codefmt#formatterhelpers#FiletypeMatches helper #212

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

Closed
dbarnett opened this issue Mar 18, 2023 · 0 comments · Fixed by #213 or #214
Closed

Implement a codefmt#formatterhelpers#FiletypeMatches helper #212

dbarnett opened this issue Mar 18, 2023 · 0 comments · Fixed by #213 or #214
Assignees

Comments

@dbarnett
Copy link
Contributor

We should define a little filetype check helper to turn formatters' common (and ugly) checks against multiple filetypes like

if &filetype is# 'c' || &filetype is# 'cpp' ||
        \ &filetype is# 'proto' || &filetype is# 'javascript' ||
        \ &filetype is# 'objc' || &filetype is# 'objcpp' ||
        \ &filetype is# 'typescript' || &filetype is# 'arduino'

into a simpler concise function call like

if codefmt#formatterhelpers#FiletypeMatches(
    \ &filetype,
    \ ['c', 'cpp', 'proto', 'javascript', 'objc', 'objcpp', 'typescript', 'arduino'])

It could also help ensure they properly support dotted filenames like 'c.doxygen' (see :help 'filetype').

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