Trying to fix the parsing of .tex and .txt file extensions when parsing templates
I was trying to create a template for some latex and noticed that it wouldn't parse. The other option of .tpl removed my lsp and syntax highlighting, so I wanted to see why it wouldn't parse
From what I saw, within the function temp.get_temp.list() the call to vim.filetype.match({ filename = name }) will not match .tex and .txt file extensions by design (see https://www.reddit.com/r/neovim/comments/1cb4kty/vimfiletypematch_returns_nil/) for why.
Because of this, templates in latex .tex, and also incidentally .txt files, will not parse requiring you to use .tpl files with a header comment of ;; tex to be read properly.
To fix this I reimplemented the functionality of vim.filetype.match and adjusted the code according to the new function's api.
If you have time feel free to review and adjust the code as needed or contact me if I made a mistake in understanding when adjusting the code.
Thank you for your time.
I noticed that when pasting multiple versions of the template into one file there was a nil exception so I added a guarding if statement to mitigate that. It looks as though the output is correct none the less
thanks I think we need a test here
No problem!