Closed tkf144 closed 7 months ago
ft_to_lang seems to raise an exception when nil is passed to it, could you add a guard around it?
Also it seems that when given a string, ft_to_lang will return that string if it doesn't find a language, so there is no need to keep the or session.filetype
at the end.
Resolved in #13
Hi @LiadOz
Thanks for the plugin.
I was working around a difference in the C# filetype (
cs
) and the corresponding TS parser name (c_sharp
) when I came across thisft_to_lang
map function provided bynvim-treesitter.parsers
. I thought it might be useful to add to the plugin, behind the existingrepl_lang
option in priority, as a way to translate between filetypes and TS parser names without requiring explicit setting ofrepl_lang
.I don't have any Neovim plugin development experience so I've just dropped the relevant function in where it seems appropriate to illustrate how it might work - but it's an untested best guess.
Hope you find it useful.