godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.52k stars 149 forks source link

Distinguish local variable and member variable #499

Closed eterlan closed 11 months ago

eterlan commented 11 months ago

Godot version

4.1

VS Code version

1.82.2

Godot Tools VS Code extension version

1.3.1

System information

win10

Problem statement

The textmate scopes for both local variable and member variable is both undifined, the color theme cannot color them correctly. image

The problem is user cannot tell whether a variable is local in function without lookup where is symbol defined, it's hard to maintain and error-prone.

Proposed solution

define both of them in textmate definition file.

DaelonSuzuka commented 11 months ago

It's not possible to tell the difference between a local variable and a member variable using only a TextMate grammar.

eterlan commented 11 months ago

It's not possible to tell the difference between a local variable and a member variable using only a TextMate grammar.

I notice C# plguin can find out all the local variable, so I think it's doable. I kind of find out how to search where the local variable declaration image image

But I don't know how to use it to seach their usage places inside function after trying whole day. Do you have any idea?

DaelonSuzuka commented 11 months ago

I notice C# plguin can find out all the local variable, so I think it's doable.

What other extensions can do for other programming languages is not relevant to what this extension can do for this programming language.

I kind of find out how to search where the local variable declaration

Here's one example of why this doesn't work:

class InnerClass:
    var inner_class_member_variable = 1

But I don't know how to use it to seach their usage places inside function after trying whole day. Do you have any idea?

This is not possible using TextMate grammars.