mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.41k stars 411 forks source link

`emmet-expand-abbr` fails in `getFileType` when there is no treesitter syntax #559

Open kmoschcau opened 1 month ago

kmoschcau commented 1 month ago

getFileType contains this piece of code:

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.

diegotoral commented 2 weeks ago

Is there a fix or known workaround for this?

nnnell commented 4 days ago

Thirded, a fix for this would be great. I've had to pin this plugin at commit 3fb2f63 to avoid the problem.