Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emmet-expand-abbr fails in getFileType when there is no treesitter syntax (E701: Invalid type for len()) #559

Open
kmoschcau opened this issue Aug 14, 2024 · 3 comments · May be fixed by #560

Comments

@kmoschcau
Copy link

kmoschcau commented Aug 14, 2024

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 grammar 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.

The error is: E701: Invalid type for len()

@diegotoral
Copy link

Is there a fix or known workaround for this?

@nnnell
Copy link

nnnell commented Sep 11, 2024

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

@kmoschcau
Copy link
Author

@diegotoral @nnnell If you haven't seen it yet, I opened a PR to fix this problem. You could just use my fork for that PR as a temporary fix.

@kmoschcau kmoschcau changed the title emmet-expand-abbr fails in getFileType when there is no treesitter syntax emmet-expand-abbr fails in getFileType when there is no treesitter syntax (E701: Invalid type for len()) Dec 30, 2024
@kmoschcau kmoschcau changed the title emmet-expand-abbr fails in getFileType when there is no treesitter syntax (E701: Invalid type for len()) emmet-expand-abbr fails in getFileType when there is no treesitter syntax (E701: Invalid type for len()) Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants