I wonder if any editor, or plugin for editor, but without having to invoke a real compiler, exists that can at least satisfy requirement #1 below. Bonus points if it can also satisfy requirements #2 and #3 (all examples are in C as the archetype of many similar constructs in other languages).
Requirement #1
Given this snippet, it should highlight control and conrtol in lines 1 and 2 with different styles:
foo() {
int control;
control = 1; // line 1
conrtol = 1; // line 2
}
Requirement #2Given this snippet, it should highlight local ang global with different styles:
int global;
foo() {
int local;
local = 1; // line 3
global = 1; // line 4
}
Requirement #3Given this snippet, it should highlight Type in a different style than aaa and ppp:
typedef int Type;
int aaa;
int *ppp;
...
return (Type) * (ppp); // line 5
return (aaa) * (aaa); // line 6
...
Note that lines 5 and 6 have exactly the same structure: not even tree-sitter recognizes that the first is a cast + dereference, while the second is a multiplication.
https://gist.github.com/swarn/fb37d9eefe1bc616c2a7e476c0bc03...
In the comments there's also a link to a plugin that does a different kind "Where every variable is a different color":