emmet-vim icon indicating copy to clipboard operation
emmet-vim copied to clipboard

Fix Invalid type for len() #561

Open ricvillagrana opened this issue 1 year ago • 9 comments

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.

ricvillagrana avatar Oct 08 '24 15:10 ricvillagrana

This looks like it's trying to fix the same bug that #560 is trying to fix.

kmoschcau avatar Oct 10 '24 05:10 kmoschcau

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 avatar Oct 29 '24 22:10 mig-hub

@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 avatar Oct 30 '24 06:10 kmoschcau

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

mig-hub avatar Oct 30 '24 08:10 mig-hub

Can we get this merged?

volodymyr-nt avatar Nov 25 '24 07:11 volodymyr-nt

I'd love to see this merged

l13rb4git avatar Dec 29 '24 19:12 l13rb4git

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

ricvillagrana avatar Feb 24 '25 04:02 ricvillagrana

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.

kmoschcau avatar Feb 24 '25 08:02 kmoschcau

Hey, is this project abandoned? :-( Can we help, @mattn ?

taq avatar May 16 '25 19:05 taq

The same thing happened to me, I solved it by replacing len(type)==0 with empty(type)

mmppppss avatar Jul 15 '25 01:07 mmppppss