Skip to content

Fix Invalid type for len() #561 #562

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricvillagrana
Copy link

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 error is thrown because in some cases the len() argument is not an String and can lead to invalid type errors.
@kmoschcau
Copy link

kmoschcau commented Oct 10, 2024

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

@mig-hub
Copy link

mig-hub commented Oct 29, 2024

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.

@kmoschcau
Copy link

kmoschcau commented Oct 30, 2024

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

@mig-hub
Copy link

mig-hub commented Oct 30, 2024

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

@volodymyr-vt
Copy link

Can we get this merged?

@l13rb4git
Copy link

I'd love to see this merged

@ricvillagrana
Copy link
Author

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

@kmoschcau
Copy link

I would suggest we merge #560 instead. That PR fixes the problem at the root cause instead of just changing the length check in one place.

@taq
Copy link

taq commented May 16, 2025

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

@mmppppss
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants