camdencheek / tree-sitter-dockerfile

A tree-sitter grammar for Dockerfile
MIT License
73 stars 22 forks source link

Parser does not work on Dockerfile with custom "extensions" #3

Closed hood closed 3 years ago

hood commented 3 years ago

Example: Dockerfile.dev won't get its syntax highlighted in latest NeoVim

camdencheek commented 3 years ago

Hi @hood!

The highlighter depends on neovim's default filetype detection in order to set the buffer's filetype. According to neovim's filetype.vim, only files with the pattern Dockerfile and *.Dockerfile will be detected as the dockerfile file type, and be highlighted with this syntax.

I'd recommend creating a custom override for your filename by making a file like ~/.config/nvim/ftdetect/dockerfile.vim with the contents

au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile