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

Error : Request textDocument/codeLens failed with message: Cannot read property 'length' of undefined #474

Closed
jamols09 opened this issue Sep 9, 2021 · 13 comments
Labels
bug Something isn't working

Comments

@jamols09
Copy link

jamols09 commented Sep 9, 2021

Hello I got a tons of error on my device upon checking the output terminal. I'm not sure how to fix this entirely.

This is on the PC

[Error - 5:38:49 PM] Request textDocument/semanticTokens/range failed.
  Message: Request textDocument/semanticTokens/range failed with message: Cannot read property 'length' of undefined
  Code: -32603 

Laptop

image

It looks like the error are somewhat related to each other.

@jiangmaniu
Copy link

+1, it seems to be caused by the v0.27.17 version, I tried to roll back the version to v0.27.16 and it works normally

@oooplz
Copy link

oooplz commented Sep 10, 2021

I have encountered same. but i just updates version of typescript to 4.4.2. The question was solved.

The tip still appear when i opening a vue file. I think we should rollback the version to v0.27.16

@jamols09
Copy link
Author

jamols09 commented Sep 10, 2021

+1, it seems to be caused by the v0.27.17 version, I tried to roll back the version to v0.27.16 and it works normally

How do I perform rollback on an extension?

@oooplz
Copy link

oooplz commented Sep 10, 2021

+1, it seems to be caused by the v0.27.17 version, I tried to roll back the version to v0.27.16 and it works normally

How do I perform rollback on an extension?

Visiting VSCode marketplace VSCode marketplace, and then clicking history version, and then downloading v0.27.16, finally to find downloaded file, Dragging it into window of VScode extension.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Sep 10, 2021
@mkhennoussi
Copy link

Still present in v0.27.18

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Sep 11, 2021

Still present in v0.27.18

Can you provide repro case?

@mkhennoussi
Copy link

I just use the vitesse template : https://github.com/antfu/vitesse

@johnsoncodehk
Copy link
Member

I just use the vitesse template : https://github.com/antfu/vitesse

Can't reproduce, what do I need to do in template?

@stafyniaksacha
Copy link
Collaborator

@jamols09 on vuero ?

@jamols09
Copy link
Author

@jamols09 on vuero ?

Nope, the extension just got bugged. Does show error on any projects but I think this is fixed already.

@oooplz
Copy link

oooplz commented Oct 20, 2021

@johnsoncodehk

When i building my project. Throwing an error

$ vue-tsc --noEmit && vite build
/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:17
                    result.push({ start: offset, end: offset + matchText.length });
                                                                         ^

TypeError: Cannot read property 'length' of undefined
    at visChild (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:17:74)
    at visChild (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:23:17)
    at visChild (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:23:17)
    at visChild (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:23:17)
    at visChild (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:23:17)
    at parse (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/parsers/cssBinds.js:6:5)
    at ReactiveEffect.fn (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/use/useSfcStyles.js:31:58)
    at ReactiveEffect.run (/Users/zc/projects/foo/node_modules/@vue/reactivity/dist/reactivity.cjs.js:164:29)
    at ComputedRefImpl.get value [as value] (/Users/zc/projects/foo/node_modules/@vue/reactivity/dist/reactivity.cjs.js:1076:39)
    at ReactiveEffect.fn (/Users/zc/projects/foo/node_modules/vscode-vue-languageservice/out/use/useSfcTemplateScript.js:22:116)
error Command failed with exit code 1.
                                ^

Because i have a segment of code like this;

<script lang="ts" setup>
const style = { foo: 'bar', color: '#101010' }
</script>

<style>
.bg-color: v-bind(style.color); // HILIGHT
</style>

Shall we creating an issue to vscode-vue-languageservice?

<script lang="ts" setup>
const color =  '#101010'
</script>

<style>
.bg-color: v-bind(color); // HILIGHT
</style>

Building successes as if binding a text variable in style tag.

@johnsoncodehk
Copy link
Member

@iamanewofkotlin please provide a minimum reproduce in a new issue with valid css code. Otherwise I can't check the problem, thank you.

@oooplz
Copy link

oooplz commented Oct 21, 2021

@johnsoncodehk
Sorry for i can not replay the error. Because i had been upgrading project dependences -- vite vue in few hours ago.

I guessed that the error was caused by dependence of vite, but i can not confirm.

Look like the error has been fixed in "vue": "^3.2.20" "vite": "^2.6.10". sfc.vuejs.org

Thanks for Volar and your contributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants