Skip to content

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

Open
@kmoschcau

Description

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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions