language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

how to highlight svelte code in VScode search result ?

Open applemate opened this issue 6 months ago • 6 comments

Describe the problem

Image

how can you highlight this code ?

Describe the proposed solution

what setting to turn on ?

Importance

nice to have

applemate avatar May 16 '25 15:05 applemate

How do I get to this search screen, i.e. what are the steps to reproduce this?

dummdidumm avatar May 17 '25 08:05 dummdidumm

How do I get to this search screen, i.e. what are the steps to reproduce this?

Can't test right now but I think when you search you get an option to open the search in a tab

paoloricciuti avatar May 17 '25 09:05 paoloricciuti

@dummdidumm got to keyboard shortcut and do this

Image

applemate avatar May 17 '25 09:05 applemate

It seems that VSCode only calculates the highlight with the part of the text in the search result. It's kind of like the highlight for a Markdown code block. Except in the majority of the time, the code block only contains an insufficient part of the code to accurately highlight. So even if we add the support, it'll only work if your search result contains the start tag of the script tag. The HTML part might work better than the script tag, but it's still going to be half-baked. So I kind of think it's not worth the effort to be honest.

Image

jasonlyu123 avatar May 17 '25 10:05 jasonlyu123

For Svelte files it seems fully non-functional; you can increase the number of shown lines around the hit in the upper right and even if relevant context is available, there is no highlighting.

Image

brunnerh avatar May 17 '25 13:05 brunnerh

Yeah. That's why I said "even if we add the support". I didn't know you could adjust the line count. That at least provides a workaround for it to highlight more correctly.

jasonlyu123 avatar May 17 '25 14:05 jasonlyu123