digitallyserviced / semanticolor

Provide Atom editor with semantic color highlighting.
https://atom.io/packages/semanticolor
MIT License
34 stars 3 forks source link

shadowed variables should get new colors #32

Closed seebs closed 4 years ago

seebs commented 6 years ago
func main() {
    var1 := "hello"
    for  {
        var1 := "foo"
    }
}

one of the best use cases for semantic coloring would be realizing that these are two different things named var1.

sharedprophet commented 5 years ago

Currently semanticolor doesn't actually know about the semantics (I know, I know) of your program. If it could take advantage of tree-sitter grammars (I have an issue open for what we need in order to support them: https://github.com/atom/atom/issues/19151), we might be able to do something like this...

sharedprophet commented 4 years ago

After further investigation I don't think this is ever likely to be possible. The problem is that scoping rules can be different between languages and this is a generic solution that works for any language grammar...