TypeScript: 'occurrences' Returns occurrences inside strings

From https://github.com/Microsoft/vscode/issues/16909

TypeScript Version: 2.1.4

Code

"fdsafdas";
"fdsafdas";

Expected behavior: In TS 2.0.10, when calling tsserver ‘occurrences’ for any position inside "fdsafdas", we get no results back.

Actual behavior: In TS 2.1.4, we now get back occurrences of the string throughout the file.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

Here is a case I find the current behavior unsatisfactory.

I want to select all divs, but I end up highlighting the entire string.

var ele = "<div>Hello World</div>";
var ele2 = "<div>Hello Hogwarts</div>";

highlightingissue

This is sort of funny because I generally considered occurrence highlighting to be useful if I’m matching on a string literal value in some manner… Do you find other occurrences highlighting to be useful?