Fix for google-code-prettify w/ c#

前端 未结 4 1181
忘掉有多难
忘掉有多难 2021-02-07 09:19

Prettify gives types and methods the same class when tokenizing c# so they are colored the same. This is because methods are pascal case in c# instead of camel case like in java

4条回答
  •  灰色年华
    2021-02-07 10:08

    The problem is that without context, it's impossible to find out whether it's a method or a type.

    Take the following example:

    var value = new Test();
    
    Test();
    

    This example instantiates a new Test and then calls the method Test. The only way to find out which is a class and which is a type is by having 1. the entire code base and 2. a compiler.

    And then I haven't even touched invalid code.

    That being said, I think that the current prettifier as used by SO does a terrific job of highlighting the code samples without any context whatsoever.

提交回复
热议问题