if get(g:, 'loaded_nvim_treesitter', 0)
let type = luaeval('require"emmet_utils".get_node_at_cursor()')
" […]
However the assumptions here are flawed. g:loaded_nvim_treesitter is v:true, even if there is no treesitter parser or grammer for the current filetype. Thus type gets set to v:null in files with only regex syntax highlighting. This then causes an error later down the line when trying to call len(type). There needs to be an alternative or more thorough check, that treesitter actually returns a file type.
getFileType
contains this piece of code:However the assumptions here are flawed.
g:loaded_nvim_treesitter
isv:true
, even if there is no treesitter parser or grammer for the current filetype. Thustype
gets set tov:null
in files with only regex syntax highlighting. This then causes an error later down the line when trying to calllen(type)
. There needs to be an alternative or more thorough check, that treesitter actually returns a file type.