fisheva / Eva-Theme

A comfortable and semantic theme.
https://marketplace.visualstudio.com/items?itemName=fisheva.eva-theme
MIT License
451 stars 39 forks source link

Keyword colorization in java is the same as class #86

Closed sharpchen closed 1 year ago

sharpchen commented 1 year ago

Screenshot

Java Case

Snipaste_2022-11-22_20-35-28

C# Case which is looking great

Snipaste_2022-11-22_20-37-22

Code Snippet

public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello World!");
    }
}
internal class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello, World!");
    }
}

Supplement

rababR1 commented 1 year ago

Same with the self parameter in Python: image

Compare that with this in JS: image Isn't self and this are special key words? I have C_pp: Enhanced Colorization enabled.

Code Snippets:

class User:

    def __init__(self,userID,user_name):
        self.id = userID
        self.user_name = user_name
        self.followers = 0
        self.following =0`
    def follow(self,user):
        user.followers+=1
        self.following+=1

userOne = User("001","Rabab")
userTwo = User("002","Jon")

userOne.follow(userTwo)
print(userOne.followers)
print(userOne.following)
print(userTwo.followers)
print(userTwo.following)`

'class Person {
  constructor(name, job) {
    this.name = name;
    this.job = job;
  }

  print() {
    const { name, job } = this;
    console.log(`${name}, ${job}`);
  }
}

const thatGuy = new Person('John Doe', 'Software Engineer');
thatGuy.print();'
fisheva commented 1 year ago

@UPIMMUNITY Thanks for providing bug sample! Fixed in 1.8.9 version.

@rababR1 It looks normal on my computer. 企业微信截图_20221123152212 When I turn on semantic Highlighting, it looks like yours. Either false or configuredByTheme, it looks correct. 企业微信截图_20221124140225 企业微信截图_20221123152316 Eva Theme doesn't support this feature yet, you can see why in issue 54.

sharpchen commented 1 year ago

@fisheva Please add colorization for class access modifier file in CSharp. A new access modifier file has been added in CSharp 11.

file class fileScopeTest
{

}

Snipaste_2022-12-01_16-11-13

fisheva commented 1 year ago

@UPIMMUNITY file can't be set to another color. Since its' scope value is a variable. 企业微信截图_20221201183420 企业微信截图_20221201183506

All characters's scope value is given by VSCode. You can check them by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (Mac) and selecting Inspect Editor Tokens and Scopes. 企业微信截图_20221201184025

fisheva commented 1 year ago

Yes, the build-in themes opened Semantic Highlighting, while Eva Theme doesn't. You can see why in issue 54.

fisheva commented 1 year ago

@UPIMMUNITY You can force open this featrue by setting this option true. 企业微信截图_20221201204204

sharpchen commented 1 year ago

You can force open this featrue by setting this option true. 企业微信截图_20221201204204

I misquoted your first reply and I deleted it because it's too long. And accidently deleted my reply again. This is awkward... Anyway, I have enable this setting however it's not working for this keyword. It works fine for parameters. image

fisheva commented 1 year ago

@UPIMMUNITY 企业微信截图_20221201210659 Semantic Highlighting doesn't work for file on my computer in either build-in themes nor Eva Theme. I guess there is another plug-in affected it in your computer. Please try enable/disable C_pp: Enhanced Colorization, then see it. 企业微信截图_20221201211547

sharpchen commented 1 year ago

@fisheva Semantic highlighting does work for file in my computer. "C_Cpp.enhancedColorization" it has no effect on this issue. And I have tried other themes that are not built-in. They all colorize file when semantic highlighting is enabled.

built-in Dark+ semantic highlighting on Snipaste_2022-12-02_00-11-21 semantic highlighting off Snipaste_2022-12-02_00-13-14

One dark pro Snipaste_2022-12-02_10-37-57

JetBrains Darcula(by Anan) Snipaste_2022-12-02_00-09-47

JetBrains Rider Dark Theme(by Edwin Sulaiman) Snipaste_2022-12-02_10-31-18

fisheva commented 1 year ago

