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

const syntax highlighting fails if the const is scrolled too far out of view #4464

Closed
cdrez opened this issue Jun 12, 2024 · 4 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@cdrez
Copy link

cdrez commented Jun 12, 2024

Vue - Official extension or vue-tsc version

2.0.21

VSCode version

1.90.0

Vue version

3.4.27

TypeScript version

5.4.5

System Info

No response

Steps to reproduce

Installed Extensions: Vue - Official

Create a new vue file with a const. The const is properly highlighted if the scroll port is within a certain distance to the const declaration. However, if the scroll port is too far away from the declaration, the variable's syntax highlighting is no longer the same.

This depends on your zoom level as well, but if you get it in the sweet spot, you can watch the syntax highlighting flip on and off for that variable as you scroll up and down.

I also noticed that if I add a comment above the foo.value = "bar2" line, the syntax highlighting returns to the variable.

I also tested the behavior on Vue - Official v1.8.27 and it worked as expected there. It was broken on every version of v2 that I tried.

Probably related to #3934 and #3935.

Screen Recording

<script setup lang="ts">
import { ref } from 'vue';

const foo = ref();









foo.value = "bar";





















































































foo.value = "bar2"
</script>

Link to minimal reproduction

No response

Any additional comments?

No response

@vusal5555
Copy link

vusal5555 commented Jun 13, 2024

That is exactly the issue I have been facing for a week now. It also fails to highlight the components imported in other components and HTML elements within the named slots as well.

@cdrez
Copy link
Author

cdrez commented Jun 17, 2024

My guess about it being based on how far you scroll passed the variable definition was wrong. I get the same issue on variables defined in the middle of the file, can scroll up and down and watch the highlighting disable and re-enable repeatedly. So I'm not sure what the cause is since scroll position and text (a comment) above the line seem to both affect it.

@MetRonnie
Copy link

MetRonnie commented Aug 15, 2024

For me it loses the semantic highlighting (falls back to the textmate grammar highlighting) at line 116 with this:

Snippet

<script setup lang="ts">
import { ref } from 'vue'

const foo = ref()

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

foo.value = 'bar'

</script>

However if I paste more of the same below, the highlighting is lost further down, always about 5 statements up from the bottom

@Noah-Ywh
Copy link

I found that the issue occurs when “Hybrid Mode” is enabled.

@KazariEX KazariEX removed the bug Something isn't working label Jan 18, 2025
@KazariEX KazariEX added duplicate This issue or pull request already exists and removed 🍰 p2-nice-to-have labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

6 participants