emmet-vim
emmet-vim copied to clipboard
Fix Invalid type for len() #561
This error is thrown because in some cases the len() argument is not a String and can lead to invalid type errors.
This is most likely to be a temporary fix.
This looks like it's trying to fix the same bug that #560 is trying to fix.
For some reason when I use a file type that is not purely html, I seem to get this kind of error:
Error detected while processing function emmet#expandAbbr[1]..emmet#getFileType:
line 61:
E701: Invalid type for len()
Is this what this pull request is meant to fix?
In my case it is a svelte file. But I suppose it does the same on any file type that has file types inside file types like vue.
@mig-hub have a look at #559 I filed before. I gave an explanation what the cause is in there. It also has an open PR to fix this problem. Though in your case, a closer look is needed to see if the fix is effective. You can install my fork instead and try if that fixes your problem.
@kmoschcau, thank you so much for your answer. I have just installed your fork and I can confirm it fixes my issue.
For info, I installed it with VimPlug, I use nvim, and I definitely have nvim-treesitter installed as one of my plugins. Although it is placed after emmet — not sure if the order of plugins matter in some cases.
To make sure it works, I used it on a .erb template file that generates a .svelte file, and the svelte file has an HTML part. Treesitter successfully color the syntax of each HTML/JS/SCSS parts. And your fork worked fine where the original was failing except when using a pure HTML file with a clear single file type.
Can we get this merged?
I'd love to see this merged
@mattn @resolritter @mrtazz
Are any of you able to confirm if this can be merged? I think this PR would solve an issue for some users.
I would suggest we merge https://github.com/mattn/emmet-vim/pull/560 instead. That PR fixes the problem at the root cause instead of just changing the length check in one place.
Hey, is this project abandoned? :-( Can we help, @mattn ?
The same thing happened to me, I solved it by replacing len(type)==0 with empty(type)