@UPIMMUNITY Semantic highlighting should work for file in Eva Theme in your computer too. I guess there is another plug-in added semantic scopes value for file in your computer.

sharpchen commented 1 year ago

@fisheva I've tested it in a virtual machine, a totally clean vscode with eva theme and C# extension installed only. Semantic highlighting still not working for file. image

fisheva commented 1 year ago

@UPIMMUNITY Does semantic highlighting work for file in build-in themes in the virtual machine ?

If it works, please screenshot its' scopes value. It shows like this in my computer (Doesn't work). 企业微信截图_20221201210659

sharpchen commented 1 year ago

@fisheva Yes it does work in virtual machine with built-in theme. image

fisheva commented 1 year ago

@UPIMMUNITY Still in virtual machine VScode, switch to Eva Theme, then give me a screenshot of file scopes value. Thx

sharpchen commented 1 year ago

@fisheva image

fisheva commented 1 year ago

@UPIMMUNITY This really confused me. I enabled semantic highlighting, but there is no semantic token type in file scopes value, either in build-in themes nor in Eva Theme. 企业微信截图_20221202204323 企业微信截图_20221202204200

Please try the following steps: 1) Turn current theme to Eva Dark. 2) Find the folder where VSCode stores plug-ins. Find Eva Theme folder. 企业微信截图_20221202211834 3) Open it, open thems folder, open Eva-Dark.json. 4) Add , keyword.cs at the end of the scope property value in line 722. 企业微信截图_20221202212719 5) Restart VSCode, enable semantic highlighting, check the scopes value of file.

fisheva commented 1 year ago

If the above steps still do not work, then only try the ultimate debugging way. Here is my debugging way when I encounter such a situation with unknown reasons and no clue. 1) Turn current theme to Eva Dark. 2) Find the folder where VSCode stores plug-ins. Find Eva Theme folder. 4) Open it, open thems folder, open Eva-Dark.json. 5) Comment some codes, restart VSCode, and see if the display is restored to the initial value. In your case, you need to check whether the scope value of the file is the same as that in the build-in themes after each VSCode restart. 企业微信截图_20221202213149 6) Comment half of the code every time. Repeat this process to find out which part of the code affects it.

sharpchen commented 1 year ago

@fisheva Now it works image

fisheva commented 1 year ago

@UPIMMUNITY Finally! A hard won achievement. Thanks! The process of debugging with you has given me a new understanding of the principle of semantic highlighting. The file scopes value has been updated in 1.9.2 version.

sharpchen commented 1 year ago

@fisheva Well done! My pleasure.

sharpchen commented 1 year ago

@fisheva Another issue in latest version. Colorization for keywords of primitive type and void in csharp is the same as access modifier. Obviously it was caused by adding , keywords in the scope property.

Before update(it is pink) image

After update(it is purple) Snipaste_2022-12-03_14-45-19

fisheva commented 1 year ago

@UPIMMUNITY Sorry for reply late.

This is why Eva Theme doesn't support Semanti Highlighting yet, which I mentioned in issue 54.

The Semantic Highlighting rule is overlaid on the Syntax Highlighting rule. While, the granularity of Semantic Highlighting is not as exact as Syntax Highlighting. One Semantic Highlighting rule can often cover multiple Syntax Highlighting rules.

By the way, why are the scope values in my computer so different from yours, which makes it difficult for me to debug. I have enabled Semantic Hightlighting. 企业微信截图_20221207110350

Here is my VSCode version. 企业微信截图_20221207110437

sharpchen commented 1 year ago

@fisheva My vscode version. Same in the virtual machine. image image

fisheva commented 1 year ago

@UPIMMUNITY I'm confused... I uninstall 1.70.0 VSCode. Installed 1.73.1 VSCode, then only installed Microsoft C# and Eva Theme, enabled Semantic Highlighting, there is still no semantic token type in void and string scopes value. 企业微信截图_20221207154512 企业微信截图_20221207154409

At present, you'd better disable Semantic Highlighting to get the best Eva Theme experience, while the keyword file will not show purple.